Merge branch 'v3-2-test' of ssh://git.samba.org/data/git/samba into v3-2-test
authorSimo Sorce <idra@samba.org>
Fri, 1 Feb 2008 19:24:31 +0000 (14:24 -0500)
committerSimo Sorce <idra@samba.org>
Fri, 1 Feb 2008 19:24:31 +0000 (14:24 -0500)
544 files changed:
.gitignore
PFIF.txt [new file with mode: 0644]
README
examples/VFS/skel_opaque.c
examples/VFS/skel_transparent.c
examples/libsmbclient/Makefile
examples/libsmbclient/get_auth_data_fn.h
examples/libsmbclient/smbwrapper/Makefile
examples/libsmbclient/smbwrapper/select.c
examples/libsmbclient/smbwrapper/wrapper.c
examples/libsmbclient/testacl.c
examples/libsmbclient/testacl3.c [new file with mode: 0644]
examples/libsmbclient/testread.c
examples/libsmbclient/teststat3.c [new file with mode: 0644]
examples/libsmbclient/testwrite.c [new file with mode: 0644]
examples/libsmbclient/tree.c
examples/logon/genlogon/genlogon.pl
examples/misc/adssearch.pl
packaging/Example/setup.sh
release-scripts/create-tarball [new file with mode: 0755]
source/Makefile.in
source/auth/auth_domain.c
source/auth/auth_server.c
source/auth/auth_unix.c
source/auth/auth_util.c
source/auth/auth_winbind.c
source/auth/pass_check.c
source/auth/token_util.c
source/client/cifs.spnego.c
source/client/client.c
source/client/clitar.c
source/client/dnsbrowse.c [new file with mode: 0644]
source/client/mount.cifs.c
source/client/smbmnt.c
source/client/smbmount.c
source/client/smbspool.c
source/configure.in
source/exports/libnetapi.syms [new file with mode: 0644]
source/exports/libwbclient.syms [new file with mode: 0644]
source/groupdb/mapping_ldb.c
source/groupdb/mapping_tdb.c
source/include/ads.h
source/include/ads_protos.h
source/include/client.h
source/include/ctdbd_conn.h
source/include/dbwrap.h
source/include/debug.h
source/include/doserr.h
source/include/includes.h
source/include/libsmb_internal.h
source/include/libsmbclient.h
source/include/memcache.h [new file with mode: 0644]
source/include/messages.h
source/include/passdb.h
source/include/popt_common.h
source/include/reg_objects.h
source/include/rpc_client.h
source/include/rpc_dce.h
source/include/rpc_ds.h [deleted file]
source/include/rpc_lsa.h
source/include/rpc_netlogon.h
source/include/rpc_samr.h
source/include/smb.h
source/include/smb_macros.h
source/include/talloc_stack.h
source/include/trans2.h
source/include/transfer_file.h [new file with mode: 0644]
source/include/vfs.h
source/include/vfs_macros.h
source/lib/access.c
source/lib/afs.c
source/lib/afs_settoken.c
source/lib/charcnv.c
source/lib/conn_tdb.c
source/lib/ctdbd_conn.c
source/lib/data_blob.c
source/lib/dbwrap.c
source/lib/dbwrap_ctdb.c
source/lib/dbwrap_file.c
source/lib/dbwrap_rbt.c
source/lib/dbwrap_tdb.c
source/lib/dbwrap_util.c [new file with mode: 0644]
source/lib/debug.c
source/lib/display_sec.c
source/lib/dprintf.c
source/lib/dummysmbd.c
source/lib/errmap_unix.c
source/lib/fault.c
source/lib/gencache.c
source/lib/interfaces.c
source/lib/md4.c
source/lib/memcache.c [new file with mode: 0644]
source/lib/messages_ctdbd.c
source/lib/module.c
source/lib/ms_fnmatch.c
source/lib/netapi/examples/Makefile.in [new file with mode: 0644]
source/lib/netapi/examples/getdc/getdc.c [new file with mode: 0644]
source/lib/netapi/examples/getjoinableous/getjoinableous.c [new file with mode: 0644]
source/lib/netapi/examples/netdomjoin-gui/logo-small.png [new file with mode: 0644]
source/lib/netapi/examples/netdomjoin-gui/logo.png [new file with mode: 0644]
source/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c [new file with mode: 0644]
source/lib/netapi/examples/netdomjoin-gui/samba.ico [new file with mode: 0755]
source/lib/netapi/examples/netdomjoin/netdomjoin.c [new file with mode: 0644]
source/lib/netapi/getdc.c [new file with mode: 0644]
source/lib/netapi/joindomain.c
source/lib/netapi/netapi.c [new file with mode: 0644]
source/lib/netapi/netapi.h [new file with mode: 0644]
source/lib/netapi/serverinfo.c [new file with mode: 0644]
source/lib/popt_common.c
source/lib/privileges.c
source/lib/replace/libreplace.m4
source/lib/replace/libreplace_cc.m4
source/lib/replace/libreplace_ld.m4
source/lib/replace/libreplace_macros.m4
source/lib/replace/system/config.m4
source/lib/replace/system/network.h
source/lib/replace/system/printing.h [deleted file]
source/lib/replace/test/testsuite.c
source/lib/secace.c
source/lib/secacl.c
source/lib/secdesc.c
source/lib/sharesec.c
source/lib/socket_wrapper/socket_wrapper.c
source/lib/substitute.c
source/lib/sysacls.c
source/lib/system.c
source/lib/talloc/talloc.c
source/lib/talloc/talloc.h
source/lib/talloc/testsuite.c
source/lib/talloc_stack.c
source/lib/tdb/common/freelist.c
source/lib/tdb/common/io.c
source/lib/tdb/common/lock.c
source/lib/tdb/common/open.c
source/lib/tdb/common/tdb.c
source/lib/tdb/common/tdb_private.h
source/lib/tdb/common/transaction.c
source/lib/tdb/common/traverse.c
source/lib/tdb/configure.ac
source/lib/tdb/include/tdb.h
source/lib/tdb/tools/tdbtool.c
source/lib/time.c
source/lib/username.c
source/lib/util.c
source/lib/util_pw.c
source/lib/util_reg.c
source/lib/util_seaccess.c
source/lib/util_sid.c
source/lib/util_sock.c
source/lib/util_str.c
source/lib/util_tdb.c
source/lib/util_transfer_file.c [new file with mode: 0644]
source/lib/version.c
source/lib/winbind_util.c [new file with mode: 0644]
source/lib/xfile.c
source/libaddns/dns.h
source/libaddns/dnsrecord.c
source/libads/ads_status.c
source/libads/ads_struct.c
source/libads/authdata.c
source/libads/kerberos.c
source/libads/kerberos_verify.c
source/libads/ldap.c
source/libads/ndr.c [new file with mode: 0644]
source/libgpo/gpo_filesync.c
source/libgpo/gpo_ldap.c
source/libnet/libnet.h [moved from source/lib/netapi/joindomain.h with 68% similarity]
source/libnet/libnet_conf.c [new file with mode: 0644]
source/libnet/libnet_conf.h [new file with mode: 0644]
source/libnet/libnet_join.c [new file with mode: 0644]
source/library-versions.in
source/librpc/gen_ndr/cli_dfs.c
source/librpc/gen_ndr/cli_dfs.h
source/librpc/gen_ndr/cli_dssetup.c [new file with mode: 0644]
source/librpc/gen_ndr/cli_dssetup.h [new file with mode: 0644]
source/librpc/gen_ndr/cli_echo.c
source/librpc/gen_ndr/cli_echo.h
source/librpc/gen_ndr/cli_epmapper.c
source/librpc/gen_ndr/cli_epmapper.h
source/librpc/gen_ndr/cli_eventlog.c
source/librpc/gen_ndr/cli_eventlog.h
source/librpc/gen_ndr/cli_initshutdown.c
source/librpc/gen_ndr/cli_initshutdown.h
source/librpc/gen_ndr/cli_lsa.c
source/librpc/gen_ndr/cli_lsa.h
source/librpc/gen_ndr/cli_netlogon.c
source/librpc/gen_ndr/cli_netlogon.h
source/librpc/gen_ndr/cli_samr.c [new file with mode: 0644]
source/librpc/gen_ndr/cli_samr.h [new file with mode: 0644]
source/librpc/gen_ndr/cli_srvsvc.c
source/librpc/gen_ndr/cli_srvsvc.h
source/librpc/gen_ndr/cli_svcctl.c
source/librpc/gen_ndr/cli_svcctl.h
source/librpc/gen_ndr/cli_unixinfo.c
source/librpc/gen_ndr/cli_unixinfo.h
source/librpc/gen_ndr/cli_winreg.c
source/librpc/gen_ndr/cli_winreg.h
source/librpc/gen_ndr/cli_wkssvc.c
source/librpc/gen_ndr/cli_wkssvc.h
source/librpc/gen_ndr/dfs.h
source/librpc/gen_ndr/dssetup.h [new file with mode: 0644]
source/librpc/gen_ndr/echo.h
source/librpc/gen_ndr/epmapper.h
source/librpc/gen_ndr/eventlog.h
source/librpc/gen_ndr/initshutdown.h
source/librpc/gen_ndr/libnet_join.h [new file with mode: 0644]
source/librpc/gen_ndr/lsa.h
source/librpc/gen_ndr/misc.h [new file with mode: 0644]
source/librpc/gen_ndr/ndr_dfs.c
source/librpc/gen_ndr/ndr_dfs.h
source/librpc/gen_ndr/ndr_dssetup.c [new file with mode: 0644]
source/librpc/gen_ndr/ndr_dssetup.h [new file with mode: 0644]
source/librpc/gen_ndr/ndr_echo.c
source/librpc/gen_ndr/ndr_echo.h
source/librpc/gen_ndr/ndr_libnet_join.c [new file with mode: 0644]
source/librpc/gen_ndr/ndr_libnet_join.h [new file with mode: 0644]
source/librpc/gen_ndr/ndr_lsa.c
source/librpc/gen_ndr/ndr_lsa.h
source/librpc/gen_ndr/ndr_misc.c [new file with mode: 0644]
source/librpc/gen_ndr/ndr_misc.h
source/librpc/gen_ndr/ndr_netlogon.c
source/librpc/gen_ndr/ndr_netlogon.h
source/librpc/gen_ndr/ndr_samr.c [new file with mode: 0644]
source/librpc/gen_ndr/ndr_samr.h [new file with mode: 0644]
source/librpc/gen_ndr/ndr_security.c [new file with mode: 0644]
source/librpc/gen_ndr/ndr_security.h
source/librpc/gen_ndr/ndr_svcctl.c
source/librpc/gen_ndr/ndr_wkssvc.c
source/librpc/gen_ndr/ndr_xattr.c [new file with mode: 0644]
source/librpc/gen_ndr/ndr_xattr.h [new file with mode: 0644]
source/librpc/gen_ndr/netlogon.h
source/librpc/gen_ndr/samr.h [new file with mode: 0644]
source/librpc/gen_ndr/security.h
source/librpc/gen_ndr/srv_dfs.c
source/librpc/gen_ndr/srv_dssetup.c [new file with mode: 0644]
source/librpc/gen_ndr/srv_dssetup.h [new file with mode: 0644]
source/librpc/gen_ndr/srv_echo.c
source/librpc/gen_ndr/srv_epmapper.c
source/librpc/gen_ndr/srv_eventlog.c
source/librpc/gen_ndr/srv_initshutdown.c
source/librpc/gen_ndr/srv_lsa.c
source/librpc/gen_ndr/srv_lsa.h
source/librpc/gen_ndr/srv_netlogon.c
source/librpc/gen_ndr/srv_netlogon.h
source/librpc/gen_ndr/srv_samr.c [new file with mode: 0644]
source/librpc/gen_ndr/srv_samr.h [new file with mode: 0644]
source/librpc/gen_ndr/srv_srvsvc.c
source/librpc/gen_ndr/srv_svcctl.c
source/librpc/gen_ndr/srv_unixinfo.c
source/librpc/gen_ndr/srv_winreg.c
source/librpc/gen_ndr/srv_wkssvc.c
source/librpc/gen_ndr/srvsvc.h
source/librpc/gen_ndr/svcctl.h
source/librpc/gen_ndr/winreg.h
source/librpc/gen_ndr/wkssvc.h
source/librpc/gen_ndr/xattr.h [new file with mode: 0644]
source/librpc/idl/dfs.idl
source/librpc/idl/dssetup.idl [new file with mode: 0644]
source/librpc/idl/echo.idl
source/librpc/idl/eventlog.idl
source/librpc/idl/initshutdown.idl
source/librpc/idl/libnet_join.idl [new file with mode: 0644]
source/librpc/idl/lsa.idl
source/librpc/idl/misc.idl
source/librpc/idl/netlogon.idl
source/librpc/idl/samr.idl
source/librpc/idl/security.idl
source/librpc/idl/srvsvc.idl
source/librpc/idl/winreg.idl
source/librpc/idl/wkssvc.idl
source/librpc/idl/xattr.idl [new file with mode: 0644]
source/librpc/ndr/libndr.h
source/librpc/ndr/misc.h [deleted file]
source/librpc/ndr/ndr_basic.c
source/librpc/ndr/ndr_misc.c
source/librpc/ndr/ndr_sec_helper.c
source/librpc/ndr/security.h [deleted file]
source/librpc/ndr/sid.c
source/libsmb/cliconnect.c
source/libsmb/clidfs.c
source/libsmb/clidgram.c
source/libsmb/clientgen.c
source/libsmb/clifile.c
source/libsmb/clifsinfo.c
source/libsmb/clilist.c
source/libsmb/climessage.c
source/libsmb/clioplock.c
source/libsmb/cliprint.c
source/libsmb/cliquota.c
source/libsmb/clirap.c
source/libsmb/clireadwrite.c
source/libsmb/clisecdesc.c
source/libsmb/clitrans.c
source/libsmb/doserr.c
source/libsmb/dsgetdcname.c
source/libsmb/errormap.c
source/libsmb/libsmbclient.c
source/libsmb/namequery.c
source/libsmb/nmblib.c
source/libsmb/ntlm_check.c
source/libsmb/ntlmssp.c
source/libsmb/ntlmssp_parse.c
source/libsmb/smb_seal.c [new file with mode: 0644]
source/libsmb/smb_signing.c
source/libsmb/smbencrypt.c
source/libsmb/trusts_util.c
source/libsmb/unexpected.c
source/locking/brlock.c
source/locking/locking.c
source/locking/posix.c
source/modules/gpfs.c
source/modules/nfs4_acls.c
source/modules/nfs4_acls.h
source/modules/vfs_afsacl.c
source/modules/vfs_aixacl.c
source/modules/vfs_aixacl2.c
source/modules/vfs_audit.c
source/modules/vfs_cacheprime.c
source/modules/vfs_cap.c
source/modules/vfs_catia.c
source/modules/vfs_commit.c
source/modules/vfs_default.c
source/modules/vfs_extd_audit.c
source/modules/vfs_fake_perms.c
source/modules/vfs_full_audit.c
source/modules/vfs_gpfs.c
source/modules/vfs_gpfs.h [new file with mode: 0644]
source/modules/vfs_hpuxacl.c
source/modules/vfs_irixacl.c
source/modules/vfs_posixacl.c
source/modules/vfs_prealloc.c
source/modules/vfs_readahead.c
source/modules/vfs_recycle.c
source/modules/vfs_shadow_copy2.c [new file with mode: 0644]
source/modules/vfs_solarisacl.c
source/modules/vfs_streams_depot.c [new file with mode: 0644]
source/modules/vfs_streams_xattr.c [new file with mode: 0644]
source/modules/vfs_tru64acl.c
source/modules/vfs_tsmsm.c [new file with mode: 0644]
source/modules/vfs_xattr_tdb.c [new file with mode: 0644]
source/modules/vfs_zfsacl.c
source/nmbd/nmbd.c
source/nmbd/nmbd_elections.c
source/nmbd/nmbd_incomingdgrams.c
source/nmbd/nmbd_incomingrequests.c
source/nmbd/nmbd_packets.c
source/nmbd/nmbd_processlogon.c
source/nmbd/nmbd_responserecordsdb.c
source/nmbd/nmbd_synclists.c
source/nsswitch/libwbclient/Doxyfile [new file with mode: 0644]
source/nsswitch/libwbclient/libwbclient.h [new file with mode: 0644]
source/nsswitch/libwbclient/wbc_err_internal.h [new file with mode: 0644]
source/nsswitch/libwbclient/wbc_idmap.c [new file with mode: 0644]
source/nsswitch/libwbclient/wbc_pam.c [new file with mode: 0644]
source/nsswitch/libwbclient/wbc_pwd.c [new file with mode: 0644]
source/nsswitch/libwbclient/wbc_sid.c [new file with mode: 0644]
source/nsswitch/libwbclient/wbc_util.c [new file with mode: 0644]
source/nsswitch/libwbclient/wbclient.c [new file with mode: 0644]
source/nsswitch/libwbclient/wbclient.h [new file with mode: 0644]
source/nsswitch/libwbclient/wbclient_internal.h [new file with mode: 0644]
source/nsswitch/pam_winbind.c
source/nsswitch/pam_winbind.h
source/nsswitch/wb_client.c
source/nsswitch/wbinfo.c
source/nsswitch/winbind_nss_config.h
source/nsswitch/winbind_struct_protocol.h
source/pam_smbpass/pam_smb_acct.c
source/pam_smbpass/pam_smb_passwd.c
source/param/loadparm.c
source/passdb/lookup_sid.c
source/passdb/passdb.c
source/passdb/pdb_interface.c
source/passdb/pdb_ldap.c
source/passdb/pdb_smbpasswd.c
source/passdb/pdb_tdb.c
source/passdb/secrets.c
source/pkgconfig/netapi.pc.in [new file with mode: 0644]
source/pkgconfig/smbclient.pc.in [new file with mode: 0644]
source/pkgconfig/smbsharemodes.pc.in [new file with mode: 0644]
source/pkgconfig/wbclient.pc.in [new file with mode: 0644]
source/printing/load.c
source/printing/lpq_parse.c
source/printing/nt_printing.c
source/printing/print_aix.c
source/printing/print_generic.c
source/printing/printfsp.c
source/printing/printing.c
source/registry/reg_api.c
source/registry/reg_backend_current_version.c [new file with mode: 0644]
source/registry/reg_backend_db.c [moved from source/registry/reg_db.c with 95% similarity]
source/registry/reg_backend_hkpt_params.c [new file with mode: 0644]
source/registry/reg_backend_netlogon_params.c [new file with mode: 0644]
source/registry/reg_backend_perflib.c [new file with mode: 0644]
source/registry/reg_backend_printing.c [moved from source/registry/reg_printing.c with 99% similarity]
source/registry/reg_backend_prod_options.c [new file with mode: 0644]
source/registry/reg_backend_shares.c [moved from source/registry/reg_shares.c with 96% similarity]
source/registry/reg_backend_smbconf.c [moved from source/registry/reg_smbconf.c with 96% similarity]
source/registry/reg_backend_tcpip_params.c [new file with mode: 0644]
source/registry/reg_cachehook.c
source/registry/reg_dispatcher.c [moved from source/registry/reg_frontend_hilvl.c with 84% similarity]
source/registry/reg_dynamic.c [deleted file]
source/registry/reg_frontend.c [deleted file]
source/registry/reg_init_full.c [new file with mode: 0644]
source/registry/reg_init_smbconf.c [moved from source/lib/util_reg_smbconf.c with 75% similarity]
source/registry/reg_util_legacy.c [new file with mode: 0644]
source/registry/regfio.c
source/rpc_client/cli_ds.c [deleted file]
source/rpc_client/cli_lsarpc.c
source/rpc_client/cli_netlogon.c
source/rpc_client/cli_pipe.c
source/rpc_client/cli_samr.c
source/rpc_parse/parse_buffer.c
source/rpc_parse/parse_ds.c [deleted file]
source/rpc_parse/parse_lsa.c
source/rpc_parse/parse_net.c
source/rpc_parse/parse_prs.c
source/rpc_parse/parse_samr.c
source/rpc_parse/parse_sec.c
source/rpc_parse/parse_spoolss.c
source/rpc_parse/parse_srv.c
source/rpc_server/srv_dfs_nt.c
source/rpc_server/srv_dssetup_nt.c [new file with mode: 0644]
source/rpc_server/srv_eventlog_lib.c
source/rpc_server/srv_eventlog_nt.c
source/rpc_server/srv_lsa_ds.c [deleted file]
source/rpc_server/srv_lsa_ds_nt.c [deleted file]
source/rpc_server/srv_lsa_nt.c
source/rpc_server/srv_netlog.c
source/rpc_server/srv_netlog_nt.c
source/rpc_server/srv_pipe.c
source/rpc_server/srv_samr.c
source/rpc_server/srv_samr_nt.c
source/rpc_server/srv_samr_util.c
source/rpc_server/srv_srvsvc_nt.c
source/rpc_server/srv_svcctl_nt.c
source/rpc_server/srv_winreg_nt.c
source/rpc_server/srv_wkssvc_nt.c
source/rpcclient/cmd_ds.c [deleted file]
source/rpcclient/cmd_dssetup.c [new file with mode: 0644]
source/rpcclient/cmd_lsarpc.c
source/rpcclient/cmd_netlogon.c
source/rpcclient/cmd_samr.c
source/rpcclient/cmd_spoolss.c
source/rpcclient/cmd_wkssvc.c
source/rpcclient/rpcclient.c
source/script/fix_bool.pl [new file with mode: 0755]
source/script/mkproto.awk
source/script/tests/selftest.sh
source/script/tests/test_local_s3.sh
source/script/tests/test_ntlm_auth_s3.sh [new file with mode: 0755]
source/script/tests/test_posix_s3.sh
source/script/tests/test_smbclient_s3.sh
source/script/tests/test_smbtorture_s3.sh
source/script/tests/test_wbinfo_s3.sh
source/script/tests/tests_all.sh
source/services/services_db.c
source/smbd/aio.c
source/smbd/blocking.c
source/smbd/chgpasswd.c
source/smbd/close.c
source/smbd/connection.c
source/smbd/dir.c
source/smbd/dmapi.c
source/smbd/dnsregister.c
source/smbd/dosmode.c
source/smbd/error.c
source/smbd/file_access.c
source/smbd/fileio.c
source/smbd/filename.c
source/smbd/files.c
source/smbd/ipc.c
source/smbd/lanman.c
source/smbd/mangle_hash.c
source/smbd/mangle_hash2.c
source/smbd/map_username.c
source/smbd/message.c
source/smbd/msdfs.c
source/smbd/negprot.c
source/smbd/notify.c
source/smbd/nttrans.c
source/smbd/open.c
source/smbd/oplock.c
source/smbd/oplock_linux.c
source/smbd/password.c
source/smbd/pipes.c
source/smbd/posix_acls.c
source/smbd/process.c
source/smbd/reply.c
source/smbd/seal.c [new file with mode: 0644]
source/smbd/sec_ctx.c
source/smbd/server.c
source/smbd/service.c
source/smbd/sesssetup.c
source/smbd/statcache.c
source/smbd/statvfs.c
source/smbd/trans2.c
source/smbd/utmp.c
source/smbd/vfs.c
source/torture/cmd_vfs.c
source/torture/pdbtest.c
source/torture/test_ntlm_auth.py [new file with mode: 0755]
source/torture/torture.c
source/torture/vfstest.c
source/utils/net.c
source/utils/net.h
source/utils/net_ads.c
source/utils/net_conf.c
source/utils/net_dns.c
source/utils/net_dom.c
source/utils/net_domain.c
source/utils/net_help.c
source/utils/net_lookup.c
source/utils/net_rpc.c
source/utils/net_rpc_audit.c
source/utils/net_rpc_join.c
source/utils/net_rpc_rights.c
source/utils/net_rpc_samsync.c
source/utils/net_rpc_sh_acct.c
source/utils/net_sam.c
source/utils/ntlm_auth.c
source/utils/pdbedit.c
source/utils/smbcacls.c
source/utils/smbcontrol.c
source/utils/smbcquotas.c
source/utils/smbfilter.c
source/utils/smbget.c
source/web/cgi.c
source/winbindd/idmap_nss.c
source/winbindd/idmap_tdb2.c [new file with mode: 0644]
source/winbindd/winbindd.c
source/winbindd/winbindd.h
source/winbindd/winbindd_ads.c
source/winbindd/winbindd_async.c
source/winbindd/winbindd_cache.c
source/winbindd/winbindd_cm.c
source/winbindd/winbindd_creds.c
source/winbindd/winbindd_dual.c
source/winbindd/winbindd_group.c
source/winbindd/winbindd_locator.c
source/winbindd/winbindd_misc.c
source/winbindd/winbindd_ndr.c [new file with mode: 0644]
source/winbindd/winbindd_pam.c
source/winbindd/winbindd_rpc.c
source/winbindd/winbindd_util.c

index bd1cba16b0652a1202d71714d9c0de1adcc22a0d..b445ccfca67fd4303da709e877447ba3ebfd08a6 100644 (file)
@@ -1,7 +1,9 @@
 *.o
 *.po
 *~
+source/TAGS
 source/client/client_proto.h
+source/libnet/libnet_proto.h
 source/include/build_env.h
 source/include/config.h
 source/include/config.h.in
@@ -9,6 +11,7 @@ source/include/proto.h
 source/include/stamp-h
 source/include/version.h
 source/Makefile
+source/lib/netapi/examples/Makefile
 source/config.log
 source/config.status
 source/configure
@@ -32,3 +35,29 @@ source/proto_exists
 source/winbindd/winbindd_proto.h
 source/cscope.out
 source/torture.tdb
+source/pkgconfig/*.pc
+source/st
+examples/VFS/Makefile
+examples/VFS/config.log
+examples/VFS/config.status
+examples/VFS/configure
+examples/VFS/module_config.h
+examples/VFS/module_config.h.in
+examples/VFS/shadow_copy_test.so
+examples/VFS/skel_opaque.so
+examples/VFS/skel_transparent.so
+examples/libsmbclient/smbwrapper/smbsh
+examples/libsmbclient/smbwrapper/smbwrapper.so
+examples/libsmbclient/testacl
+examples/libsmbclient/testacl2
+examples/libsmbclient/testacl3
+examples/libsmbclient/testbrowse
+examples/libsmbclient/testbrowse2
+examples/libsmbclient/testchmod
+examples/libsmbclient/testread
+examples/libsmbclient/testsmbc
+examples/libsmbclient/teststat
+examples/libsmbclient/teststat2
+examples/libsmbclient/teststat3
+examples/libsmbclient/testutime
+examples/libsmbclient/testwrite
diff --git a/PFIF.txt b/PFIF.txt
new file mode 100644 (file)
index 0000000..09f1458
--- /dev/null
+++ b/PFIF.txt
@@ -0,0 +1,7 @@
+This code was developed in participation with the Protocol Freedom
+Information Foundation.
+
+Please see 
+  http://protocolfreedom.org/ and
+  http://samba.org/samba/PFIF/ 
+for more details.
diff --git a/README b/README
index 1d55a1040ca150b1e51eb8ca44fe1995956171b3..e6634febc0ea08a3551dc0ba3b170a98fb7b7064 100644 (file)
--- a/README
+++ b/README
@@ -102,16 +102,16 @@ for more details) and are always glad to receive feedback or
 suggestions to the address samba@lists.samba.org.  More information
 on the various Samba mailing lists can be found at http://lists.samba.org/.
 
-You can also get the Samba sourcecode straight from the Subversion tree - see
-http://samba.org/samba/subversion.html.
+You can also get the Samba sourcecode straight from the git repository - see
+http://wiki.samba.org/index.php/Using_Git_for_Samba_Development.
 
 You could also send hardware/software/money/jewelry or pre-paid pizza
 vouchers directly to Andrew. The pizza vouchers would be especially
 welcome, in fact there is a special field in the survey for people who
 have paid up their pizza :-)
 
-If you like a particular feature then look through the Subversion change-log
-(on the web at http://websvn.samba.org/cgi-bin/viewcvs.cgi) and see
+If you like a particular feature then look through the git change-log
+(on the web at http://gitweb.samba.org/?p=samba.git;a=summary) and see
 who added it, then send them an email.
 
 Remember that free software of this kind lives or dies by the response
index fd4b20618514c68550aec3d96b75ac4bbc35c0a4..4a6e6be42fd04b1c40ebd52a42cbf4a162af35e6 100644 (file)
@@ -92,7 +92,7 @@ static SMB_STRUCT_DIRENT *skel_readdir(vfs_handle_struct *handle,  SMB_STRUCT_DI
 
 static void skel_seekdir(vfs_handle_struct *handle,  SMB_STRUCT_DIR *dirp, long offset)
 {
-       return vfswrap_seekdir(NULL,  dirp, offset);
+       vfswrap_seekdir(NULL,  dirp, offset);
 }
 
 static long skel_telldir(vfs_handle_struct *handle,  SMB_STRUCT_DIR *dirp)
@@ -102,7 +102,7 @@ static long skel_telldir(vfs_handle_struct *handle,  SMB_STRUCT_DIR *dirp)
 
 static void skel_rewinddir(vfs_handle_struct *handle,  SMB_STRUCT_DIR *dirp)
 {
-       return vfswrap_rewinddir(NULL,  dirp);
+       vfswrap_rewinddir(NULL,  dirp);
 }
 
 static int skel_mkdir(vfs_handle_struct *handle,  const char *path, mode_t mode)
@@ -130,40 +130,40 @@ static int skel_close(vfs_handle_struct *handle, files_struct *fsp, int fd)
        return vfswrap_close(NULL, fsp, fd);
 }
 
-static ssize_t skel_read(vfs_handle_struct *handle, files_struct *fsp, int fd, void *data, size_t n)
+static ssize_t skel_read(vfs_handle_struct *handle, files_struct *fsp, void *data, size_t n)
 {
-       return vfswrap_read(NULL, fsp, fd, data, n);
+       return vfswrap_read(NULL, fsp, data, n);
 }
 
-static ssize_t skel_pread(vfs_handle_struct *handle, struct files_struct *fsp, int fd, void *data, size_t n, SMB_OFF_T offset)
+static ssize_t skel_pread(vfs_handle_struct *handle, struct files_struct *fsp, void *data, size_t n, SMB_OFF_T offset)
 {
-       return vfswrap_pread(NULL, fsp, fd, data, n, offset);
+       return vfswrap_pread(NULL, fsp, data, n, offset);
 }
 
-static ssize_t skel_write(vfs_handle_struct *handle, files_struct *fsp, int fd, const void *data, size_t n)
+static ssize_t skel_write(vfs_handle_struct *handle, files_struct *fsp, const void *data, size_t n)
 {
-       return vfswrap_write(NULL, fsp, fd, data, n);
+       return vfswrap_write(NULL, fsp, data, n);
 }
 
-ssize_t skel_pwrite(vfs_handle_struct *handle, struct files_struct *fsp, int fd, const void *data, size_t n, SMB_OFF_T offset)
+ssize_t skel_pwrite(vfs_handle_struct *handle, struct files_struct *fsp, const void *data, size_t n, SMB_OFF_T offset)
 {
-       return vfswrap_pwrite(NULL, fsp, fd, data, n, offset);
+       return vfswrap_pwrite(NULL, fsp, data, n, offset);
 }
 
-static SMB_OFF_T skel_lseek(vfs_handle_struct *handle, files_struct *fsp, int filedes, SMB_OFF_T offset, int whence)
+static SMB_OFF_T skel_lseek(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_T offset, int whence)
 {
-       return vfswrap_lseek(NULL, fsp, filedes, offset, whence);
+       return vfswrap_lseek(NULL, fsp, offset, whence);
 }
 
-static ssize_t skel_sendfile(vfs_handle_struct *handle, int tofd, files_struct *fsp, int fromfd, const DATA_BLOB *hdr,
+static ssize_t skel_sendfile(vfs_handle_struct *handle, int tofd, files_struct *fromfsp, const DATA_BLOB *hdr,
                                        SMB_OFF_T offset, size_t n)
 {
-       return vfswrap_sendfile(NULL, tofd, fsp, fromfd, hdr, offset, n);
+       return vfswrap_sendfile(NULL, tofd, fromfsp, hdr, offset, n);
 }
 
-static ssize_t skel_recvfile(vfs_handle_struct *handle, int fromfd, files_struct *fsp, int tofd, SMB_OFF_T offset, size_t n)
+static ssize_t skel_recvfile(vfs_handle_struct *handle, int fromfd, files_struct *tofsp, SMB_OFF_T offset, size_t n)
 {
-       return vfswrap_recvfile(NULL, fromfd, fsp, tofd, offset, n);
+       return vfswrap_recvfile(NULL, fromfd, tofsp, offset, n);
 }
 
 static int skel_rename(vfs_handle_struct *handle,  const char *oldname, const char *newname)
@@ -171,9 +171,9 @@ static int skel_rename(vfs_handle_struct *handle,  const char *oldname, const ch
        return vfswrap_rename(NULL,  oldname, newname);
 }
 
-static int skel_fsync(vfs_handle_struct *handle, files_struct *fsp, int fd)
+static int skel_fsync(vfs_handle_struct *handle, files_struct *fsp)
 {
-       return vfswrap_fsync(NULL, fsp, fd);
+       return vfswrap_fsync(NULL, fsp);
 }
 
 static int skel_stat(vfs_handle_struct *handle,  const char *fname, SMB_STRUCT_STAT *sbuf)
@@ -181,9 +181,9 @@ static int skel_stat(vfs_handle_struct *handle,  const char *fname, SMB_STRUCT_S
        return vfswrap_stat(NULL,  fname, sbuf);
 }
 
-static int skel_fstat(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_STRUCT_STAT *sbuf)
+static int skel_fstat(vfs_handle_struct *handle, files_struct *fsp, SMB_STRUCT_STAT *sbuf)
 {
-       return vfswrap_fstat(NULL, fsp, fd, sbuf);
+       return vfswrap_fstat(NULL, fsp, sbuf);
 }
 
 static int skel_lstat(vfs_handle_struct *handle,  const char *path, SMB_STRUCT_STAT *sbuf)
@@ -201,9 +201,9 @@ static int skel_chmod(vfs_handle_struct *handle,  const char *path, mode_t mode)
        return vfswrap_chmod(NULL,  path, mode);
 }
 
-static int skel_fchmod(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode)
+static int skel_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t mode)
 {
-       return vfswrap_fchmod(NULL, fsp, fd, mode);
+       return vfswrap_fchmod(NULL, fsp, mode);
 }
 
 static int skel_chown(vfs_handle_struct *handle,  const char *path, uid_t uid, gid_t gid)
@@ -211,9 +211,9 @@ static int skel_chown(vfs_handle_struct *handle,  const char *path, uid_t uid, g
        return vfswrap_chown(NULL,  path, uid, gid);
 }
 
-static int skel_fchown(vfs_handle_struct *handle, files_struct *fsp, int fd, uid_t uid, gid_t gid)
+static int skel_fchown(vfs_handle_struct *handle, files_struct *fsp, uid_t uid, gid_t gid)
 {
-       return vfswrap_fchown(NULL, fsp, fd, uid, gid);
+       return vfswrap_fchown(NULL, fsp, uid, gid);
 }
 
 static int skel_lchown(vfs_handle_struct *handle,  const char *path, uid_t uid, gid_t gid)
@@ -236,19 +236,19 @@ static int skel_ntimes(vfs_handle_struct *handle,  const char *path, const struc
        return vfswrap_ntimes(NULL,  path, ts);
 }
 
-static int skel_ftruncate(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_OFF_T offset)
+static int skel_ftruncate(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_T offset)
 {
-       return vfswrap_ftruncate(NULL, fsp, fd, offset);
+       return vfswrap_ftruncate(NULL, fsp, offset);
 }
 
-static bool skel_lock(vfs_handle_struct *handle, files_struct *fsp, int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type)
+static bool skel_lock(vfs_handle_struct *handle, files_struct *fsp, int op, SMB_OFF_T offset, SMB_OFF_T count, int type)
 {
-       return vfswrap_lock(NULL, fsp, fd, op, offset, count, type);
+       return vfswrap_lock(NULL, fsp, op, offset, count, type);
 }
 
-static bool skel_getlock(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid)
+static bool skel_getlock(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid)
 {
-       return vfswrap_getlock(NULL, fsp, fd, poffset, pcount, ptype, ppid);
+       return vfswrap_getlock(NULL, fsp, poffset, pcount, ptype, ppid);
 }
 
 static int skel_symlink(vfs_handle_struct *handle,  const char *oldpath, const char *newpath)
@@ -301,7 +301,7 @@ static struct file_id skel_file_id_create(vfs_handle_struct *handle,
 }
 
 static size_t skel_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
-       int fd, uint32 security_info, SEC_DESC **ppdesc)
+       uint32 security_info, SEC_DESC **ppdesc)
 {
        errno = ENOSYS;
        return 0;
@@ -314,8 +314,8 @@ static size_t skel_get_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
        return 0;
 }
 
-static NTSTATUS skel_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, int
-       fd, uint32 security_info_sent, SEC_DESC *psd)
+static NTSTATUS skel_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
+       uint32 security_info_sent, SEC_DESC *psd)
 {
        errno = ENOSYS;
        return NT_STATUS_NOT_IMPLEMENTED;
@@ -334,7 +334,7 @@ static int skel_chmod_acl(vfs_handle_struct *handle,  const char *name, mode_t m
        return -1;
 }
 
-static int skel_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode)
+static int skel_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, mode_t mode)
 {
        errno = ENOSYS;
        return -1;
@@ -370,7 +370,7 @@ static SMB_ACL_T skel_sys_acl_get_file(vfs_handle_struct *handle,  const char *p
        return NULL;
 }
 
-static SMB_ACL_T skel_sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp, int fd)
+static SMB_ACL_T skel_sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp)
 {
        errno = ENOSYS;
        return NULL;
@@ -436,7 +436,7 @@ static int skel_sys_acl_set_file(vfs_handle_struct *handle,  const char *name, S
        return -1;
 }
 
-static int skel_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_ACL_T theacl)
+static int skel_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp, SMB_ACL_T theacl)
 {
        errno = ENOSYS;
        return -1;
@@ -485,7 +485,7 @@ size)
        return -1;
 }
 
-static ssize_t skel_fgetxattr(vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *name, void *value, size_t size)
+static ssize_t skel_fgetxattr(vfs_handle_struct *handle, struct files_struct *fsp, const char *name, void *value, size_t size)
 {
        errno = ENOSYS;
        return -1;
@@ -503,7 +503,7 @@ static ssize_t skel_llistxattr(vfs_handle_struct *handle, const char *path, char
        return -1;
 }
 
-static ssize_t skel_flistxattr(vfs_handle_struct *handle, struct files_struct *fsp,int fd, char *list, size_t size)
+static ssize_t skel_flistxattr(vfs_handle_struct *handle, struct files_struct *fsp, char *list, size_t size)
 {
        errno = ENOSYS;
        return -1;
@@ -521,7 +521,7 @@ static int skel_lremovexattr(vfs_handle_struct *handle, const char *path, const
        return -1;
 }
 
-static int skel_fremovexattr(vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *name)
+static int skel_fremovexattr(vfs_handle_struct *handle, struct files_struct *fsp, const char *name)
 {
        errno = ENOSYS;
        return -1;
@@ -539,7 +539,7 @@ static int skel_lsetxattr(vfs_handle_struct *handle, const char *path, const cha
        return -1;
 }
 
-static int skel_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *name, const void *value, size_t size, int flags)
+static int skel_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp, const char *name, const void *value, size_t size, int flags)
 {
        errno = ENOSYS;
        return -1;
@@ -560,9 +560,9 @@ static ssize_t skel_aio_return(struct vfs_handle_struct *handle, struct files_st
        return vfswrap_aio_return(NULL, fsp, aiocb);
 }
 
-static int skel_aio_cancel(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, SMB_STRUCT_AIOCB *aiocb)
+static int skel_aio_cancel(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb)
 {
-       return vfswrap_aio_cancel(NULL, fsp, fd, aiocb);
+       return vfswrap_aio_cancel(NULL, fsp, aiocb);
 }
 
 static int skel_aio_error(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb)
@@ -580,6 +580,21 @@ static int skel_aio_suspend(struct vfs_handle_struct *handle, struct files_struc
        return vfswrap_aio_suspend(NULL, fsp, aiocb, n, ts);
 }
 
+static bool skel_aio_force(struct vfs_handle_struct *handle, struct files_struct *fsp)
+{
+       return vfswrap_aio_force(NULL, fsp);
+}
+
+static bool skel_is_offline(struct vfs_handle_struct *handle, const char *path, SMB_STRUCT_STAT *sbuf)
+{
+       return vfswrap_is_offline(NULL, path, sbuf);
+}
+
+static int skel_set_offline(struct vfs_handle_struct *handle, const char *path)
+{
+       return vfswrap_set_offline(NULL, path);
+}
+
 /* VFS operations structure */
 
 static vfs_op_tuple skel_op_tuples[] = {
@@ -615,7 +630,7 @@ static vfs_op_tuple skel_op_tuples[] = {
        {SMB_VFS_OP(skel_pwrite),                       SMB_VFS_OP_PWRITE,              SMB_VFS_LAYER_OPAQUE},
        {SMB_VFS_OP(skel_lseek),                        SMB_VFS_OP_LSEEK,               SMB_VFS_LAYER_OPAQUE},
        {SMB_VFS_OP(skel_sendfile),                     SMB_VFS_OP_SENDFILE,            SMB_VFS_LAYER_OPAQUE},
-       {SMB_VFS_OP(skel_recvfile),                     SMB_VFS_OP_RECVFLE,             SMB_VFS_LAYER_OPAQUE},
+       {SMB_VFS_OP(skel_recvfile),                     SMB_VFS_OP_RECVFILE,            SMB_VFS_LAYER_OPAQUE},
        {SMB_VFS_OP(skel_rename),                       SMB_VFS_OP_RENAME,              SMB_VFS_LAYER_OPAQUE},
        {SMB_VFS_OP(skel_fsync),                        SMB_VFS_OP_FSYNC,               SMB_VFS_LAYER_OPAQUE},
        {SMB_VFS_OP(skel_stat),                         SMB_VFS_OP_STAT,                SMB_VFS_LAYER_OPAQUE},
@@ -676,7 +691,7 @@ static vfs_op_tuple skel_op_tuples[] = {
        {SMB_VFS_OP(skel_sys_acl_free_text),            SMB_VFS_OP_SYS_ACL_FREE_TEXT,           SMB_VFS_LAYER_OPAQUE},
        {SMB_VFS_OP(skel_sys_acl_free_acl),             SMB_VFS_OP_SYS_ACL_FREE_ACL,            SMB_VFS_LAYER_OPAQUE},
        {SMB_VFS_OP(skel_sys_acl_free_qualifier),       SMB_VFS_OP_SYS_ACL_FREE_QUALIFIER,      SMB_VFS_LAYER_OPAQUE},
-       
+
        /* EA operations. */
        {SMB_VFS_OP(skel_getxattr),                     SMB_VFS_OP_GETXATTR,                    SMB_VFS_LAYER_OPAQUE},
        {SMB_VFS_OP(skel_lgetxattr),                    SMB_VFS_OP_LGETXATTR,                   SMB_VFS_LAYER_OPAQUE},
@@ -699,6 +714,11 @@ static vfs_op_tuple skel_op_tuples[] = {
        {SMB_VFS_OP(skel_aio_error),                    SMB_VFS_OP_AIO_ERROR,                   SMB_VFS_LAYER_OPAQUE},
        {SMB_VFS_OP(skel_aio_fsync),                    SMB_VFS_OP_AIO_FSYNC,                   SMB_VFS_LAYER_OPAQUE},
        {SMB_VFS_OP(skel_aio_suspend),                  SMB_VFS_OP_AIO_SUSPEND,                 SMB_VFS_LAYER_OPAQUE},
+       {SMB_VFS_OP(skel_aio_force),                    SMB_VFS_OP_AIO_FORCE,                   SMB_VFS_LAYER_OPAQUE},
+
+        /* offline operations */
+       {SMB_VFS_OP(skel_is_offline),                   SMB_VFS_OP_IS_OFFLINE,                  SMB_VFS_LAYER_OPAQUE},
+       {SMB_VFS_OP(skel_set_offline),                  SMB_VFS_OP_SET_OFFLINE,                 SMB_VFS_LAYER_OPAQUE},
 
        {NULL,                                          SMB_VFS_OP_NOOP,                        SMB_VFS_LAYER_NOOP}
 };
index 2512f4d6dbdddd6bcd3fa1ceddc16b8db9489a94..f4cb9b15ba2e048dfa7523e6c54ba707e1f03fc7 100644 (file)
@@ -124,39 +124,39 @@ static int skel_close(vfs_handle_struct *handle, files_struct *fsp, int fd)
        return SMB_VFS_NEXT_CLOSE(handle, fsp, fd);
 }
 
-static ssize_t skel_read(vfs_handle_struct *handle, files_struct *fsp, int fd, void *data, size_t n)
+static ssize_t skel_read(vfs_handle_struct *handle, files_struct *fsp, void *data, size_t n)
 {
-       return SMB_VFS_NEXT_READ(handle, fsp, fd, data, n);
+       return SMB_VFS_NEXT_READ(handle, fsp, data, n);
 }
 
-static ssize_t skel_pread(vfs_handle_struct *handle, files_struct *fsp, int fd, void *data, size_t n, SMB_OFF_T offset)
+static ssize_t skel_pread(vfs_handle_struct *handle, files_struct *fsp, void *data, size_t n, SMB_OFF_T offset)
 {
-       return SMB_VFS_NEXT_PREAD(handle, fsp, fd, data, n, offset);
+       return SMB_VFS_NEXT_PREAD(handle, fsp, data, n, offset);
 }
 
-static ssize_t skel_write(vfs_handle_struct *handle, files_struct *fsp, int fd, const void *data, size_t n)
+static ssize_t skel_write(vfs_handle_struct *handle, files_struct *fsp, const void *data, size_t n)
 {
-       return SMB_VFS_NEXT_WRITE(handle, fsp, fd, data, n);
+       return SMB_VFS_NEXT_WRITE(handle, fsp, data, n);
 }
 
-static ssize_t skel_pwrite(vfs_handle_struct *handle, files_struct *fsp, int fd, const void *data, size_t n, SMB_OFF_T offset)
+static ssize_t skel_pwrite(vfs_handle_struct *handle, files_struct *fsp, const void *data, size_t n, SMB_OFF_T offset)
 {
-       return SMB_VFS_NEXT_PWRITE(handle, fsp, fd, data, n, offset);
+       return SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, offset);
 }
 
-static SMB_OFF_T skel_lseek(vfs_handle_struct *handle, files_struct *fsp, int filedes, SMB_OFF_T offset, int whence)
+static SMB_OFF_T skel_lseek(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_T offset, int whence)
 {
-       return SMB_VFS_NEXT_LSEEK(handle, fsp, filedes, offset, whence);
+       return SMB_VFS_NEXT_LSEEK(handle, fsp, offset, whence);
 }
 
-static ssize_t skel_sendfile(vfs_handle_struct *handle, int tofd, files_struct *fsp, int fromfd, const DATA_BLOB *hdr, SMB_OFF_T offset, size_t n)
+static ssize_t skel_sendfile(vfs_handle_struct *handle, int tofd, files_struct *fromfsp, const DATA_BLOB *hdr, SMB_OFF_T offset, size_t n)
 {
-       return SMB_VFS_NEXT_SENDFILE(handle, tofd, fsp, fromfd, hdr, offset, n);
+       return SMB_VFS_NEXT_SENDFILE(handle, tofd, fromfsp, hdr, offset, n);
 }
 
-static ssize_t skel_recvfile(vfs_handle_struct *handle, int fromfd, files_struct *fsp, int tofd, SMB_OFF_T offset, size_t n)
+static ssize_t skel_recvfile(vfs_handle_struct *handle, int fromfd, files_struct *tofsp, SMB_OFF_T offset, size_t n)
 {
-       return SMB_VFS_NEXT_RECVFILE(handle, fromfd, fsp, tofd, offset, n);
+       return SMB_VFS_NEXT_RECVFILE(handle, fromfd, tofsp, offset, n);
 }
 
 static int skel_rename(vfs_handle_struct *handle,  const char *oldname, const char *newname)
@@ -164,9 +164,9 @@ static int skel_rename(vfs_handle_struct *handle,  const char *oldname, const ch
        return SMB_VFS_NEXT_RENAME(handle, oldname, newname);
 }
 
-static int skel_fsync(vfs_handle_struct *handle, files_struct *fsp, int fd)
+static int skel_fsync(vfs_handle_struct *handle, files_struct *fsp)
 {
-       return SMB_VFS_NEXT_FSYNC(handle, fsp, fd);
+       return SMB_VFS_NEXT_FSYNC(handle, fsp);
 }
 
 static int skel_stat(vfs_handle_struct *handle,  const char *fname, SMB_STRUCT_STAT *sbuf)
@@ -174,9 +174,9 @@ static int skel_stat(vfs_handle_struct *handle,  const char *fname, SMB_STRUCT_S
        return SMB_VFS_NEXT_STAT(handle, fname, sbuf);
 }
 
-static int skel_fstat(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_STRUCT_STAT *sbuf)
+static int skel_fstat(vfs_handle_struct *handle, files_struct *fsp, SMB_STRUCT_STAT *sbuf)
 {
-       return SMB_VFS_NEXT_FSTAT(handle, fsp, fd, sbuf);
+       return SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf);
 }
 
 static int skel_lstat(vfs_handle_struct *handle,  const char *path, SMB_STRUCT_STAT *sbuf)
@@ -194,9 +194,9 @@ static int skel_chmod(vfs_handle_struct *handle,  const char *path, mode_t mode)
        return SMB_VFS_NEXT_CHMOD(handle, path, mode);
 }
 
-static int skel_fchmod(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode)
+static int skel_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t mode)
 {
-       return SMB_VFS_NEXT_FCHMOD(handle, fsp, fd, mode);
+       return SMB_VFS_NEXT_FCHMOD(handle, fsp, mode);
 }
 
 static int skel_chown(vfs_handle_struct *handle,  const char *path, uid_t uid, gid_t gid)
@@ -204,9 +204,9 @@ static int skel_chown(vfs_handle_struct *handle,  const char *path, uid_t uid, g
        return SMB_VFS_NEXT_CHOWN(handle, path, uid, gid);
 }
 
-static int skel_fchown(vfs_handle_struct *handle, files_struct *fsp, int fd, uid_t uid, gid_t gid)
+static int skel_fchown(vfs_handle_struct *handle, files_struct *fsp, uid_t uid, gid_t gid)
 {
-       return SMB_VFS_NEXT_FCHOWN(handle, fsp, fd, uid, gid);
+       return SMB_VFS_NEXT_FCHOWN(handle, fsp, uid, gid);
 }
 
 static int skel_lchown(vfs_handle_struct *handle,  const char *path, uid_t uid, gid_t gid)
@@ -229,19 +229,19 @@ static int skel_ntimes(vfs_handle_struct *handle,  const char *path, const struc
        return SMB_VFS_NEXT_NTIMES(handle, path, ts);
 }
 
-static int skel_ftruncate(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_OFF_T offset)
+static int skel_ftruncate(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_T offset)
 {
-       return SMB_VFS_NEXT_FTRUNCATE(handle, fsp, fd, offset);
+       return SMB_VFS_NEXT_FTRUNCATE(handle, fsp, offset);
 }
 
-static bool skel_lock(vfs_handle_struct *handle, files_struct *fsp, int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type)
+static bool skel_lock(vfs_handle_struct *handle, files_struct *fsp, int op, SMB_OFF_T offset, SMB_OFF_T count, int type)
 {
-       return SMB_VFS_NEXT_LOCK(handle, fsp, fd, op, offset, count, type);
+       return SMB_VFS_NEXT_LOCK(handle, fsp, op, offset, count, type);
 }
 
-static bool skel_getlock(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid)
+static bool skel_getlock(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid)
 {
-       return SMB_VFS_NEXT_GETLOCK(handle, fsp, fd, poffset, pcount, ptype, ppid);
+       return SMB_VFS_NEXT_GETLOCK(handle, fsp, poffset, pcount, ptype, ppid);
 }
 
 static int skel_symlink(vfs_handle_struct *handle,  const char *oldpath, const char *newpath)
@@ -289,22 +289,22 @@ static struct file_id skel_file_id_create(vfs_handle_struct *handle,
        return SMB_VFS_NEXT_FILE_ID_CREATE(handle, dev, inode);
 }
 
-static size_t skel_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
-       int fd, uint32 security_info, SEC_DESC **ppdesc)
+static NTSTATUS skel_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
+       uint32 security_info, SEC_DESC **ppdesc)
 {
-       return SMB_VFS_NEXT_FGET_NT_ACL(handle, fsp, fd, security_info, ppdesc);
+       return SMB_VFS_NEXT_FGET_NT_ACL(handle, fsp, security_info, ppdesc);
 }
 
-static size_t skel_get_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
+static NTSTATUS skel_get_nt_acl(vfs_handle_struct *handle,
        const char *name, uint32 security_info, SEC_DESC **ppdesc)
 {
-       return SMB_VFS_NEXT_GET_NT_ACL(handle, fsp, name, security_info, ppdesc);
+       return SMB_VFS_NEXT_GET_NT_ACL(handle, name, security_info, ppdesc);
 }
 
 static NTSTATUS skel_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
-       int fd, uint32 security_info_sent, SEC_DESC *psd)
+       uint32 security_info_sent, SEC_DESC *psd)
 {
-       return SMB_VFS_NEXT_FSET_NT_ACL(handle, fsp, fd, security_info_sent, psd);
+       return SMB_VFS_NEXT_FSET_NT_ACL(handle, fsp, security_info_sent, psd);
 }
 
 static NTSTATUS skel_set_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
@@ -323,14 +323,14 @@ static int skel_chmod_acl(vfs_handle_struct *handle,  const char *name, mode_t m
        return SMB_VFS_NEXT_CHMOD_ACL(handle, name, mode);
 }
 
-static int skel_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode)
+static int skel_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, mode_t mode)
 {
        /* If the underlying VFS doesn't have ACL support... */
        if (!handle->vfs_next.ops.fchmod_acl) {
                errno = ENOSYS;
                return -1;
        }
-       return SMB_VFS_NEXT_FCHMOD_ACL(handle, fsp, fd, mode);
+       return SMB_VFS_NEXT_FCHMOD_ACL(handle, fsp, mode);
 }
 
 static int skel_sys_acl_get_entry(vfs_handle_struct *handle,  SMB_ACL_T theacl, int entry_id, SMB_ACL_ENTRY_T *entry_p)
@@ -358,9 +358,9 @@ static SMB_ACL_T skel_sys_acl_get_file(vfs_handle_struct *handle,  const char *p
        return SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, path_p, type);
 }
 
-static SMB_ACL_T skel_sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp, int fd)
+static SMB_ACL_T skel_sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp)
 {
-       return SMB_VFS_NEXT_SYS_ACL_GET_FD(handle, fsp, fd);
+       return SMB_VFS_NEXT_SYS_ACL_GET_FD(handle, fsp);
 }
 
 static int skel_sys_acl_clear_perms(vfs_handle_struct *handle,  SMB_ACL_PERMSET_T permset)
@@ -413,9 +413,9 @@ static int skel_sys_acl_set_file(vfs_handle_struct *handle,  const char *name, S
        return SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, name, acltype, theacl);
 }
 
-static int skel_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_ACL_T theacl)
+static int skel_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp, SMB_ACL_T theacl)
 {
-       return SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, fd, theacl);
+       return SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, theacl);
 }
 
 static int skel_sys_acl_delete_def_file(vfs_handle_struct *handle,  const char *path)
@@ -454,9 +454,9 @@ size)
         return SMB_VFS_NEXT_LGETXATTR(handle, path, name, value, size);
 }
 
-static ssize_t skel_fgetxattr(vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *name, void *value, size_t size)
+static ssize_t skel_fgetxattr(vfs_handle_struct *handle, struct files_struct *fsp, const char *name, void *value, size_t size)
 {
-        return SMB_VFS_NEXT_FGETXATTR(handle, fsp, fd, name, value, size);
+        return SMB_VFS_NEXT_FGETXATTR(handle, fsp, name, value, size);
 }
 
 static ssize_t skel_listxattr(vfs_handle_struct *handle, const char *path, char *list, size_t size)
@@ -469,9 +469,9 @@ static ssize_t skel_llistxattr(vfs_handle_struct *handle, const char *path, char
         return SMB_VFS_NEXT_LLISTXATTR(handle, path, list, size);
 }
 
-static ssize_t skel_flistxattr(vfs_handle_struct *handle, struct files_struct *fsp,int fd, char *list, size_t size)
+static ssize_t skel_flistxattr(vfs_handle_struct *handle, struct files_struct *fsp, char *list, size_t size)
 {
-        return SMB_VFS_NEXT_FLISTXATTR(handle, fsp, fd, list, size);
+        return SMB_VFS_NEXT_FLISTXATTR(handle, fsp, list, size);
 }
 
 static int skel_removexattr(vfs_handle_struct *handle, const char *path, const char *name)
@@ -484,9 +484,9 @@ static int skel_lremovexattr(vfs_handle_struct *handle, const char *path, const
         return SMB_VFS_NEXT_LREMOVEXATTR(handle, path, name);
 }
 
-static int skel_fremovexattr(vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *name)
+static int skel_fremovexattr(vfs_handle_struct *handle, struct files_struct *fsp, const char *name)
 {
-        return SMB_VFS_NEXT_FREMOVEXATTR(handle, fsp, fd, name);
+        return SMB_VFS_NEXT_FREMOVEXATTR(handle, fsp, name);
 }
 
 static int skel_setxattr(vfs_handle_struct *handle, const char *path, const char *name, const void *value, size_t size, int flags)
@@ -499,9 +499,9 @@ static int skel_lsetxattr(vfs_handle_struct *handle, const char *path, const cha
         return SMB_VFS_NEXT_LSETXATTR(handle, path, name, value, size, flags);
 }
 
-static int skel_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *name, const void *value, size_t size, int flags)
+static int skel_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp, const char *name, const void *value, size_t size, int flags)
 {
-        return SMB_VFS_NEXT_FSETXATTR(handle, fsp, fd, name, value, size, flags);
+        return SMB_VFS_NEXT_FSETXATTR(handle, fsp, name, value, size, flags);
 }
 
 static int skel_aio_read(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb)
@@ -519,9 +519,9 @@ static ssize_t skel_aio_return(struct vfs_handle_struct *handle, struct files_st
        return SMB_VFS_NEXT_AIO_RETURN(handle, fsp, aiocb);
 }
 
-static int skel_aio_cancel(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, SMB_STRUCT_AIOCB *aiocb)
+static int skel_aio_cancel(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb)
 {
-       return SMB_VFS_NEXT_AIO_CANCEL(handle, fsp, fd, aiocb);
+       return SMB_VFS_NEXT_AIO_CANCEL(handle, fsp, aiocb);
 }
 
 static int skel_aio_error(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb)
@@ -539,6 +539,26 @@ static int skel_aio_suspend(struct vfs_handle_struct *handle, struct files_struc
        return SMB_VFS_NEXT_AIO_SUSPEND(handle, fsp, aiocb, n, ts);
 }
 
+static bool skel_aio_force(struct vfs_handle_struct *handle, struct files_struct *fsp)
+{
+        return SMB_VFS_NEXT_AIO_FORCE(handle, fsp);
+}
+
+static bool skel_is_offline(struct vfs_handle_struct *handle, const char *path, SMB_STRUCT_STAT *sbuf)
+{
+       return SMB_VFS_NEXT_IS_OFFLINE(handle, path, sbuf);
+}
+
+static int skel_set_offline(struct vfs_handle_struct *handle, const char *path)
+{
+       return SMB_VFS_NEXT_SET_OFFLINE(handle, path);
+}
+
+static bool skel_is_remotestorage(struct vfs_handle_struct *handle, const char *path)
+{
+       return SMB_VFS_NEXT_IS_REMOTESTORAGE(handle, path);
+}
+
 /* VFS operations structure */
 
 static vfs_op_tuple skel_op_tuples[] = {
@@ -633,7 +653,7 @@ static vfs_op_tuple skel_op_tuples[] = {
        {SMB_VFS_OP(skel_sys_acl_free_text),            SMB_VFS_OP_SYS_ACL_FREE_TEXT,           SMB_VFS_LAYER_TRANSPARENT},
        {SMB_VFS_OP(skel_sys_acl_free_acl),             SMB_VFS_OP_SYS_ACL_FREE_ACL,            SMB_VFS_LAYER_TRANSPARENT},
        {SMB_VFS_OP(skel_sys_acl_free_qualifier),       SMB_VFS_OP_SYS_ACL_FREE_QUALIFIER,      SMB_VFS_LAYER_TRANSPARENT},
-       
+
        /* EA operations. */
        {SMB_VFS_OP(skel_getxattr),                     SMB_VFS_OP_GETXATTR,                    SMB_VFS_LAYER_TRANSPARENT},
        {SMB_VFS_OP(skel_lgetxattr),                    SMB_VFS_OP_LGETXATTR,                   SMB_VFS_LAYER_TRANSPARENT},
@@ -656,6 +676,11 @@ static vfs_op_tuple skel_op_tuples[] = {
        {SMB_VFS_OP(skel_aio_error),                    SMB_VFS_OP_AIO_ERROR,                   SMB_VFS_LAYER_TRANSPARENT},
        {SMB_VFS_OP(skel_aio_fsync),                    SMB_VFS_OP_AIO_FSYNC,                   SMB_VFS_LAYER_TRANSPARENT},
        {SMB_VFS_OP(skel_aio_suspend),                  SMB_VFS_OP_AIO_SUSPEND,                 SMB_VFS_LAYER_TRANSPARENT},
+       {SMB_VFS_OP(skel_aio_force),                    SMB_VFS_OP_AIO_FORCE,                   SMB_VFS_LAYER_TRANSPARENT},
+
+       /* offline operations */
+       {SMB_VFS_OP(skel_is_offline),                   SMB_VFS_OP_IS_OFFLINE,                  SMB_VFS_LAYER_TRANSPARENT},
+       {SMB_VFS_OP(skel_set_offline),                  SMB_VFS_OP_SET_OFFLINE,                 SMB_VFS_LAYER_TRANSPARENT},
 
        {NULL,                                          SMB_VFS_OP_NOOP,                        SMB_VFS_LAYER_NOOP}
 };
index be383aea671c53347ae68a8d706f7af71de4ec09..6c70659661701bb0292e262783d7b2308501e52b 100644 (file)
@@ -5,7 +5,7 @@ SAMBA_INCL = ../../source/include
 EXTLIB_INCL = -I/usr/include/gtk-1.2 \
              -I/usr/include/glib-1.2 \
              -I/usr/lib/glib/include
-
+EXTLIB_INCL = `gtk-config --cflags`
 
 DEFS = -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
 CFLAGS = -O0 -g -I$(SAMBA_INCL) $(EXTLIB_INCL) $(DEFS)
@@ -13,18 +13,21 @@ CFLAGS = -O0 -g -I$(SAMBA_INCL) $(EXTLIB_INCL) $(DEFS)
 LDFLAGS = -L/usr/local/samba/lib \
          -lldap -lkrb5 -lgssapi_krb5
 #LIBSMBCLIENT = /usr/local/samba/lib/libsmbclient.so
-LIBSMBCLIENT = ../../source/bin/libsmbclient.a -ldl -lresolv
+LIBSMBCLIENT = -lwbclient -lsmbclient -ldl -lresolv
 
 TESTS= testsmbc \
        testacl \
        testacl2 \
+       testacl3 \
        testbrowse \
        testbrowse2 \
        teststat \
        teststat2 \
+       teststat3 \
        testchmod \
        testutime \
-       testread
+       testread \
+       testwrite
 
 #      tree \
 
@@ -46,6 +49,10 @@ testacl2: testacl2.o
        @echo Linking testacl2
        $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBSMBCLIENT) -lpopt
 
+testacl3: testacl3.o
+       @echo Linking testacl3
+       $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBSMBCLIENT) -lpopt
+
 testbrowse: testbrowse.o
        @echo Linking testbrowse
        $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBSMBCLIENT) -lpopt
@@ -62,6 +69,10 @@ teststat2: teststat2.o
        @echo Linking teststat2
        $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBSMBCLIENT) -lpopt
 
+teststat3: teststat3.o
+       @echo Linking teststat3
+       $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBSMBCLIENT) -lpopt
+
 testchmod: testchmod.o
        @echo Linking testchmod
        $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBSMBCLIENT) -lpopt
@@ -74,6 +85,10 @@ testread: testread.o
        @echo Linking testread
        $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBSMBCLIENT) -lpopt
 
+testwrite: testwrite.o
+       @echo Linking testwrite
+       $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBSMBCLIENT) -lpopt
+
 smbsh:
        make -C smbwrapper
 
index eb493885af207b2e0ec71ccbf71bd2136e6cc90a..b1d36c8beacd4ecadc63075f2d8719cd5c7dd6c8 100644 (file)
@@ -8,7 +8,23 @@ get_auth_data_fn(const char * pServer,
                  char * pPassword,
                  int maxLenPassword)
 {
-    char temp[128];
+    char            temp[128];
+    char            server[256] = { '\0' };
+    char            share[256] = { '\0' };
+    char            workgroup[256] = { '\0' };
+    char            username[256] = { '\0' };
+    char            password[256] = { '\0' };
+
+    if (strcmp(server, pServer) == 0 &&
+        strcmp(share, pShare) == 0 &&
+        *workgroup != '\0' &&
+        *username != '\0')
+    {
+        strncpy(pWorkgroup, workgroup, maxLenWorkgroup - 1);
+        strncpy(pUsername, username, maxLenUsername - 1);
+        strncpy(pPassword, password, maxLenPassword - 1);
+        return;
+    }
     
     fprintf(stdout, "Workgroup: [%s] ", pWorkgroup);
     fgets(temp, sizeof(temp), stdin);
@@ -48,4 +64,8 @@ get_auth_data_fn(const char * pServer,
     {
         strncpy(pPassword, temp, maxLenPassword - 1);
     }
+
+    strncpy(workgroup, pWorkgroup, sizeof(workgroup) - 1);
+    strncpy(username, pUsername, sizeof(username) - 1);
+    strncpy(password, pPassword, sizeof(password) - 1);
 }
index c94ef8fa6afdd47674ab6d7956a7ab822fbd0a28..726435319f89eb3ba14174718f37894a6efecafa 100644 (file)
@@ -1,4 +1,4 @@
-LIBS = -lsmbclient -ldl
+LIBS = -lwbclient -lsmbclient -ldl
 DEFS = -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
 
 CFLAGS = -I$(SAMBA_INCL) $(EXTLIB_INCL)
index 4e87a2e2e8ed95f8688a5550aa86bff3e3da98b8..bb7a25f13e8f526386e1e0f858cac236960f6a23 100644 (file)
@@ -72,13 +72,12 @@ int sys_select_intr(int maxfd, fd_set *readfds, fd_set *writefds, fd_set *errorf
        int ret;
        fd_set *readfds2, readfds_buf, *writefds2, writefds_buf, *errorfds2, errorfds_buf;
        struct timeval tval2, *ptval, end_time, now_time;
-        extern void GetTimeOfDay(struct timeval *tval);
 
        readfds2 = (readfds ? &readfds_buf : NULL);
        writefds2 = (writefds ? &writefds_buf : NULL);
        errorfds2 = (errorfds ? &errorfds_buf : NULL);
         if (tval) {
-                GetTimeOfDay(&end_time);
+                gettimeofday(&end_time, NULL);
                 end_time.tv_sec += tval->tv_sec;
                 end_time.tv_usec += tval->tv_usec;
                 end_time.tv_sec += end_time.tv_usec / 1000000;
@@ -96,7 +95,7 @@ int sys_select_intr(int maxfd, fd_set *readfds, fd_set *writefds, fd_set *errorf
                if (errorfds)
                        errorfds_buf = *errorfds;
                if (tval) {
-                        GetTimeOfDay(&now_time);
+                        gettimeofday(&now_time, NULL);
                         tval2.tv_sec = end_time.tv_sec - now_time.tv_sec;
                        tval2.tv_usec = end_time.tv_usec - now_time.tv_usec;
                         if ((signed long) tval2.tv_usec < 0) {
index 30f9037d53a144f62f153312bae31c9eebb50386..958e00636ea5428f455166e601ba3abe06c0f59e 100644 (file)
@@ -61,6 +61,7 @@
 #include <dirent.h>
 #include <signal.h>
 #include <stdarg.h>
+#include <string.h>
 #ifdef __USE_GNU
 # define SMBW_USE_GNU
 #endif
index 4d327b39a7a11e0c7a0eea3768fd94ed66a50ced..51cc90f1015e34289aa4574930448ecade2cd2f7 100644 (file)
@@ -7,6 +7,7 @@
 
 enum acl_mode
 {
+    SMB_ACL_LIST,
     SMB_ACL_GET,
     SMB_ACL_SET,
     SMB_ACL_DELETE,
@@ -24,7 +25,7 @@ int main(int argc, const char *argv[])
     int debug = 0;
     int numeric = 0;
     int full_time_names = 0;
-    enum acl_mode mode = SMB_ACL_GET;
+    enum acl_mode mode = SMB_ACL_LIST;
     static char *the_acl = NULL;
     int ret;
     char *p;
@@ -149,6 +150,30 @@ int main(int argc, const char *argv[])
     
     switch(mode)
     {
+    case SMB_ACL_LIST:
+        ret = smbc_listxattr(path, value, sizeof(value)-2);
+        if (ret < 0)
+        {
+            printf("Could not get attribute list for [%s] %d: %s\n",
+                   path, errno, strerror(errno));
+            return 1;
+        }
+
+        /*
+         * The list of attributes has a series of null-terminated strings.
+         * The list of strings terminates with an extra null byte, thus two in
+         * a row.  Ensure that our buffer, which is conceivably shorter than
+         * the list of attributes, actually ends with two null bytes in a row.
+         */
+        value[sizeof(value) - 2] = '\0';
+        value[sizeof(value) - 1] = '\0';
+        printf("Supported attributes:\n");
+        for (p = value; *p; p += strlen(p) + 1)
+        {
+            printf("\t%s\n", p);
+        }
+        break;
+
     case SMB_ACL_GET:
         if (the_acl == NULL)
         {
diff --git a/examples/libsmbclient/testacl3.c b/examples/libsmbclient/testacl3.c
new file mode 100644 (file)
index 0000000..9102405
--- /dev/null
@@ -0,0 +1,62 @@
+#include <sys/types.h>
+#include <stdio.h> 
+#include <unistd.h>
+#include <string.h> 
+#include <time.h> 
+#include <errno.h>
+#include <libsmbclient.h> 
+#include "get_auth_data_fn.h"
+
+
+int main(int argc, char * argv[]) 
+{ 
+    int             i;
+    int             fd;
+    int             ret;
+    int             debug = 0;
+    int             mode = 0666;
+    int             savedErrno;
+    char            value[2048]; 
+    char            path[2048];
+    char *          the_acl;
+    char *          p;
+    time_t          t0;
+    time_t          t1;
+    struct stat     st; 
+    SMBCCTX *       context;
+    
+    smbc_init(get_auth_data_fn, debug); 
+    
+    context = smbc_set_context(NULL);
+    smbc_option_set(context, "full_time_names", 1);
+    
+    for (;;)
+    {
+        fprintf(stdout, "Path: ");
+        *path = '\0';
+        fgets(path, sizeof(path) - 1, stdin);
+        if (strlen(path) == 0)
+        {
+            return 0;
+        }
+
+        p = path + strlen(path) - 1;
+        if (*p == '\n')
+        {
+            *p = '\0';
+        }
+    
+        the_acl = strdup("system.nt_sec_desc.*+");
+        ret = smbc_getxattr(path, the_acl, value, sizeof(value));
+        if (ret < 0)
+        {
+            printf("Could not get attributes for [%s] %d: %s\n",
+                   path, errno, strerror(errno));
+            return 1;
+        }
+    
+        printf("Attributes for [%s] are:\n%s\n", path, value);
+    }
+
+    return 0; 
+}
index d59fc70ec11fcc7683ed71cf0c991e6c291a46b8..3f948848957151badf4ad95f7560bbc26eeca194 100644 (file)
 
 int main(int argc, char * argv[]) 
 { 
+    int             i;
     int             fd;
     int             ret;
     int             debug = 0;
     int             mode = 0666;
     int             savedErrno;
     char            buffer[2048]; 
-    char *          pSmbPath = NULL;
+    char            path[2048];
+    char *          p;
     time_t          t0;
     time_t          t1;
     struct stat     st; 
     
-    if (argc == 1)
-    {
-        pSmbPath = "smb://RANDOM/Public/bigfile";
-    }
-    else if (argc == 2)
-    {
-        pSmbPath = argv[1];
-    }
-    else
-    {
-        printf("usage: "
-               "%s [ smb://path/to/file ]\n",
-               argv[0]);
-        return 1;
-    }
-
     smbc_init(get_auth_data_fn, debug); 
     
-    printf("Open file %s\n", pSmbPath);
-    
-    t0 = time(NULL);
-
-    if ((fd = smbc_open(pSmbPath, O_RDONLY, 0)) < 0)
+    for (;;)
     {
-        perror("smbc_open");
-        return 1;
-    }
+        fprintf(stdout, "Path: ");
+        *path = '\0';
+        fgets(path, sizeof(path) - 1, stdin);
+        if (strlen(path) == 0)
+        {
+            return 0;
+        }
 
-    printf("Beginning read loop.\n");
+        p = path + strlen(path) - 1;
+        if (*p == '\n')
+        {
+            *p = '\0';
+        }
+    
+        if ((fd = smbc_open(path, O_RDONLY, 0)) < 0)
+        {
+            perror("smbc_open");
+            continue;
+        }
 
-    do
-    {
-        ret = smbc_read(fd, buffer, sizeof(buffer));
-        savedErrno = errno;
-        if (ret > 0) fwrite(buffer, 1, ret, stdout);
-    } while (ret > 0);
+        do
+        {
+            ret = smbc_read(fd, buffer, sizeof(buffer));
+            savedErrno = errno;
+            if (ret > 0) fwrite(buffer, 1, ret, stdout);
+        } while (ret > 0);
 
-    smbc_close(fd);
+        smbc_close(fd);
 
-    if (ret < 0)
-    {
-        errno = savedErrno;
-        perror("read");
-        return 1;
+        if (ret < 0)
+        {
+            errno = savedErrno;
+            perror("read");
+        }
     }
 
-    t1 = time(NULL);
-
-    printf("Elapsed time: %d seconds\n", t1 - t0);
-
     return 0; 
 }
diff --git a/examples/libsmbclient/teststat3.c b/examples/libsmbclient/teststat3.c
new file mode 100644 (file)
index 0000000..26348b3
--- /dev/null
@@ -0,0 +1,78 @@
+#include <libsmbclient.h>
+#include <sys/stat.h>
+#include <string.h>
+#include <stdio.h>
+#include <time.h>
+#include "get_auth_data_fn.h"
+
+/*
+ * This test is intended to ensure that the timestamps returned by
+ * libsmbclient using smbc_stat() are the same as those returned by
+ * smbc_fstat().
+ */
+
+
+int main(int argc, char* argv[])
+{
+        int             fd;
+        struct stat     st1;
+        struct stat     st2;
+        char            mtime[32];
+        char            ctime[32];
+        char            atime[32];
+        char *          pUrl = argv[1];
+
+        if(argc != 2)
+        {
+                printf("usage: %s <file_url>\n", argv[0]);
+                return 1;
+        }
+
+        
+        smbc_init(get_auth_data_fn, 0);
+        
+        if (smbc_stat(pUrl, &st1) < 0)
+        {
+                perror("smbc_stat");
+                return 1;
+        }
+        
+        if ((fd = smbc_open(pUrl, O_RDONLY, 0)) < 0)
+        {
+                perror("smbc_open");
+                return 1;
+        }
+
+        if (smbc_fstat(fd, &st2) < 0)
+        {
+                perror("smbc_fstat");
+                return 1;
+        }
+        
+        smbc_close(fd);
+
+#define COMPARE(name, field)                                            \
+        if (st1.field != st2.field)                                     \
+        {                                                               \
+                printf("Field " name " MISMATCH: st1=%lu, st2=%lu\n",   \
+                       (unsigned long) st1.field,                       \
+                       (unsigned long) st2.field);                      \
+        }
+
+        COMPARE("st_dev", st_dev);
+        COMPARE("st_ino", st_ino);
+        COMPARE("st_mode", st_mode);
+        COMPARE("st_nlink", st_nlink);
+        COMPARE("st_uid", st_uid);
+        COMPARE("st_gid", st_gid);
+        COMPARE("st_rdev", st_rdev);
+        COMPARE("st_size", st_size);
+        COMPARE("st_blksize", st_blksize);
+        COMPARE("st_blocks", st_blocks);
+        COMPARE("st_atime", st_atime);
+        COMPARE("st_mtime", st_mtime);
+        COMPARE("st_ctime", st_ctime);
+
+        return 0;
+}
+
diff --git a/examples/libsmbclient/testwrite.c b/examples/libsmbclient/testwrite.c
new file mode 100644 (file)
index 0000000..780f0e9
--- /dev/null
@@ -0,0 +1,69 @@
+#include <sys/types.h>
+#include <stdio.h> 
+#include <unistd.h>
+#include <string.h> 
+#include <time.h> 
+#include <errno.h>
+#include <libsmbclient.h> 
+#include "get_auth_data_fn.h"
+
+
+int main(int argc, char * argv[]) 
+{ 
+    int             i;
+    int             fd;
+    int             ret;
+    int             debug = 0;
+    int             mode = 0666;
+    int             savedErrno;
+    char            buffer[2048]; 
+    char            path[2048];
+    char *          p;
+    time_t          t0;
+    time_t          t1;
+    struct stat     st; 
+    
+    smbc_init(get_auth_data_fn, debug); 
+    
+    printf("CAUTION: This program will overwrite a file.  "
+           "Press ENTER to continue.");
+    fgets(buffer, sizeof(buffer), stdin);
+           
+
+    for (;;)
+    {
+        fprintf(stdout, "\nPath: ");
+        *path = '\0';
+        fgets(path, sizeof(path) - 1, stdin);
+        if (strlen(path) == 0)
+        {
+            return 0;
+        }
+
+        p = path + strlen(path) - 1;
+        if (*p == '\n')
+        {
+            *p = '\0';
+        }
+    
+        if ((fd = smbc_open(path, O_WRONLY | O_CREAT | O_TRUNC, 0)) < 0)
+        {
+            perror("smbc_open");
+            continue;
+        }
+
+        strcpy(buffer, "Hello world\n");
+
+        ret = smbc_write(fd, buffer, strlen(buffer));
+        savedErrno = errno;
+        smbc_close(fd);
+
+        if (ret < 0)
+        {
+            errno = savedErrno;
+            perror("write");
+        }
+    }
+
+    return 0; 
+}
index d5a71e2868361f7d3f254294717f166226ed69a2..6e34cd05627c4d47ee05b654e0329baeadf6ba4e 100644 (file)
@@ -24,6 +24,8 @@
 
 #include <stdio.h>
 #include <errno.h>
+#include <string.h>
+#include <stdlib.h>
 #include <gtk/gtk.h>
 #include "libsmbclient.h"
 
index 8ebf39214117fe460fee19a934add6901026cb00..4799ac8452d5c11bc849e5e57f7b826233a7f709 100644 (file)
@@ -45,7 +45,7 @@ if ($ARGV[1] eq "SUPPORT" || $ARGV[0] eq "support")
 }
 
 # Connect shares just used by Administration staff
-If ($ARGV[1] eq "ADMIN" || $ARGV[0] eq "admin")
+if ($ARGV[1] eq "ADMIN" || $ARGV[0] eq "admin")
 {
        print LOGON "NET USE L: \\\\$ARGV[2]\\ADMIN\r\n";
        print LOGON "NET USE K: \\\\$ARGV[2]\\MKTING\r\n";
index a63ae311eb877df398752163302845e08be4a6f0..d17e680ec8e9b0fefe5c83ccd35c33cf738944c8 100755 (executable)
@@ -3,7 +3,7 @@
 # adssearch.pl         - query an Active Directory server and
 #                display objects in a human readable format
 #
-# Copyright (C) Guenther Deschner <gd@samba.org> 2003-2007
+# Copyright (C) Guenther Deschner <gd@samba.org> 2003-2008
 #
 # TODO: add range retrieval
 #      write sddl-converter, decode userParameters
@@ -230,6 +230,7 @@ my %ads_mixed_domain = (
 my %ads_ds_func = (
 "DS_BEHAVIOR_WIN2000"                  => 0,   # untested
 "DS_BEHAVIOR_WIN2003"                  => 2,
+"DS_BEHAVIOR_WIN2008"                  => 3,
 );
 
 my %ads_instance_type = (
@@ -244,6 +245,14 @@ my %ads_uacc = (
        "ACCOUNT_LOCKED_OUT"            => 0x800010, # 8388624
 );
 
+my %ads_enctypes = (
+       "DES-CBC-CRC"                           => 0x01,
+       "DES-CBC-MD5"                           => 0x02,
+       "RC4_HMAC_MD5"                          => 0x04,
+       "AES128_CTS_HMAC_SHA1_96"               => 0x08,
+       "AES128_CTS_HMAC_SHA1_128"              => 0x10,
+);
+
 my %ads_gpoptions = (
        "GPOPTIONS_INHERIT"             => 0,
        "GPOPTIONS_BLOCK_INHERITANCE"   => 1,
@@ -518,6 +527,7 @@ my %attr_handler = (
        "modifyTimeStamp"               => \&dump_timestr,
        "msDS-Behavior-Version"         => \&dump_ds_func,      #unsure
        "msDS-User-Account-Control-Computed" => \&dump_uacc,
+       "msDS-SupportedEncryptionTypes" => \&dump_enctypes,
        "mS-DS-CreatorSID"              => \&dump_sid,
 #      "msRADIUSFramedIPAddress"       => \&dump_ipaddr,
 #      "msRASSavedFramedIPAddress"     => \&dump_ipaddr,
@@ -1209,6 +1219,10 @@ sub dump_uacc {
        return dump_bitmask_equal(@_,%ads_uacc); 
 }
 
+sub dump_enctypes {
+       return dump_bitmask_and(@_,%ads_enctypes);
+}
+
 sub dump_uf {
        return dump_bitmask_and(@_,%ads_uf);
 }
index 994b16d5ef0fae3b1e6d95bfe7da61d785322008..7fd8fc41105f77708cb72d373c29b21071b03433 100755 (executable)
@@ -24,4 +24,4 @@ echo "Done. Now settting up samba command"
 ln /sbin/init.d/samba.init /sbin/samba
 echo "Done."
 echo "To start / stop samba:"
-echo " execute:  samba [start | stop]
+echo " execute:  samba [start | stop]"
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 21fc8cebf76a09e59a21766713cace50e211ac6c..4625feda067583fc70eccf7cd550fed1a4f06f82 100644 (file)
@@ -21,11 +21,12 @@ smbtorture4_path=@smbtorture4_path@
 LIBS=@LIBS@
 CC=@CC@
 SHLD=@SHLD@
+LIB_PATH_VAR=@LIB_PATH_VAR@
 
 ## Dynamic shared libraries build settings
 DSO_EXPORTS_CMD=-Wl,--version-script,$(srcdir)/exports/`basename $@ | sed 's/@SHLIBEXT@$$/syms/'`
 DSO_EXPORTS=@DSO_EXPORTS@
-SONAME_VER=`grep ^$@ $(builddir)/library-versions | cut -d: -f2`
+SONAME_VER=`grep \^$@ $(builddir)/library-versions | cut -d: -f2`
 SHLD_DSO = $(SHLD) $(LDSHFLAGS) $(DSO_EXPORTS) -o $@
 
 # The MODULE_EXPORTS variable contains the platform-specific linker flags
@@ -63,6 +64,7 @@ KRB5LIBS=@KRB5_LIBS@
 LDAP_LIBS=@LDAP_LIBS@
 NSCD_LIBS=@NSCD_LIBS@
 UUID_LIBS=@UUID_LIBS@
+WINBIND_LIBS=@WINBIND_LIBS@
 DNSSD_LIBS=@DNSSD_LIBS@
 
 INSTALLCMD=@INSTALL@
@@ -90,6 +92,7 @@ BINDIR = @bindir@
 SBINDIR = @sbindir@
 ROOTSBINDIR = @rootsbindir@
 LIBDIR = @libdir@
+INCLUDEDIR=@includedir@
 PAMMODULESDIR = @pammodulesdir@
 VFSLIBDIR = $(LIBDIR)/vfs
 PDBLIBDIR = $(LIBDIR)/pdb
@@ -141,6 +144,8 @@ PIDDIR = @piddir@
 LIBSMBCLIENT=bin/libsmbclient.a @LIBSMBCLIENT_SHARED@
 LIBSMBSHAREMODES=bin/libsmbsharemodes.a @LIBSMBSHAREMODES_SHARED@
 LIBADDNS=bin/libaddns.a @LIBADDNS_SHARED@
+LIBWBCLIENT=@LIBWBCLIENT_SHARED@
+LIBNETAPI=bin/libnetapi.a @LIBNETAPI_SHARED@
 
 FLAGS1 = $(CFLAGS) @FLAGS1@ @SAMBA_CPPFLAGS@ $(CPPFLAGS)
 FLAGS2 =
@@ -198,7 +203,7 @@ EVERYTHING_PROGS = bin/debug2html@EXEEXT@ bin/smbfilter@EXEEXT@ \
        bin/log2pcap@EXEEXT@ bin/sharesec@EXEEXT@ bin/ndrdump@EXEEXT@ \
        bin/vlp@EXEEXT@
 
-SHLIBS = @LIBSMBCLIENT@ @LIBSMBSHAREMODES@ @LIBADDNS@
+SHLIBS = @LIBSMBCLIENT@ @LIBSMBSHAREMODES@ @LIBADDNS@ @LIBNETAPI@ @LIBWBCLIENT@
 
 PAM_MODULES = @PAM_MODULES@
 
@@ -248,8 +253,14 @@ ERRORMAP_OBJ = libsmb/errormap.o
 PASSCHANGE_OBJ = libsmb/passchange.o
 
 
-LIBNDR_OBJ = librpc/ndr/ndr_basic.o librpc/ndr/ndr.o librpc/ndr/ndr_misc.o \
-            librpc/ndr/ndr_sec_helper.o librpc/ndr/ndr_string.o librpc/ndr/sid.o \
+LIBNDR_OBJ = librpc/ndr/ndr_basic.o \
+            librpc/ndr/ndr.o \
+            librpc/ndr/ndr_misc.o \
+            librpc/gen_ndr/ndr_misc.o \
+            librpc/gen_ndr/ndr_security.o \
+            librpc/ndr/ndr_sec_helper.o \
+            librpc/ndr/ndr_string.o \
+            librpc/ndr/sid.o \
             librpc/ndr/uuid.o
 
 RPCCLIENT_NDR_OBJ = rpc_client/ndr.o
@@ -263,7 +274,11 @@ 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_netlogon.o \
+                librpc/gen_ndr/ndr_samr.o \
+                librpc/gen_ndr/ndr_dssetup.o \
+                librpc/gen_ndr/ndr_notify.o \
+                librpc/gen_ndr/ndr_xattr.o
 
 RPC_PARSE_OBJ0 = rpc_parse/parse_prs.o rpc_parse/parse_misc.o
 
@@ -280,11 +295,16 @@ NSS_WRAPPER_OBJ = @NSS_WRAPPER_OBJS@
 
 TALLOC_OBJ = lib/talloc/talloc.o
 
+LIBSAMBAUTIL_OBJ = $(TALLOC_OBJ) \
+               $(LIBREPLACE_OBJ) \
+               $(SOCKET_WRAPPER_OBJ) \
+               $(NSS_WRAPPER_OBJ)
 
-LIB_WITHOUT_PROTO_OBJ = $(LIBREPLACE_OBJ) $(SOCKET_WRAPPER_OBJ) $(NSS_WRAPPER_OBJ) $(TALLOC_OBJ) \
+LIB_WITHOUT_PROTO_OBJ = $(LIBSAMBAUTIL_OBJ) \
        lib/messages.o librpc/gen_ndr/ndr_messaging.o lib/messages_local.o \
        lib/messages_ctdbd.o lib/packet.o lib/ctdbd_conn.o lib/talloc_stack.o \
-       lib/interfaces.o lib/rbtree.o
+       lib/interfaces.o lib/rbtree.o lib/memcache.o \
+       lib/util_transfer_file.o
 
 LIB_WITH_PROTO_OBJ = $(VERSION_OBJ) lib/charcnv.o lib/debug.o lib/fault.o \
          lib/interface.o lib/md4.o \
@@ -297,11 +317,11 @@ LIB_WITH_PROTO_OBJ = $(VERSION_OBJ) lib/charcnv.o lib/debug.o lib/fault.o \
          lib/util_str.o lib/clobber.o lib/util_sid.o lib/util_uuid.o \
          lib/util_unistr.o lib/util_file.o lib/data_blob.o \
          lib/util.o lib/util_sock.o lib/sock_exec.o lib/util_sec.o \
-         lib/substitute.o lib/fsusage.o \
+         lib/substitute.o lib/fsusage.o lib/dbwrap_util.o \
          lib/ms_fnmatch.o lib/select.o lib/errmap_unix.o \
          lib/tallocmsg.o lib/dmallocmsg.o libsmb/smb_signing.o \
          lib/md5.o lib/hmacmd5.o lib/arc4.o lib/iconv.o \
-         nsswitch/wb_client.o $(WBCOMMON_OBJ) \
+         $(WBCOMMON_OBJ) \
          lib/pam_errors.o intl/lang_tdb.o lib/conn_tdb.o \
          lib/adt_tree.o lib/gencache.o $(TDB_OBJ) \
          lib/module.o lib/events.o lib/ldap_escape.o @CHARSET_STATIC@ \
@@ -330,6 +350,14 @@ LIBADDNS_OBJ0 = libaddns/dnsrecord.o libaddns/dnsutils.o  libaddns/dnssock.o \
               libaddns/dnsgss.o libaddns/dnsmarshall.o
 LIBADDNS_OBJ = $(LIBADDNS_OBJ0) $(TALLOC_OBJ)
 
+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
 LIBGPO_OBJ = $(LIBGPO_OBJ0)
@@ -339,7 +367,7 @@ LIBADS_OBJ = libads/ldap.o libads/ldap_printer.o \
             libads/krb5_setpw.o libads/ldap_user.o \
             libads/ads_struct.o libads/kerberos_keytab.o \
              libads/disp_sec.o libads/ads_utils.o libads/ldap_utils.o \
-            libads/cldap.o libads/ldap_schema.o libads/util.o
+            libads/cldap.o libads/ldap_schema.o libads/util.o libads/ndr.o
 
 LIBADS_SERVER_OBJ = libads/kerberos_verify.o libads/authdata.o
 
@@ -360,7 +388,7 @@ LIBSMB_OBJ = libsmb/clientgen.o libsmb/cliconnect.o libsmb/clifile.o \
             libsmb/clistr.o libsmb/cliquota.o libsmb/clifsinfo.o libsmb/clidfs.o \
              libsmb/smberr.o libsmb/credentials.o libsmb/pwd_cache.o \
             libsmb/clioplock.o $(ERRORMAP_OBJ) libsmb/clirap2.o \
-            $(DOSERR_OBJ) \
+            libsmb/smb_seal.o $(DOSERR_OBJ) \
             $(RPC_PARSE_OBJ1) $(LIBSAMBA_OBJ) $(LIBNMB_OBJ)
 
 RPC_CLIENT_OBJ1 = rpc_client/cli_netlogon.o rpc_client/cli_srvsvc.o
@@ -368,7 +396,7 @@ RPC_CLIENT_OBJ1 = rpc_client/cli_netlogon.o rpc_client/cli_srvsvc.o
 LIBMSRPC_OBJ = rpc_client/cli_lsarpc.o rpc_client/cli_samr.o \
               $(RPC_CLIENT_OBJ1) rpc_client/cli_reg.o $(RPC_CLIENT_OBJ) \
               rpc_client/cli_spoolss.o rpc_client/cli_spoolss_notify.o  \
-              rpc_client/cli_ds.o rpc_client/cli_svcctl.o
+              rpc_client/cli_svcctl.o
 
 LIBMSRPC_GEN_OBJ = librpc/gen_ndr/cli_lsa.o \
                   librpc/gen_ndr/cli_dfs.o \
@@ -379,26 +407,69 @@ LIBMSRPC_GEN_OBJ = librpc/gen_ndr/cli_lsa.o \
                   librpc/gen_ndr/cli_initshutdown.o \
                   librpc/gen_ndr/cli_eventlog.o \
                   librpc/gen_ndr/cli_wkssvc.o \
+                  librpc/gen_ndr/cli_netlogon.o \
+                  librpc/gen_ndr/cli_samr.o \
+                  librpc/gen_ndr/cli_dssetup.o \
                   $(LIBNDR_GEN_OBJ) \
                   $(RPCCLIENT_NDR_OBJ)
 
+#
+# registry-related objects
+#
+UTIL_REG_OBJ = lib/util_reg.o
+UTIL_REG_API_OBJ = lib/util_reg_api.o
+REG_INIT_SMBCONF_OBJ = registry/reg_init_smbconf.o
+
+REGFIO_OBJ = registry/regfio.o
+
 REGOBJS_OBJ = registry/reg_objects.o
 
-REGISTRY_OBJ = registry/reg_frontend.o registry/reg_cachehook.o registry/reg_printing.o \
-               registry/reg_db.o registry/reg_eventlog.o registry/reg_shares.o \
-               registry/reg_util.o registry/reg_dynamic.o registry/reg_perfcount.o \
-              registry/reg_smbconf.o registry/reg_api.o \
-              registry/reg_frontend_hilvl.o \
-              $(UTIL_REG_API_OBJ) $(UTIL_REG_SMBCONF_OBJ)
+REGISTRY_BACKENDS = registry/reg_backend_printing.o \
+                   registry/reg_backend_db.o \
+                   registry/reg_backend_smbconf.o \
+                   registry/reg_backend_shares.o \
+                   registry/reg_backend_netlogon_params.o \
+                   registry/reg_backend_prod_options.o \
+                   registry/reg_backend_tcpip_params.o \
+                   registry/reg_backend_hkpt_params.o \
+                   registry/reg_backend_current_version.o \
+                   registry/reg_backend_perflib.o
+
+
+REGISTRY_OBJ = registry/reg_init_full.o registry/reg_cachehook.o \
+               registry/reg_eventlog.o \
+               registry/reg_util.o registry/reg_perfcount.o \
+              registry/reg_util_legacy.o \
+              registry/reg_api.o \
+              registry/reg_dispatcher.o \
+              $(REGISTRY_BACKENDS) \
+              $(UTIL_REG_API_OBJ) \
+              $(REG_INIT_SMBCONF_OBJ)
+
+# objects to be used when not all of the registry code should be
+# loaded but only the portion needed by reg_api, typically for
+# using smbconf (registry) - full access
+REG_API_OBJ = registry/reg_api.o \
+             registry/reg_dispatcher.o \
+             registry/reg_backend_smbconf.o \
+             registry/reg_backend_db.o \
+             registry/reg_util.o \
+             \
+             registry/reg_cachehook.o \
+             \
+             lib/util_nttoken.o \
+             $(UTIL_REG_API_OBJ) \
+             $(REG_INIT_SMBCONF_OBJ)
+
 
 RPC_LSA_OBJ = rpc_server/srv_lsa.o rpc_server/srv_lsa_nt.o librpc/gen_ndr/srv_lsa.o
 
-RPC_NETLOG_OBJ = rpc_server/srv_netlog.o rpc_server/srv_netlog_nt.o
+RPC_NETLOG_OBJ = rpc_server/srv_netlog.o rpc_server/srv_netlog_nt.o \
+                librpc/gen_ndr/srv_netlogon.o
 
 RPC_SAMR_OBJ = rpc_server/srv_samr.o rpc_server/srv_samr_nt.o \
-               rpc_server/srv_samr_util.o
-
-REGFIO_OBJ = registry/regfio.o
+               rpc_server/srv_samr_util.o \
+              librpc/gen_ndr/srv_samr.o
 
 RPC_INITSHUTDOWN_OBJ =  librpc/gen_ndr/srv_initshutdown.o rpc_server/srv_initshutdown_nt.o
 
@@ -406,7 +477,7 @@ RPC_REG_OBJ =  rpc_server/srv_winreg_nt.o \
               librpc/gen_ndr/srv_winreg.o \
               $(REGFIO_OBJ)
 
-RPC_LSA_DS_OBJ =  rpc_server/srv_lsa_ds.o rpc_server/srv_lsa_ds_nt.o
+RPC_DSSETUP_OBJ =  rpc_server/srv_dssetup_nt.o librpc/gen_ndr/srv_dssetup.o
 
 RPC_SVC_OBJ = rpc_server/srv_srvsvc.o rpc_server/srv_srvsvc_nt.o \
              librpc/gen_ndr/srv_srvsvc.o
@@ -437,7 +508,7 @@ RPC_SERVER_OBJ = @RPC_STATIC@ $(RPC_PIPE_OBJ)
 
 RPC_PARSE_OBJ = rpc_parse/parse_lsa.o $(RPC_PARSE_OBJ2) \
                 rpc_parse/parse_samr.o \
-                rpc_parse/parse_ds.o rpc_parse/parse_spoolss.o \
+                rpc_parse/parse_spoolss.o \
                rpc_parse/parse_eventlog.o rpc_parse/parse_buffer.o \
                 rpc_parse/parse_ntsvcs.o rpc_parse/parse_svcctl.o $(REGOBJS_OBJ)
 
@@ -452,7 +523,7 @@ PASSDB_OBJ = $(PASSDB_GET_SET_OBJ) passdb/passdb.o passdb/pdb_interface.o \
                passdb/util_unixsids.o passdb/lookup_sid.o \
                passdb/login_cache.o @PDB_STATIC@ \
                lib/account_pol.o lib/privileges.o lib/privileges_basic.o \
-               lib/util_nscd.o
+               lib/util_nscd.o lib/winbind_util.o
 
 DEVEL_HELP_WEIRD_OBJ = modules/weird.o
 CP850_OBJ = modules/CP850.o
@@ -484,7 +555,9 @@ VFS_READONLY_OBJ = modules/vfs_readonly.o modules/getdate.o
 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_SHADOW_COPY2_OBJ = modules/vfs_shadow_copy2.o
 VFS_AFSACL_OBJ = modules/vfs_afsacl.o
+VFS_XATTR_TDB_OBJ = modules/vfs_xattr_tdb.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
@@ -494,12 +567,15 @@ VFS_HPUXACL_OBJ = modules/vfs_hpuxacl.o
 VFS_IRIXACL_OBJ = modules/vfs_irixacl.o
 VFS_TRU64ACL_OBJ = modules/vfs_tru64acl.o
 VFS_CATIA_OBJ = modules/vfs_catia.o
+VFS_STREAMS_XATTR_OBJ = modules/vfs_streams_xattr.o
+VFS_STREAMS_DEPOT_OBJ = modules/vfs_streams_depot.o
 VFS_CACHEPRIME_OBJ = modules/vfs_cacheprime.o
 VFS_PREALLOC_OBJ = modules/vfs_prealloc.o
 VFS_COMMIT_OBJ = modules/vfs_commit.o
 VFS_GPFS_OBJ = modules/vfs_gpfs.o modules/gpfs.o modules/nfs4_acls.o
 VFS_NOTIFY_FAM_OBJ = modules/vfs_notify_fam.o
 VFS_READAHEAD_OBJ = modules/vfs_readahead.o
+VFS_TSMSM_OBJ = modules/vfs_tsmsm.o
 VFS_FILEID_OBJ = modules/vfs_fileid.o
 VFS_SYNCOPS_OBJ = modules/vfs_syncops.o
 
@@ -537,7 +613,7 @@ SMBD_OBJ_SRV = smbd/files.o smbd/chgpasswd.o smbd/connection.o \
                smbd/reply.o smbd/sesssetup.o smbd/trans2.o smbd/uid.o \
               smbd/dosmode.o smbd/filename.o smbd/open.o smbd/close.o \
               smbd/blocking.o smbd/sec_ctx.o smbd/srvstr.o \
-              smbd/vfs.o smbd/statcache.o \
+              smbd/vfs.o smbd/statcache.o smbd/seal.o \
                smbd/posix_acls.o lib/sysacls.o $(SERVER_MUTEX_OBJ) \
               smbd/process.o smbd/service.o smbd/error.o \
               printing/printfsp.o lib/sysquotas.o lib/sysquotas_linux.o \
@@ -557,8 +633,8 @@ SMBD_OBJ_BASE = $(PARAM_WITHOUT_REG_OBJ) $(SMBD_OBJ_SRV) $(LIBSMB_OBJ) \
                $(NOTIFY_OBJ) $(GROUPDB_OBJ) $(AUTH_OBJ) \
                $(LIBMSRPC_OBJ) $(LIBMSRPC_GEN_OBJ) \
                $(LIBADS_OBJ) $(KRBCLIENT_OBJ) $(LIBADS_SERVER_OBJ) \
-               $(REGISTRY_OBJ) $(POPT_LIB_OBJ) \
-               $(BUILDOPT_OBJ) $(SMBLDAP_OBJ) $(LDB_OBJ)
+               $(REGISTRY_OBJ) $(POPT_LIB_OBJ) @LIBWBCLIENT_STATIC@ \
+               $(BUILDOPT_OBJ) $(SMBLDAP_OBJ) $(LDB_OBJ) $(LIBNET_OBJ)
 
 PRINTING_OBJ = printing/pcap.o printing/print_svid.o printing/print_aix.o \
                printing/print_cups.o printing/print_generic.o \
@@ -569,6 +645,7 @@ PRINTBASE_OBJ = printing/notify.o printing/printing_db.o
 PRINTBACKEND_OBJ = printing/printing.o printing/nt_printing.o $(PRINTBASE_OBJ)
 
 SMBD_OBJ = $(SMBD_OBJ_BASE) $(SMBD_OBJ_MAIN)
+
 NMBD_OBJ1 = nmbd/asyncdns.o nmbd/nmbd.o nmbd/nmbd_become_dmb.o \
             nmbd/nmbd_become_lmb.o nmbd/nmbd_browserdb.o \
             nmbd/nmbd_browsesync.o nmbd/nmbd_elections.o \
@@ -589,7 +666,7 @@ SWAT_OBJ1 = web/cgi.o web/diagnose.o web/startstop.o web/statuspage.o \
            web/swat.o web/neg_lang.o
 
 SWAT_OBJ = $(SWAT_OBJ1) $(PARAM_OBJ) $(PRINTING_OBJ) $(LIBSMB_OBJ) \
-          $(LOCKING_OBJ) $(PASSDB_OBJ) $(SECRETS_OBJ) $(KRBCLIENT_OBJ) \
+          $(LOCKING_OBJ) $(PASSDB_OBJ) @LIBWBCLIENT_STATIC@ $(SECRETS_OBJ) $(KRBCLIENT_OBJ) \
           $(LIB_NONSMBD_OBJ) $(GROUPDB_OBJ) $(PLAINTEXT_AUTH_OBJ) \
           $(POPT_LIB_OBJ) $(SMBLDAP_OBJ) $(RPC_PARSE_OBJ) $(LIBMSRPC_GEN_OBJ) $(LIBMSRPC_OBJ) \
            $(PASSCHANGE_OBJ) $(LDB_OBJ)
@@ -610,7 +687,7 @@ SMBTREE_OBJ = utils/smbtree.o $(PARAM_OBJ) \
             $(KRBCLIENT_OBJ) $(POPT_LIB_OBJ) $(SECRETS_OBJ) \
              rpc_client/cli_pipe.o $(RPC_PARSE_OBJ2) \
              $(RPC_CLIENT_OBJ1) \
-            $(PASSDB_OBJ) $(SMBLDAP_OBJ) $(LDB_OBJ) $(GROUPDB_OBJ) \
+            $(PASSDB_OBJ) @LIBWBCLIENT_STATIC@ $(SMBLDAP_OBJ) $(LDB_OBJ) $(GROUPDB_OBJ) \
             $(LIBMSRPC_GEN_OBJ)
 
 TESTPARM_OBJ = utils/testparm.o \
@@ -620,14 +697,15 @@ TESTPARM_OBJ = utils/testparm.o \
 PASSWD_UTIL_OBJ = utils/passwd_util.o
 
 SMBPASSWD_OBJ = utils/smbpasswd.o $(PASSWD_UTIL_OBJ) $(PASSCHANGE_OBJ) \
-               $(PARAM_OBJ) $(SECRETS_OBJ) $(LIBSMB_OBJ) $(PASSDB_OBJ) \
+               $(PARAM_OBJ) $(SECRETS_OBJ) $(LIBSMB_OBJ) $(PASSDB_OBJ) @LIBWBCLIENT_STATIC@ \
                $(GROUPDB_OBJ) $(LIB_NONSMBD_OBJ) $(KRBCLIENT_OBJ) \
-               $(POPT_LIB_OBJ) $(SMBLDAP_OBJ) $(RPC_PARSE_OBJ) $(LIBMSRPC_GEN_OBJ) $(LIBMSRPC_OBJ) $(LDB_OBJ)
+               $(POPT_LIB_OBJ) $(SMBLDAP_OBJ) $(RPC_PARSE_OBJ) \
+               $(LIBMSRPC_GEN_OBJ) $(LIBMSRPC_OBJ) $(LDB_OBJ) 
 
-PDBEDIT_OBJ = utils/pdbedit.o $(PASSWD_UTIL_OBJ) $(PARAM_OBJ) $(PASSDB_OBJ) \
+PDBEDIT_OBJ = utils/pdbedit.o $(PASSWD_UTIL_OBJ) $(PARAM_OBJ) $(PASSDB_OBJ) @LIBWBCLIENT_STATIC@ \
                $(LIBSAMBA_OBJ) $(LIB_NONSMBD_OBJ) $(GROUPDB_OBJ) \
                $(SECRETS_OBJ) $(POPT_LIB_OBJ) $(SMBLDAP_OBJ) libsmb/asn1.o \
-               $(RPC_PARSE_OBJ1) $(DOSERR_OBJ) $(LDB_OBJ) $(ERRORMAP_OBJ)
+               $(RPC_PARSE_OBJ1) $(DOSERR_OBJ) $(LDB_OBJ) $(ERRORMAP_OBJ) 
 
 SMBGET_OBJ = utils/smbget.o $(POPT_LIB_OBJ) $(LIBSMBCLIENT_OBJ)
 
@@ -638,29 +716,29 @@ RPCCLIENT_OBJ1 = rpcclient/rpcclient.o rpcclient/cmd_lsarpc.o \
                 rpcclient/cmd_samr.o rpcclient/cmd_spoolss.o \
                 rpcclient/cmd_netlogon.o rpcclient/cmd_srvsvc.o \
                 rpcclient/cmd_dfs.o \
-                rpcclient/cmd_ds.o rpcclient/cmd_echo.o \
+                rpcclient/cmd_dssetup.o rpcclient/cmd_echo.o \
                 rpcclient/cmd_shutdown.o rpcclient/cmd_test.o \
                 rpcclient/cmd_wkssvc.o \
                 $(DISPLAY_SEC_OBJ) $(DISPLAY_DSDCINFO_OBJ)
 
 RPCCLIENT_OBJ = $(RPCCLIENT_OBJ1) \
              $(PARAM_OBJ) $(LIBSMB_OBJ) $(LIB_NONSMBD_OBJ) \
-             $(RPC_PARSE_OBJ) $(PASSDB_OBJ) $(LIBMSRPC_GEN_OBJ) $(LIBMSRPC_OBJ) \
+             $(RPC_PARSE_OBJ) $(PASSDB_OBJ) @LIBWBCLIENT_STATIC@ $(LIBMSRPC_GEN_OBJ) $(LIBMSRPC_OBJ) \
              $(READLINE_OBJ) $(GROUPDB_OBJ) $(KRBCLIENT_OBJ) \
             $(LIBADS_OBJ) $(SECRETS_OBJ) $(POPT_LIB_OBJ) \
-            $(SMBLDAP_OBJ) $(DCUTIL_OBJ) $(LDB_OBJ)
+            $(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 \
                   $(PARAM_OBJ) $(LIB_NONSMBD_OBJ) \
                   $(LIBSMB_OBJ) $(KRBCLIENT_OBJ) \
                   $(LIBMSRPC_OBJ) $(LIBMSRPC_GEN_OBJ) $(RPC_PARSE_OBJ) \
-                  $(SECRETS_OBJ) $(PASSDB_OBJ) $(SMBLDAP_OBJ) $(GROUPDB_OBJ) $(LDB_OBJ)
+                  $(SECRETS_OBJ) $(PASSDB_OBJ) @LIBWBCLIENT_STATIC@ $(SMBLDAP_OBJ) $(GROUPDB_OBJ) $(LDB_OBJ)
 
-LIBSMBSHAREMODES_OBJ = libsmb/smb_share_modes.o $(TDB_BASE_OBJ)
+LIBSMBSHAREMODES_OBJ = libsmb/smb_share_modes.o $(TDBBASE_OBJ)
 
 # This shared library is intended for linking with unit test programs
 # to test Samba internals.  It's called libbigballofmud.so to
@@ -669,42 +747,35 @@ LIBSMBSHAREMODES_OBJ = libsmb/smb_share_modes.o $(TDB_BASE_OBJ)
 LIBBIGBALLOFMUD_MAJOR = 0
 
 LIBBIGBALLOFMUD_OBJ = $(PARAM_OBJ) $(LIB_NONSMBD_OBJ) $(SECRETS_OBJ) \
-       $(LIBSMB_OBJ) $(LIBMSRPC_OBJ) $(LIBMSRPC_GEN_OBJ) $(RPC_PARSE_OBJ) $(PASSDB_OBJ) \
+       $(LIBSMB_OBJ) $(LIBMSRPC_OBJ) $(LIBMSRPC_GEN_OBJ) $(RPC_PARSE_OBJ) $(PASSDB_OBJ) @LIBWBCLIENT_STATIC@ \
        $(GROUPDB_OBJ) $(KRBCLIENT_OBJ) $(SMBLDAP_OBJ) $(LDB_OBJ)
 
 CLIENT_OBJ1 = client/client.o client/clitar.o rpc_client/cli_pipe.o \
+             client/dnsbrowse.o \
              $(RPC_CLIENT_OBJ1) \
              $(RPC_PARSE_OBJ2)
 
 CLIENT_OBJ = $(CLIENT_OBJ1) $(PARAM_OBJ) $(LIBSMB_OBJ) \
             $(LIB_NONSMBD_OBJ) $(KRBCLIENT_OBJ) $(LIBMSRPC_GEN_OBJ) \
              $(READLINE_OBJ) $(POPT_LIB_OBJ) $(SECRETS_OBJ) \
-             $(PASSDB_OBJ) $(SMBLDAP_OBJ) $(GROUPDB_OBJ) $(LDB_OBJ) \
-            $(DISPLAY_SEC_OBJ)
+             $(PASSDB_OBJ) @LIBWBCLIENT_STATIC@ $(SMBLDAP_OBJ) $(GROUPDB_OBJ) $(LDB_OBJ) \
+            $(DISPLAY_SEC_OBJ) 
 
-UTIL_REG_OBJ = lib/util_reg.o
-UTIL_REG_API_OBJ = lib/util_reg_api.o
-UTIL_REG_SMBCONF_OBJ = lib/util_reg_smbconf.o
+LIBNETAPI_OBJ1 = lib/netapi/netapi.o \
+                lib/netapi/joindomain.o \
+                lib/netapi/serverinfo.o \
+                lib/netapi/getdc.o
 
-# objects to be used when not all of the registry code should be
-# loaded but only the portion needed by reg_api, typically for
-# using smbconf (registry) - full access
-REG_API_OBJ = registry/reg_api.o \
-             registry/reg_frontend_hilvl.o \
-             registry/reg_smbconf.o \
-             registry/reg_db.o \
-             registry/reg_util.o \
-             \
-             registry/reg_cachehook.o \
-             registry/reg_eventlog.o \
-             registry/reg_perfcount.o \
-             registry/reg_dynamic.o \
-             \
-             lib/util_nttoken.o \
-             $(UTIL_REG_API_OBJ) \
-             $(UTIL_REG_SMBCONF_OBJ)
+LIBNETAPI_OBJ  = $(LIBNETAPI_OBJ1) $(LIBNET_OBJ) \
+                $(REG_API_OBJ) \
+                $(PARAM_WITHOUT_REG_OBJ) $(LIB_NONSMBD_OBJ) \
+                $(LIBSMB_OBJ) $(KRBCLIENT_OBJ) \
+                $(LIBMSRPC_OBJ) $(LIBMSRPC_GEN_OBJ) $(RPC_PARSE_OBJ) \
+                $(SECRETS_OBJ) $(PASSDB_OBJ) @LIBWBCLIENT_STATIC@ $(SMBLDAP_OBJ) $(GROUPDB_OBJ) $(LDB_OBJ) \
+                $(DCUTIL_OBJ) $(LIBADS_OBJ)
 
-NETAPI_OBJ = lib/netapi/joindomain.o
+LIBNET_OBJ = libnet/libnet_conf.o libnet/libnet_join.o \
+            librpc/gen_ndr/ndr_libnet_join.o
 
 NET_OBJ1 = utils/net.o utils/net_ads.o utils/net_domain.o utils/net_help.o \
           utils/net_rap.o utils/net_rpc.o utils/net_rpc_samsync.o \
@@ -715,17 +786,17 @@ NET_OBJ1 = utils/net.o utils/net_ads.o utils/net_domain.o utils/net_help.o \
           utils/netlookup.o utils/net_sam.o utils/net_rpc_shell.o \
           utils/net_util.o utils/net_rpc_sh_acct.o utils/net_rpc_audit.o \
           $(PASSWD_UTIL_OBJ) utils/net_dns.o utils/net_ads_gpo.o \
-          utils/net_conf.o auth/token_util.o utils/net_dom.o
+          utils/net_conf.o auth/token_util.o utils/net_dom.o nsswitch/wb_client.o
 
 NET_OBJ = $(NET_OBJ1) $(PARAM_WITHOUT_REG_OBJ) $(SECRETS_OBJ) $(LIBSMB_OBJ) \
-         $(RPC_PARSE_OBJ) $(PASSDB_OBJ) $(GROUPDB_OBJ) \
+         $(RPC_PARSE_OBJ) $(PASSDB_OBJ) @LIBWBCLIENT_STATIC@ $(GROUPDB_OBJ) \
          $(KRBCLIENT_OBJ) $(LIB_NONSMBD_OBJ) $(LIBADDNS_OBJ0) \
          $(LIBMSRPC_OBJ) $(LIBMSRPC_GEN_OBJ) \
          $(LIBADS_OBJ) $(LIBADS_SERVER_OBJ) $(POPT_LIB_OBJ) \
          $(SMBLDAP_OBJ) $(DCUTIL_OBJ) $(SERVER_MUTEX_OBJ) \
          $(AFS_OBJ) $(AFS_SETTOKEN_OBJ) $(REGFIO_OBJ) $(READLINE_OBJ) \
          $(LDB_OBJ) $(LIBGPO_OBJ) @BUILD_INIPARSER@ $(DISPLAY_SEC_OBJ) \
-         $(REG_API_OBJ) $(DISPLAY_DSDCINFO_OBJ) $(NETAPI_OBJ)
+         $(REG_API_OBJ) $(DISPLAY_DSDCINFO_OBJ) $(LIBNETAPI_OBJ1) $(LIBNET_OBJ)
 
 CUPS_OBJ = client/smbspool.o $(PARAM_OBJ) $(LIBSMB_OBJ) \
          $(LIB_NONSMBD_OBJ) $(KRBCLIENT_OBJ) $(SECRETS_OBJ) $(POPT_LIB_OBJ)
@@ -766,7 +837,7 @@ NSSTEST_OBJ = torture/nsstest.o $(PARAM_OBJ) $(LIBSMB_OBJ) $(KRBCLIENT_OBJ) \
                  $(LIB_NONSMBD_OBJ) $(SECRETS_OBJ)
 
 PDBTEST_OBJ = torture/pdbtest.o $(PARAM_OBJ) $(LIBSMB_OBJ) $(KRBCLIENT_OBJ) \
-               $(LIB_NONSMBD_OBJ) $(SECRETS_OBJ) $(PASSDB_OBJ) $(GROUPDB_OBJ) \
+               $(LIB_NONSMBD_OBJ) $(SECRETS_OBJ) $(PASSDB_OBJ) @LIBWBCLIENT_STATIC@ $(GROUPDB_OBJ) \
                $(SMBLDAP_OBJ) $(POPT_LIB_OBJ) $(LDB_OBJ)
 
 
@@ -780,15 +851,16 @@ LOCKTEST2_OBJ = torture/locktest2.o $(PARAM_OBJ) $(LOCKING_OBJ) $(LIBSMB_OBJ) \
                $(KRBCLIENT_OBJ) $(LIB_NONSMBD_OBJ) $(SECRETS_OBJ)
 
 SMBCACLS_OBJ = utils/smbcacls.o $(PARAM_OBJ) $(LIBSMB_OBJ) \
-                          $(KRBCLIENT_OBJ) $(LIB_NONSMBD_OBJ) $(RPC_PARSE_OBJ) \
-                          $(PASSDB_OBJ) $(GROUPDB_OBJ) $(LIBMSRPC_OBJ) $(LIBMSRPC_GEN_OBJ) $(SECRETS_OBJ) \
-                          $(POPT_LIB_OBJ) $(DCUTIL_OBJ) $(LIBADS_OBJ) $(SMBLDAP_OBJ) $(LDB_OBJ)
+               $(KRBCLIENT_OBJ) $(LIB_NONSMBD_OBJ) $(RPC_PARSE_OBJ) \
+               $(PASSDB_OBJ) @LIBWBCLIENT_STATIC@ $(GROUPDB_OBJ) $(LIBMSRPC_OBJ) $(LIBMSRPC_GEN_OBJ) \
+               $(SECRETS_OBJ) \
+               $(POPT_LIB_OBJ) $(DCUTIL_OBJ) $(LIBADS_OBJ) $(SMBLDAP_OBJ) $(LDB_OBJ)
 
 SMBCQUOTAS_OBJ = utils/smbcquotas.o $(LIBSMB_OBJ) $(KRBCLIENT_OBJ) \
                $(PARAM_OBJ) \
                $(LIB_NONSMBD_OBJ) $(RPC_PARSE_OBJ) \
                $(LIBMSRPC_OBJ) $(LIBMSRPC_GEN_OBJ) $(SECRETS_OBJ) $(POPT_LIB_OBJ) \
-               $(PASSDB_OBJ) $(SMBLDAP_OBJ) $(GROUPDB_OBJ) $(LDB_OBJ)
+               $(PASSDB_OBJ) @LIBWBCLIENT_STATIC@ $(SMBLDAP_OBJ) $(GROUPDB_OBJ) $(LDB_OBJ)
 
 EVTLOGADM_OBJ0 = utils/eventlogadm.o
 
@@ -796,7 +868,7 @@ EVTLOGADM_OBJ       = $(EVTLOGADM_OBJ0) $(PARAM_OBJ) $(LIB_NONSMBD_OBJ) $(REGOBJS_OBJ)
                $(ERRORMAP_OBJ) $(RPC_PARSE_OBJ1) $(LIBSAMBA_OBJ) $(DOSERR_OBJ) \
                $(SECRETS_OBJ) \
                registry/reg_eventlog.o rpc_server/srv_eventlog_lib.o registry/reg_util.o \
-               registry/reg_db.o
+               registry/reg_backend_db.o
 
 SHARESEC_OBJ0 = utils/sharesec.o
 SHARESEC_OBJ  = $(SHARESEC_OBJ0) $(PARAM_OBJ) $(LIB_NONSMBD_OBJ) $(REGOBJS_OBJ) \
@@ -832,7 +904,7 @@ PROTO_OBJ = $(SMBD_OBJ_MAIN) $(LIBNDR_OBJ) $(LIBNDR_GEN_OBJ) \
            $(PASSDB_OBJ) $(GROUPDB_OBJ) \
            $(READLINE_OBJ) $(PROFILE_OBJ) $(LIBADS_OBJ) $(LIBADS_SERVER_OBJ) \
            $(AUTH_SAM_OBJ) $(REGISTRY_OBJ) $(POPT_LIB_OBJ) \
-           $(RPC_LSA_OBJ) $(RPC_NETLOG_OBJ) $(RPC_SAMR_OBJ) $(RPC_REG_OBJ) $(RPC_LSA_DS_OBJ) \
+           $(RPC_LSA_OBJ) $(RPC_NETLOG_OBJ) $(RPC_SAMR_OBJ) $(RPC_REG_OBJ) $(RPC_DSSETUP_OBJ) \
            $(RPC_SVC_OBJ) $(RPC_WKS_OBJ) $(RPC_DFS_OBJ) $(RPC_SPOOLSS_OBJ) \
            $(RPC_ECHO_OBJ) $(RPC_SVCCTL_OBJ) $(RPC_EVENTLOG_OBJ) $(SMBLDAP_OBJ) \
             $(IDMAP_OBJ) libsmb/spnego.o $(PASSCHANGE_OBJ) $(RPC_UNIXINFO_OBJ) \
@@ -845,7 +917,7 @@ WINBIND_WINS_NSS_OBJ = nsswitch/wins.o $(PARAM_OBJ) \
 
 PAM_SMBPASS_OBJ_0 = pam_smbpass/pam_smb_auth.o pam_smbpass/pam_smb_passwd.o \
                pam_smbpass/pam_smb_acct.o pam_smbpass/support.o
-PAM_SMBPASS_OBJ = $(PAM_SMBPASS_OBJ_0) $(PARAM_OBJ) $(LIB_NONSMBD_OBJ) $(PASSDB_OBJ) $(GROUPDB_OBJ) \
+PAM_SMBPASS_OBJ = $(PAM_SMBPASS_OBJ_0) $(PARAM_OBJ) $(LIB_NONSMBD_OBJ) $(PASSDB_OBJ) @LIBWBCLIENT_STATIC@ $(GROUPDB_OBJ) \
                $(SECRETS_OBJ) $(SMBLDAP_OBJ) $(LIBSAMBA_OBJ) \
                $(RPC_PARSE_OBJ1) $(DOSERR_OBJ) $(LDB_OBJ) $(ERRORMAP_OBJ)
 
@@ -876,22 +948,24 @@ WINBINDD_OBJ1 = \
                winbindd/winbindd_domain.o \
                winbindd/winbindd_idmap.o \
                winbindd/winbindd_locator.o \
+               winbindd/winbindd_ndr.o \
                auth/token_util.o
 
 WINBINDD_OBJ = \
-               $(WINBINDD_OBJ1) $(PASSDB_OBJ) $(GROUPDB_OBJ) \
+               $(WINBINDD_OBJ1) $(PASSDB_OBJ) @LIBWBCLIENT_STATIC@ $(GROUPDB_OBJ) \
                $(PARAM_OBJ) $(LIB_NONSMBD_OBJ) \
                $(LIBSMB_OBJ) $(LIBMSRPC_OBJ) $(LIBMSRPC_GEN_OBJ) $(RPC_PARSE_OBJ) \
                $(PROFILE_OBJ) $(SLCACHE_OBJ) $(SMBLDAP_OBJ) \
                $(SECRETS_OBJ) $(LIBADS_OBJ) $(KRBCLIENT_OBJ) $(POPT_LIB_OBJ) \
                $(DCUTIL_OBJ) $(IDMAP_OBJ) $(NSS_INFO_OBJ) \
                $(AFS_OBJ) $(AFS_SETTOKEN_OBJ) \
-               $(LIBADS_SERVER_OBJ) $(SERVER_MUTEX_OBJ) $(LDB_OBJ)
+               $(LIBADS_SERVER_OBJ) $(SERVER_MUTEX_OBJ) $(LDB_OBJ) 
 
 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)
+               $(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 \
@@ -913,13 +987,13 @@ LDB_LDAP_OBJ=@LDBLDAP@
 LDB_OBJ = ${LDB_COMMON_OBJ} ${LDB_TDB_OBJ} ${LDB_LDAP_OBJ} ${LDB_MODULES_OBJ}
 
 LDB_CMDLINE_OBJ = $(PARAM_OBJ) $(SECRETS_OBJ) $(LIBSMB_OBJ) \
-         $(RPC_PARSE_OBJ) $(PASSDB_OBJ) $(GROUPDB_OBJ) \
+         $(RPC_PARSE_OBJ) $(PASSDB_OBJ) @LIBWBCLIENT_STATIC@ $(GROUPDB_OBJ) \
          $(KRBCLIENT_OBJ) $(LIB_NONSMBD_OBJ) $(LIBADDNS_OBJ0) \
          $(LIBMSRPC_OBJ) $(LIBMSRPC_GEN_OBJ) \
          $(LIBADS_OBJ) $(LIBADS_SERVER_OBJ) $(POPT_LIB_OBJ) \
          $(SMBLDAP_OBJ) $(DCUTIL_OBJ) $(SERVER_MUTEX_OBJ) \
          $(AFS_OBJ) $(AFS_SETTOKEN_OBJ) $(REGFIO_OBJ) $(READLINE_OBJ) \
-         $(LDB_OBJ) lib/ldb/tools/cmdline.o
+         $(LDB_OBJ) lib/ldb/tools/cmdline.o 
 
 
 LDBEDIT_OBJ = $(LDB_CMDLINE_OBJ) lib/ldb/tools/ldbedit.o
@@ -929,7 +1003,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
@@ -955,16 +1029,16 @@ NTLM_AUTH_OBJ1 = utils/ntlm_auth.o utils/ntlm_auth_diagnostics.o
 NTLM_AUTH_OBJ = ${NTLM_AUTH_OBJ1} $(LIBSAMBA_OBJ) $(POPT_LIB_OBJ) \
                libsmb/asn1.o libsmb/spnego.o libsmb/clikrb5.o libads/kerberos.o \
                libads/kerberos_verify.o $(SECRETS_OBJ) $(SERVER_MUTEX_OBJ) \
-               libads/authdata.o $(RPC_PARSE_OBJ1) $(PASSDB_OBJ) $(GROUPDB_OBJ) \
+               libads/authdata.o $(RPC_PARSE_OBJ1) $(PASSDB_OBJ) @LIBWBCLIENT_STATIC@ $(GROUPDB_OBJ) \
                $(SMBLDAP_OBJ) $(DOSERR_OBJ) rpc_parse/parse_net.o $(LIBNMB_OBJ) \
-               $(LDB_OBJ) $(ERRORMAP_OBJ)
+               $(LDB_OBJ) $(ERRORMAP_OBJ) 
 
 VLP_OBJ1 = ../testsuite/printing/vlp.o $(RPC_CLIENT_OBJ1) $(RPC_PARSE_OBJ2) $(RPC_CLIENT_OBJ)
 
 VLP_OBJ = $(VLP_OBJ1) $(PARAM_OBJ) $(LIBSMB_OBJ) \
          $(LIB_NONSMBD_OBJ) $(KRBCLIENT_OBJ) $(LIBMSRPC_GEN_OBJ) \
          $(READLINE_OBJ) $(POPT_LIB_OBJ) $(SECRETS_OBJ) \
-         $(PASSDB_OBJ) $(SMBLDAP_OBJ) $(GROUPDB_OBJ) $(LDB_OBJ) \
+         $(PASSDB_OBJ) @LIBWBCLIENT_STATIC@ $(SMBLDAP_OBJ) $(GROUPDB_OBJ) $(LDB_OBJ) \
          $(DISPLAY_SEC_OBJ)
 
 ######################################################################
@@ -1012,8 +1086,8 @@ replacetort : SHOWFLAGS bin/replacetort@EXEEXT@
 timelimit : SHOWFLAGS bin/timelimit@EXEEXT@
 
 nsswitch : SHOWFLAGS bin/winbindd@EXEEXT@ bin/wbinfo@EXEEXT@ @WINBIND_NSS@ \
-       @WINBIND_WINS_NSS@ bin/pam_winbind.@SHLIBEXT@ bin/smbcontrol@EXEEXT@ \
-       @WINBIND_KRB5_LOCATOR@
+       @WINBIND_WINS_NSS@ @WINBIND_KRB5_LOCATOR@ \
+       bin/pam_winbind.@SHLIBEXT@ bin/smbcontrol@EXEEXT@
 
 wins : SHOWFLAGS @WINBIND_WINS_NSS@
 
@@ -1023,7 +1097,8 @@ 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 misc.idl samr.idl security.idl \
+       dssetup.idl
 
 idl:
        @IDL_FILES="$(IDL_FILES)" CPP="$(CPP)" PERL="$(PERL)" \
@@ -1033,7 +1108,7 @@ idl:
 #####################################################################
 
 
-everything: all libsmbclient debug2html smbfilter talloctort replacetort modules torture \
+everything: all libsmbclient libnetapi debug2html smbfilter talloctort replacetort modules torture \
        $(EVERYTHING_PROGS)
 
 .SUFFIXES:
@@ -1136,34 +1211,41 @@ bin/.dummy:
          dir=bin $(MAKEDIR); fi
        @: >> $@ || : > $@ # what a fancy emoticon!
 
-bin/smbd@EXEEXT@: $(BINARY_PREREQS) $(SMBD_OBJ) @BUILD_POPT@
+bin/smbd@EXEEXT@: $(BINARY_PREREQS) $(SMBD_OBJ) @LIBWBCLIENT_SHARED@ @BUILD_POPT@
        @echo Linking $@
        @$(CC) $(FLAGS) -o $@ $(SMBD_OBJ) $(LDFLAGS) $(LDAP_LIBS) \
                $(KRB5LIBS) $(DYNEXP) $(PRINT_LIBS) $(AUTH_LIBS) \
-               $(ACL_LIBS) $(PASSDB_LIBS) $(LIBS) @POPTLIBS@ @SMBD_LIBS@
+               $(ACL_LIBS) $(PASSDB_LIBS) $(LIBS) $(DNSSD_LIBS) \
+               @POPTLIBS@ @SMBD_LIBS@ @WINBIND_LIBS@
 
 bin/nmbd@EXEEXT@: $(BINARY_PREREQS) $(NMBD_OBJ) @BUILD_POPT@
        @echo Linking $@
-       @$(CC) $(FLAGS) -o $@ $(NMBD_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) @POPTLIBS@ $(KRB5LIBS) $(LDAP_LIBS)
+       @$(CC) $(FLAGS) -o $@ $(NMBD_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) \
+               @POPTLIBS@ $(KRB5LIBS) $(LDAP_LIBS)
 
-bin/swat@EXEEXT@: $(BINARY_PREREQS) $(SWAT_OBJ) @BUILD_POPT@
+bin/swat@EXEEXT@: $(BINARY_PREREQS) $(SWAT_OBJ) @BUILD_POPT@ @LIBWBCLIENT_SHARED@ 
        @echo Linking $@
        @$(CC) $(FLAGS) -o $@ $(SWAT_OBJ) $(LDFLAGS) $(DYNEXP) $(PRINT_LIBS) \
-         $(AUTH_LIBS) $(LIBS) $(PASSDB_LIBS) @POPTLIBS@ $(KRB5LIBS) $(LDAP_LIBS)
+         $(AUTH_LIBS) $(LIBS) $(PASSDB_LIBS) @POPTLIBS@ $(KRB5LIBS) \
+         $(LDAP_LIBS) @WINBIND_LIBS@
 
-bin/rpcclient@EXEEXT@: $(BINARY_PREREQS) $(RPCCLIENT_OBJ) @BUILD_POPT@
+bin/rpcclient@EXEEXT@: $(BINARY_PREREQS) $(RPCCLIENT_OBJ) @BUILD_POPT@ @LIBWBCLIENT_SHARED@
        @echo Linking $@
        @$(CC) $(FLAGS) -o $@ $(LDFLAGS) $(PASSDB_LIBS) $(RPCCLIENT_OBJ) \
                $(DYNEXP) $(TERMLDFLAGS) $(TERMLIBS) $(LIBS) @POPTLIBS@ \
-               $(KRB5LIBS) $(LDAP_LIBS)
+               $(KRB5LIBS) $(LDAP_LIBS) @WINBIND_LIBS@
 
-bin/smbclient@EXEEXT@: $(BINARY_PREREQS) $(CLIENT_OBJ) @BUILD_POPT@
+bin/smbclient@EXEEXT@: $(BINARY_PREREQS) $(CLIENT_OBJ) @BUILD_POPT@ @LIBWBCLIENT_SHARED@
        @echo Linking $@
-       @$(CC) $(FLAGS) -o $@ $(CLIENT_OBJ) $(LDFLAGS) $(DYNEXP) $(TERMLDFLAGS) $(TERMLIBS) $(LIBS) @POPTLIBS@ $(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS)
+       @$(CC) $(FLAGS) -o $@ $(CLIENT_OBJ) $(LDFLAGS) $(DYNEXP) \
+               $(TERMLDFLAGS) $(TERMLIBS) $(LIBS) @POPTLIBS@ \
+               $(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS) $(DNSSD_LIBS) @WINBIND_LIBS@
 
-bin/net@EXEEXT@: $(BINARY_PREREQS) $(NET_OBJ) @BUILD_POPT@
+bin/net@EXEEXT@: $(BINARY_PREREQS) $(NET_OBJ) @BUILD_POPT@ @LIBWBCLIENT_SHARED@
        @echo Linking $@
-       @$(CC) $(FLAGS) -o $@ $(NET_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS) @POPTLIBS@ $(KRB5LIBS) $(UUID_LIBS) $(LDAP_LIBS) $(PASSDB_LIBS) $(TERMLDFLAGS) $(TERMLIBS) $(NSCD_LIBS) @INIPARSERLIBS@
+       @$(CC) $(FLAGS) -o $@ $(NET_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS) \
+               @POPTLIBS@ $(KRB5LIBS) $(UUID_LIBS) $(LDAP_LIBS) \
+               $(PASSDB_LIBS) $(TERMLDFLAGS) $(TERMLIBS) $(NSCD_LIBS) @INIPARSERLIBS@ @WINBIND_LIBS@
 
 bin/profiles@EXEEXT@: $(BINARY_PREREQS) $(PROFILES_OBJ) @BUILD_POPT@
        @echo Linking $@
@@ -1196,7 +1278,7 @@ bin/umount.cifs@EXEEXT@: $(BINARY_PREREQS) $(CIFS_UMOUNT_OBJ) @BUILD_POPT@
 bin/cifs.spnego@EXEEXT@: $(BINARY_PREREQS) $(CIFS_SPNEGO_OBJ) $(LIBSMBCLIENT_OBJ) @BUILD_POPT@
        @echo Linking $@
        @$(CC) $(FLAGS) -o $@ $(CIFS_SPNEGO_OBJ) $(DYNEXP) $(LDFLAGS) -lkeyutils $(LIBS) \
-               $(LIBSMBCLIENT_OBJ) $(KRB5LIBS) $(LDAP_LIBS) @POPTLIBS@
+               $(LIBSMBCLIENT_OBJ) $(KRB5LIBS) $(LDAP_LIBS) @POPTLIBS@ @LIBWBCLIENT_SHARED@
 
 bin/testparm@EXEEXT@: $(BINARY_PREREQS) $(TESTPARM_OBJ) @BUILD_POPT@
        @echo Linking $@
@@ -1213,22 +1295,25 @@ bin/smbcontrol@EXEEXT@: $(BINARY_PREREQS) $(SMBCONTROL_OBJ) @BUILD_POPT@
        $(SMBCONTROL_OBJ) $(DYNEXP) $(LDFLAGS) \
        $(LIBS) $(LDAP_LIBS) @LIBUNWIND_PTRACE@ @POPTLIBS@
 
-bin/smbtree@EXEEXT@: $(BINARY_PREREQS) $(SMBTREE_OBJ) @BUILD_POPT@
+bin/smbtree@EXEEXT@: $(BINARY_PREREQS) $(SMBTREE_OBJ) @BUILD_POPT@ @LIBWBCLIENT_SHARED@
        @echo Linking $@
-       @$(CC) $(FLAGS) -o $@ $(SMBTREE_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) @POPTLIBS@ $(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS)
+       @$(CC) $(FLAGS) -o $@ $(SMBTREE_OBJ) $(LDFLAGS) $(DYNEXP) \
+               $(LIBS) @POPTLIBS@ $(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS) @WINBIND_LIBS@
 
-bin/smbpasswd@EXEEXT@: $(BINARY_PREREQS) $(SMBPASSWD_OBJ) @BUILD_POPT@
+bin/smbpasswd@EXEEXT@: $(BINARY_PREREQS) $(SMBPASSWD_OBJ) @BUILD_POPT@ @LIBWBCLIENT_SHARED@
        @echo Linking $@
        @$(CC) $(FLAGS) -o $@ $(SMBPASSWD_OBJ) $(LDFLAGS) $(PASSDB_LIBS) \
-               $(DYNEXP) $(LIBS) @POPTLIBS@ $(KRB5LIBS) $(LDAP_LIBS)
+               $(DYNEXP) $(LIBS) @POPTLIBS@ $(KRB5LIBS) $(LDAP_LIBS) @WINBIND_LIBS@
 
-bin/pdbedit@EXEEXT@: $(BINARY_PREREQS) $(PDBEDIT_OBJ) @BUILD_POPT@
+bin/pdbedit@EXEEXT@: $(BINARY_PREREQS) $(PDBEDIT_OBJ) @BUILD_POPT@ @LIBWBCLIENT_SHARED@
        @echo Linking $@
-       @$(CC) $(FLAGS) -o $@ $(PDBEDIT_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) @POPTLIBS@ $(PASSDB_LIBS) $(LDAP_LIBS)
+       @$(CC) $(FLAGS) -o $@ $(PDBEDIT_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) \
+               @POPTLIBS@ $(PASSDB_LIBS) $(LDAP_LIBS) @WINBIND_LIBS@
 
-bin/smbget@EXEEXT@: $(BINARY_PREREQS) $(SMBGET_OBJ) @BUILD_POPT@
+bin/smbget@EXEEXT@: $(BINARY_PREREQS) $(SMBGET_OBJ) @BUILD_POPT@ @LIBWBCLIENT_SHARED@
        @echo Linking $@
-       @$(CC) $(FLAGS) -o $@ $(SMBGET_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) @POPTLIBS@  $(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS)
+       @$(CC) $(FLAGS) -o $@ $(SMBGET_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) \
+               @POPTLIBS@  $(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS) @WINBIND_LIBS@
 
 bin/samtest@EXEEXT@: $(SAMTEST_OBJ) @BUILD_POPT@
        @echo Linking $@
@@ -1260,15 +1345,15 @@ bin/msgtest@EXEEXT@: $(BINARY_PREREQS) $(MSGTEST_OBJ) @BUILD_POPT@
        @echo Linking $@
        @$(CC) $(FLAGS) -o $@ $(MSGTEST_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) $(KRB5LIBS) $(LDAP_LIBS) @POPTLIBS@
 
-bin/smbcacls@EXEEXT@: $(BINARY_PREREQS) $(SMBCACLS_OBJ) @BUILD_POPT@
+bin/smbcacls@EXEEXT@: $(BINARY_PREREQS) $(SMBCACLS_OBJ) @BUILD_POPT@ @LIBWBCLIENT_SHARED@
        @echo Linking $@
        @$(CC) $(FLAGS) -o $@ $(SMBCACLS_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS) @POPTLIBS@ \
-       $(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS)
+       $(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS) @WINBIND_LIBS@
 
-bin/smbcquotas@EXEEXT@: $(BINARY_PREREQS) $(SMBCQUOTAS_OBJ) @BUILD_POPT@
+bin/smbcquotas@EXEEXT@: $(BINARY_PREREQS) $(SMBCQUOTAS_OBJ) @BUILD_POPT@ @LIBWBCLIENT_SHARED@
        @echo Linking $@
        @$(CC) $(FLAGS) -o $@ $(SMBCQUOTAS_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS) @POPTLIBS@ \
-       $(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS)
+       $(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS) @WINBIND_LIBS@
 
 bin/eventlogadm@EXEEXT@: $(BINARY_PREREQS) $(EVTLOGADM_OBJ) @BUILD_POPT@
        @echo Linking $@
@@ -1288,11 +1373,11 @@ bin/nsstest@EXEEXT@: $(BINARY_PREREQS) $(NSSTEST_OBJ) @BUILD_POPT@
 
 bin/pdbtest@EXEEXT@: $(BINARY_PREREQS) $(PDBTEST_OBJ) @BUILD_POPT@
        @echo Linking $@
-       @$(CC) $(FLAGS) -o $@ $(PDBTEST_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) $(KRB5LIBS) $(LDAP_LIBS) $(PASSDB_LIBS) $(LIBS) @POPTLIBS@
+       @$(CC) $(FLAGS) -o $@ $(PDBTEST_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) $(KRB5LIBS) $(LDAP_LIBS) $(PASSDB_LIBS) $(LIBS) @POPTLIBS@ @LIBWBCLIENT_SHARED@
 
 bin/vfstest@EXEEXT@: $(BINARY_PREREQS) $(VFSTEST_OBJ) @BUILD_POPT@
        @echo Linking $@
-       @$(CC) $(FLAGS) -o $@ $(VFSTEST_OBJ) $(LDFLAGS) $(TERMLDFLAGS) $(TERMLIBS) $(DYNEXP) $(PRINT_LIBS) $(AUTH_LIBS) $(ACL_LIBS) $(LIBS) @POPTLIBS@ $(KRB5LIBS) $(LDAP_LIBS) @SMBD_LIBS@ $(NSCD_LIBS)
+       @$(CC) $(FLAGS) -o $@ $(VFSTEST_OBJ) $(LDFLAGS) $(TERMLDFLAGS) $(TERMLIBS) $(DYNEXP) $(PRINT_LIBS) $(AUTH_LIBS) $(ACL_LIBS) $(LIBS) @POPTLIBS@ $(KRB5LIBS) $(LDAP_LIBS) @SMBD_LIBS@ $(NSCD_LIBS) @LIBWBCLIENT_SHARED@
 
 bin/smbiconv@EXEEXT@: $(BINARY_PREREQS) $(SMBICONV_OBJ) @BUILD_POPT@
        @echo Linking $@
@@ -1319,25 +1404,45 @@ bin/smbfilter@EXEEXT@: $(BINARY_PREREQS) $(SMBFILTER_OBJ) @BUILD_POPT@
        @echo Linking $@
        @$(CC) $(FLAGS) -o $@ $(SMBFILTER_OBJ) $(LDFLAGS) $(LIBS) $(KRB5LIBS) $(LDAP_LIBS) @POPTLIBS@
 
-bin/ldbedit: $(BINARY_PREREQS) $(LDBEDIT_OBJ) @BUILD_POPT@
+bin/ldbedit: $(BINARY_PREREQS) $(LDBEDIT_OBJ) @BUILD_POPT@ @LIBWBCLIENT_SHARED@
        @echo Linking $@
-       @$(CC) $(FLAGS) -o $@ $(LDBEDIT_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS) @POPTLIBS@ $(KRB5LIBS) $(UUID_LIBS) $(LDAP_LIBS) $(PASSDB_LIBS) $(TERMLDFLAGS) $(TERMLIBS) $(NSCD_LIBS)
+       @$(CC) $(FLAGS) -o $@ $(LDBEDIT_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS) \
+               @POPTLIBS@ $(KRB5LIBS) $(UUID_LIBS) $(LDAP_LIBS) $(PASSDB_LIBS) \
+               $(TERMLDFLAGS) $(TERMLIBS) $(NSCD_LIBS) @WINBIND_LIBS@
 
-bin/ldbsearch: $(BINARY_PREREQS) $(LDBSEARCH_OBJ) @BUILD_POPT@
+bin/ldbsearch: $(BINARY_PREREQS) $(LDBSEARCH_OBJ) @BUILD_POPT@ @LIBWBCLIENT_SHARED@
        @echo Linking $@
-       @$(CC) $(FLAGS) -o $@ $(LDBSEARCH_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS) @POPTLIBS@ $(KRB5LIBS) $(UUID_LIBS) $(LDAP_LIBS) $(PASSDB_LIBS) $(TERMLDFLAGS) $(TERMLIBS) $(NSCD_LIBS)
+       @$(CC) $(FLAGS) -o $@ $(LDBSEARCH_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS) \
+               @POPTLIBS@ $(KRB5LIBS) $(UUID_LIBS) $(LDAP_LIBS) $(PASSDB_LIBS) \
+               $(TERMLDFLAGS) $(TERMLIBS) $(NSCD_LIBS) @WINBIND_LIBS@
 
-bin/ldbadd: $(BINARY_PREREQS) $(LDBADD_OBJ) @BUILD_POPT@
+bin/ldbadd: $(BINARY_PREREQS) $(LDBADD_OBJ) @BUILD_POPT@ @LIBWBCLIENT_SHARED@
        @echo Linking $@
-       @$(CC) $(FLAGS) -o $@ $(LDBADD_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS) @POPTLIBS@ $(KRB5LIBS) $(UUID_LIBS) $(LDAP_LIBS) $(PASSDB_LIBS) $(TERMLDFLAGS) $(TERMLIBS) $(NSCD_LIBS)
+       @$(CC) $(FLAGS) -o $@ $(LDBADD_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS) \
+               @POPTLIBS@ $(KRB5LIBS) $(UUID_LIBS) $(LDAP_LIBS) $(PASSDB_LIBS) \
+               $(TERMLDFLAGS) $(TERMLIBS) $(NSCD_LIBS) @WINBIND_LIBS@
 
-bin/ldbmodify: $(BINARY_PREREQS) $(LDBMODIFY_OBJ) @BUILD_POPT@
+bin/ldbmodify: $(BINARY_PREREQS) $(LDBMODIFY_OBJ) @BUILD_POPT@ @LIBWBCLIENT_SHARED@
        @echo Linking $@
-       @$(CC) $(FLAGS) -o $@ $(LDBMODIFY_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS) @POPTLIBS@ $(KRB5LIBS) $(UUID_LIBS) $(LDAP_LIBS) $(PASSDB_LIBS) $(TERMLDFLAGS) $(TERMLIBS) $(NSCD_LIBS)
+       @$(CC) $(FLAGS) -o $@ $(LDBMODIFY_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS) \
+               @POPTLIBS@ $(KRB5LIBS) $(UUID_LIBS) $(LDAP_LIBS) $(PASSDB_LIBS) \
+               $(TERMLDFLAGS) $(TERMLIBS) $(NSCD_LIBS) @WINBIND_LIBS@
 
-bin/ldbdel: $(BINARY_PREREQS) $(LDBDEL_OBJ) @BUILD_POPT@
+bin/ldbdel: $(BINARY_PREREQS) $(LDBDEL_OBJ) @BUILD_POPT@ @LIBWBCLIENT_SHARED@
        @echo Linking $@
-       @$(CC) $(FLAGS) -o $@ $(LDBDEL_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS) @POPTLIBS@ $(KRB5LIBS) $(UUID_LIBS) $(LDAP_LIBS) $(PASSDB_LIBS) $(TERMLDFLAGS) $(TERMLIBS) $(NSCD_LIBS)
+       @$(CC) $(FLAGS) -o $@ $(LDBDEL_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS) \
+               @POPTLIBS@ $(KRB5LIBS) $(UUID_LIBS) $(LDAP_LIBS) $(PASSDB_LIBS) \
+               $(TERMLDFLAGS) $(TERMLIBS) $(NSCD_LIBS) @WINBIND_LIBS@
+
+bin/libwbclient.@SHLIBEXT@: $(BINARY_PREREQS) $(LIBWBCLIENT_OBJ)
+       @echo Linking shared library $@
+       @$(SHLD_DSO) $(LIBWBCLIENT_OBJ) \
+               @SONAMEFLAG@`basename $@`.$(SONAME_VER)
+       @ln -s -f `basename $@` $@.$(SONAME_VER)
+
+bin/libwbclient.a: $(BINARY_PREREQS) $(LIBWBCLIENT_OBJ0)
+       @echo Linking non-shared library $@
+       @-$(AR) -rc $@ $(LIBWBCLIENT_OBJ0)
 
 bin/libaddns.@SHLIBEXT@: $(BINARY_PREREQS) $(LIBADDNS_OBJ)
        @echo Linking shared library $@
@@ -1349,9 +1454,19 @@ bin/libaddns.a: $(BINARY_PREREQS) $(LIBADDNS_OBJ)
        @echo Linking non-shared library $@
        @-$(AR) -rc $@ $(LIBADDNS_OBJ)
 
+bin/libnetapi.@SHLIBEXT@: $(BINARY_PREREQS) $(LIBNETAPI_OBJ)
+       @echo Linking shared library $@
+       @$(SHLD_DSO) $(LIBNETAPI_OBJ) @LIBWBCLIENT_SHARED@ $(LIBS) \
+               $(LDAP_LIBS) $(KRB5LIBS) $(NSCD_LIBS) \
+               @SONAMEFLAG@`basename $@`.$(SONAME_VER)
+
+bin/libnetapi.a: $(BINARY_PREREQS) $(LIBNETAPI_OBJ)
+       @echo Linking non-shared library $@
+       @-$(AR) -rc $@ $(LIBNETAPI_OBJ)
+
 bin/libsmbclient.@SHLIBEXT@: $(BINARY_PREREQS) $(LIBSMBCLIENT_OBJ)
        @echo Linking shared library $@
-       @$(SHLD_DSO) $(LIBSMBCLIENT_OBJ) $(LIBS) \
+       @$(SHLD_DSO) $(LIBSMBCLIENT_OBJ) @LIBWBCLIENT_SHARED@ $(LIBS) \
                $(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS) \
                @SONAMEFLAG@`basename $@`.$(SONAME_VER)
 
@@ -1385,6 +1500,8 @@ bin/libbigballofmud.@SHLIBEXT@: $(BINARY_PREREQS) $(LIBBIGBALLOFMUD_OBJ)
 libsmbclient: $(LIBSMBCLIENT)
 libsmbsharemodes: $(LIBSMBSHAREMODES)
 libaddns: $(LIBADDNS)
+libwbclient: $(LIBWBCLIENT)
+libnetapi: $(LIBNETAPI)
 
 # Linker command to link a RPC, VFS, AUTH, CHARSET or PASSDB module.
 SHLD_MODULE = $(SHLD) $(LDSHFLAGS) $(MODULE_EXPORTS) \
@@ -1430,9 +1547,9 @@ bin/librpc_initshutdown.@SHLIBEXT@: $(BINARY_PREREQS) $(RPC_INITSHUTDOWN_OBJ)
        @echo "Linking $@"
        @$(SHLD_MODULE) $(RPC_INITSHUTDOWN_OBJ)
 
-bin/librpc_lsa_ds.@SHLIBEXT@: $(BINARY_PREREQS) $(RPC_LSA_DS_OBJ)
+bin/librpc_dssetup.@SHLIBEXT@: $(BINARY_PREREQS) $(RPC_DSSETUP_OBJ)
        @echo "Linking $@"
-       @$(SHLD_MODULE) $(RPC_LSA_DS_OBJ)
+       @$(SHLD_MODULE) $(RPC_DSSETUP_OBJ)
 
 bin/librpc_spoolss.@SHLIBEXT@: $(BINARY_PREREQS) $(RPC_SPOOLSS_OBJ)
        @echo "Linking $@"
@@ -1450,15 +1567,16 @@ bin/librpc_echo.@SHLIBEXT@: $(BINARY_PREREQS) $(RPC_ECHO_OBJ)
        @echo "Linking $@"
        @$(SHLD_MODULE) $(RPC_ECHO_OBJ)
 
-bin/winbindd@EXEEXT@: $(BINARY_PREREQS) $(WINBINDD_OBJ) @BUILD_POPT@
+bin/winbindd@EXEEXT@: $(BINARY_PREREQS) $(WINBINDD_OBJ) @BUILD_POPT@ @LIBWBCLIENT_SHARED@
        @echo "Linking $@"
        @$(CC) $(FLAGS) -o $@ $(WINBINDD_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) \
-               @POPTLIBS@ $(KRB5LIBS) $(LDAP_LIBS) $(PASSDB_LIBS)
+               @POPTLIBS@ $(KRB5LIBS) $(LDAP_LIBS) \
+               $(PASSDB_LIBS) @WINBIND_LIBS@
 
-bin/vlp@EXEEXT@: $(BINARY_PREREQS) $(VLP_OBJ)
+bin/vlp@EXEEXT@: $(BINARY_PREREQS) $(VLP_OBJ) @LIBWBCLIENT_SHARED@
        @echo "Linking $@"
        @$(CC) $(FLAGS) -o $@ $(VLP_OBJ) $(LDFLAGS) $(DYNEXP) $(TERMLDFLAGS) $(TERMLIBS) $(LIBS) @POPTLIBS@ \
-               $(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS)
+               $(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS) @LIBWBCLIENT_SHARED@
 
 @WINBIND_NSS@: $(BINARY_PREREQS) $(WINBIND_NSS_OBJ)
        @echo "Linking $@"
@@ -1529,6 +1647,10 @@ bin/ad.@SHLIBEXT@: $(BINARY_PREREQS) winbindd/idmap_ad.o
        @echo "Building plugin $@"
        @$(SHLD_MODULE) winbindd/idmap_ad.o
 
+bin/tdb2.@SHLIBEXT@: $(BINARY_PREREQS) winbindd/idmap_tdb2.o
+       @echo "Building plugin $@"
+       @$(SHLD_MODULE) winbindd/idmap_tdb2.o
+
 bin/ldap.@SHLIBEXT@: $(BINARY_PREREQS) winbindd/idmap_ldap.o
        @echo "Building plugin $@"
        @$(SHLD_MODULE) winbindd/idmap_ldap.o
@@ -1588,6 +1710,10 @@ bin/shadow_copy.@SHLIBEXT@: $(BINARY_PREREQS) $(VFS_SHADOW_COPY_OBJ)
        @echo "Building plugin $@"
        @$(SHLD_MODULE) $(VFS_SHADOW_COPY_OBJ)
 
+bin/shadow_copy2.@SHLIBEXT@: $(BINARY_PREREQS) $(VFS_SHADOW_COPY2_OBJ)
+       @echo "Building plugin $@"
+       @$(SHLD_MODULE) $(VFS_SHADOW_COPY2_OBJ)
+
 bin/syncops.@SHLIBEXT@: $(BINARY_PREREQS) $(VFS_SYNCOPS_OBJ)
        @echo "Building plugin $@"
        @$(SHLD_MODULE) $(VFS_SYNCOPS_OBJ)
@@ -1604,6 +1730,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)
@@ -1640,6 +1770,14 @@ bin/catia.@SHLIBEXT@: $(BINARY_PREREQS) $(VFS_CATIA_OBJ)
        @echo "Building plugin $@"
        @$(SHLD_MODULE) $(VFS_CATIA_OBJ)
 
+bin/streams_xattr.@SHLIBEXT@: $(BINARY_PREREQS) $(VFS_STREAMS_XATTR_OBJ)
+       @echo "Building plugin $@"
+       @$(SHLD_MODULE) $(VFS_STREAMS_XATTR_OBJ)
+
+bin/streams_depot.@SHLIBEXT@: $(BINARY_PREREQS) $(VFS_STREAMS_DEPOT_OBJ)
+       @echo "Building plugin $@"
+       @$(SHLD_MODULE) $(VFS_STREAMS_DEPOT_OBJ)
+
 bin/cacheprime.@SHLIBEXT@: $(BINARY_PREREQS) $(VFS_CACHEPRIME_OBJ)
        @echo "Building plugin $@"
        @$(SHLD_MODULE) $(VFS_CACHEPRIME_OBJ)
@@ -1664,6 +1802,10 @@ bin/readahead.@SHLIBEXT@: $(BINARY_PREREQS) $(VFS_READAHEAD_OBJ)
        @echo "Building plugin $@"
        @$(SHLD_MODULE) $(VFS_READAHEAD_OBJ)
 
+bin/tsmsm.@SHLIBEXT@: $(BINARY_PREREQS) $(VFS_TSMSM_OBJ)
+       @echo "Building plugin $@"
+       @$(SHLD_MODULE) $(VFS_TSMSM_OBJ)
+
 bin/fileid.@SHLIBEXT@: $(BINARY_PREREQS) $(VFS_FILEID_OBJ)
        @echo "Building plugin $@"
        @$(SHLD_MODULE) $(VFS_FILEID_OBJ)
@@ -1674,16 +1816,17 @@ bin/fileid.@SHLIBEXT@: $(BINARY_PREREQS) $(VFS_FILEID_OBJ)
 ## None here right now
 #########################################################
 
-bin/wbinfo@EXEEXT@: $(BINARY_PREREQS) $(WBINFO_OBJ) @BUILD_POPT@
+bin/wbinfo@EXEEXT@: $(BINARY_PREREQS) $(WBINFO_OBJ) @BUILD_POPT@ @LIBWBCLIENT_SHARED@
        @echo Linking $@
-       @$(CC) $(FLAGS) -o $@ $(LDFLAGS) $(WBINFO_OBJ) $(DYNEXP) $(LIBS) $(LDAP_LIBS) @POPTLIBS@
+       @$(CC) $(FLAGS) -o $@ $(LDFLAGS) $(WBINFO_OBJ) $(DYNEXP) $(LIBS) \
+               $(LDAP_LIBS) @POPTLIBS@ @WINBIND_LIBS@
 
 bin/ntlm_auth@EXEEXT@: $(BINARY_PREREQS) $(NTLM_AUTH_OBJ) $(PARAM_OBJ) \
-       $(LIB_NONSMBD_OBJ) @BUILD_POPT@
+       $(LIB_NONSMBD_OBJ) @BUILD_POPT@ @LIBWBCLIENT_SHARED@
        @echo Linking $@
        @$(CC) $(FLAGS) -o $@ $(LDFLAGS) $(DYNEXP) $(NTLM_AUTH_OBJ) \
                $(PARAM_OBJ) $(LIB_NONSMBD_OBJ) $(LIBS) \
-               @POPTLIBS@ $(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS)
+               @POPTLIBS@ $(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS) @WINBIND_LIBS@
 
 bin/pam_smbpass.@SHLIBEXT@: $(BINARY_PREREQS) $(PAM_SMBPASS_OBJ)
        @echo "Linking shared library $@"
@@ -1721,8 +1864,10 @@ bin/timelimit@EXEEXT@: script/tests/timelimit.o
        @echo Linking $@
        @$(CC) $(FLAGS) -o $@ $(DYNEXP) script/tests/timelimit.o
 
-install: installservers installbin @INSTALL_CIFSMOUNT@ @INSTALL_CIFSSPNEGO@ installman installscripts installdat installmodules @SWAT_INSTALL_TARGETS@ @INSTALL_LIBSMBCLIENT@ @INSTALL_PAM_MODULES@ @INSTALL_LIBSMBSHAREMODES@
-
+install: installservers installbin @INSTALL_CIFSMOUNT@ @INSTALL_CIFSSPNEGO@ installman \
+               installscripts installdat installmodules @SWAT_INSTALL_TARGETS@ \
+               @INSTALL_LIBSMBCLIENT@ @INSTALL_PAM_MODULES@ \
+               @INSTALL_LIBSMBSHAREMODES@ @INSTALL_LIBWBCLIENT@ @INSTALL_LIBNETAPI@
 
 install-everything: install installmodules
 
@@ -1800,6 +1945,18 @@ installlibaddns: installdirs libaddns
        -$(INSTALLLIBCMD_SH) bin/libaddns.@SHLIBEXT@ $(DESTDIR)$(LIBDIR)
        -$(INSTALLLIBCMD_A) bin/libaddns.a $(DESTDIR)$(LIBDIR)
 
+installlibwbclient: installdirs libwbclient
+       @$(SHELL) $(srcdir)/script/installdirs.sh $(INSTALLPERMS_BIN) $(DESTDIR) $(LIBDIR)
+       -$(INSTALLLIBCMD_SH) bin/libwbclient.@SHLIBEXT@ $(DESTDIR)$(LIBDIR)
+       @$(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)
+       -$(INSTALLLIBCMD_SH) bin/libnetapi.@SHLIBEXT@ $(DESTDIR)$(LIBDIR)
+       -$(INSTALLLIBCMD_A) bin/libnetapi.a $(DESTDIR)$(LIBDIR)
+       -$(INSTALLCMD) -m $(INSTALLPERMS_DATA) $(srcdir)/lib/netapi/netapi.h $(DESTDIR)${prefix}/include
+
 installpammodules: $(PAM_MODULES)
        @$(SHELL) $(srcdir)/script/installdirs.sh $(INSTALLPERMS_BIN) $(DESTDIR) $(PAMMODULESDIR)
        @for module in $(PAM_MODULES); do \
@@ -1834,7 +1991,7 @@ showlayout:
        @echo "  swatdir:     $(SWATDIR)"
 
 
-uninstall: uninstallman uninstallservers uninstallbin @UNINSTALL_CIFSMOUNT@ @UNINSTALL_CIFSSPNEGO@ uninstallscripts uninstalldat uninstallswat uninstallmodules @UNINSTALL_LIBSMBCLIENT@ @UNINSTALL_PAM_MODULES@ @UNINSTALL_LIBSMBSHAREMODES@
+uninstall: uninstallman uninstallservers uninstallbin @UNINSTALL_CIFSMOUNT@ @UNINSTALL_CIFSSPNEGO@ uninstallscripts uninstalldat uninstallswat uninstallmodules @UNINSTALL_LIBSMBCLIENT@ @UNINSTALL_PAM_MODULES@ @UNINSTALL_LIBSMBSHAREMODES@ @UNINSTALL_LIBNETAPI@
 
 uninstallman:
        @$(SHELL) $(srcdir)/script/uninstallman.sh $(DESTDIR)$(MANDIR) $(srcdir) C
@@ -1884,6 +2041,11 @@ uninstalllibaddns:
        -$(UNINSTALLLIBCMD_SH) $(DESTDIR)$(LIBDIR)/libaddns.@SHLIBEXT@
        -$(UNINSTALLLIBCMD_A) $(DESTDIR)$(LIBDIR)/libaddns.a
 
+uninstalllibnetapi:
+       -$(UNINSTALLLIBCMD_SH) $(DESTDIR)$(LIBDIR)/libnetapi.@SHLIBEXT@
+       -$(UNINSTALLLIBCMD_A) $(DESTDIR)$(LIBDIR)/libnetapi.a
+       -rm -f $(DESTDIR)${prefix}/include/netapi.h
+
 uninstallpammodules:
        @for module in $(PAM_MODULES); do \
                echo "Removing $(DESTDIR)/$(PAMMODULESDIR)/$${module}.@SHLIBEXT@ "; \
@@ -1897,10 +2059,12 @@ clean: delheaders
        -rm -f $(PRECOMPILED_HEADER)
        -rm -f core */*~ *~ \
                */*.o */*/*.o */*/*/*.o \
+               ../testsuite/*/*.o \
                */*.@SHLIBEXT@ */*/*.@SHLIBEXT@ */*/*/*.@SHLIBEXT@ \
                $(TOPFILES) $(BIN_PROGS) $(SBIN_PROGS) $(ROOT_SBIN_PROGS) \
                $(MODULES) $(TORTURE_PROGS) $(LIBSMBCLIENT) $(LIBADDNS) \
-               $(LIBSMBSHAREMODES) $(EVERYTHING_PROGS) \
+               $(LIBSMBSHAREMODES) $(EVERYTHING_PROGS) $(LIBNETAPI) \
+               bin/libwbclient.so.0 bin/timelimit \
                .headers.stamp */src/*.o proto_exists
        -rm -rf t_dir
 
@@ -1910,6 +2074,7 @@ clean: delheaders
 # afterwards.
 proto_exists: include/proto.h include/build_env.h \
        winbindd/winbindd_proto.h web/swat_proto.h \
+       libnet/libnet_proto.h \
        client/client_proto.h utils/net_proto.h utils/ntlm_auth_proto.h smbd/build_options.c
        @touch proto_exists
 
@@ -1919,7 +2084,7 @@ delheaders:
                winbindd/winbindd_proto.h web/swat_proto.h \
                client/client_proto.h utils/net_proto.h \
                smbd/build_options.c utils/ntlm_auth_proto.h \
-               utils/passwd_proto.h
+               utils/passwd_proto.h libnet/libnet_proto.h
 
 MKPROTO_SH = $(srcdir)/script/mkproto.sh
 
@@ -1964,6 +2129,11 @@ utils/ntlm_auth_proto.h:
          -h _NTLM_AUTH_PROTO_H_ $(builddir)/utils/ntlm_auth_proto.h \
          $(NTLM_AUTH_OBJ1)
 
+libnet/libnet_proto.h:
+       @cd $(srcdir) && $(SHELL) $(MKPROTO_SH) $(AWK) \
+         -h _LIBNET_PROTO_H_ $(builddir)/libnet/libnet_proto.h \
+         $(LIBNET_OBJ)
+
 # "make headers" or "make proto" calls a subshell because we need to
 # make sure these commands are executed in sequence even for a
 # parallel make.
@@ -1977,7 +2147,8 @@ headers:
        $(MAKE) client/client_proto.h; \
        $(MAKE) utils/ntlm_auth_proto.h; \
        $(MAKE) utils/net_proto.h; \
-       $(MAKE) utils/passwd_proto.h;
+       $(MAKE) utils/passwd_proto.h; \
+       $(MAKE) libnet/libnet_proto.h;
 
 proto: headers
 
@@ -2026,6 +2197,14 @@ Makefile: $(srcdir)/Makefile.in config.status
 ######################################################################
 # Samba Testing Framework
 
+# Check shared libs for unresolved symbols
+test_shlibs: $(SHLIBS)
+       @echo "Testing $(SHLIBS) "
+       @for module in $(SHLIBS); do \
+               ./script/tests/dlopen.sh bin/$${module}.@SHLIBEXT@ \
+                       || exit 1; \
+       done
+
 # Check for NSS module problems.
 test_nss_modules: nss_modules
        @echo "Testing $(NSS_MODULES) "
@@ -2043,16 +2222,18 @@ test_pam_modules: pam_modules
                        || exit 1; \
        done
 
+
 ##
 ## Targets for 'make test'
 ##
 test: all torture timelimit
        @echo Running Test suite
-       @PERL="$(PERL)" $(srcdir)/script/tests/selftest.sh ${selftest_prefix}/st all "${smbtorture4_path}"
+       @LIB_PATH_VAR=$(LIB_PATH_VAR) PERL="$(PERL)" $(srcdir)/script/tests/selftest.sh ${selftest_prefix}/st all "${smbtorture4_path}"
 
 valgrindtest: all torture timelimit
        @echo Running Test suite with valgrind
-       @NMBD_VALGRIND="xterm -n nmbd -e valgrind -q --db-attach=yes --num-callers=30" \
+       @LIB_PATH_VAR=$(LIB_PATH_VAR) \
+        NMBD_VALGRIND="xterm -n nmbd -e valgrind -q --db-attach=yes --num-callers=30" \
         WINBINDD_VALGRIND="xterm -n winbindd -e valgrind -q --db-attach=yes --num-callers=30" \
         SMBD_VALGRIND="xterm -n smbd -e valgrind -q --db-attach=yes --num-callers=30" \
         VALGRIND="valgrind -q --num-callers=30 --log-file=${selftest_prefix}/st/valgrind.log" \
index b2c87174fd332baa33dcc1cfef282dadbf043952..40a29856002338e07c913e90603eac7a38cd55b0 100644 (file)
@@ -124,7 +124,7 @@ machine %s. Error was : %s.\n", dc_name, nt_errstr(result)));
 
        if (!lp_client_schannel()) {
                /* We need to set up a creds chain on an unauthenticated netlogon pipe. */
-               uint32 neg_flags = NETLOGON_NEG_AUTH2_FLAGS;
+               uint32 neg_flags = NETLOGON_NEG_SELECT_AUTH2_FLAGS;
                uint32 sec_chan_type = 0;
                unsigned char machine_pwd[16];
                const char *account_name;
@@ -270,7 +270,9 @@ static NTSTATUS domain_client_validate(TALLOC_CTX *mem_ctx,
                                                &info3);
 
                if (NT_STATUS_IS_OK(nt_status)) {
-                       (*server_info)->was_mapped |= user_info->was_mapped;
+                       if (user_info->was_mapped) {
+                               (*server_info)->was_mapped = user_info->was_mapped;
+                       }
 
                        if ( ! (*server_info)->guest) {
                                /* if a real user check pam account restrictions */
index 9f90ef8ccd21e5e47414c288420a19db9ad130ef..095f0b9fb83b7d0a1453eed2212f2515a4eb3859 100644 (file)
@@ -75,6 +75,7 @@ static struct cli_state *server_cryptkey(TALLOC_CTX *mem_ctx)
                   connection (tridge) */
 
                if (!grab_server_mutex(desthost)) {
+                       cli_shutdown(cli);
                        return NULL;
                }
 
index 4fca5bcbe4c79b819e499179b01e3c2c989fe578..58c765226d633c707d05a9923e6588eb987da44b 100644 (file)
@@ -92,7 +92,7 @@ static NTSTATUS check_unix_security(const struct auth_context *auth_context,
        struct passwd *pass = NULL;
 
        become_root();
-       pass = Get_Pwnam(user_info->internal_username);
+       pass = Get_Pwnam_alloc(talloc_tos(), user_info->internal_username);
 
        
        /** @todo This call assumes a ASCII password, no charset transformation is 
@@ -123,6 +123,7 @@ static NTSTATUS check_unix_security(const struct auth_context *auth_context,
                }
        }
 
+       TALLOC_FREE(pass);
        return nt_status;
 }
 
index 1e33869ea943b68de243fc0490f8c7c8cb5d9db7..ce47e94eb54f3279e8b2b200625bb94e665f9ff6 100644 (file)
@@ -549,11 +549,13 @@ NTSTATUS make_server_info_sam(auth_serversupplied_info **server_info,
                                "for gid %d!\n", gids[i]));
                        continue;
                }
-               if (!add_sid_to_array_unique( result, &unix_group_sid,
-                               &result->sids, &result->num_sids )) {
+               status = add_sid_to_array_unique(result, &unix_group_sid,
+                                                &result->sids,
+                                                &result->num_sids);
+               if (!NT_STATUS_IS_OK(status)) {
                        result->sam_account = NULL; /* Don't free on error exit. */
                        TALLOC_FREE(result);
-                       return NT_STATUS_NO_MEMORY;
+                       return status;
                }
        }
 
@@ -895,9 +897,9 @@ NTSTATUS create_token_from_username(TALLOC_CTX *mem_ctx, const char *username,
                                "for gid %d!\n", gids[i]));
                        continue;
                }
-               if (!add_sid_to_array_unique(tmp_ctx, &unix_group_sid,
-                               &group_sids, &num_group_sids )) {
-                       result = NT_STATUS_NO_MEMORY;
+               result = add_sid_to_array_unique(tmp_ctx, &unix_group_sid,
+                                                &group_sids, &num_group_sids);
+               if (!NT_STATUS_IS_OK(result)) {
                        goto done;
                }
        }
@@ -1074,11 +1076,12 @@ NTSTATUS make_server_info_pw(auth_serversupplied_info **server_info,
                return NT_STATUS_NO_SUCH_USER;
        }
 
-       if (!add_sid_to_array_unique(result, &u_sid,
-                                       &result->sids,
-                                       &result->num_sids)) {
+       status = add_sid_to_array_unique(result, &u_sid,
+                                        &result->sids,
+                                        &result->num_sids);
+       if (!NT_STATUS_IS_OK(status)) {
                TALLOC_FREE(result);
-               return NT_STATUS_NO_MEMORY;
+               return status;
        }
 
        /* For now we throw away the gids and convert via sid_to_gid
@@ -1103,7 +1106,7 @@ static NTSTATUS make_new_server_info_guest(auth_serversupplied_info **server_inf
        struct samu *sampass = NULL;
        DOM_SID guest_sid;
        bool ret;
-       static const char zeros[16] = { 0, };
+       char zeros[16];
 
        if ( !(sampass = samu_new( NULL )) ) {
                return NT_STATUS_NO_MEMORY;
@@ -1138,6 +1141,7 @@ static NTSTATUS make_new_server_info_guest(auth_serversupplied_info **server_inf
 
        /* annoying, but the Guest really does have a session key, and it is
           all zeros! */
+       ZERO_STRUCT(zeros);
        (*server_info)->user_session_key = data_blob(zeros, sizeof(zeros));
        (*server_info)->lm_session_key = data_blob(zeros, sizeof(zeros));
 
@@ -1420,10 +1424,10 @@ NTSTATUS make_server_info_info3(TALLOC_CTX *mem_ctx,
                                auth_serversupplied_info **server_info, 
                                NET_USER_INFO_3 *info3) 
 {
-       static const char zeros[16] = { 0, };
+       char zeros[16];
 
        NTSTATUS nt_status = NT_STATUS_OK;
-       char *found_username;
+       char *found_username = NULL;
        const char *nt_domain;
        const char *nt_username;
        struct samu *sam_account = NULL;
@@ -1431,8 +1435,8 @@ NTSTATUS make_server_info_info3(TALLOC_CTX *mem_ctx,
        DOM_SID group_sid;
        bool username_was_mapped;
 
-       uid_t uid;
-       gid_t gid;
+       uid_t uid = (uid_t)-1;
+       gid_t gid = (gid_t)-1;
 
        auth_serversupplied_info *result;
 
@@ -1624,7 +1628,9 @@ NTSTATUS make_server_info_info3(TALLOC_CTX *mem_ctx,
                                            &(info3->uni_logon_srv));
 
        /* ensure we are never given NULL session keys */
-       
+
+       ZERO_STRUCT(zeros);
+
        if (memcmp(info3->user_sess_key, zeros, sizeof(zeros)) == 0) {
                result->user_session_key = data_blob_null;
        } else {
@@ -1731,17 +1737,17 @@ bool is_trusted_domain(const char* dom_name)
                        return True;
        }
        else {
-               NSS_STATUS result;
+               wbcErr result;
 
                /* If winbind is around, ask it */
 
                result = wb_is_trusted_domain(dom_name);
 
-               if (result == NSS_STATUS_SUCCESS) {
+               if (result == WBC_ERR_SUCCESS) {
                        return True;
                }
 
-               if (result == NSS_STATUS_NOTFOUND) {
+               if (result == WBC_ERR_DOMAIN_NOT_FOUND) {
                        /* winbind could not find the domain */
                        return False;
                }
index 959c550524be854bda7a6870de4c6e633ddcf7da..b24aa3a75b3a036c0d362d073000996ff210adcc 100644 (file)
@@ -134,7 +134,9 @@ static NTSTATUS check_winbind_security(const struct auth_context *auth_context,
                        }
                        
                        if (NT_STATUS_IS_OK(nt_status)) {
-                               (*server_info)->was_mapped |= user_info->was_mapped;
+                               if (user_info->was_mapped) {
+                                       (*server_info)->was_mapped = user_info->was_mapped;
+                               }
                        }
                }
        } else if (NT_STATUS_IS_OK(nt_status)) {
index 27915bf4999281e4561c419d58e399af622034c5..813540d9fa822a15848badfa2de5d062a087235a 100644 (file)
 #define DBGC_CLASS DBGC_AUTH
 
 /* these are kept here to keep the string_combinations function simple */
-static fstring this_user;
-#if !defined(WITH_PAM) 
-static fstring this_salt;
-static fstring this_crypted;
+static char *ths_user;
+
+static const char *get_this_user(void)
+{
+       if (!ths_user) {
+               return "";
+       }
+       return ths_user;
+}
+
+#if defined(WITH_PAM) || defined(OSF1_ENH_SEC)
+static const char *set_this_user(const char *newuser)
+{
+       char *orig_user = ths_user;
+       ths_user = SMB_STRDUP(newuser);
+       SAFE_FREE(orig_user);
+       return ths_user;
+}
+#endif
+
+#if !defined(WITH_PAM)
+static char *ths_salt;
+/* This must be writable. */
+static char *get_this_salt(void)
+{
+       return ths_salt;
+}
+
+/* We may be setting a modified version of the same
+ * string, so don't free before use. */
+
+static const char *set_this_salt(const char *newsalt)
+{
+       char *orig_salt = ths_salt;
+       ths_salt = SMB_STRDUP(newsalt);
+       SAFE_FREE(orig_salt);
+       return ths_salt;
+}
+
+static char *ths_crypted;
+static const char *get_this_crypted(void)
+{
+       if (!ths_crypted) {
+               return "";
+       }
+       return ths_crypted;
+}
+
+static const char *set_this_crypted(const char *newcrypted)
+{
+       char *orig_crypted = ths_crypted;
+       ths_crypted = SMB_STRDUP(newcrypted);
+       SAFE_FREE(orig_crypted);
+       return ths_crypted;
+}
 #endif
 
 #ifdef WITH_AFS
@@ -113,7 +164,7 @@ static bool dfs_auth(char *user, char *password)
         * Assumes local passwd file is kept in sync w/ DCE RGY!
         */
 
-       if (strcmp((char *)crypt(password, this_salt), this_crypted))
+       if (strcmp((char *)crypt(password, get_this_salt()), get_this_crypted()))
        {
                return (False);
        }
@@ -492,29 +543,29 @@ core of password checking routine
 static NTSTATUS password_check(const char *password)
 {
 #ifdef WITH_PAM
-       return smb_pam_passcheck(this_user, password);
+       return smb_pam_passcheck(get_this_user(), password);
 #else
 
        bool ret;
 
 #ifdef WITH_AFS
-       if (afs_auth(this_user, password))
+       if (afs_auth(get_this_user(), password))
                return NT_STATUS_OK;
 #endif /* WITH_AFS */
 
 #ifdef WITH_DFS
-       if (dfs_auth(this_user, password))
+       if (dfs_auth(get_this_user(), password))
                return NT_STATUS_OK;
 #endif /* WITH_DFS */
 
 #ifdef OSF1_ENH_SEC
        
-       ret = (strcmp(osf1_bigcrypt(password, this_salt),
-                     this_crypted) == 0);
+       ret = (strcmp(osf1_bigcrypt(password, get_this_salt()),
+                     get_this_crypted()) == 0);
        if (!ret) {
                DEBUG(2,
                      ("OSF1_ENH_SEC failed. Trying normal crypt.\n"));
-               ret = (strcmp((char *)crypt(password, this_salt), this_crypted) == 0);
+               ret = (strcmp((char *)crypt(password, get_this_salt()), get_this_crypted()) == 0);
        }
        if (ret) {
                return NT_STATUS_OK;
@@ -525,7 +576,7 @@ static NTSTATUS password_check(const char *password)
 #endif /* OSF1_ENH_SEC */
        
 #ifdef ULTRIX_AUTH
-       ret = (strcmp((char *)crypt16(password, this_salt), this_crypted) == 0);
+       ret = (strcmp((char *)crypt16(password, get_this_salt()), get_this_crypted()) == 0);
        if (ret) {
                return NT_STATUS_OK;
         } else {
@@ -535,7 +586,7 @@ static NTSTATUS password_check(const char *password)
 #endif /* ULTRIX_AUTH */
        
 #ifdef LINUX_BIGCRYPT
-       ret = (linux_bigcrypt(password, this_salt, this_crypted));
+       ret = (linux_bigcrypt(password, get_this_salt(), get_this_crypted()));
         if (ret) {
                return NT_STATUS_OK;
        } else {
@@ -552,10 +603,10 @@ static NTSTATUS password_check(const char *password)
         * by crypt.
         */
 
-       if (strcmp(bigcrypt(password, this_salt), this_crypted) == 0)
+       if (strcmp(bigcrypt(password, get_this_salt()), get_this_crypted()) == 0)
                return NT_STATUS_OK;
        else
-               ret = (strcmp((char *)crypt(password, this_salt), this_crypted) == 0);
+               ret = (strcmp((char *)crypt(password, get_this_salt()), get_this_crypted()) == 0);
        if (ret) {
                return NT_STATUS_OK;
        } else {
@@ -564,7 +615,7 @@ static NTSTATUS password_check(const char *password)
 #else /* HAVE_BIGCRYPT && HAVE_CRYPT && USE_BOTH_CRYPT_CALLS */
        
 #ifdef HAVE_BIGCRYPT
-       ret = (strcmp(bigcrypt(password, this_salt), this_crypted) == 0);
+       ret = (strcmp(bigcrypt(password, get_this_salt()), get_this_crypted()) == 0);
         if (ret) {
                return NT_STATUS_OK;
        } else {
@@ -576,7 +627,7 @@ static NTSTATUS password_check(const char *password)
        DEBUG(1, ("Warning - no crypt available\n"));
        return NT_STATUS_LOGON_FAILURE;
 #else /* HAVE_CRYPT */
-       ret = (strcmp((char *)crypt(password, this_salt), this_crypted) == 0);
+       ret = (strcmp((char *)crypt(password, get_this_salt()), get_this_crypted()) == 0);
         if (ret) {
                return NT_STATUS_OK;
        } else {
@@ -621,7 +672,9 @@ NTSTATUS pass_check(const struct passwd *pass, const char *user, const char *pas
         * checks below and dive straight into the PAM code.
         */
 
-       fstrcpy(this_user, user);
+       if (set_this_user(user) == NULL) {
+               return NT_STATUS_NO_MEMORY;
+       }
 
        DEBUG(4, ("pass_check: Checking (PAM) password for user %s (l=%d)\n", user, pwlen));
 
@@ -638,8 +691,12 @@ NTSTATUS pass_check(const struct passwd *pass, const char *user, const char *pas
        /* Copy into global for the convenience of looping code */
        /* Also the place to keep the 'password' no matter what
           crazy struct it started in... */
-       fstrcpy(this_crypted, pass->pw_passwd);
-       fstrcpy(this_salt, pass->pw_passwd);
+       if (set_this_crypted(pass->pw_passwd) == NULL) {
+               return NT_STATUS_NO_MEMORY;
+       }
+       if (set_this_salt(pass->pw_passwd) == NULL) {
+               return NT_STATUS_NO_MEMORY;
+       }
 
 #ifdef HAVE_GETSPNAM
        {
@@ -652,8 +709,12 @@ NTSTATUS pass_check(const struct passwd *pass, const char *user, const char *pas
 
                spass = getspnam(pass->pw_name);
                if (spass && spass->sp_pwdp) {
-                       fstrcpy(this_crypted, spass->sp_pwdp);
-                       fstrcpy(this_salt, spass->sp_pwdp);
+                       if (set_this_crypted(spass->sp_pwdp) == NULL) {
+                               return NT_STATUS_NO_MEMORY;
+                       }
+                       if (set_this_salt(spass->sp_pwdp) == NULL) {
+                               return NT_STATUS_NO_MEMORY;
+                       }
                }
        }
 #elif defined(IA_UINFO)
@@ -671,8 +732,11 @@ NTSTATUS pass_check(const struct passwd *pass, const char *user, const char *pas
 #ifdef HAVE_GETPRPWNAM
        {
                struct pr_passwd *pr_pw = getprpwnam(pass->pw_name);
-               if (pr_pw && pr_pw->ufld.fd_encrypt)
-                       fstrcpy(this_crypted, pr_pw->ufld.fd_encrypt);
+               if (pr_pw && pr_pw->ufld.fd_encrypt) {
+                       if (set_this_crypted(pr_pw->ufld.fd_encrypt) == NULL) {
+                               return NT_STATUS_NO_MEMORY;
+                       }
+               }
        }
 #endif
 
@@ -680,8 +744,11 @@ NTSTATUS pass_check(const struct passwd *pass, const char *user, const char *pas
        {
                struct passwd_adjunct *pwret;
                pwret = getpwanam(s);
-               if (pwret && pwret->pwa_passwd)
-                       fstrcpy(this_crypted, pwret->pwa_passwd);
+               if (pwret && pwret->pwa_passwd) {
+                       if (set_this_crypted(pwret->pwa_passwd) == NULL) {
+                               return NT_STATUS_NO_MEMORY;
+                       }
+               }
        }
 #endif
 
@@ -692,8 +759,12 @@ NTSTATUS pass_check(const struct passwd *pass, const char *user, const char *pas
                          user));
                mypasswd = getprpwnam(user);
                if (mypasswd) {
-                       fstrcpy(this_user, mypasswd->ufld.fd_name);
-                       fstrcpy(this_crypted, mypasswd->ufld.fd_encrypt);
+                       if (set_this_user(mypasswd->ufld.fd_name) == NULL) {
+                               return NT_STATUS_NO_MEMORY;
+                       }
+                       if (set_this_crypted(mypasswd->ufld.fd_encrypt) == NULL) {
+                               return NT_STATUS_NO_MEMORY;
+                       }
                } else {
                        DEBUG(5,
                              ("OSF1_ENH_SEC: No entry for user %s in protected database !\n",
@@ -706,7 +777,10 @@ NTSTATUS pass_check(const struct passwd *pass, const char *user, const char *pas
        {
                AUTHORIZATION *ap = getauthuid(pass->pw_uid);
                if (ap) {
-                       fstrcpy(this_crypted, ap->a_password);
+                       if (set_this_crypted(ap->a_password) == NULL) {
+                               endauthent();
+                               return NT_STATUS_NO_MEMORY;
+                       }
                        endauthent();
                }
        }
@@ -715,19 +789,28 @@ NTSTATUS pass_check(const struct passwd *pass, const char *user, const char *pas
 #if defined(HAVE_TRUNCATED_SALT)
        /* crypt on some platforms (HPUX in particular)
           won't work with more than 2 salt characters. */
-       this_salt[2] = 0;
+       {
+               char *trunc_salt = get_this_salt();
+               if (!trunc_salt || strlen(trunc_salt) < 2) {
+                       return NT_STATUS_LOGON_FAILURE;
+               }
+               trunc_salt[2] = 0;
+               if (set_this_salt(trunc_salt) == NULL) {
+                       return NT_STATUS_NO_MEMORY;
+               }
+       }
 #endif
 
-       if (!*this_crypted) {
+       if (!get_this_crypted() || !*get_this_crypted()) {
                if (!lp_null_passwords()) {
                        DEBUG(2, ("Disallowing %s with null password\n",
-                                 this_user));
+                                 get_this_user()));
                        return NT_STATUS_LOGON_FAILURE;
                }
                if (!*password) {
                        DEBUG(3,
                              ("Allowing access to %s with null password\n",
-                              this_user));
+                              get_this_user()));
                        return NT_STATUS_OK;
                }
        }
index 27c98c9581183bedf0ea54490ee02ef1ab4824ed..fc93060fc6a61e4cb235236db5862b90a11d7c42 100644 (file)
@@ -77,12 +77,19 @@ bool nt_token_check_domain_rid( NT_USER_TOKEN *token, uint32 rid )
 
 NT_USER_TOKEN *get_root_nt_token( void )
 {
-       static NT_USER_TOKEN *token = NULL;
+       struct nt_user_token *token = NULL;
        DOM_SID u_sid, g_sid;
        struct passwd *pw;
+       void *cache_data;
 
-       if ( token )
-               return token;
+       cache_data = memcache_lookup_talloc(
+               NULL, SINGLETON_CACHE_TALLOC,
+               data_blob_string_const("root_nt_token"));
+
+       if (cache_data != NULL) {
+               return talloc_get_type_abort(
+                       cache_data, struct nt_user_token);
+       }
 
        if ( !(pw = sys_getpwnam( "root" )) ) {
                DEBUG(0,("get_root_nt_token: getpwnam(\"root\") failed!\n"));
@@ -97,6 +104,11 @@ NT_USER_TOKEN *get_root_nt_token( void )
 
        token = create_local_nt_token(NULL, &u_sid, False,
                                      1, &global_sid_Builtin_Administrators);
+
+       memcache_add_talloc(
+               NULL, SINGLETON_CACHE_TALLOC,
+               data_blob_string_const("root_nt_token"), token);
+
        return token;
 }
 
@@ -128,22 +140,22 @@ NTSTATUS add_aliases(const DOM_SID *domain_sid,
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(10, ("pdb_enum_alias_memberships failed: %s\n",
                           nt_errstr(status)));
-               TALLOC_FREE(tmp_ctx);
-               return status;
+               goto done;
        }
 
        for (i=0; i<num_aliases; i++) {
                DOM_SID alias_sid;
                sid_compose(&alias_sid, domain_sid, aliases[i]);
-               if (!add_sid_to_array_unique(token, &alias_sid,
-                                       &token->user_sids,
-                                       &token->num_sids)) {
+               status = add_sid_to_array_unique(token, &alias_sid,
+                                                &token->user_sids,
+                                                &token->num_sids);
+               if (!NT_STATUS_IS_OK(status)) {
                        DEBUG(0, ("add_sid_to_array failed\n"));
-                       TALLOC_FREE(tmp_ctx);
-                       return NT_STATUS_NO_MEMORY;
+                       goto done;
                }
        }
 
+done:
        TALLOC_FREE(tmp_ctx);
        return NT_STATUS_OK;
 }
@@ -154,6 +166,7 @@ NTSTATUS add_aliases(const DOM_SID *domain_sid,
 static NTSTATUS add_builtin_administrators( struct nt_user_token *token )
 {
        DOM_SID domadm;
+       NTSTATUS status;
 
        /* nothing to do if we aren't in a domain */
 
@@ -174,9 +187,11 @@ static NTSTATUS add_builtin_administrators( struct nt_user_token *token )
        /* Add Administrators if the user beloongs to Domain Admins */
 
        if ( nt_token_check_sid( &domadm, token ) ) {
-               if (!add_sid_to_array(token, &global_sid_Builtin_Administrators,
-                                        &token->user_sids, &token->num_sids)) {
-                       return NT_STATUS_NO_MEMORY;
+               status = add_sid_to_array(token,
+                                         &global_sid_Builtin_Administrators,
+                                         &token->user_sids, &token->num_sids);
+       if (!NT_STATUS_IS_OK(status)) {
+                       return status;
                }
        }
 
@@ -284,45 +299,55 @@ struct nt_user_token *create_local_nt_token(TALLOC_CTX *mem_ctx,
        DEBUG(10, ("Create local NT token for %s\n",
                   sid_string_dbg(user_sid)));
 
-       if (!(result = TALLOC_ZERO_P(mem_ctx, NT_USER_TOKEN))) {
+       if (!(result = TALLOC_ZERO_P(mem_ctx, struct nt_user_token))) {
                DEBUG(0, ("talloc failed\n"));
                return NULL;
        }
 
        /* Add the user and primary group sid */
 
-       if (!add_sid_to_array(result, user_sid,
-                        &result->user_sids, &result->num_sids)) {
+       status = add_sid_to_array(result, user_sid,
+                                 &result->user_sids, &result->num_sids);
+       if (!NT_STATUS_IS_OK(status)) {
                return NULL;
        }
 
        /* For guest, num_groupsids may be zero. */
        if (num_groupsids) {
-               if (!add_sid_to_array(result, &groupsids[0],
-                                &result->user_sids, &result->num_sids)) {
+               status = add_sid_to_array(result, &groupsids[0],
+                                         &result->user_sids,
+                                         &result->num_sids);
+               if (!NT_STATUS_IS_OK(status)) {
                        return NULL;
                }
        }
 
        /* Add in BUILTIN sids */
 
-       if (!add_sid_to_array(result, &global_sid_World,
-                        &result->user_sids, &result->num_sids)) {
+       status = add_sid_to_array(result, &global_sid_World,
+                                 &result->user_sids, &result->num_sids);
+       if (!NT_STATUS_IS_OK(status)) {
                return NULL;
        }
-       if (!add_sid_to_array(result, &global_sid_Network,
-                        &result->user_sids, &result->num_sids)) {
+       status = add_sid_to_array(result, &global_sid_Network,
+                                 &result->user_sids, &result->num_sids);
+       if (!NT_STATUS_IS_OK(status)) {
                return NULL;
        }
 
        if (is_guest) {
-               if (!add_sid_to_array(result, &global_sid_Builtin_Guests,
-                                &result->user_sids, &result->num_sids)) {
+               status = add_sid_to_array(result, &global_sid_Builtin_Guests,
+                                         &result->user_sids,
+                                         &result->num_sids);
+               if (!NT_STATUS_IS_OK(status)) {
                        return NULL;
                }
        } else {
-               if (!add_sid_to_array(result, &global_sid_Authenticated_Users,
-                                &result->user_sids, &result->num_sids)) {
+               status = add_sid_to_array(result,
+                                         &global_sid_Authenticated_Users,
+                                         &result->user_sids,
+                                         &result->num_sids);
+               if (!NT_STATUS_IS_OK(status)) {
                        return NULL;
                }
        }
@@ -334,8 +359,10 @@ struct nt_user_token *create_local_nt_token(TALLOC_CTX *mem_ctx,
         * first group sid as primary above. */
 
        for (i=1; i<num_groupsids; i++) {
-               if (!add_sid_to_array_unique(result, &groupsids[i],
-                                       &result->user_sids, &result->num_sids)) {
+               status = add_sid_to_array_unique(result, &groupsids[i],
+                                                &result->user_sids,
+                                                &result->num_sids);
+               if (!NT_STATUS_IS_OK(status)) {
                        return NULL;
                }
        }
index caa22276c47b46eb30c1857977207f37ec3b00f0..d10d19da96ad48d05eca436b71c4f4e3c9bc0423 100644 (file)
@@ -3,11 +3,13 @@
 * Copyright (C) Igor Mammedov (niallain@gmail.com) 2007
 *
 * Used by /sbin/request-key for handling
-* cifs upcall for kerberos authorization of access to share.
+* cifs upcall for kerberos authorization of access to share and
+* cifs upcall for DFS srver name resolving (IPv4/IPv6 aware).
 * You should have keyutils installed and add following line to
 * /etc/request-key.conf file
 
 create cifs.spnego * * /usr/local/sbin/cifs.spnego [-v][-c] %k
+create cifs.resolver * * /usr/local/sbin/cifs.spnego [-v] %k
 
 * 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
@@ -27,7 +29,7 @@ create cifs.spnego * * /usr/local/sbin/cifs.spnego [-v][-c] %k
 
 #include "cifs_spnego.h"
 
-const char* CIFSSPNEGO_VERSION="1.0";
+const char *CIFSSPNEGO_VERSION = "1.1";
 static const char *prog = "cifs.spnego";
 typedef enum _secType {
        KRB5,
@@ -146,6 +148,58 @@ int decode_key_description(const char *desc, int *ver, secType_t * sec,
        return retval;
 }
 
+int cifs_resolver(const key_serial_t key, const char *key_descr)
+{
+       int c;
+       struct addrinfo *addr;
+       char ip[INET6_ADDRSTRLEN];
+       void *p;
+       const char *keyend = key_descr;
+       /* skip next 4 ';' delimiters to get to description */
+       for (c = 1; c <= 4; c++) {
+               keyend = index(keyend+1, ';');
+               if (!keyend) {
+                       syslog(LOG_WARNING, "invalid key description: %s",
+                                       key_descr);
+                       return 1;
+               }
+       }
+       keyend++;
+
+       /* resolve name to ip */
+       c = getaddrinfo(keyend, NULL, NULL, &addr);
+       if (c) {
+               syslog(LOG_WARNING, "unable to resolve hostname: %s [%s]",
+                               keyend, gai_strerror(c));
+               return 1;
+       }
+
+       /* conver ip to string form */
+       if (addr->ai_family == AF_INET) {
+               p = &(((struct sockaddr_in *)addr->ai_addr)->sin_addr);
+       } else {
+               p = &(((struct sockaddr_in6 *)addr->ai_addr)->sin6_addr);
+       }
+       if (!inet_ntop(addr->ai_family, p, ip, sizeof(ip))) {
+               syslog(LOG_WARNING, "%s: inet_ntop: %s",
+                               __FUNCTION__, strerror(errno));
+               freeaddrinfo(addr);
+               return 1;
+       }
+
+       /* setup key */
+       c = keyctl_instantiate(key, ip, strlen(ip)+1, 0);
+       if (c == -1) {
+               syslog(LOG_WARNING, "%s: keyctl_instantiate: %s",
+                               __FUNCTION__, strerror(errno));
+               freeaddrinfo(addr);
+               return 1;
+       }
+
+       freeaddrinfo(addr);
+       return 0;
+}
+
 int main(const int argc, char *const argv[])
 {
        struct cifs_spnego_msg *keydata = NULL;
@@ -199,6 +253,11 @@ int main(const int argc, char *const argv[])
                goto out;
        }
 
+       if (strncmp(buf, "cifs.resolver", sizeof("cifs.resolver")-1) == 0) {
+               rc = cifs_resolver(key, buf);
+               goto out;
+       }
+
        rc = decode_key_description(buf, &kernel_upcall_version, &sectype,
                                    &hostname, &uid);
        if ((rc & DKD_MUSTHAVE_SET) != DKD_MUSTHAVE_SET) {
index d59af9e6cfb833bb2ff2504e8d8c76574b266187..c9343104911096214bd140346d2f9bf4c3790afe 100644 (file)
 #define REGISTER 0
 #endif
 
+extern int do_smb_browse(void); /* mDNS browsing */
+
 extern bool AllowDebugChange;
 extern bool override_logfile;
 extern char tar_type;
 extern bool in_client;
+
 static int port = 0;
 static char *service;
 static char *desthost;
 static char *calling_name;
 static bool grepable = false;
 static char *cmdstr = NULL;
+static const char *cmd_ptr = NULL;
 
 static int io_bufsize = 64512;
 
@@ -89,6 +93,9 @@ static unsigned int put_total_time_ms = 0;
 /* totals globals */
 static double dir_total;
 
+/* encrypted state. */
+static bool smb_encrypt;
+
 /* root cli_state connection */
 
 struct cli_state *cli;
@@ -422,7 +429,7 @@ static int cmd_cd(void)
        char *buf = NULL;
        int rc = 0;
 
-       if (next_token_nr_talloc(talloc_tos(), NULL, &buf,NULL)) {
+       if (next_token_talloc(talloc_tos(), &cmd_ptr, &buf,NULL)) {
                rc = do_cd(buf);
        } else {
                d_printf("Current directory is %s\n",client_get_cur_dir());
@@ -860,7 +867,7 @@ static int cmd_dir(void)
                return 1;
        }
 
-       if (next_token_nr_talloc(ctx, NULL,&buf,NULL)) {
+       if (next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
                string_replace(buf,'/','\\');
                if (*buf == CLI_DIRSEP_CHAR) {
                        mask = talloc_strdup(ctx, buf + 1);
@@ -912,7 +919,7 @@ static int cmd_du(void)
                }
        }
 
-       if (next_token_nr_talloc(ctx, NULL,&buf,NULL)) {
+       if (next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
                string_replace(buf,'/','\\');
                if (*buf == CLI_DIRSEP_CHAR) {
                        mask = talloc_strdup(ctx, buf);
@@ -938,8 +945,8 @@ static int cmd_echo(void)
        char *num;
        char *data;
 
-       if (!next_token_nr_talloc(ctx, NULL, &num, NULL)
-           || !next_token_nr_talloc(ctx, NULL, &data, NULL)) {
+       if (!next_token_talloc(ctx, &cmd_ptr, &num, NULL)
+           || !next_token_talloc(ctx, &cmd_ptr, &data, NULL)) {
                d_printf("echo <num> <data>\n");
                return 1;
        }
@@ -1113,7 +1120,7 @@ static int cmd_get(void)
                return 1;
        }
 
-       if (!next_token_nr_talloc(ctx, NULL,&fname,NULL)) {
+       if (!next_token_talloc(ctx, &cmd_ptr,&fname,NULL)) {
                d_printf("get <filename> [localname]\n");
                return 1;
        }
@@ -1126,7 +1133,7 @@ static int cmd_get(void)
                return 1;
        }
 
-       next_token_nr_talloc(ctx, NULL,&lname,NULL);
+       next_token_talloc(ctx, &cmd_ptr,&lname,NULL);
        if (!lname) {
                lname = fname;
        }
@@ -1274,7 +1281,7 @@ static int cmd_more(void)
        }
        close(fd);
 
-       if (!next_token_nr_talloc(ctx,NULL,&fname,NULL)) {
+       if (!next_token_talloc(ctx, &cmd_ptr,&fname,NULL)) {
                d_printf("more <filename>\n");
                unlink(lname);
                return 1;
@@ -1322,7 +1329,7 @@ static int cmd_mget(void)
 
        abort_mget = false;
 
-       while (next_token_nr_talloc(ctx,NULL,&buf,NULL)) {
+       while (next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
                mget_mask = talloc_strdup(ctx, client_get_cur_dir());
                if (!mget_mask) {
                        return 1;
@@ -1439,7 +1446,7 @@ static int cmd_mkdir(void)
                return 1;
        }
 
-       if (!next_token_nr_talloc(ctx, NULL,&buf,NULL)) {
+       if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
                if (!recurse) {
                        d_printf("mkdir <dirname>\n");
                }
@@ -1456,6 +1463,7 @@ static int cmd_mkdir(void)
                struct cli_state *targetcli;
                char *targetname = NULL;
                char *p = NULL;
+               char *saveptr;
 
                ddir2 = talloc_strdup(ctx, "");
                if (!ddir2) {
@@ -1471,7 +1479,7 @@ static int cmd_mkdir(void)
                        return 1;
                }
                trim_char(ddir,'.','\0');
-               p = strtok(ddir,"/\\");
+               p = strtok_r(ddir, "/\\", &saveptr);
                while (p) {
                        ddir2 = talloc_asprintf_append(ddir2, p);
                        if (!ddir2) {
@@ -1484,7 +1492,7 @@ static int cmd_mkdir(void)
                        if (!ddir2) {
                                return 1;
                        }
-                       p = strtok(NULL,"/\\");
+                       p = strtok_r(NULL, "/\\", &saveptr);
                }
        } else {
                do_mkdir(mask);
@@ -1508,7 +1516,7 @@ static int cmd_altname(void)
                return 1;
        }
 
-       if (!next_token_nr_talloc(ctx, NULL, &buf, NULL)) {
+       if (!next_token_talloc(ctx, &cmd_ptr, &buf, NULL)) {
                d_printf("altname <file>\n");
                return 1;
        }
@@ -1520,6 +1528,92 @@ static int cmd_altname(void)
        return 0;
 }
 
+/****************************************************************************
+ Show all info we can get
+****************************************************************************/
+
+static int do_allinfo(const char *name)
+{
+       fstring altname;
+       struct timespec b_time, a_time, m_time, c_time;
+       SMB_OFF_T size;
+       uint16_t mode;
+       SMB_INO_T ino;
+       NTTIME tmp;
+       unsigned int num_streams;
+       struct stream_struct *streams;
+       unsigned int i;
+
+       if (!NT_STATUS_IS_OK(cli_qpathinfo_alt_name(cli, name, altname))) {
+               d_printf("%s getting alt name for %s\n",
+                        cli_errstr(cli),name);
+               return false;
+       }
+       d_printf("altname: %s\n", altname);
+
+       if (!cli_qpathinfo2(cli, name, &b_time, &a_time, &m_time, &c_time,
+                           &size, &mode, &ino)) {
+               d_printf("%s getting pathinfo for %s\n",
+                        cli_errstr(cli),name);
+               return false;
+       }
+
+       unix_timespec_to_nt_time(&tmp, b_time);
+       d_printf("create_time:    %s\n", nt_time_string(talloc_tos(), tmp));
+
+       unix_timespec_to_nt_time(&tmp, a_time);
+       d_printf("access_time:    %s\n", nt_time_string(talloc_tos(), tmp));
+
+       unix_timespec_to_nt_time(&tmp, m_time);
+       d_printf("write_time:     %s\n", nt_time_string(talloc_tos(), tmp));
+
+       unix_timespec_to_nt_time(&tmp, c_time);
+       d_printf("change_time:    %s\n", nt_time_string(talloc_tos(), tmp));
+
+       if (!cli_qpathinfo_streams(cli, name, talloc_tos(), &num_streams,
+                                  &streams)) {
+               d_printf("%s getting streams for %s\n",
+                        cli_errstr(cli),name);
+               return false;
+       }
+
+       for (i=0; i<num_streams; i++) {
+               d_printf("stream: [%s], %lld bytes\n", streams[i].name,
+                        (unsigned long long)streams[i].size);
+       }
+
+       return 0;
+}
+
+/****************************************************************************
+ Show all info we can get
+****************************************************************************/
+
+static int cmd_allinfo(void)
+{
+       TALLOC_CTX *ctx = talloc_tos();
+       char *name;
+       char *buf;
+
+       name = talloc_strdup(ctx, client_get_cur_dir());
+       if (!name) {
+               return 1;
+       }
+
+       if (!next_token_talloc(ctx, &cmd_ptr, &buf, NULL)) {
+               d_printf("allinfo <file>\n");
+               return 1;
+       }
+       name = talloc_asprintf_append(name, buf);
+       if (!name) {
+               return 1;
+       }
+
+       do_allinfo(name);
+
+       return 0;
+}
+
 /****************************************************************************
  Put a single file.
 ****************************************************************************/
@@ -1674,12 +1768,12 @@ static int cmd_put(void)
                return 1;
        }
 
-       if (!next_token_nr_talloc(ctx,NULL,&lname,NULL)) {
+       if (!next_token_talloc(ctx, &cmd_ptr,&lname,NULL)) {
                d_printf("put <filename>\n");
                return 1;
        }
 
-       if (next_token_nr_talloc(ctx, NULL,&buf,NULL)) {
+       if (next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
                rname = talloc_asprintf_append(rname, buf);
        } else {
                rname = talloc_asprintf_append(rname, lname);
@@ -1759,7 +1853,7 @@ static int cmd_select(void)
 {
        TALLOC_CTX *ctx = talloc_tos();
        char *new_fs = NULL;
-       next_token_nr_talloc(ctx, NULL,&new_fs,NULL)
+       next_token_talloc(ctx, &cmd_ptr,&new_fs,NULL)
                ;
        if (new_fs) {
                client_set_fileselection(new_fs);
@@ -1845,7 +1939,7 @@ static int cmd_mput(void)
        TALLOC_CTX *ctx = talloc_tos();
        char *p = NULL;
 
-       while (next_token_nr_talloc(ctx, NULL,&p,NULL)) {
+       while (next_token_talloc(ctx, &cmd_ptr,&p,NULL)) {
                int ret;
                struct file_list *temp_list;
                char *quest, *lname, *rname;
@@ -1956,14 +2050,14 @@ static int cmd_cancel(void)
        char *buf = NULL;
        int job;
 
-       if (!next_token_nr_talloc(ctx, NULL, &buf,NULL)) {
+       if (!next_token_talloc(ctx, &cmd_ptr, &buf,NULL)) {
                d_printf("cancel <jobid> ...\n");
                return 1;
        }
        do {
                job = atoi(buf);
                do_cancel(job);
-       } while (next_token_nr_talloc(ctx,NULL,&buf,NULL));
+       } while (next_token_talloc(ctx, &cmd_ptr,&buf,NULL));
 
        return 0;
 }
@@ -1979,7 +2073,7 @@ static int cmd_print(void)
        char *rname = NULL;
        char *p = NULL;
 
-       if (!next_token_nr_talloc(ctx, NULL, &lname,NULL)) {
+       if (!next_token_talloc(ctx, &cmd_ptr, &lname,NULL)) {
                d_printf("print <filename>\n");
                return 1;
        }
@@ -2075,7 +2169,7 @@ static int cmd_del(void)
        if (!mask) {
                return 1;
        }
-       if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) {
+       if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
                d_printf("del <filename>\n");
                return 1;
        }
@@ -2101,14 +2195,14 @@ static int cmd_wdel(void)
        struct cli_state *targetcli;
        char *targetname = NULL;
 
-       if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) {
+       if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
                d_printf("wdel 0x<attrib> <wcard>\n");
                return 1;
        }
 
        attribute = (uint16)strtol(buf, (char **)NULL, 16);
 
-       if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) {
+       if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
                d_printf("wdel 0x<attrib> <wcard>\n");
                return 1;
        }
@@ -2143,7 +2237,7 @@ static int cmd_open(void)
        struct cli_state *targetcli;
        int fnum;
 
-       if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) {
+       if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
                d_printf("open <filename>\n");
                return 1;
        }
@@ -2174,6 +2268,49 @@ static int cmd_open(void)
        return 0;
 }
 
+static int cmd_posix_encrypt(void)
+{
+       TALLOC_CTX *ctx = talloc_tos();
+       NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
+
+       if (cli->use_kerberos) {
+               status = cli_gss_smb_encryption_start(cli);
+       } else {
+               char *domain = NULL;
+               char *user = NULL;
+               char *password = NULL;
+
+               if (!next_token_talloc(ctx, &cmd_ptr,&domain,NULL)) {
+                       d_printf("posix_encrypt domain user password\n");
+                       return 1;
+               }
+
+               if (!next_token_talloc(ctx, &cmd_ptr,&user,NULL)) {
+                       d_printf("posix_encrypt domain user password\n");
+                       return 1;
+               }
+
+               if (!next_token_talloc(ctx, &cmd_ptr,&password,NULL)) {
+                       d_printf("posix_encrypt domain user password\n");
+                       return 1;
+               }
+
+               status = cli_raw_ntlm_smb_encryption_start(cli,
+                                                       user,
+                                                       password,
+                                                       domain);
+       }
+
+       if (!NT_STATUS_IS_OK(status)) {
+               d_printf("posix_encrypt failed with error %s\n", nt_errstr(status));
+       } else {
+               d_printf("encryption on\n");
+               smb_encrypt = true;
+       }
+
+       return 0;
+}
+
 /****************************************************************************
 ****************************************************************************/
 
@@ -2187,7 +2324,7 @@ static int cmd_posix_open(void)
        mode_t mode;
        int fnum;
 
-       if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) {
+       if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
                d_printf("posix_open <filename> 0<mode>\n");
                return 1;
        }
@@ -2199,7 +2336,7 @@ static int cmd_posix_open(void)
                return 1;
        }
 
-       if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) {
+       if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
                d_printf("posix_open <filename> 0<mode>\n");
                return 1;
        }
@@ -2235,7 +2372,7 @@ static int cmd_posix_mkdir(void)
        mode_t mode;
        int fnum;
 
-       if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) {
+       if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
                d_printf("posix_mkdir <filename> 0<mode>\n");
                return 1;
        }
@@ -2247,7 +2384,7 @@ static int cmd_posix_mkdir(void)
                return 1;
        }
 
-       if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) {
+       if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
                d_printf("posix_mkdir <filename> 0<mode>\n");
                return 1;
        }
@@ -2275,7 +2412,7 @@ static int cmd_posix_unlink(void)
        char *targetname = NULL;
        struct cli_state *targetcli;
 
-       if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) {
+       if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
                d_printf("posix_unlink <filename>\n");
                return 1;
        }
@@ -2309,7 +2446,7 @@ static int cmd_posix_rmdir(void)
        char *targetname = NULL;
        struct cli_state *targetcli;
 
-       if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) {
+       if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
                d_printf("posix_rmdir <filename>\n");
                return 1;
        }
@@ -2341,7 +2478,7 @@ static int cmd_close(void)
        char *buf = NULL;
        int fnum;
 
-       if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) {
+       if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
                d_printf("close <fnum>\n");
                return 1;
        }
@@ -2420,17 +2557,30 @@ static int cmd_posix(void)
                        return 1;
                }
        }
+       if (caplow & CIFS_UNIX_TRANSPORT_ENCRYPTION_CAP) {
+               caps = talloc_asprintf_append(caps, "posix_encrypt ");
+               if (!caps) {
+                       return 1;
+               }
+       }
+       if (caplow & CIFS_UNIX_TRANSPORT_ENCRYPTION_MANDATORY_CAP) {
+               caps = talloc_asprintf_append(caps, "mandatory_posix_encrypt ");
+               if (!caps) {
+                       return 1;
+               }
+       }
 
        if (*caps && caps[strlen(caps)-1] == ' ') {
                caps[strlen(caps)-1] = '\0';
        }
+
+       d_printf("Server supports CIFS capabilities %s\n", caps);
+
        if (!cli_set_unix_extensions_capabilities(cli, major, minor, caplow, caphigh)) {
                d_printf("Can't set UNIX CIFS extensions capabilities. %s.\n", cli_errstr(cli));
                return 1;
        }
 
-       d_printf("Selecting server supported CIFS capabilities %s\n", caps);
-
        if (caplow & CIFS_UNIX_POSIX_PATHNAMES_CAP) {
                CLI_DIRSEP_CHAR = '/';
                *CLI_DIRSEP_STR = '/';
@@ -2448,13 +2598,13 @@ static int cmd_lock(void)
        enum brl_type lock_type;
        int fnum;
 
-       if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) {
+       if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
                d_printf("lock <fnum> [r|w] <hex-start> <hex-len>\n");
                return 1;
        }
        fnum = atoi(buf);
 
-       if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) {
+       if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
                d_printf("lock <fnum> [r|w] <hex-start> <hex-len>\n");
                return 1;
        }
@@ -2468,14 +2618,14 @@ static int cmd_lock(void)
                return 1;
        }
 
-       if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) {
+       if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
                d_printf("lock <fnum> [r|w] <hex-start> <hex-len>\n");
                return 1;
        }
 
        start = (SMB_BIG_UINT)strtol(buf, (char **)NULL, 16);
 
-       if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) {
+       if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
                d_printf("lock <fnum> [r|w] <hex-start> <hex-len>\n");
                return 1;
        }
@@ -2496,20 +2646,20 @@ static int cmd_unlock(void)
        SMB_BIG_UINT start, len;
        int fnum;
 
-       if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) {
+       if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
                d_printf("unlock <fnum> <hex-start> <hex-len>\n");
                return 1;
        }
        fnum = atoi(buf);
 
-       if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) {
+       if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
                d_printf("unlock <fnum> <hex-start> <hex-len>\n");
                return 1;
        }
 
        start = (SMB_BIG_UINT)strtol(buf, (char **)NULL, 16);
 
-       if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) {
+       if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
                d_printf("unlock <fnum> <hex-start> <hex-len>\n");
                return 1;
        }
@@ -2536,7 +2686,7 @@ static int cmd_rmdir(void)
        char *targetname = NULL;
        struct cli_state *targetcli;
 
-       if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) {
+       if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
                d_printf("rmdir <dirname>\n");
                return 1;
        }
@@ -2575,8 +2725,8 @@ static int cmd_link(void)
        char *targetname = NULL;
        struct cli_state *targetcli;
 
-       if (!next_token_nr_talloc(ctx,NULL,&buf,NULL) ||
-           !next_token_nr_talloc(ctx,NULL,&buf2,NULL)) {
+       if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL) ||
+           !next_token_talloc(ctx, &cmd_ptr,&buf2,NULL)) {
                d_printf("link <oldname> <newname>\n");
                return 1;
        }
@@ -2626,8 +2776,8 @@ static int cmd_symlink(void)
        char *targetname = NULL;
        struct cli_state *targetcli;
 
-       if (!next_token_nr_talloc(ctx,NULL,&buf,NULL) ||
-           !next_token_nr_talloc(ctx,NULL,&buf2,NULL)) {
+       if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL) ||
+           !next_token_talloc(ctx, &cmd_ptr,&buf2,NULL)) {
                d_printf("symlink <oldname> <newname>\n");
                return 1;
        }
@@ -2679,8 +2829,8 @@ static int cmd_chmod(void)
        struct cli_state *targetcli;
        mode_t mode;
 
-       if (!next_token_nr_talloc(ctx,NULL,&buf,NULL) ||
-           !next_token_nr_talloc(ctx,NULL,&buf2,NULL)) {
+       if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL) ||
+           !next_token_talloc(ctx, &cmd_ptr,&buf2,NULL)) {
                d_printf("chmod mode file\n");
                return 1;
        }
@@ -2835,7 +2985,7 @@ static int cmd_getfacl(void)
        uint16 num_dir_acls = 0;
        uint16 i;
 
-       if (!next_token_nr_talloc(ctx,NULL,&name,NULL)) {
+       if (!next_token_talloc(ctx, &cmd_ptr,&name,NULL)) {
                d_printf("getfacl filename\n");
                return 1;
        }
@@ -3001,7 +3151,7 @@ static int cmd_stat(void)
        SMB_STRUCT_STAT sbuf;
        struct tm *lt;
 
-       if (!next_token_nr_talloc(ctx,NULL,&name,NULL)) {
+       if (!next_token_talloc(ctx, &cmd_ptr,&name,NULL)) {
                d_printf("stat file\n");
                return 1;
        }
@@ -3097,9 +3247,9 @@ static int cmd_chown(void)
        struct cli_state *targetcli;
        char *targetname = NULL;
 
-       if (!next_token_nr_talloc(ctx,NULL,&buf,NULL) ||
-           !next_token_nr_talloc(ctx,NULL,&buf2,NULL) ||
-           !next_token_nr_talloc(ctx,NULL,&buf3,NULL)) {
+       if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL) ||
+           !next_token_talloc(ctx, &cmd_ptr,&buf2,NULL) ||
+           !next_token_talloc(ctx, &cmd_ptr,&buf3,NULL)) {
                d_printf("chown uid gid file\n");
                return 1;
        }
@@ -3146,8 +3296,8 @@ static int cmd_rename(void)
        char *targetsrc;
        char *targetdest;
 
-       if (!next_token_nr_talloc(ctx,NULL,&buf,NULL) ||
-           !next_token_nr_talloc(ctx,NULL,&buf2,NULL)) {
+       if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL) ||
+           !next_token_talloc(ctx, &cmd_ptr,&buf2,NULL)) {
                d_printf("rename <src> <dest>\n");
                return 1;
        }
@@ -3221,8 +3371,8 @@ static int cmd_hardlink(void)
        struct cli_state *targetcli;
        char *targetname;
 
-       if (!next_token_nr_talloc(ctx,NULL,&buf,NULL) ||
-           !next_token_nr_talloc(ctx,NULL,&buf2,NULL)) {
+       if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL) ||
+           !next_token_talloc(ctx, &cmd_ptr,&buf2,NULL)) {
                d_printf("hardlink <src> <dest>\n");
                return 1;
        }
@@ -3278,7 +3428,7 @@ static int cmd_newer(void)
        bool ok;
        SMB_STRUCT_STAT sbuf;
 
-       ok = next_token_nr_talloc(ctx,NULL,&buf,NULL);
+       ok = next_token_talloc(ctx, &cmd_ptr,&buf,NULL);
        if (ok && (sys_stat(buf,&sbuf) == 0)) {
                newer_than = sbuf.st_mtime;
                DEBUG(1,("Getting files newer than %s",
@@ -3304,7 +3454,7 @@ static int cmd_archive(void)
        TALLOC_CTX *ctx = talloc_tos();
        char *buf;
 
-       if (next_token_nr_talloc(ctx,NULL,&buf,NULL)) {
+       if (next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
                archive_level = atoi(buf);
        } else {
                d_printf("Archive level is %d\n",archive_level);
@@ -3383,7 +3533,7 @@ static int cmd_lcd(void)
        char *buf;
        char *d;
 
-       if (next_token_nr_talloc(ctx,NULL,&buf,NULL)) {
+       if (next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
                chdir(buf);
        }
        d = TALLOC_ARRAY(ctx, char, PATH_MAX+1);
@@ -3414,7 +3564,7 @@ static int cmd_reget(void)
                return 1;
        }
 
-       if (!next_token_nr_talloc(ctx, NULL, &fname, NULL)) {
+       if (!next_token_talloc(ctx, &cmd_ptr, &fname, NULL)) {
                d_printf("reget <filename>\n");
                return 1;
        }
@@ -3428,7 +3578,7 @@ static int cmd_reget(void)
        }
 
        local_name = fname;
-       next_token_nr_talloc(ctx, NULL, &p, NULL);
+       next_token_talloc(ctx, &cmd_ptr, &p, NULL);
        if (p) {
                local_name = p;
        }
@@ -3456,7 +3606,7 @@ static int cmd_reput(void)
                return 1;
        }
 
-       if (!next_token_nr_talloc(ctx, NULL, &local_name, NULL)) {
+       if (!next_token_talloc(ctx, &cmd_ptr, &local_name, NULL)) {
                d_printf("reput <filename>\n");
                return 1;
        }
@@ -3466,7 +3616,7 @@ static int cmd_reput(void)
                return 1;
        }
 
-       if (next_token_nr_talloc(ctx, NULL, &buf, NULL)) {
+       if (next_token_talloc(ctx, &cmd_ptr, &buf, NULL)) {
                remote_name = talloc_asprintf_append(remote_name,
                                                buf);
        } else {
@@ -3640,7 +3790,7 @@ static int cmd_vuid(void)
        TALLOC_CTX *ctx = talloc_tos();
        char *buf;
 
-       if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) {
+       if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
                d_printf("Current VUID is %d\n", cli->vuid);
                return 0;
        }
@@ -3658,12 +3808,12 @@ static int cmd_logon(void)
        TALLOC_CTX *ctx = talloc_tos();
        char *l_username, *l_password;
 
-       if (!next_token_nr_talloc(ctx,NULL,&l_username,NULL)) {
+       if (!next_token_talloc(ctx, &cmd_ptr,&l_username,NULL)) {
                d_printf("logon <username> [<password>]\n");
                return 0;
        }
 
-       if (!next_token_nr_talloc(ctx,NULL,&l_password,NULL)) {
+       if (!next_token_talloc(ctx, &cmd_ptr,&l_password,NULL)) {
                char *pass = getpass("Password: ");
                if (pass) {
                        l_password = talloc_strdup(ctx,pass);
@@ -3726,17 +3876,29 @@ int cmd_iosize(void)
        char *buf;
        int iosize;
 
-       if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) {
-               d_printf("iosize <n> or iosize 0x<n>. "
-                       "Minimum is 16384 (0x4000), "
-                       "max is 16776960 (0xFFFF00)\n");
+       if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
+               if (!smb_encrypt) {
+                       d_printf("iosize <n> or iosize 0x<n>. "
+                               "Minimum is 16384 (0x4000), "
+                               "max is 16776960 (0xFFFF00)\n");
+               } else {
+                       d_printf("iosize <n> or iosize 0x<n>. "
+                               "(Encrypted connection) ,"
+                               "Minimum is 16384 (0x4000), "
+                               "max is 130048 (0x1FC00)\n");
+               }
                return 1;
        }
 
        iosize = strtol(buf,NULL,0);
-       if (iosize < 0 || iosize > 0xFFFF00) {
+       if (smb_encrypt && (iosize < 0x4000 || iosize > 0xFC00)) {
+               d_printf("iosize out of range for encrypted "
+                       "connection (min = 16384 (0x4000), "
+                       "max = 130048 (0x1FC00)");
+               return 1;
+       } else if (!smb_encrypt && (iosize < 0x4000 || iosize > 0xFFFF00)) {
                d_printf("iosize out of range (min = 16384 (0x4000), "
-                       "max = 16776960 (0x0xFFFF00)");
+                       "max = 16776960 (0xFFFF00)");
                return 1;
        }
 
@@ -3764,6 +3926,8 @@ static struct {
        char compl_args[2];      /* Completion argument info */
 } commands[] = {
   {"?",cmd_help,"[command] give help on a command",{COMPL_NONE,COMPL_NONE}},
+  {"allinfo",cmd_allinfo,"<file> show all available info",
+   {COMPL_NONE,COMPL_NONE}},
   {"altname",cmd_altname,"<file> show alt name",{COMPL_NONE,COMPL_NONE}},
   {"archive",cmd_archive,"<level>\n0=ignore archive bit\n1=only get archive files\n2=only get archive files and reset archive bit\n3=get all files and reset archive bit",{COMPL_NONE,COMPL_NONE}},
   {"blocksize",cmd_block,"blocksize <number> (default 20)",{COMPL_NONE,COMPL_NONE}},
@@ -3799,6 +3963,7 @@ static struct {
   {"newer",cmd_newer,"<file> only mget files newer than the specified local file",{COMPL_LOCAL,COMPL_NONE}},
   {"open",cmd_open,"<mask> open a file",{COMPL_REMOTE,COMPL_NONE}},
   {"posix", cmd_posix, "turn on all POSIX capabilities", {COMPL_REMOTE,COMPL_NONE}},
+  {"posix_encrypt",cmd_posix_encrypt,"<domain> <user> <password> start up transport encryption",{COMPL_REMOTE,COMPL_NONE}},
   {"posix_open",cmd_posix_open,"<name> 0<mode> open_flags mode open a file using POSIX interface",{COMPL_REMOTE,COMPL_NONE}},
   {"posix_mkdir",cmd_posix_mkdir,"<name> 0<mode> creates a directory using POSIX interface",{COMPL_REMOTE,COMPL_NONE}},
   {"posix_rmdir",cmd_posix_rmdir,"<name> removes a directory using POSIX interface",{COMPL_REMOTE,COMPL_NONE}},
@@ -3879,7 +4044,7 @@ static int cmd_help(void)
        int i=0,j;
        char *buf;
 
-       if (next_token_nr_talloc(ctx,NULL,&buf,NULL)) {
+       if (next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
                if ((i = process_tok(buf)) >= 0)
                        d_printf("HELP %s:\n\t%s\n\n",
                                commands[i].name,commands[i].description);
@@ -3911,7 +4076,8 @@ static int process_command_string(const char *cmd_in)
        /* establish the connection if not already */
 
        if (!cli) {
-               cli = cli_cm_open(talloc_tos(), NULL, desthost, service, true);
+               cli = cli_cm_open(talloc_tos(), NULL, desthost,
+                               service, true, smb_encrypt);
                if (!cli) {
                        return 1;
                }
@@ -3919,7 +4085,6 @@ static int process_command_string(const char *cmd_in)
 
        while (cmd[0] != '\0')    {
                char *line;
-               const char *ptr;
                char *p;
                char *tok;
                int i;
@@ -3934,8 +4099,8 @@ static int process_command_string(const char *cmd_in)
                }
 
                /* and get the first part of the command */
-               ptr = line;
-               if (!next_token_nr_talloc(ctx,&ptr,&tok,NULL)) {
+               cmd_ptr = line;
+               if (!next_token_talloc(ctx, &cmd_ptr,&tok,NULL)) {
                        continue;
                }
 
@@ -4252,16 +4417,22 @@ static void readline_callback(void)
        timeout.tv_usec = 0;
        sys_select_intr(cli->fd+1,&fds,NULL,NULL,&timeout);
 
-       /* We deliberately use receive_smb instead of
+       /* We deliberately use receive_smb_raw instead of
           client_receive_smb as we want to receive
           session keepalives and then drop them here.
        */
        if (FD_ISSET(cli->fd,&fds)) {
-               if (!receive_smb(cli->fd,cli->inbuf,0,&cli->smb_rw_error)) {
+               if (receive_smb_raw(cli->fd,cli->inbuf,0,0,&cli->smb_rw_error) == -1) {
                        DEBUG(0, ("Read from server failed, maybe it closed the "
                                "connection\n"));
                        return;
                }
+               if(CVAL(cli->inbuf,0) != SMBkeepalive) {
+                       DEBUG(0, ("Read from server "
+                               "returned unexpected packet!\n"));
+                       return;
+               }
+
                goto again;
        }
 
@@ -4279,7 +4450,6 @@ static void readline_callback(void)
 
 static int process_stdin(void)
 {
-       const char *ptr;
        int rc = 0;
 
        while (1) {
@@ -4310,8 +4480,8 @@ static int process_stdin(void)
                }
 
                /* and get the first part of the command */
-               ptr = line;
-               if (!next_token_nr_talloc(frame,&ptr,&tok,NULL)) {
+               cmd_ptr = line;
+               if (!next_token_talloc(frame, &cmd_ptr,&tok,NULL)) {
                        TALLOC_FREE(frame);
                        SAFE_FREE(line);
                        continue;
@@ -4338,7 +4508,8 @@ static int process(const char *base_directory)
 {
        int rc = 0;
 
-       cli = cli_cm_open(talloc_tos(), NULL, desthost, service, true);
+       cli = cli_cm_open(talloc_tos(), NULL,
+                       desthost, service, true, smb_encrypt);
        if (!cli) {
                return 1;
        }
@@ -4367,7 +4538,8 @@ static int process(const char *base_directory)
 
 static int do_host_query(const char *query_host)
 {
-       cli = cli_cm_open(talloc_tos(), NULL, query_host, "IPC$", true);
+       cli = cli_cm_open(talloc_tos(), NULL,
+                       query_host, "IPC$", true, smb_encrypt);
        if (!cli)
                return 1;
 
@@ -4380,7 +4552,8 @@ static int do_host_query(const char *query_host)
 
                cli_cm_shutdown();
                cli_cm_set_port( 139 );
-               cli = cli_cm_open(talloc_tos(), NULL, query_host, "IPC$", true);
+               cli = cli_cm_open(talloc_tos(), NULL,
+                               query_host, "IPC$", true, smb_encrypt);
        }
 
        if (cli == NULL) {
@@ -4405,7 +4578,8 @@ static int do_tar_op(const char *base_directory)
 
        /* do we already have a connection? */
        if (!cli) {
-               cli = cli_cm_open(talloc_tos(), NULL, desthost, service, true);
+               cli = cli_cm_open(talloc_tos(), NULL,
+                       desthost, service, true, smb_encrypt);
                if (!cli)
                        return 1;
        }
@@ -4512,6 +4686,7 @@ static int do_message_op(void)
                { "send-buffer", 'b', POPT_ARG_INT, &io_bufsize, 'b', "Changes the transmit/send buffer", "BYTES" },
                { "port", 'p', POPT_ARG_INT, &port, 'p', "Port to connect to", "PORT" },
                { "grepable", 'g', POPT_ARG_NONE, NULL, 'g', "Produce grepable output" },
+                { "browse", 'B', POPT_ARG_NONE, NULL, 'B', "Browse SMB servers using DNS" },
                POPT_COMMON_SAMBA
                POPT_COMMON_CONNECTION
                POPT_COMMON_CREDENTIALS
@@ -4538,7 +4713,7 @@ static int do_message_op(void)
        set_global_myworkgroup( "" );
        set_global_myname( "" );
 
-        /* set default debug level to 0 regardless of what smb.conf sets */
+        /* set default debug level to 1 regardless of what smb.conf sets */
        setup_logging( "smbclient", true );
        DEBUGLEVEL_CLASS[DBGC_ALL] = 1;
        if ((dbf = x_fdup(x_stderr))) {
@@ -4654,6 +4829,12 @@ static int do_message_op(void)
                case 'g':
                        grepable=true;
                        break;
+               case 'e':
+                       smb_encrypt=true;
+                       break;
+               case 'B':
+                       return(do_smb_browse());
+
                }
        }
 
@@ -4741,6 +4922,7 @@ static int do_message_op(void)
                calling_name = talloc_strdup(frame, global_myname() );
        }
 
+       smb_encrypt = get_cmdline_auth_info_smb_encrypt();
        init_names();
 
        if(new_name_resolve_order)
index 0b4a8b2943846c2c7d102c8a7c14533b4ea661b6..04cc987889428937047e56e5b9e83baa22f1ec4d 100644 (file)
@@ -100,6 +100,7 @@ char tar_type='\0';
 static char **cliplist=NULL;
 static int clipn=0;
 static bool must_free_cliplist = False;
+static const char *cmd_ptr = NULL;
 
 extern bool lowercase;
 extern uint16 cnum;
@@ -512,6 +513,7 @@ static bool ensurepath(const char *fname)
        char *partpath, *ffname;
        const char *p=fname;
        char *basehack;
+       char *saveptr;
 
        DEBUG(5, ( "Ensurepath called with: %s\n", fname));
 
@@ -527,7 +529,7 @@ static bool ensurepath(const char *fname)
 
        *partpath = 0;
 
-       /* fname copied to ffname so can strtok */
+       /* fname copied to ffname so can strtok_r */
 
        safe_strcpy(ffname, fname, strlen(fname));
 
@@ -540,7 +542,7 @@ static bool ensurepath(const char *fname)
                *basehack='\0';
        }
 
-       p=strtok(ffname, "\\");
+       p=strtok_r(ffname, "\\", &saveptr);
 
        while (p) {
                safe_strcat(partpath, p, strlen(fname) + 1);
@@ -557,7 +559,7 @@ static bool ensurepath(const char *fname)
                }
 
                safe_strcat(partpath, "\\", strlen(fname) + 1);
-               p = strtok(NULL,"/\\");
+               p = strtok_r(NULL, "/\\", &saveptr);
        }
 
        SAFE_FREE(partpath);
@@ -1273,7 +1275,7 @@ int cmd_block(void)
        char *buf;
        int block;
 
-       if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) {
+       if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
                DEBUG(0, ("blocksize <n>\n"));
                return 1;
        }
@@ -1298,7 +1300,7 @@ int cmd_tarmode(void)
        TALLOC_CTX *ctx = talloc_tos();
        char *buf;
 
-       while (next_token_nr_talloc(ctx,NULL,&buf,NULL)) {
+       while (next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
                if (strequal(buf, "full"))
                        tar_inc=False;
                else if (strequal(buf, "inc"))
@@ -1348,7 +1350,7 @@ int cmd_setmode(void)
 
        attra[0] = attra[1] = 0;
 
-       if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) {
+       if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
                DEBUG(0, ("setmode <filename> <[+|-]rsha>\n"));
                return 1;
        }
@@ -1361,7 +1363,7 @@ int cmd_setmode(void)
                return 1;
        }
 
-       while (next_token_nr_talloc(ctx,NULL,&buf,NULL)) {
+       while (next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
                q=buf;
 
                while(*q) {
@@ -1402,6 +1404,55 @@ int cmd_setmode(void)
        return 0;
 }
 
+/**
+ Convert list of tokens to array; dependent on above routine.
+ Uses the global cmd_ptr from above - bit of a hack.
+**/
+
+static char **toktocliplist(int *ctok, const char *sep)
+{
+       char *s=(char *)cmd_ptr;
+       int ictok=0;
+       char **ret, **iret;
+
+       if (!sep)
+               sep = " \t\n\r";
+
+       while(*s && strchr_m(sep,*s))
+               s++;
+
+       /* nothing left? */
+       if (!*s)
+               return(NULL);
+
+       do {
+               ictok++;
+               while(*s && (!strchr_m(sep,*s)))
+                       s++;
+               while(*s && strchr_m(sep,*s))
+                       *s++=0;
+       } while(*s);
+
+       *ctok=ictok;
+       s=(char *)cmd_ptr;
+
+       if (!(ret=iret=SMB_MALLOC_ARRAY(char *,ictok+1)))
+               return NULL;
+
+       while(ictok--) {
+               *iret++=s;
+               if (ictok > 0) {
+                       while(*s++)
+                               ;
+                       while(!*s)
+                               s++;
+               }
+       }
+
+       ret[*ctok] = NULL;
+       return ret;
+}
+
 /****************************************************************************
 Principal command for creating / extracting
 ***************************************************************************/
@@ -1414,14 +1465,16 @@ int cmd_tar(void)
        int argcl = 0;
        int ret;
 
-       if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) {
+       if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
                DEBUG(0,("tar <c|x>[IXbgan] <filename>\n"));
                return 1;
        }
 
        argl=toktocliplist(&argcl, NULL);
-       if (!tar_parseargs(argcl, argl, buf, 0))
+       if (!tar_parseargs(argcl, argl, buf, 0)) {
+               SAFE_FREE(argl);
                return 1;
+       }
 
        ret = process_tar();
        SAFE_FREE(argl);
diff --git a/source/client/dnsbrowse.c b/source/client/dnsbrowse.c
new file mode 100644 (file)
index 0000000..5e3a4de
--- /dev/null
@@ -0,0 +1,237 @@
+/*
+   Unix SMB/CIFS implementation.
+   DNS-SD browse client
+   Copyright (C) Rishi Srivatsavai 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 "client/client_proto.h"
+
+#ifdef WITH_DNSSD_SUPPORT
+
+#include <dns_sd.h>
+
+/* Holds service instances found during DNS browse */
+struct mdns_smbsrv_result
+{
+       char *serviceName;
+       char *regType;
+       char *domain;
+       uint32_t ifIndex;
+       struct mdns_smbsrv_result *nextResult;
+};
+
+/* Maintains state during DNS browse */
+struct mdns_browse_state
+{
+       struct mdns_smbsrv_result *listhead; /* Browse result list head */
+       int browseDone;
+
+};
+
+
+static void
+do_smb_resolve_reply (DNSServiceRef sdRef, DNSServiceFlags flags,
+               uint32_t interfaceIndex, DNSServiceErrorType errorCode,
+               const char *fullname, const char *hosttarget, uint16_t port,
+               uint16_t txtLen, const unsigned char *txtRecord, void *context)
+{
+       printf("SMB service available on %s port %u\n",
+               hosttarget, ntohs(port));
+}
+
+
+static void do_smb_resolve(struct mdns_smbsrv_result *browsesrv)
+{
+       DNSServiceRef mdns_conn_sdref = NULL;
+       int mdnsfd;
+       int fdsetsz;
+       int ret;
+       fd_set *fdset = NULL;
+       struct timeval tv;
+       DNSServiceErrorType err;
+
+       TALLOC_CTX * ctx = talloc_tos();
+
+       err = DNSServiceResolve(&mdns_conn_sdref, 0 /* flags */,
+               browsesrv->ifIndex,
+               browsesrv->serviceName, browsesrv->regType, browsesrv->domain,
+               do_smb_resolve_reply, NULL);
+
+       if (err != kDNSServiceErr_NoError) {
+               return;
+       }
+
+       mdnsfd = DNSServiceRefSockFD(mdns_conn_sdref);
+       for (;;)  {
+               if (fdset != NULL) {
+                       TALLOC_FREE(fdset);
+               }
+
+               fdsetsz = howmany(mdnsfd + 1, NFDBITS) * sizeof(fd_mask);
+               fdset = TALLOC_ZERO(ctx, fdsetsz);
+               FD_SET(mdnsfd, fdset);
+
+               tv.tv_sec = 1;
+               tv.tv_usec = 0;
+
+               /* Wait until response received from mDNS daemon */
+               ret = sys_select(mdnsfd + 1, fdset, NULL, NULL, &tv);
+               if (ret <= 0 && errno != EINTR) {
+                       break;
+               }
+
+               if (FD_ISSET(mdnsfd, fdset)) {
+                       /* Invoke callback function */
+                       DNSServiceProcessResult(mdns_conn_sdref);
+                       break;
+               }
+       }
+
+       TALLOC_FREE(fdset);
+       DNSServiceRefDeallocate(mdns_conn_sdref);
+}
+
+
+static void
+do_smb_browse_reply(DNSServiceRef sdRef, DNSServiceFlags flags,
+        uint32_t interfaceIndex, DNSServiceErrorType errorCode,
+        const char  *serviceName, const char *regtype,
+        const char  *replyDomain, void  *context)
+{
+       struct mdns_browse_state *bstatep = (struct mdns_browse_state *)context;
+       struct mdns_smbsrv_result *bresult;
+
+       if (bstatep == NULL) {
+               return;
+       }
+
+       if (errorCode != kDNSServiceErr_NoError) {
+               bstatep->browseDone = 1;
+               return;
+       }
+
+       if (flags & kDNSServiceFlagsMoreComing) {
+               bstatep->browseDone = 0;
+       } else {
+               bstatep->browseDone = 1;
+       }
+
+       if (!(flags & kDNSServiceFlagsAdd)) {
+               return;
+       }
+
+       bresult = TALLOC_ARRAY(talloc_tos(), struct mdns_smbsrv_result, 1);
+       if (bresult == NULL) {
+               return;
+       }
+
+       if (bstatep->listhead != NULL) {
+               bresult->nextResult = bstatep->listhead;
+       }
+
+       bresult->serviceName = talloc_strdup(talloc_tos(), serviceName);
+       bresult->regType = talloc_strdup(talloc_tos(), regtype);
+       bresult->domain = talloc_strdup(talloc_tos(), replyDomain);
+       bresult->ifIndex = interfaceIndex;
+       bstatep->listhead = bresult;
+}
+
+int do_smb_browse(void)
+{
+       int mdnsfd;
+       int fdsetsz;
+       int ret;
+       fd_set *fdset = NULL;
+       struct mdns_browse_state bstate;
+       struct mdns_smbsrv_result *resptr;
+       struct timeval tv;
+       DNSServiceRef mdns_conn_sdref = NULL;
+       DNSServiceErrorType err;
+
+       TALLOC_CTX * ctx = talloc_stackframe();
+
+       ZERO_STRUCT(bstate);
+
+       err = DNSServiceBrowse(&mdns_conn_sdref, 0, 0, "_smb._tcp", "",
+                       do_smb_browse_reply, &bstate);
+
+       if (err != kDNSServiceErr_NoError) {
+               d_printf("Error connecting to the Multicast DNS daemon\n");
+               TALLOC_FREE(ctx);
+               return 1;
+       }
+
+       mdnsfd = DNSServiceRefSockFD(mdns_conn_sdref);
+       for (;;)  {
+               if (fdset != NULL) {
+                       TALLOC_FREE(fdset);
+               }
+
+               fdsetsz = howmany(mdnsfd + 1, NFDBITS) * sizeof(fd_mask);
+               fdset = TALLOC_ZERO(ctx, fdsetsz);
+               FD_SET(mdnsfd, fdset);
+
+               tv.tv_sec = 1;
+               tv.tv_usec = 0;
+
+               /* Wait until response received from mDNS daemon */
+               ret = sys_select(mdnsfd + 1, fdset, NULL, NULL, &tv);
+               if (ret <= 0 && errno != EINTR) {
+                       break;
+               }
+
+               if (FD_ISSET(mdnsfd, fdset)) {
+                       /* Invoke callback function */
+                       if (DNSServiceProcessResult(mdns_conn_sdref)) {
+                               break;
+                       }
+                       if (bstate.browseDone) {
+                               break;
+                       }
+               }
+       }
+
+       DNSServiceRefDeallocate(mdns_conn_sdref);
+
+       if (bstate.listhead != NULL) {
+               resptr = bstate.listhead;
+               while (resptr != NULL) {
+                       struct mdns_smbsrv_result *oldresptr;
+                       oldresptr = resptr;
+
+                       /* Resolve smb service instance */
+                       do_smb_resolve(resptr);
+
+                       resptr = resptr->nextResult;
+               }
+       }
+
+       TALLOC_FREE(ctx);
+       return 0;
+}
+
+#else /* WITH_DNSSD_SUPPORT */
+
+int do_smb_browse(void)
+{
+    d_printf("DNS-SD browsing is not supported on this platform\n");
+    return 1;
+}
+
+#endif /* WITH_DNSSD_SUPPORT */
+
+
index ec245ed200054df70778adbd44980d921711c8f2..79f402a7d486cc6ae2d09a0cd81dbbfba459d553 100644 (file)
@@ -39,7 +39,7 @@
 #include <fcntl.h>
 
 #define MOUNT_CIFS_VERSION_MAJOR "1"
-#define MOUNT_CIFS_VERSION_MINOR "10"
+#define MOUNT_CIFS_VERSION_MINOR "11"
 
 #ifndef MOUNT_CIFS_VENDOR_SUFFIX
  #ifdef _SAMBA_BUILD_
@@ -62,6 +62,8 @@
 #define MS_BIND 4096
 #endif
 
+#define MAX_UNC_LEN 1024
+
 #define CONST_DISCARD(type, ptr)      ((type) ((void *) (ptr)))
 
 const char *thisprogram;
@@ -73,7 +75,6 @@ static int got_ip = 0;
 static int got_unc = 0;
 static int got_uid = 0;
 static int got_gid = 0;
-static int free_share_name = 0;
 static char * user_name = NULL;
 static char * mountpassword = NULL;
 char * domain_name = NULL;
@@ -135,14 +136,16 @@ static void mount_cifs_usage(void)
        printf("\nLess commonly used options:");
        printf("\n\tcredentials=<filename>,guest,perm,noperm,setuids,nosetuids,rw,ro,");
        printf("\n\tsep=<char>,iocharset=<codepage>,suid,nosuid,exec,noexec,serverino,");
-       printf("\n\tdirectio,mapchars,nomapchars,nolock,servernetbiosname=<SRV_RFC1001NAME>");
+       printf("\n\tmapchars,nomapchars,nolock,servernetbiosname=<SRV_RFC1001NAME>");
+       printf("\n\tdirectio,nounix,cifsacl,sec=<authentication mechanism>,sign");
        printf("\n\nOptions not needed for servers supporting CIFS Unix extensions");
        printf("\n\t(e.g. unneeded for mounts to most Samba versions):");
        printf("\n\tuid=<uid>,gid=<gid>,dir_mode=<mode>,file_mode=<mode>,sfu");
        printf("\n\nRarely used options:");
        printf("\n\tport=<tcpport>,rsize=<size>,wsize=<size>,unc=<unc_name>,ip=<ip_address>,");
        printf("\n\tdev,nodev,nouser_xattr,netbiosname=<OUR_RFC1001NAME>,hard,soft,intr,");
-       printf("\n\tnointr,ignorecase,noposixpaths,noacl");
+       printf("\n\tnointr,ignorecase,noposixpaths,noacl,prefixpath=<path>,nobrl");
+       printf("\n\tin6_addr");
        printf("\n\nOptions are described in more detail in the manual page");
        printf("\n\tman 8 mount.cifs\n");
        printf("\nTo display the version number of the mount helper:");
@@ -828,17 +831,27 @@ static char * check_for_domain(char **ppuser)
        return domainnm;
 }
 
+/* replace all occurances of "from" in a string with "to" */
+static void replace_char(char *string, char from, char to)
+{
+       while (string) {
+               string = strchr(string, from);
+               if (string)
+                       *string = to;
+       }
+}
+
 /* Note that caller frees the returned buffer if necessary */
 static char * parse_server(char ** punc_name)
 {
        char * unc_name = *punc_name;
-       int length = strnlen(unc_name,1024);
+       int length = strnlen(unc_name, MAX_UNC_LEN);
        char * share;
        char * ipaddress_string = NULL;
        struct hostent * host_entry = NULL;
        struct in_addr server_ipaddr;
 
-       if(length > 1023) {
+       if(length > (MAX_UNC_LEN - 1)) {
                printf("mount error: UNC name too long");
                return NULL;
        }
@@ -857,7 +870,6 @@ static char * parse_server(char ** punc_name)
                        /* check for nfs syntax ie server:share */
                        share = strchr(unc_name,':');
                        if(share) {
-                               free_share_name = 1;
                                *punc_name = (char *)malloc(length+3);
                                if(*punc_name == NULL) {
                                        /* put the original string back  if 
@@ -865,9 +877,9 @@ static char * parse_server(char ** punc_name)
                                        *punc_name = unc_name;
                                        return NULL;
                                }
-                                       
                                *share = '/';
                                strncpy((*punc_name)+2,unc_name,length);
+                               free(unc_name);
                                unc_name = *punc_name;
                                unc_name[length+2] = 0;
                                goto continue_unc_parsing;
@@ -878,18 +890,21 @@ static char * parse_server(char ** punc_name)
                        }
                } else {
 continue_unc_parsing:
-                       unc_name[0] = '/';
-                       unc_name[1] = '/';
+                       unc_name[0] = '\\';
+                       unc_name[1] = '\\';
                        unc_name += 2;
-                       if ((share = strchr(unc_name, '/')) || 
-                               (share = strchr(unc_name,'\\'))) {
+
+                       /* convert any '/' in unc to '\\' */
+                       replace_char(unc_name, '/', '\\');
+
+                       if ((share = strchr(unc_name,'\\'))) {
                                *share = 0;  /* temporarily terminate the string */
                                share += 1;
                                if(got_ip == 0) {
                                        host_entry = gethostbyname(unc_name);
                                }
-                               *(share - 1) = '/'; /* put the slash back */
-                               if ((prefixpath = strchr(share, '/'))) {
+                               *(share - 1) = '\\'; /* put delimiter back */
+                               if ((prefixpath = strchr(share, '\\'))) {
                                        *prefixpath = 0;  /* permanently terminate the string */
                                        if (!strlen(++prefixpath))
                                                prefixpath = NULL; /* this needs to be done explicitly */
@@ -954,6 +969,25 @@ static struct option longopts[] = {
        { NULL, 0, NULL, 0 }
 };
 
+/* convert a string to uppercase. return false if the string
+ * wasn't ASCII or was a NULL ptr */
+static int
+uppercase_string(char *string)
+{
+       if (!string)
+               return 0;
+
+       while (*string) {
+               /* check for unicode */
+               if ((unsigned char) string[0] & 0x80)
+                       return 0;
+               *string = toupper((unsigned char) *string);
+               string++;
+       }
+
+       return 1;
+}
+
 int main(int argc, char ** argv)
 {
        int c;
@@ -966,6 +1000,7 @@ int main(int argc, char ** argv)
        char * options = NULL;
        char * resolved_path = NULL;
        char * temp;
+       char * dev_name;
        int rc;
        int rsize = 0;
        int wsize = 0;
@@ -1002,8 +1037,16 @@ int main(int argc, char ** argv)
        printf(" node: %s machine: %s sysname %s domain %s\n", sysinfo.nodename,sysinfo.machine,sysinfo.sysname,sysinfo.domainname);
 #endif */
        if(argc > 2) {
-               share_name = argv[1];
+               dev_name = argv[1];
+               share_name = strndup(argv[1], MAX_UNC_LEN);
+               if (share_name == NULL) {
+                       fprintf(stderr, "%s: %s", argv[0], strerror(ENOMEM));
+                       exit(1);
+               }
                mountpoint = argv[2];
+       } else {
+               mount_cifs_usage();
+               exit(1);
        }
 
        /* add sharename in opts string as unc= parm */
@@ -1143,7 +1186,7 @@ int main(int argc, char ** argv)
                }
        }
 
-       if((argc < 3) || (share_name == NULL) || (mountpoint == NULL)) {
+       if((argc < 3) || (dev_name == NULL) || (mountpoint == NULL)) {
                mount_cifs_usage();
                exit(1);
        }
@@ -1301,10 +1344,12 @@ mount_retry:
        }
        if(verboseflag)
                printf("\nmount.cifs kernel mount options %s \n",options);
-       if(mount(share_name, mountpoint, "cifs", flags, options)) {
-       /* remember to kill daemon on error */
-               char * tmp;
 
+       /* convert all '\\' to '/' so that /proc/mounts looks pretty */
+       replace_char(dev_name, '\\', '/');
+
+       if(mount(dev_name, mountpoint, "cifs", flags, options)) {
+       /* remember to kill daemon on error */
                switch (errno) {
                case 0:
                        printf("mount failed but no error number set\n");
@@ -1315,12 +1360,9 @@ mount_retry:
                case ENXIO:
                        if(retry == 0) {
                                retry = 1;
-                               tmp = share_name;
-                               while (*tmp && !(((unsigned char)tmp[0]) & 0x80)) {
-                                       *tmp = toupper((unsigned char)*tmp);
-                                       tmp++;
-                               }
-                               if(!*tmp) {
+                               if (uppercase_string(dev_name) &&
+                                   uppercase_string(share_name) &&
+                                   uppercase_string(prefixpath)) {
                                        printf("retrying with upper case share name\n");
                                        goto mount_retry;
                                }
@@ -1334,7 +1376,7 @@ mount_retry:
        } else {
                pmntfile = setmntent(MOUNTED, "a+");
                if(pmntfile) {
-                       mountent.mnt_fsname = share_name;
+                       mountent.mnt_fsname = dev_name;
                        mountent.mnt_dir = mountpoint;
                        mountent.mnt_type = CONST_DISCARD(char *,"cifs");
                        mountent.mnt_opts = (char *)malloc(220);
@@ -1394,8 +1436,6 @@ mount_exit:
                free(resolved_path);
        }
 
-       if(free_share_name) {
-               free(share_name);
-               }
+       free(share_name);
        return rc;
 }
index 7f1e1d5003ac05580c34af1f3cf55e4a628bd87f..198faca173cbd6e339f4a25feca4d82429bf5c83 100644 (file)
@@ -162,6 +162,7 @@ do_mount(char *share_name, unsigned int flags, struct smb_mount_data *data)
        char *release, *major, *minor;
        char *data1, *data2;
        int ret;
+       char *saveptr = NULL;
 
        if (asprintf(&opts,
                        "version=7,uid=%d,gid=%d,file_mode=0%o,dir_mode=0%o,%s",
@@ -172,8 +173,8 @@ do_mount(char *share_name, unsigned int flags, struct smb_mount_data *data)
 
        uname(&uts);
        release = uts.release;
-       major = strtok(release, ".");
-       minor = strtok(NULL, ".");
+       major = strtok_r(release, ".", &saveptr);
+       minor = strtok_r(NULL, ".", &saveptr);
        if (major && minor && atoi(major) == 2 && atoi(minor) < 4) {
                /* < 2.4, assume struct */
                data1 = (char *) data;
index 98c61a30d89d968d918f3d68651645863e4528dd..ee4b180a89f93bac7997a7719a6742cf7b8d431f 100644 (file)
@@ -764,6 +764,7 @@ static void parse_mount_smb(int argc, char **argv)
        char *opts;
        char *opteq;
        int val;
+       char *saveptr = NULL;
        TALLOC_CTX *ctx = talloc_tos();
 
        /* FIXME: This function can silently fail if the arguments are
@@ -813,7 +814,8 @@ static void parse_mount_smb(int argc, char **argv)
        /*
         * option parsing from nfsmount.c (util-linux-2.9u)
         */
-        for (opts = strtok(optarg, ","); opts; opts = strtok(NULL, ",")) {
+        for (opts = strtok_r(optarg, ",", &saveptr); opts;
+            opts = strtok_r(NULL, ",", &saveptr)) {
                DEBUG(3, ("opts: %s\n", opts));
                 if ((opteq = strchr_m(opts, '='))) {
                         val = atoi(opteq + 1);
index 4270eb427208774f1bf8cf038711bdb3dc9fa984..e7df22c2bcbe8a364182892934b2c820493b1d56 100644 (file)
@@ -47,7 +47,9 @@ static struct cli_state *smb_complete_connection(const char *, const char *,int
 static struct cli_state        *smb_connect(const char *, const char *, int, const char *, const char *, const char *, const char *);
 static int             smb_print(struct cli_state *, char *, FILE *);
 static char *          uri_unescape_alloc(const char *);
-
+#if 0
+static bool smb_encrypt;
+#endif
 
 /*
  * 'main()' - Main entry for SMB backend.
@@ -468,6 +470,23 @@ static struct cli_state
     return NULL;
   }
     
+#if 0
+  /* Need to work out how to specify this on the URL. */
+  if (smb_encrypt)
+  {
+    if (!cli_cm_force_encryption(cli,
+                       username,
+                       password,
+                       workgroup,
+                       share))
+    {
+      fprintf(stderr, "ERROR: encryption setup failed\n");
+      cli_shutdown(cli);
+      return NULL;
+    }
+  }
+#endif
+
   return cli;
 }
 
index ac60b6f645fda853da4b9660a411bb17e2bdce82..4bfb1db02e8e1cbee41d13844c3e78c83ae31bbb 100644 (file)
@@ -318,6 +318,16 @@ AC_SUBST(INSTALL_LIBADDNS)
 AC_SUBST(UNINSTALL_LIBADDNS)
 AC_SUBST(LIBADDNS_SHARED)
 AC_SUBST(LIBADDNS)
+
+AC_SUBST(INSTALL_LIBWBCLIENT)
+AC_SUBST(UNINSTALL_LIBWBCLIENT)
+AC_SUBST(LIBWBCLIENT_SHARED)
+AC_SUBST(LIBWBCLIENT_STATIC)
+AC_SUBST(LIBWBCLIENT)
+AC_SUBST(WINBIND_LIBS)
+
+AC_SUBST(LIBSAMBAUTIL_SHARED)
+
 AC_SUBST(INSTALL_LIBSMBCLIENT)
 AC_SUBST(UNINSTALL_LIBSMBCLIENT)
 AC_SUBST(LIBSMBCLIENT_SHARED)
@@ -326,6 +336,10 @@ AC_SUBST(INSTALL_LIBSMBSHAREMODES)
 AC_SUBST(UNINSTALL_LIBSMBSHAREMODES)
 AC_SUBST(LIBSMBSHAREMODES_SHARED)
 AC_SUBST(LIBSMBSHAREMODES)
+AC_SUBST(INSTALL_LIBNETAPI)
+AC_SUBST(UNINSTALL_LIBNETAPI)
+AC_SUBST(LIBNETAPI_SHARED)
+AC_SUBST(LIBNETAPI)
 AC_SUBST(PRINT_LIBS)
 AC_SUBST(AUTH_LIBS)
 AC_SUBST(ACL_LIBS)
@@ -442,7 +456,7 @@ AC_ARG_ENABLE(krb5developer, [  --enable-krb5developer  Turn on developer warnin
 # DEVELOPER_CFLAGS, so that you can turn them on and off with a simple
 # Makefile edit, avoiding the need to re-run configure.
 if test x"$ac_cv_prog_gcc" = x"yes" ; then
-       DEVELOPER_CFLAGS="-gstabs -Wall -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -DDEBUG_PASSWORD -DDEVELOPER"
+       DEVELOPER_CFLAGS="-g -Wall -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -DDEBUG_PASSWORD -DDEVELOPER"
        # Add -Wdeclaration-after-statement if compiler supports it
        AC_CACHE_CHECK(
           [that the C compiler understands -Wdeclaration-after-statement],
@@ -690,10 +704,10 @@ AC_SUBST(DYNEXP)
 
 dnl Add modules that have to be built by default here
 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"
+default_static_modules="pdb_smbpasswd pdb_tdbsam rpc_lsa rpc_samr2 rpc_winreg rpc_initshutdown rpc_dssetup 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 vfs_shadow_copy2 charset_CP850 charset_CP437 auth_script vfs_readahead vfs_syncops vfs_xattr_tdb vfs_streams_xattr"
 
 if test "x$developer" = xyes; then
    default_static_modules="$default_static_modules rpc_rpcecho"
@@ -951,6 +965,7 @@ AC_CHECK_HEADERS(sys/sysmacros.h)
 AC_CHECK_HEADERS(sys/syslog.h syslog.h)
 AC_CHECK_HEADERS(langinfo.h locale.h)
 AC_CHECK_HEADERS(xfs/libxfs.h)
+AC_CHECK_HEADERS(netgroup.h)
 
 AC_CHECK_HEADERS(rpcsvc/yp_prot.h,,,[[
 #if HAVE_RPC_RPC_H
@@ -1850,7 +1865,7 @@ DSO_EXPORTS=""
                *aix*) AC_DEFINE(AIX,1,[Whether the host os is aix])
                        BLDSHARED="true"
                        LDSHFLAGS="-Wl,-G,-bexpall,-bbigtoc"
-                       DYNEXP="-Wl,-brtl,-bexpall,-bbigtoc"
+                       DYNEXP="-Wl,-brtl,-bexpfull,-bbigtoc"
                        PICFLAG="-O2"
                        # as AIX code is always position independent...
                        # .po will just create compile warnings, use po.o:
@@ -2024,6 +2039,8 @@ AC_MSG_RESULT([$PICFLAG])
 
 AC_DEFINE_UNQUOTED(SHLIBEXT, "$SHLIBEXT", [Shared library extension])
 
+AC_LIBREPLACE_RUNTIME_LIB_PATH_VAR
+
 ################
 
 AC_CACHE_CHECK([for long long],samba_cv_have_longlong,[
@@ -2735,6 +2752,12 @@ AC_SUBST(SMB_FAM_LIBS)
 
 SMB_CHECK_DMAPI([], AC_MSG_NOTICE(DMAPI support not present) )
 
+# Add TSM SM VFS module only if there are both GPFS and DMAPI support
+# Theoretically it should work with AIX JFS2 too but this needs testing
+if test x"$samba_cv_HAVE_GPFS" = x"yes" && test x"$samba_dmapi_libs" != x"" ; then
+    default_shared_modules="$default_shared_modules vfs_tsmsm"
+fi
+
 AC_CACHE_CHECK([for kernel share modes],samba_cv_HAVE_KERNEL_SHARE_MODES,[
 AC_TRY_RUN([
 #include <sys/types.h>
@@ -2999,6 +3022,7 @@ AC_TRY_RUN([
 #define NO_CONFIG_H 1
 #define HAVE_IFACE_IFCONF 1
 #define AUTOCONF_TEST 1
+#define SOCKET_WRAPPER_NOT_REPLACE
 #include "${srcdir-.}/lib/replace/replace.c"
 #include "${srcdir-.}/lib/interfaces.c"],
            samba_cv_HAVE_IFACE_IFCONF=yes,samba_cv_HAVE_IFACE_IFCONF=no,samba_cv_HAVE_IFACE_IFCONF=cross)])
@@ -3016,7 +3040,10 @@ AC_TRY_RUN([
 #define NO_CONFIG_H 1
 #define HAVE_IFACE_IFREQ 1
 #define AUTOCONF_TEST 1
+#define SOCKET_WRAPPER_NOT_REPLACE
 #include "${srcdir-.}/lib/replace/replace.c"
+#include "${srcdir-.}/lib/replace/getaddrinfo.c"
+#include "${srcdir-.}/lib/replace/snprintf.c"
 #include "${srcdir-.}/lib/interfaces.c"],
            samba_cv_HAVE_IFACE_IFREQ=yes,samba_cv_HAVE_IFACE_IFREQ=no,samba_cv_HAVE_IFACE_IFREQ=cross)])
 CPPFLAGS="$SAVE_CPPFLAGS"
@@ -3034,7 +3061,9 @@ AC_TRY_RUN([
 #define HAVE_IFACE_AIX 1
 #define AUTOCONF_TEST 1
 #undef _XOPEN_SOURCE_EXTENDED
+#define SOCKET_WRAPPER_NOT_REPLACE
 #include "${srcdir-.}/lib/replace/replace.c"
+#include "${srcdir-.}/lib/replace/snprintf.c"
 #include "${srcdir-.}/lib/interfaces.c"],
            samba_cv_HAVE_IFACE_AIX=yes,samba_cv_HAVE_IFACE_AIX=no,samba_cv_HAVE_IFACE_AIX=cross)])
 CPPFLAGS="$SAVE_CPPFLAGS"
@@ -5066,6 +5095,51 @@ if test $enable_static = yes; then
        UNINSTALLLIBCMD_A="rm -f"
 fi
 
+#################################################
+# should we build libnetapi?
+INSTALL_LIBNETAPI=
+UNINSTALL_LIBNETAPI=
+LIBNETAPI_SHARED=
+LIBNETAPI=
+AC_MSG_CHECKING(whether to build the libnetapi shared library)
+AC_ARG_WITH(libnetapi,
+[  --with-libnetapi        Build the libnetapi shared library (default=yes if shared libs supported)],
+[ case "$withval" in
+  *)
+     AC_MSG_RESULT(no)
+     ;;
+  yes)
+     if test $BLDSHARED = true; then
+        LIBNETAPI_SHARED=bin/libnetapi.$SHLIBEXT
+        LIBNETAPI=libnetapi
+        AC_MSG_RESULT(yes)
+     else
+       enable_static=yes
+        AC_MSG_RESULT(no shared library support -- will supply static library)
+     fi
+     if test $enable_static = yes; then
+        LIBNETAPI=libnetapi
+     fi
+     INSTALL_LIBNETAPI=installlibnetapi
+     UNINSTALL_LIBNETAPI=uninstalllibnetapi
+     ;;
+  esac ],
+[
+# if unspecified, default is to built it if possible.
+  if test $BLDSHARED = true; then
+     LIBNETAPI_SHARED=bin/libnetapi.$SHLIBEXT
+     LIBNETAPI=libnetapi
+     AC_MSG_RESULT(yes)
+   else
+     enable_static=yes
+     AC_MSG_RESULT(no shared library support -- will supply static library)
+   fi
+   if test $enable_static = yes; then
+     LIBNETAPI=libnetapi
+  fi]
+  INSTALL_LIBNETAPI=installlibnetapi
+)
+
 #################################################
 # should we build libaddns?
 INSTALL_LIBADDNS=
@@ -5094,11 +5168,13 @@ AC_ARG_WITH(libaddns,
      INSTALL_LIBADDNS=installlibaddns
      UNINSTALL_LIBADDNS=uninstalllibaddns
      ;;
-  esac ]
+  esac ],
+[AC_MSG_RESULT(no)]
 )
 
 #################################################
 # should we build libsmbclient?
+
 INSTALL_LIBSMBCLIENT=
 UNINSTALL_LIBSMBCLIENT=
 LIBSMBCLIENT_SHARED=
@@ -5185,6 +5261,7 @@ AC_ARG_WITH(libsmbsharemodes,
   INSTALL_LIBSMBSHAREMODES=installlibsmbsharemodes
 )
 
+
 #################################################
 # these tests are taken from the GNU fileutils package
 AC_CHECKING(how to get filesystem space usage)
@@ -6082,8 +6159,26 @@ if test x"$HAVE_WINBIND" = x"no"; then
        WINBIND_WINS_NSS=""
 fi
 
-if test $BLDSHARED = true -a x"$HAVE_WINBIND" = x"yes"; then
+BUILD_LIBWBCLIENT_SHARED=yes
+
+AC_ARG_ENABLE(libwbclient-shared,
+[ --enable-libwbclient-shared  Build libwbclient as shared object (default=yes, \"no\" only for --enable-developer)],
+       [if eval "test x$enable_developer = xyes -a x$enable_libwbclient_shared = xno" ; then
+               BUILD_LIBWBCLIENT_SHARED=no
+       fi])
+
+if test $BLDSHARED = true -a x"$HAVE_WINBIND" = x"yes" -a x"$BUILD_LIBWBCLIENT_SHARED" = x"yes"; then
        NSS_MODULES="${WINBIND_NSS} ${WINBIND_WINS_NSS}"
+       ## Only worry about libwbclient if we have shared library support
+       ## and winbindd
+        LIBWBCLIENT_SHARED=bin/libwbclient.$SHLIBEXT
+        LIBWBCLIENT=libwbclient
+       INSTALL_LIBWBCLIENT=installlibwbclient
+       UNINSTALL_LIBWBCLIENT=uninstalllibwbclient
+       WINBIND_LIBS="-lwbclient"
+       LDFLAGS="$LDFLAGS -L./bin"
+else
+       LIBWBCLIENT_STATIC=bin/libwbclient.a
 fi
 
 if test x"$HAVE_WINBIND" = x"yes"; then
@@ -6191,6 +6286,7 @@ AC_SUBST(FLAGS1)
 AC_ARG_ENABLE(dnssd,
 [  --enable-dnssd          Enable DNS service discovery support (default=auto)])
 
+AC_SUBST(DNSSD_LIBS)
 if test x"$enable_dnssd" != x"no"; then
     have_dnssd_support=yes
 
@@ -6339,7 +6435,7 @@ SMB_SUBSYSTEM(PDB,passdb/pdb_interface.o)
 SMB_MODULE(rpc_lsa, \$(RPC_LSA_OBJ), "bin/librpc_lsarpc.$SHLIBEXT", RPC)
 SMB_MODULE(rpc_winreg, \$(RPC_REG_OBJ), "bin/librpc_winreg.$SHLIBEXT", RPC)
 SMB_MODULE(rpc_initshutdown, \$(RPC_INITSHUTDOWN_OBJ), "bin/librpc_initshutdown.$SHLIBEXT", RPC)
-SMB_MODULE(rpc_lsa_ds, \$(RPC_LSA_DS_OBJ), "bin/librpc_lsa_ds.$SHLIBEXT", RPC)
+SMB_MODULE(rpc_dssetup, \$(RPC_DSSETUP_OBJ), "bin/librpc_dssetup.$SHLIBEXT", RPC)
 SMB_MODULE(rpc_wkssvc, \$(RPC_WKS_OBJ), "bin/librpc_wkssvc.$SHLIBEXT", RPC)
 SMB_MODULE(rpc_svcctl2, \$(RPC_SVCCTL_OBJ), "bin/librpc_svcctl2.$SHLIBEXT", RPC)
 SMB_MODULE(rpc_ntsvcs, \$(RPC_NTSVCS_OBJ), "bin/librpc_ntsvcs.$SHLIBEXT", RPC)
@@ -6348,12 +6444,13 @@ SMB_MODULE(rpc_netdfs, \$(RPC_DFS_OBJ), "bin/librpc_netdfs.$SHLIBEXT", RPC)
 SMB_MODULE(rpc_srvsvc2, \$(RPC_SVC_OBJ), "bin/librpc_svcsvc2.$SHLIBEXT", RPC)
 SMB_MODULE(rpc_spoolss, \$(RPC_SPOOLSS_OBJ), "bin/librpc_spoolss.$SHLIBEXT", RPC)
 SMB_MODULE(rpc_eventlog2, \$(RPC_EVENTLOG_OBJ), "bin/librpc_eventlog2.$SHLIBEXT", RPC)
-SMB_MODULE(rpc_samr, \$(RPC_SAMR_OBJ), "bin/librpc_samr.$SHLIBEXT", RPC)
+SMB_MODULE(rpc_samr2, \$(RPC_SAMR_OBJ), "bin/librpc_samr2.$SHLIBEXT", RPC)
 SMB_MODULE(rpc_rpcecho, \$(RPC_ECHO_OBJ), "bin/librpc_rpcecho.$SHLIBEXT", RPC)
 SMB_SUBSYSTEM(RPC,smbd/server.o)
 
 SMB_MODULE(idmap_ldap, winbindd/idmap_ldap.o, "bin/ldap.$SHLIBEXT", IDMAP)
 SMB_MODULE(idmap_tdb, winbindd/idmap_tdb.o, "bin/tdb.$SHLIBEXT", IDMAP)
+SMB_MODULE(idmap_tdb2, winbindd/idmap_tdb2.o, "bin/tdb2.$SHLIBEXT", IDMAP)
 SMB_MODULE(idmap_passdb, winbindd/idmap_passdb.o, "bin/passdb.$SHLIBEXT", IDMAP)
 SMB_MODULE(idmap_nss, winbindd/idmap_nss.o, "bin/nss.$SHLIBEXT", IDMAP)
 SMB_MODULE(idmap_rid, winbindd/idmap_rid.o, "bin/rid.$SHLIBEXT", IDMAP)
@@ -6390,7 +6487,9 @@ SMB_MODULE(vfs_readonly, \$(VFS_READONLY_OBJ), "bin/readonly.$SHLIBEXT", VFS)
 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_shadow_copy2, \$(VFS_SHADOW_COPY2_OBJ), "bin/shadow_copy2.$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)
@@ -6399,14 +6498,19 @@ SMB_MODULE(vfs_irixacl, \$(VFS_IRIXACL_OBJ), "bin/irixacl.$SHLIBEXT", VFS)
 SMB_MODULE(vfs_hpuxacl, \$(VFS_HPUXACL_OBJ), "bin/hpuxacl.$SHLIBEXT", VFS)
 SMB_MODULE(vfs_tru64acl, \$(VFS_TRU64ACL_OBJ), "bin/tru64acl.$SHLIBEXT", VFS)
 SMB_MODULE(vfs_catia, \$(VFS_CATIA_OBJ), "bin/catia.$SHLIBEXT", VFS)
+SMB_MODULE(vfs_streams_xattr, \$(VFS_STREAMS_XATTR_OBJ), "bin/streams_xattr.$SHLIBEXT", VFS)
+SMB_MODULE(vfs_streams_depot, \$(VFS_STREAMS_DEPOT_OBJ), "bin/streams_depot.$SHLIBEXT", VFS)
 SMB_MODULE(vfs_cacheprime, \$(VFS_CACHEPRIME_OBJ), "bin/cacheprime.$SHLIBEXT", VFS)
 SMB_MODULE(vfs_prealloc, \$(VFS_PREALLOC_OBJ), "bin/prealloc.$SHLIBEXT", VFS)
 SMB_MODULE(vfs_commit, \$(VFS_COMMIT_OBJ), "bin/commit.$SHLIBEXT", VFS)
 SMB_MODULE(vfs_gpfs, \$(VFS_GPFS_OBJ), "bin/gpfs.$SHLIBEXT", VFS)
 SMB_MODULE(vfs_readahead, \$(VFS_READAHEAD_OBJ), "bin/readahead.$SHLIBEXT", VFS)
+SMB_MODULE(vfs_tsmsm, \$(VFS_TSMSM_OBJ), "bin/tsmsm.$SHLIBEXT", VFS)
 SMB_MODULE(vfs_fileid, \$(VFS_FILEID_OBJ), "bin/fileid.$SHLIBEXT", VFS)
 SMB_MODULE(vfs_syncops, \$(VFS_SYNCOPS_OBJ), "bin/syncops.$SHLIBEXT", VFS)
 SMB_MODULE(vfs_zfsacl, \$(VFS_ZFSACL_OBJ), "bin/zfsacl.$SHLIBEXT", VFS)
+SMB_MODULE(vfs_notify_fam, \$(VFS_NOTIFY_FAM_OBJ), "bin/notify_fam.$SHLIBEXT", VFS)
+
 
 SMB_SUBSYSTEM(VFS,smbd/vfs.o)
 
@@ -6553,7 +6657,14 @@ AC_SUBST(builddir)
 SMBD_LIBS="$samba_dmapi_libs"
 AC_SUBST(SMBD_LIBS)
 
-AC_OUTPUT(Makefile library-versions script/findsmb smbadduser script/gen-8bit-gap.sh script/installbin.sh script/uninstallbin.sh)
+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/wbclient.pc
+         pkgconfig/netapi.pc
+         pkgconfig/smbsharemodes.pc
+         )
 
 #################################################
 # Print very concise instructions on building/use
diff --git a/source/exports/libnetapi.syms b/source/exports/libnetapi.syms
new file mode 100644 (file)
index 0000000..eb34bfc
--- /dev/null
@@ -0,0 +1,3 @@
+{
+       global: *;
+};
diff --git a/source/exports/libwbclient.syms b/source/exports/libwbclient.syms
new file mode 100644 (file)
index 0000000..f1e68b4
--- /dev/null
@@ -0,0 +1,4 @@
+{
+       global: wbc*;
+       local: *;
+};
index ea467775983942c943f782b4daa77ed8be55a5a1..454fe467a97a39a5336600e1fbdf9b70a49aa824 100644 (file)
@@ -398,8 +398,8 @@ static NTSTATUS one_alias_membership(const DOM_SID *member,
                        goto failed;
                }
                string_to_sid(&alias, (char *)el->values[0].data);
-               if (!add_sid_to_array_unique(NULL, &alias, sids, num)) {
-                       status = NT_STATUS_NO_MEMORY;
+               status = add_sid_to_array_unique(NULL, &alias, sids, num);
+               if (!NT_STATUS_IS_OK(status)) {
                        goto failed;
                }
        }
@@ -492,6 +492,7 @@ static NTSTATUS enum_aliasmem(const DOM_SID *alias, DOM_SID **sids, size_t *num)
                NULL
        };
        int ret, i;
+       NTSTATUS status = NT_STATUS_OK;
        struct ldb_result *res=NULL;
        struct ldb_dn *dn;
        struct ldb_message_element *el;
@@ -524,14 +525,15 @@ static NTSTATUS enum_aliasmem(const DOM_SID *alias, DOM_SID **sids, size_t *num)
        for (i=0;i<el->num_values;i++) {
                DOM_SID sid;
                string_to_sid(&sid, (const char *)el->values[i].data);
-               if (!add_sid_to_array_unique(NULL, &sid, sids, num)) {
-                       talloc_free(dn);
-                       return NT_STATUS_NO_MEMORY;
+               status = add_sid_to_array_unique(NULL, &sid, sids, num);
+               if (!NT_STATUS_IS_OK(status)) {
+                       goto done;
                }
        }
-       talloc_free(dn);
 
-       return NT_STATUS_OK;
+done:
+       talloc_free(dn);
+       return status;
 }
 
 /*
index cf9f9058afc7b6cac5a0d71915d1c64f04798f01..67e377c338c12b4e3e8f7fbc6101d38dff1b8893 100644 (file)
@@ -394,6 +394,7 @@ static NTSTATUS one_alias_membership(const DOM_SID *member,
        char *string_sid;
        TDB_DATA dbuf;
        const char *p;
+       NTSTATUS status = NT_STATUS_OK;
        TALLOC_CTX *frame;
 
        slprintf(key, sizeof(key), "%s%s", MEMBEROF_PREFIX,
@@ -413,15 +414,16 @@ static NTSTATUS one_alias_membership(const DOM_SID *member,
                if (!string_to_sid(&alias, string_sid))
                        continue;
 
-               if (!add_sid_to_array_unique(NULL, &alias, sids, num)) {
-                       TALLOC_FREE(frame);
-                       return NT_STATUS_NO_MEMORY;
+               status= add_sid_to_array_unique(NULL, &alias, sids, num);
+               if (!NT_STATUS_IS_OK(status)) {
+                       goto done;
                }
        }
 
+done:
        TALLOC_FREE(frame);
        SAFE_FREE(dbuf.dptr);
-       return NT_STATUS_OK;
+       return status;
 }
 
 static NTSTATUS alias_memberships(const DOM_SID *members, size_t num_members,
@@ -558,7 +560,10 @@ static int collect_aliasmem(TDB_CONTEXT *tdb_ctx, TDB_DATA key, TDB_DATA data,
                if (!string_to_sid(&member, member_string))
                        continue;
 
-               if (!add_sid_to_array(NULL, &member, closure->sids, closure->num)) {
+               if (!NT_STATUS_IS_OK(add_sid_to_array(NULL, &member,
+                                                     closure->sids,
+                                                     closure->num)))
+               {
                        /* talloc fail. */
                        break;
                }
index a75eaf80fc6e1751b745474cc0d0bd948a557bc0..d1047bbdc20a2699aaeea29a953f095dde4f888e 100644 (file)
@@ -396,4 +396,11 @@ typedef struct {
 
 #define ADS_IGNORE_PRINCIPAL "not_defined_in_RFC4178@please_ignore"
 
+/* Settings for the domainFunctionality attribute in the rootDSE */
+
+#define DS_DOMAIN_FUNCTION_2000                0
+#define DS_DOMAIN_FUCNTION_2003_MIXED  1
+#define DS_DOMAIN_FUNCTION_2003                2
+#define DS_DOMAIN_FUNCTION_2008                3
+
 #endif /* _INCLUDE_ADS_H_ */
index 0292d91f4f0c64b852a01ddf1a61747da7312005..738df3ed40cabbf99688bc8327927ed3cfab8489 100644 (file)
@@ -114,3 +114,7 @@ ADS_STATUS ads_get_tokensids(ADS_STRUCT *ads,
                              DOM_SID *primary_group_sid,
                              DOM_SID **sids,
                              size_t *num_sids);
+ADS_STATUS ads_get_joinable_ous(ADS_STRUCT *ads,
+                               TALLOC_CTX *mem_ctx,
+                               char ***ous,
+                               size_t *num_ous);
index 0047b2bf235bdecdda8df233fb4b79ae5932c1f4..f8adf567de904e5edc65db31d4064d837b8d1504 100644 (file)
@@ -27,7 +27,9 @@
    will be a multiple of the page size on almost any system */
 #define CLI_BUFFER_SIZE (0xFFFF)
 #define CLI_SAMBA_MAX_LARGE_READX_SIZE (127*1024) /* Works for Samba servers */
+#define CLI_SAMBA_MAX_LARGE_WRITEX_SIZE (127*1024) /* Works for Samba servers */
 #define CLI_WINDOWS_MAX_LARGE_READX_SIZE ((64*1024)-2) /* Windows servers are broken.... */
+#define CLI_WINDOWS_MAX_LARGE_WRITEX_SIZE ((64*1024)-2) /* Windows servers are broken.... */
 #define CLI_SAMBA_MAX_POSIX_LARGE_READX_SIZE (0xFFFF00) /* 24-bit len. */
 #define CLI_SAMBA_MAX_POSIX_LARGE_WRITEX_SIZE (0xFFFF00) /* 24-bit len. */
 
@@ -79,6 +81,28 @@ struct rpc_pipe_client {
        struct dcinfo *dc;
 };
 
+/* Transport encryption state. */
+enum smb_trans_enc_type { SMB_TRANS_ENC_NTLM, SMB_TRANS_ENC_GSS };
+
+#if defined(HAVE_GSSAPI) && defined(HAVE_KRB5)
+struct smb_tran_enc_state_gss {
+        gss_ctx_id_t gss_ctx;
+        gss_cred_id_t creds;
+};
+#endif
+
+struct smb_trans_enc_state {
+        enum smb_trans_enc_type smb_enc_type;
+        uint16 enc_ctx_num;
+        bool enc_on;
+        union {
+                NTLMSSP_STATE *ntlmssp_state;
+#if defined(HAVE_GSSAPI) && defined(HAVE_KRB5)
+                struct smb_tran_enc_state_gss *gss_state;
+#endif
+        } s;
+};
+
 struct cli_state {
        int port;
        int fd;
@@ -142,6 +166,8 @@ struct cli_state {
 
        smb_sign_info sign_info;
 
+       struct smb_trans_enc_state *trans_enc_state; /* Setup if we're encrypting SMB's. */
+
        /* the session key for this CLI, outside
           any per-pipe authenticaion */
        DATA_BLOB user_session_key;
index 425cc65a007b5d585e579e1341013131bbc4d655..6e1b2f737abe187ac4cd6c46bcae1db2d7b6b16f 100644 (file)
@@ -17,6 +17,9 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
+#ifndef _CTDBD_CONN_H
+#define _CTDBD_CONN_H
+
 struct ctdbd_connection;
 
 NTSTATUS ctdbd_init_connection(TALLOC_CTX *mem_ctx,
@@ -62,3 +65,6 @@ NTSTATUS ctdbd_register_ips(struct ctdbd_connection *conn,
 
 NTSTATUS ctdbd_register_reconfigure(struct ctdbd_connection *conn);
 
+NTSTATUS ctdbd_persistent_store(struct ctdbd_connection *conn, uint32_t db_id, TDB_DATA key, TDB_DATA data);
+
+#endif /* _CTDBD_CONN_H */
index 3bb378c8413516156e50ec608c957a099351c624..4eb174fef1c15e58e2f1690c2513567e1a640758 100644 (file)
@@ -43,6 +43,7 @@ struct db_context {
                             void *private_data);
        int (*get_seqnum)(struct db_context *db);
        void *private_data;
+       bool persistent;
 };
 
 struct db_context *db_open(TALLOC_CTX *mem_ctx,
index 46e5620cc79dbe1bde326b903c62b2ac4260641b..d8dafcbd457509b25f35ca423d0b4f7b46668028 100644 (file)
@@ -161,17 +161,35 @@ extern bool *DEBUGLEVEL_CLASS_ISSET;
  * will remove the extra conditional test.
  */
 
-#define DEBUGLVL( level ) \
+/*
+ * From talloc.c:
+ */
+
+/* these macros gain us a few percent of speed on gcc */
+#if (__GNUC__ >= 3)
+/* the strange !! is to ensure that __builtin_expect() takes either 0 or 1
+   as its first argument */
+#define likely(x)   __builtin_expect(!!(x), 1)
+#define unlikely(x) __builtin_expect(!!(x), 0)
+#else
+#define likely(x) (x)
+#define unlikely(x) (x)
+#endif
+
+#define CHECK_DEBUGLVL( level ) \
   ( ((level) <= MAX_DEBUG_LEVEL) && \
-     ((DEBUGLEVEL_CLASS[ DBGC_CLASS ] >= (level))||  \
+     unlikely((DEBUGLEVEL_CLASS[ DBGC_CLASS ] >= (level))||  \
      (!DEBUGLEVEL_CLASS_ISSET[ DBGC_CLASS ] && \
-      DEBUGLEVEL_CLASS[ DBGC_ALL   ] >= (level))  ) \
+      DEBUGLEVEL_CLASS[ DBGC_ALL   ] >= (level))  ) )
+
+#define DEBUGLVL( level ) \
+  ( CHECK_DEBUGLVL(level) \
    && dbghdr( level, DBGC_CLASS, __FILE__, FUNCTION_MACRO, (__LINE__) ) )
 
 
 #define DEBUGLVLC( dbgc_class, level ) \
   ( ((level) <= MAX_DEBUG_LEVEL) && \
-     ((DEBUGLEVEL_CLASS[ dbgc_class ] >= (level))||  \
+     unlikely((DEBUGLEVEL_CLASS[ dbgc_class ] >= (level))||  \
      (!DEBUGLEVEL_CLASS_ISSET[ dbgc_class ] && \
       DEBUGLEVEL_CLASS[ DBGC_ALL   ] >= (level))  ) \
    && dbghdr( level, DBGC_CLASS, __FILE__, FUNCTION_MACRO, (__LINE__) ) )
@@ -179,7 +197,7 @@ extern bool *DEBUGLEVEL_CLASS_ISSET;
 
 #define DEBUG( level, body ) \
   (void)( ((level) <= MAX_DEBUG_LEVEL) && \
-           ((DEBUGLEVEL_CLASS[ DBGC_CLASS ] >= (level))||  \
+           unlikely((DEBUGLEVEL_CLASS[ DBGC_CLASS ] >= (level))||  \
            (!DEBUGLEVEL_CLASS_ISSET[ DBGC_CLASS ] && \
             DEBUGLEVEL_CLASS[ DBGC_ALL   ] >= (level))  ) \
        && (dbghdr( level, DBGC_CLASS, __FILE__, FUNCTION_MACRO, (__LINE__) )) \
@@ -187,7 +205,7 @@ extern bool *DEBUGLEVEL_CLASS_ISSET;
 
 #define DEBUGC( dbgc_class, level, body ) \
   (void)( ((level) <= MAX_DEBUG_LEVEL) && \
-           ((DEBUGLEVEL_CLASS[ dbgc_class ] >= (level))||  \
+           unlikely((DEBUGLEVEL_CLASS[ dbgc_class ] >= (level))||  \
            (!DEBUGLEVEL_CLASS_ISSET[ dbgc_class ] && \
            DEBUGLEVEL_CLASS[ DBGC_ALL   ] >= (level))  ) \
        && (dbghdr( level, DBGC_CLASS, __FILE__, FUNCTION_MACRO, (__LINE__) )) \
@@ -195,14 +213,14 @@ extern bool *DEBUGLEVEL_CLASS_ISSET;
 
 #define DEBUGADD( level, body ) \
   (void)( ((level) <= MAX_DEBUG_LEVEL) && \
-           ((DEBUGLEVEL_CLASS[ DBGC_CLASS ] >= (level))||  \
+           unlikely((DEBUGLEVEL_CLASS[ DBGC_CLASS ] >= (level))||  \
            (!DEBUGLEVEL_CLASS_ISSET[ DBGC_CLASS ] && \
             DEBUGLEVEL_CLASS[ DBGC_ALL   ] >= (level))  ) \
        && (dbgtext body) )
 
 #define DEBUGADDC( dbgc_class, level, body ) \
   (void)( ((level) <= MAX_DEBUG_LEVEL) && \
-          ((DEBUGLEVEL_CLASS[ dbgc_class ] >= (level))||  \
+          unlikely((DEBUGLEVEL_CLASS[ dbgc_class ] >= (level))||  \
            (!DEBUGLEVEL_CLASS_ISSET[ dbgc_class ] && \
             DEBUGLEVEL_CLASS[ DBGC_ALL   ] >= (level))  ) \
        && (dbgtext body) )
index a22eda2ab7e37e74f08896b7c451456b6dbb67fa..5794fbe71ca0be706aeecca1aaa4386f2ce4f25d 100644 (file)
 #define WERR_SERVICE_ALREADY_RUNNING W_ERROR(1056)
 #define WERR_SERVICE_DISABLED W_ERROR(1058)
 #define WERR_SERVICE_NEVER_STARTED W_ERROR(1077)
+#define WERR_INVALID_COMPUTER_NAME W_ERROR(1210)
 #define WERR_MACHINE_LOCKED W_ERROR(1271)
 #define WERR_NO_LOGON_SERVERS W_ERROR(1311)
+#define WERR_NO_SUCH_LOGON_SESSION W_ERROR(1312)
 #define WERR_LOGON_FAILURE W_ERROR(1326)
 #define WERR_NO_SUCH_DOMAIN W_ERROR(1355)
 #define WERR_INVALID_SECURITY_DESCRIPTOR W_ERROR(1338)
 #define WERR_SERVER_UNAVAILABLE W_ERROR(1722)
 #define WERR_INVALID_FORM_NAME W_ERROR(1902)
 #define WERR_INVALID_FORM_SIZE W_ERROR(1903)
+#define WERR_PASSWORD_MUST_CHANGE W_ERROR(1907)
+#define WERR_DOMAIN_CONTROLLER_NOT_FOUND W_ERROR(1908)
+#define WERR_ACCOUNT_LOCKED_OUT W_ERROR(1909)
+
+/* should these go down to NERR_BASE ? */
 #define WERR_BUF_TOO_SMALL W_ERROR(2123)
 #define WERR_JOB_NOT_FOUND W_ERROR(2151)
 #define WERR_DEST_NOT_FOUND W_ERROR(2152)
+#define WERR_USER_EXISTS W_ERROR(2224)
 #define WERR_NOT_LOCAL_DOMAIN W_ERROR(2320)
-#define WERR_DOMAIN_CONTROLLER_NOT_FOUND W_ERROR(2453)
+#define WERR_DC_NOT_FOUND W_ERROR(2453)
 
 #define WERR_SETUP_ALREADY_JOINED W_ERROR(2691)
 #define WERR_SETUP_NOT_JOINED W_ERROR(2692)
 #define WERR_SETUP_DOMAIN_CONTROLLER W_ERROR(2693)
+#define WERR_DEFAULT_JOIN_REQUIRED W_ERROR(2694)
 
 #define WERR_DEVICE_NOT_AVAILABLE W_ERROR(4319)
 #define WERR_STATUS_MORE_ENTRIES   W_ERROR(0x0105)
index 22451741a148f55236a1426c78422937fee2c8b1..041c431a58c1974053586e25c23b2feaddface9a 100644 (file)
@@ -250,6 +250,10 @@ typedef int ber_int_t;
 #include <langinfo.h>
 #endif
 
+#if HAVE_NETGROUP_H
+#include <netgroup.h>
+#endif
+
 #if defined(HAVE_AIO_H) && defined(WITH_AIO)
 #include <aio.h>
 #endif
@@ -698,10 +702,10 @@ typedef char fstring[FSTRING_LEN];
 #include "rpc_srvsvc.h"
 #include "rpc_spoolss.h"
 #include "rpc_eventlog.h"
-#include "rpc_ds.h"
 #include "rpc_perfcount.h"
 #include "rpc_perfcount_defs.h"
 #include "librpc/gen_ndr/notify.h"
+#include "librpc/gen_ndr/xattr.h"
 #include "nt_printing.h"
 #include "idmap.h"
 #include "client.h"
@@ -719,6 +723,7 @@ typedef char fstring[FSTRING_LEN];
 #include "packet.h"
 #include "ctdbd_conn.h"
 #include "talloc_stack.h"
+#include "memcache.h"
 
 /* used in net.c */
 struct functable {
@@ -783,6 +788,7 @@ enum flush_reason_enum {
     NUM_FLUSH_REASONS};
 
 #include "nss_info.h"
+#include "nsswitch/libwbclient/wbclient.h"
 
 /* generated rpc server implementation functions */
 #include "librpc/gen_ndr/srv_echo.h"
@@ -809,6 +815,9 @@ enum flush_reason_enum {
 #include "srvstr.h"
 #include "safe_string.h"
 
+/* prototypes from lib/util_transfer_file.c */
+#include "transfer_file.h"
+
 #ifdef __COMPAR_FN_T
 #define QSORT_CAST (__compar_fn_t)
 #endif
@@ -1102,6 +1111,14 @@ char *talloc_asprintf_strupper_m(TALLOC_CTX *t, const char *fmt, ...) PRINTF_ATT
 #define VXFS_QUOTA
 #endif
 
+#ifndef XATTR_CREATE
+#define XATTR_CREATE  0x1       /* set value, fail if attr already exists */
+#endif
+
+#ifndef XATTR_REPLACE
+#define XATTR_REPLACE 0x2       /* set value, fail if attr does not exist */
+#endif
+
 #if defined(HAVE_KRB5)
 
 krb5_error_code smb_krb5_parse_name(krb5_context context,
index 19a3edc9bfdb070bbc1a4254dc31b615d714af82..6c7dc80da8d9922830f602f0ba96c1f5746235a5 100644 (file)
@@ -15,6 +15,7 @@ struct _SMBCSRV {
        bool no_pathinfo;
        bool no_pathinfo2;
         bool no_nt_session;
+        POLICY_HND pol;
 
        SMBCSRV *next, *prev;
        
@@ -106,6 +107,13 @@ struct smbc_internal_data {
          * and retrieved with smbc_option_set() and smbc_option_get().
          */
         void * _user_data;
+
+        /*
+         * Should we attempt UNIX smb encryption ? 
+         * Set to 0 if we should never attempt, set to 1 if
+         * encryption requested, set to 2 if encryption required.
+         */
+        int _smb_encryption_level;
 };     
 
 
index 9175b33d6023460df466462f58905286ab016042..07242f795675005bbd6eb86fc0f8f89266bdff08 100644 (file)
@@ -1961,7 +1961,7 @@ int smbc_fremovexattr(int fd,
  *                            extended attributes
  *
  * @note            This function always returns all attribute names supported
- *                  by NT file systems, regardless of wether the referenced
+ *                  by NT file systems, regardless of whether the referenced
  *                  file system supports extended attributes (e.g. a Windows
  *                  2000 machine supports extended attributes if NTFS is used,
  *                  but not if FAT is used, and Windows 98 doesn't support
diff --git a/source/include/memcache.h b/source/include/memcache.h
new file mode 100644 (file)
index 0000000..0a596b9
--- /dev/null
@@ -0,0 +1,115 @@
+/*
+   Unix SMB/CIFS implementation.
+   In-memory cache
+   Copyright (C) Volker Lendecke 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 __MEMCACHE_H__
+#define __MEMCACHE_H__
+
+#include "includes.h"
+
+struct memcache;
+
+/*
+ * A memcache can store different subkeys with overlapping keys, the
+ * memcache_number becomes part of the key. Feel free to add caches of your
+ * own here.
+ *
+ * If you add talloc type caches, also note this in the switch statement in
+ * memcache_is_talloc().
+ */
+
+enum memcache_number {
+       STAT_CACHE,
+       UID_SID_CACHE,
+       SID_UID_CACHE,
+       GID_SID_CACHE,
+       SID_GID_CACHE,
+       GETWD_CACHE,
+       GETPWNAM_CACHE,         /* talloc */
+       MANGLE_HASH2_CACHE,
+       PDB_GETPWSID_CACHE,     /* talloc */
+       SINGLETON_CACHE_TALLOC, /* talloc */
+       SINGLETON_CACHE
+};
+
+/*
+ * Create a memcache structure. max_size is in bytes, if you set it 0 it will
+ * not forget anything.
+ */
+
+struct memcache *memcache_init(TALLOC_CTX *mem_ctx, size_t max_size);
+
+/*
+ * If you set this global memcache, use it as the default cache when NULL is
+ * passed to the memcache functions below. This is a workaround for many
+ * situations where passing the cache everywhere would be a big hassle.
+ */
+
+void memcache_set_global(struct memcache *cache);
+
+/*
+ * Add a data blob to the cache
+ */
+
+void memcache_add(struct memcache *cache, enum memcache_number n,
+                 DATA_BLOB key, DATA_BLOB value);
+
+/*
+ * Add a talloc object to the cache. The difference to memcache_add() is that
+ * when the objects is to be discared, talloc_free is called for it. Also
+ * talloc_move() ownership of the object to the cache.
+ *
+ * Please note that the current implementation has a fixed relationship
+ * between what cache subtypes store talloc objects and which ones store plain
+ * blobs. We can fix this, but for now we don't have a mixed use of blobs vs
+ * talloc objects in the cache types.
+ */
+
+void memcache_add_talloc(struct memcache *cache, enum memcache_number n,
+                        DATA_BLOB key, void *ptr);
+
+/*
+ * Delete an object from the cache
+ */
+
+void memcache_delete(struct memcache *cache, enum memcache_number n,
+                    DATA_BLOB key);
+
+/*
+ * Look up an object from the cache. Memory still belongs to the cache, so
+ * make a copy of it if needed.
+ */
+
+bool memcache_lookup(struct memcache *cache, enum memcache_number n,
+                    DATA_BLOB key, DATA_BLOB *value);
+
+/*
+ * Look up an object from the cache. Memory still belongs to the cache, so
+ * make a copy of it if needed.
+ */
+
+void *memcache_lookup_talloc(struct memcache *cache, enum memcache_number n,
+                            DATA_BLOB key);
+
+/*
+ * Flush a complete cache subset.
+ */
+
+void memcache_flush(struct memcache *cache, enum memcache_number n);
+
+#endif
index 8de41ca049b870f703c90f290c400c4fe41ecfc4..c97ad982b3c34ab402e7588db41dc27a0502622e 100644 (file)
@@ -97,6 +97,7 @@
 #define MSG_WINBIND_TRY_TO_GO_ONLINE   0x0406
 #define MSG_WINBIND_FAILED_TO_GO_ONLINE 0x0407
 #define MSG_WINBIND_VALIDATE_CACHE     0x0408
+#define MSG_WINBIND_DUMP_DOMAIN_LIST   0x0409
 
 /* event messages */
 #define MSG_DUMP_EVENT_LIST            0x0500
index bb8a336b8c01032c9ddcfa47d4a19f8a5af35f88..b72ec6b0baa565ff3e8b8f8ea81caaf17b4a3a9c 100644 (file)
@@ -242,20 +242,15 @@ struct pdb_search {
  * changed to version 14 to move lookup_rids and lookup_names to return
  * enum lsa_SidType rather than uint32.
  * Changed to 16 for access to the trusted domain passwords (obnox).
+ * Changed to 17, the sampwent interface is gone.
  */
 
-#define PASSDB_INTERFACE_VERSION 16
+#define PASSDB_INTERFACE_VERSION 17
 
 struct pdb_methods 
 {
        const char *name; /* What name got this module */
 
-       NTSTATUS (*setsampwent)(struct pdb_methods *, bool update, uint32 acb_mask);
-       
-       void (*endsampwent)(struct pdb_methods *);
-       
-       NTSTATUS (*getsampwent)(struct pdb_methods *, struct samu *user);
-       
        NTSTATUS (*getsampwnam)(struct pdb_methods *, struct samu *sam_acct, const char *username);
        
        NTSTATUS (*getsampwsid)(struct pdb_methods *, struct samu *sam_acct, const DOM_SID *sid);
index 1d3cc57acde68238e6a27fc1c47eedf5728eaec1..9e5503f2701f09b368edd063c8df09a15d85ff6c 100644 (file)
@@ -49,6 +49,7 @@ struct user_auth_info {
        bool got_pass;
        bool use_kerberos;
        int signing_state;
+       bool smb_encrypt;
 };
 
 #endif /* _POPT_COMMON_H */
index f6cf9cccb7150a7c9a7f45ff4defc73216c41ce3..3df701f61cced8fc79fe60fe062b1a45f721108c 100644 (file)
@@ -61,6 +61,7 @@ struct registry_value {
 typedef struct {
        uint32          num_values;
        REGISTRY_VALUE  **values;
+       int seqnum;
 } REGVAL_CTR;
 
 /* container for registry subkey names */
@@ -68,6 +69,7 @@ typedef struct {
 typedef struct {
        uint32          num_subkeys;
        char            **subkeys;
+       int seqnum;
 } REGSUBKEY_CTR;
 
 /*
@@ -92,11 +94,17 @@ typedef struct {
 #define KEY_HKCU               "HKCU"
 #define KEY_HKDD               "HKDD"
 #define KEY_SERVICES           "HKLM\\SYSTEM\\CurrentControlSet\\Services"
+#define KEY_EVENTLOG           "HKLM\\SYSTEM\\CurrentControlSet\\Services\\Eventlog"
+#define KEY_SHARES             "HKLM\\SYSTEM\\CurrentControlSet\\Services\\LanmanServer\\Shares"
+#define KEY_NETLOGON_PARAMS    "HKLM\\SYSTEM\\CurrentControlSet\\Services\\Netlogon\\Parameters"
+#define KEY_TCPIP_PARAMS       "HKLM\\SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters"
+#define KEY_PROD_OPTIONS       "HKLM\\SYSTEM\\CurrentControlSet\\Control\\ProductOptions"
 #define KEY_PRINTING           "HKLM\\SYSTEM\\CurrentControlSet\\Control\\Print"
 #define KEY_PRINTING_2K                "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Print\\Printers"
 #define KEY_PRINTING_PORTS     "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Ports"
-#define KEY_EVENTLOG           "HKLM\\SYSTEM\\CurrentControlSet\\Services\\Eventlog"
-#define KEY_SHARES             "HKLM\\SYSTEM\\CurrentControlSet\\Services\\LanmanServer\\Shares"
+#define KEY_CURRENT_VERSION    "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion"
+#define KEY_PERFLIB            "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Perflib"
+#define KEY_PERFLIB_009                "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Perflib\\009"
 #define KEY_SMBCONF            "HKLM\\SOFTWARE\\Samba\\smbconf"
 #define KEY_TREE_ROOT          ""
 
@@ -128,6 +136,8 @@ typedef struct {
                              struct security_descriptor **psecdesc);
        WERROR (*set_secdesc)(const char *key,
                              struct security_descriptor *sec_desc);
+       bool    (*subkeys_need_update)(REGSUBKEY_CTR *subkeys);
+       bool    (*values_need_update)(REGVAL_CTR *values);
 } REGISTRY_OPS;
 
 typedef struct {
index 66c4f589879252a2a6419cf52443ba8197d9ec37..c560fd09090d700ddbe1da31329fbda4459cd973 100644 (file)
@@ -31,6 +31,9 @@
 #include "librpc/gen_ndr/cli_initshutdown.h"
 #include "librpc/gen_ndr/cli_winreg.h"
 #include "librpc/gen_ndr/cli_srvsvc.h"
+#include "librpc/gen_ndr/cli_samr.h"
+#include "librpc/gen_ndr/cli_netlogon.h"
+#include "librpc/gen_ndr/cli_dssetup.h"
 
 /* macro to expand cookie-cutter code in cli_xxx() using rpc_api_pipe_req() */
 
index 7ea3fcbc233d89659babf130d7bf05384988a3b7..ec08eb5f8f1f3761f70cd7bc9913b7f02b470206 100644 (file)
@@ -98,11 +98,6 @@ enum RPC_PKT_TYPE {
 #define RPC_AUTH_SCHANNEL_SIGN_OR_SEAL_CHK_LEN         0x20
 #define RPC_AUTH_SCHANNEL_SIGN_ONLY_CHK_LEN    0x18
 
-
-#define NETLOGON_NEG_ARCFOUR                   0x00000004
-#define NETLOGON_NEG_128BIT                    0x00004000
-#define NETLOGON_NEG_SCHANNEL                  0x40000000
-
 /* The 7 here seems to be required to get Win2k not to downgrade us
    to NT4.  Actually, anything other than 1ff would seem to do... */
 #define NETLOGON_NEG_AUTH2_FLAGS 0x000701ff
@@ -111,6 +106,8 @@ enum RPC_PKT_TYPE {
 /* these are the flags that ADS clients use */
 #define NETLOGON_NEG_AUTH2_ADS_FLAGS (0x200fbffb | NETLOGON_NEG_ARCFOUR | NETLOGON_NEG_128BIT | NETLOGON_NEG_SCHANNEL)
 
+#define NETLOGON_NEG_SELECT_AUTH2_FLAGS ((lp_security() == SEC_ADS) ? NETLOGON_NEG_AUTH2_ADS_FLAGS : NETLOGON_NEG_AUTH2_FLAGS)
+
 enum schannel_direction {
        SENDER_IS_INITIATOR,
        SENDER_IS_ACCEPTOR
diff --git a/source/include/rpc_ds.h b/source/include/rpc_ds.h
deleted file mode 100644 (file)
index 1ba02ae..0000000
+++ /dev/null
@@ -1,184 +0,0 @@
-/* 
-   Unix SMB/CIFS implementation.
-   SMB parameters and setup
-   Copyright (C) Gerald Carter                 2002
-      
-   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 _RPC_DS_H /* _RPC_LSA_H */
-#define _RPC_DS_H 
-
-/* Opcodes available on PIPE_LSARPC_DS */
-
-#define DS_GETPRIMDOMINFO      0x00
-#define DS_NOP                 0xFF    /* no op -- placeholder */
-
-/* Opcodes available on PIPE_NETLOGON */
-
-#define DS_ENUM_DOM_TRUSTS      0x28
-
-/* macros for RPC's */
-
-/* DSROLE_PRIMARY_DOMAIN_INFO_BASIC */
-
-/* flags */
-
-#define DSROLE_PRIMARY_DS_RUNNING           0x00000001
-#define DSROLE_PRIMARY_DS_MIXED_MODE        0x00000002
-#define DSROLE_UPGRADE_IN_PROGRESS          0x00000004
-#define DSROLE_PRIMARY_DOMAIN_GUID_PRESENT  0x01000000
-
-/* machine role */
-
-#define DSROLE_DOMAIN_MEMBER_WKS       1
-#define DSROLE_STANDALONE_SRV          2       
-#define DSROLE_DOMAIN_MEMBER_SRV       3
-#define DSROLE_BDC                     4
-#define DSROLE_PDC                     5
-
-/* Settings for the domainFunctionality attribute in the rootDSE */
-
-#define DS_DOMAIN_FUNCTION_2000                0
-#define DS_DOMAIN_FUCNTION_2003_MIXED  1
-#define DS_DOMAIN_FUNCTION_2003                2
-
-typedef struct
-{
-       uint16          machine_role;
-       uint32          flags;  
-       uint32          netbios_ptr;
-       uint32          dnsname_ptr;
-       uint32          forestname_ptr;
-       
-       struct GUID     domain_guid;    
-       UNISTR2 netbios_domain;
-       UNISTR2 dns_domain;     /* our dns domain */
-       UNISTR2 forest_domain;  /* root domain of the forest to which we belong */
-} DSROLE_PRIMARY_DOMAIN_INFO_BASIC;
-
-typedef struct
-{
-       DSROLE_PRIMARY_DOMAIN_INFO_BASIC        *basic;
-} DS_DOMINFO_CTR;
-
-/* info levels for ds_getprimdominfo() */
-
-#define DsRolePrimaryDomainInfoBasic           1
-
-/* DS_Q_GETPRIMDOMINFO - DsGetPrimaryDomainInformation() request */
-typedef struct 
-{
-       uint16  level;
-} DS_Q_GETPRIMDOMINFO;
-
-/* DS_R_GETPRIMDOMINFO - DsGetPrimaryDomainInformation() response */
-typedef struct 
-{
-       uint32          ptr;
-               
-       uint16          level;
-       uint16          unknown0;       /* 0x455c -- maybe just alignment? */
-
-       DS_DOMINFO_CTR  info;
-       
-       NTSTATUS status;
-} DS_R_GETPRIMDOMINFO;
-
-typedef struct {
-       /* static portion of structure */
-       uint32          netbios_ptr;
-       uint32          dns_ptr;
-       uint32          flags;
-       uint32          parent_index;
-       uint32          trust_type;
-       uint32          trust_attributes;
-       uint32          sid_ptr;
-       struct GUID     guid;
-       
-       UNISTR2         netbios_domain;
-       UNISTR2         dns_domain;
-       DOM_SID2        sid;
-
-} DS_DOMAIN_TRUSTS;
-
-struct ds_domain_trust {
-       /* static portion of structure */
-       uint32          flags;
-       uint32          parent_index;
-       uint32          trust_type;
-       uint32          trust_attributes;
-       struct GUID     guid;
-       
-       DOM_SID sid;
-       char *netbios_domain;
-       char *dns_domain;
-};
-
-typedef struct {
-
-       uint32                  ptr;
-       uint32                  max_count;
-       DS_DOMAIN_TRUSTS        *trusts;
-       
-} DS_DOMAIN_TRUSTS_CTR;
-
-/* Trust flags */
-
-#define DS_DOMAIN_IN_FOREST           0x0001   /* domains in the forest to which 
-                                                  we belong; even different domain trees */
-#define DS_DOMAIN_DIRECT_OUTBOUND     0x0002   /* trusted domains */
-#define DS_DOMAIN_TREE_ROOT           0x0004   /* root of a forest */
-#define DS_DOMAIN_PRIMARY             0x0008   /* our domain */
-#define DS_DOMAIN_NATIVE_MODE         0x0010   /* native mode AD servers */
-#define DS_DOMAIN_DIRECT_INBOUND      0x0020   /* trusting domains */
-
-/* Trust types */
-
-#define DS_DOMAIN_TRUST_TYPE_DOWNLEVEL   0x00000001
-#define DS_DOMAIN_TRUST_TYPE_UPLEVEL     0x00000002
-
-/* Trust attributes */
-
-#define DS_DOMAIN_TRUST_ATTRIB_NON_TRANSITIVE         0x00000001
-#define DS_DOMAIN_TRUST_ATTRIB_UPLEVEL_ONLY           0x00000002            
-#define DS_DOMAIN_TRUST_ATTRIB_QUARANTINED_DOMAIN     0x00000004            
-#define DS_DOMAIN_TRUST_ATTRIB_FOREST_TRANSITIVE      0x00000008            
-#define DS_DOMAIN_TRUST_ATTRIB_CROSS_ORG              0x00000010            
-#define DS_DOMAIN_TRUST_ATTRIB_IN_FOREST              0x00000020            
-#define DS_DOMAIN_TRUST_ATTRIB_EXTERNAL               0x00000040            
-
-
-
-/* DS_Q_ENUM_DOM_TRUSTS - DsEnumerateDomainTrusts() request */
-typedef struct 
-{
-       uint32          server_ptr;
-       UNISTR2         server;
-       uint32          flags;
-       
-} DS_Q_ENUM_DOM_TRUSTS;
-
-/* DS_R_ENUM_DOM_TRUSTS - DsEnumerateDomainTrusts() response */
-typedef struct 
-{
-       uint32                  num_domains;
-       DS_DOMAIN_TRUSTS_CTR    domains;
-               
-       NTSTATUS status;
-
-} DS_R_ENUM_DOM_TRUSTS;
-
-
-#endif /* _RPC_DS_H */
index 9f90b53ffabdb1e42ec6f6c7f2a68357d9b3c000..371c3ebd114e14d0cf27d566bc8da03763a57480 100644 (file)
 
 #define LSA_AUDIT_NUM_CATEGORIES_NT4   7
 #define LSA_AUDIT_NUM_CATEGORIES_WIN2K 9
-
 #define LSA_AUDIT_NUM_CATEGORIES LSA_AUDIT_NUM_CATEGORIES_NT4
 
-#define LSA_AUDIT_POLICY_NONE          0x00
-#define LSA_AUDIT_POLICY_SUCCESS       0x01
-#define LSA_AUDIT_POLICY_FAILURE       0x02
-#define LSA_AUDIT_POLICY_ALL           (LSA_AUDIT_POLICY_SUCCESS|LSA_AUDIT_POLICY_FAILURE)
-#define LSA_AUDIT_POLICY_CLEAR         0x04
-
-enum lsa_audit_categories {
-       LSA_AUDIT_CATEGORY_SYSTEM = 0,
-       LSA_AUDIT_CATEGORY_LOGON = 1,
-       LSA_AUDIT_CATEGORY_FILE_AND_OBJECT_ACCESS,
-       LSA_AUDIT_CATEGORY_USE_OF_USER_RIGHTS,
-       LSA_AUDIT_CATEGORY_PROCCESS_TRACKING,
-       LSA_AUDIT_CATEGORY_SECURITY_POLICY_CHANGES,
-       LSA_AUDIT_CATEGORY_ACCOUNT_MANAGEMENT,
-       LSA_AUDIT_CATEGORY_DIRECTORY_SERVICE_ACCESS,    /* only in win2k/2k3 */
-       LSA_AUDIT_CATEGORY_ACCOUNT_LOGON                /* only in win2k/2k3 */
-};
-
 /* level 1 is auditing settings */
 typedef struct dom_query_1
 {
@@ -334,22 +315,6 @@ typedef struct lsa_info_ctr
 
 typedef LSA_INFO_CTR LSA_INFO_CTR2;
 
-/* LSA_Q_SET_INFO - LSA set info policy */
-typedef struct lsa_set_info
-{
-       POLICY_HND pol; /* policy handle */
-       uint16 info_class; /* info class */
-       LSA_INFO_CTR ctr;
-
-} LSA_Q_SET_INFO;
-
-/* LSA_R_SET_INFO - response to LSA set info policy */
-typedef struct lsa_r_set_info
-{
-       NTSTATUS status; /* return code */
-
-} LSA_R_SET_INFO;
-
 /* LSA_R_QUERY_INFO - response to LSA query info policy */
 typedef struct lsa_r_query_info
 {
@@ -961,64 +926,6 @@ typedef struct lsa_r_removeprivs
        NTSTATUS status;
 } LSA_R_REMOVEPRIVS;
 
-/*******************************************************/
-#if 0 /* jerry, I think this not correct - gd */
-typedef struct {
-       POLICY_HND      handle;
-       uint32          count;  /* ??? this is what ethereal calls it */
-       DOM_SID         sid;
-} LSA_Q_OPEN_TRUSTED_DOMAIN;
-#endif
-
-/* LSA_Q_OPEN_TRUSTED_DOMAIN - LSA Query Open Trusted Domain */
-typedef struct lsa_q_open_trusted_domain
-{
-       POLICY_HND      pol;    /* policy handle */
-       DOM_SID2        sid;    /* domain sid */
-       uint32  access_mask;    /* access mask */
-       
-} LSA_Q_OPEN_TRUSTED_DOMAIN;
-
-/* LSA_R_OPEN_TRUSTED_DOMAIN - response to LSA Query Open Trusted Domain */
-typedef struct {
-       POLICY_HND      handle; /* trustdom policy handle */
-       NTSTATUS        status; /* return code */
-} LSA_R_OPEN_TRUSTED_DOMAIN;
-
-
-/*******************************************************/
-
-/* LSA_Q_OPEN_TRUSTED_DOMAIN_BY_NAME - LSA Query Open Trusted Domain by Name*/
-typedef struct lsa_q_open_trusted_domain_by_name
-{
-       POLICY_HND      pol;    /* policy handle */
-       LSA_STRING      name;   /* domain name */
-       uint32  access_mask;    /* access mask */
-       
-} LSA_Q_OPEN_TRUSTED_DOMAIN_BY_NAME;
-
-/* LSA_R_OPEN_TRUSTED_DOMAIN_BY_NAME - response to LSA Query Open Trusted Domain by Name */
-typedef struct {
-       POLICY_HND      handle; /* trustdom policy handle */
-       NTSTATUS        status; /* return code */
-} LSA_R_OPEN_TRUSTED_DOMAIN_BY_NAME;
-
-
-/*******************************************************/
-
-
-typedef struct {
-       POLICY_HND      handle; 
-       UNISTR4         secretname;
-       uint32          access;
-} LSA_Q_OPEN_SECRET;
-
-typedef struct {
-       POLICY_HND      handle;
-       NTSTATUS        status;
-} LSA_R_OPEN_SECRET;
-
-
 /*******************************************************/
 
 typedef struct {
@@ -1029,221 +936,4 @@ typedef struct {
        NTSTATUS        status;
 } LSA_R_DELETE_OBJECT;
 
-
-/*******************************************************/
-
-typedef struct {
-       POLICY_HND      handle;
-       UNISTR4         secretname;
-       uint32          access;
-} LSA_Q_CREATE_SECRET;
-
-typedef struct {
-       POLICY_HND      handle;
-       NTSTATUS        status;
-} LSA_R_CREATE_SECRET;
-
-
-/*******************************************************/
-
-typedef struct {
-       POLICY_HND      handle; 
-       UNISTR4         secretname;
-       uint32          access;
-} LSA_Q_CREATE_TRUSTED_DOMAIN;
-
-typedef struct {
-       POLICY_HND      handle;
-       NTSTATUS        status;
-} LSA_R_CREATE_TRUSTED_DOMAIN;
-
-
-/*******************************************************/
-
-typedef struct {
-       uint32  size;   /* size is written on the wire twice so I 
-                          can only assume that one is supposed to 
-                          be a max length and one is a size */
-       UNISTR2 *data;  /* not really a UNICODE string but the parsing 
-                          is the same */
-} LSA_DATA_BLOB;
-
-typedef struct {
-       POLICY_HND      handle; 
-       LSA_DATA_BLOB   *old_value;
-       LSA_DATA_BLOB   *new_value;
-} LSA_Q_SET_SECRET;
-
-typedef struct {
-       NTSTATUS        status;
-} LSA_R_SET_SECRET;
-
-/* LSA_Q_QUERY_TRUSTED_DOMAIN_INFO - LSA query trusted domain info */
-typedef struct lsa_query_trusted_domain_info
-{
-       POLICY_HND      pol;            /* policy handle */
-       uint16          info_class;     /* info class */
-
-} LSA_Q_QUERY_TRUSTED_DOMAIN_INFO;
-
-/* LSA_Q_QUERY_TRUSTED_DOMAIN_INFO_BY_SID - LSA query trusted domain info */
-typedef struct lsa_query_trusted_domain_info_by_sid
-{
-       POLICY_HND      pol;            /* policy handle */
-       DOM_SID2        dom_sid;        /* domain sid */
-       uint16          info_class;     /* info class */
-       
-} LSA_Q_QUERY_TRUSTED_DOMAIN_INFO_BY_SID;
-
-/* LSA_Q_QUERY_TRUSTED_DOMAIN_INFO_BY_NAME - LSA query trusted domain info */
-typedef struct lsa_query_trusted_domain_info_by_name
-{
-       POLICY_HND      pol;            /* policy handle */
-       LSA_STRING      domain_name;    /* domain name */
-       uint16          info_class;     /* info class */
-       
-} LSA_Q_QUERY_TRUSTED_DOMAIN_INFO_BY_NAME;
-
-typedef struct trusted_domain_info_name {
-       LSA_STRING      netbios_name; 
-} TRUSTED_DOMAIN_INFO_NAME;
-
-typedef struct trusted_domain_info_posix_offset {
-       uint32          posix_offset;
-} TRUSTED_DOMAIN_INFO_POSIX_OFFSET;
-
-typedef struct lsa_data_buf {
-       uint32 size;
-       uint32 offset;
-       uint32 length;
-       uint8 *data;
-} LSA_DATA_BUF;
-
-typedef struct lsa_data_buf_hdr {
-       uint32 length;
-       uint32 size;
-       uint32 data_ptr;
-} LSA_DATA_BUF_HDR;
-
-
-typedef struct lsa_data_buf2 {
-       uint32 size;
-       uint8 *data;
-} LSA_DATA_BUF2;
-
-typedef struct trusted_domain_info_password {
-       uint32 ptr_password;
-       uint32 ptr_old_password;
-       LSA_DATA_BUF_HDR password_hdr;
-       LSA_DATA_BUF_HDR old_password_hdr;
-       LSA_DATA_BUF password;
-       LSA_DATA_BUF old_password;
-} TRUSTED_DOMAIN_INFO_PASSWORD;
-
-typedef struct trusted_domain_info_basic {
-       LSA_STRING      netbios_name;
-       DOM_SID2        sid;
-} TRUSTED_DOMAIN_INFO_BASIC;
-
-typedef struct trusted_domain_info_ex {
-       LSA_STRING      domain_name;
-       LSA_STRING      netbios_name;
-       DOM_SID2        sid;
-       uint32          trust_direction;
-       uint32          trust_type;
-       uint32          trust_attributes;
-} TRUSTED_DOMAIN_INFO_EX;
-
-typedef struct trust_domain_info_buffer {
-       NTTIME          last_update_time;
-       uint32          secret_type;
-       LSA_DATA_BUF2   data;
-} LSA_TRUSTED_DOMAIN_INFO_BUFFER;
-
-typedef struct trusted_domain_info_auth_info {
-       uint32 incoming_count;
-       LSA_TRUSTED_DOMAIN_INFO_BUFFER incoming_current_auth_info;
-       LSA_TRUSTED_DOMAIN_INFO_BUFFER incoming_previous_auth_info;
-       uint32 outgoing_count;
-       LSA_TRUSTED_DOMAIN_INFO_BUFFER outgoing_current_auth_info;
-       LSA_TRUSTED_DOMAIN_INFO_BUFFER outgoing_previous_auth_info;
-} TRUSTED_DOMAIN_INFO_AUTH_INFO;
-
-typedef struct trusted_domain_info_full_info {
-       TRUSTED_DOMAIN_INFO_EX          info_ex;
-       TRUSTED_DOMAIN_INFO_POSIX_OFFSET posix_offset;
-       TRUSTED_DOMAIN_INFO_AUTH_INFO   auth_info;
-} TRUSTED_DOMAIN_INFO_FULL_INFO;
-
-typedef struct trusted_domain_info_11 {
-       TRUSTED_DOMAIN_INFO_EX          info_ex;
-       LSA_DATA_BUF2                   data1;
-} TRUSTED_DOMAIN_INFO_11;
-
-typedef struct trusted_domain_info_all {
-       TRUSTED_DOMAIN_INFO_EX          info_ex;
-       LSA_DATA_BUF2                   data1;
-       TRUSTED_DOMAIN_INFO_POSIX_OFFSET posix_offset;
-       TRUSTED_DOMAIN_INFO_AUTH_INFO   auth_info;
-} TRUSTED_DOMAIN_INFO_ALL;
-
-/* LSA_TRUSTED_DOMAIN_INFO */
-typedef union lsa_trusted_domain_info
-{
-       uint16                                  info_class;
-       TRUSTED_DOMAIN_INFO_NAME                name;
-       /* deprecated - gd
-       TRUSTED_DOMAIN_INFO_CONTROLLERS_INFO    controllers; */
-       TRUSTED_DOMAIN_INFO_POSIX_OFFSET        posix_offset;
-       TRUSTED_DOMAIN_INFO_PASSWORD            password;
-       TRUSTED_DOMAIN_INFO_BASIC               basic;
-       TRUSTED_DOMAIN_INFO_EX                  info_ex;
-       TRUSTED_DOMAIN_INFO_AUTH_INFO           auth_info;
-       TRUSTED_DOMAIN_INFO_FULL_INFO           full_info;
-       TRUSTED_DOMAIN_INFO_11                  info11;
-       TRUSTED_DOMAIN_INFO_ALL                 info_all;
-
-} LSA_TRUSTED_DOMAIN_INFO;
-
-/* LSA_R_QUERY_TRUSTED_DOMAIN_INFO - LSA query trusted domain info */
-typedef struct r_lsa_query_trusted_domain_info
-{
-       LSA_TRUSTED_DOMAIN_INFO *info;
-       NTSTATUS status;
-} LSA_R_QUERY_TRUSTED_DOMAIN_INFO;
-
-typedef struct dom_info_kerberos {
-       uint32 enforce_restrictions;
-       NTTIME service_tkt_lifetime;
-       NTTIME user_tkt_lifetime;
-       NTTIME user_tkt_renewaltime;
-       NTTIME clock_skew;
-       NTTIME unknown6;
-} LSA_DOM_INFO_POLICY_KERBEROS;
-
-typedef struct dom_info_efs {
-       uint32 blob_len;
-       UNISTR2 efs_blob;
-} LSA_DOM_INFO_POLICY_EFS;
-
-typedef struct lsa_dom_info_union {
-       uint16 info_class;
-       LSA_DOM_INFO_POLICY_EFS efs_policy;
-       LSA_DOM_INFO_POLICY_KERBEROS krb_policy;
-} LSA_DOM_INFO_UNION;
-
-/* LSA_Q_QUERY_DOM_INFO_POLICY - LSA query info */
-typedef struct lsa_q_query_dom_info_policy
-{
-       POLICY_HND pol;    /* policy handle */
-       uint16 info_class; /* info class */
-} LSA_Q_QUERY_DOM_INFO_POLICY;
-
-typedef struct lsa_r_query_dom_info_policy
-{
-       LSA_DOM_INFO_UNION *info;
-       NTSTATUS status;
-} LSA_R_QUERY_DOM_INFO_POLICY;
-
-
 #endif /* _RPC_LSA_H */
index a82b977a5bbadfd8014a52eebf15307b7f303e4e..244e37d85a3170cbbba2a479a0fbcbe0cdfa5e69 100644 (file)
 #define NET_DSR_GETDCNAMEEX2   0x22
 #define NET_SAMLOGON_EX                0x27
 
-/* Secure Channel types.  used in NetrServerAuthenticate negotiation */
-#define SEC_CHAN_WKSTA   2
-#define SEC_CHAN_DOMAIN  4
-#define SEC_CHAN_BDC     6
-
 /* Returned delta types */
 #define SAM_DELTA_DOMAIN_INFO    0x01
 #define SAM_DELTA_GROUP_INFO     0x02
 #define NL_CTRL_REPL_IN_PROGRESS 0x0002
 #define NL_CTRL_FULL_SYNC        0x0004
 
-#define LOGON_GUEST                    0x00000001
-#define LOGON_NOENCRYPTION             0x00000002
-#define LOGON_CACHED_ACCOUNT           0x00000004
-#define LOGON_USED_LM_PASSWORD         0x00000008
-#define LOGON_EXTRA_SIDS               0x00000020
-#define LOGON_SUBAUTH_SESSION_KEY      0x00000040
-#define LOGON_SERVER_TRUST_ACCOUNT     0x00000080
-#define LOGON_NTLMV2_ENABLED           0x00000100
-#define LOGON_RESOURCE_GROUPS          0x00000200
-#define LOGON_PROFILE_PATH_RETURNED    0x00000400
-#define LOGON_GRACE_LOGON              0x01000000
 #define LOGON_KRB5_FAIL_CLOCK_SKEW     0x02000000
 
-#define SE_GROUP_MANDATORY             0x00000001
-#define SE_GROUP_ENABLED_BY_DEFAULT    0x00000002
-#define SE_GROUP_ENABLED               0x00000004
-#define SE_GROUP_OWNER                         0x00000008
-#define SE_GROUP_USE_FOR_DENY_ONLY     0x00000010
-#define SE_GROUP_LOGON_ID              0xC0000000
-#define SE_GROUP_RESOURCE              0x20000000      /* Domain Local Group */
-
 /* Flags for controlling the behaviour of a particular logon */
 
-/* sets LOGON_SERVER_TRUST_ACCOUNT user_flag */
+/* sets NETLOGON_SERVER_TRUST_ACCOUNT user_flag */
+#if 0
 #define MSV1_0_ALLOW_SERVER_TRUST_ACCOUNT      0x00000020
 #define MSV1_0_ALLOW_WORKSTATION_TRUST_ACCOUNT 0x00000800
 
 /* returns the profilepath in the driveletter and 
  * sets LOGON_PROFILE_PATH_RETURNED user_flag */
 #define MSV1_0_RETURN_PROFILE_PATH             0x00000200
+#endif
 
 #if 0
 /* I think this is correct - it's what gets parsed on the wire. JRA. */
@@ -1054,31 +1032,6 @@ typedef struct net_r_sam_deltas_info {
        NTSTATUS status;
 } NET_R_SAM_DELTAS;
 
-#define DS_FORCE_REDISCOVERY            0x00000001
-#define DS_DIRECTORY_SERVICE_REQUIRED   0x00000010
-#define DS_DIRECTORY_SERVICE_PREFERRED  0x00000020
-#define DS_GC_SERVER_REQUIRED           0x00000040
-#define DS_PDC_REQUIRED                 0x00000080
-#define DS_BACKGROUND_ONLY              0x00000100
-#define DS_IP_REQUIRED                  0x00000200
-#define DS_KDC_REQUIRED                 0x00000400
-#define DS_TIMESERV_REQUIRED            0x00000800
-#define DS_WRITABLE_REQUIRED            0x00001000
-#define DS_GOOD_TIMESERV_PREFERRED      0x00002000
-#define DS_AVOID_SELF                   0x00004000
-#define DS_ONLY_LDAP_NEEDED             0x00008000
-
-#define DS_IS_FLAT_NAME                 0x00010000
-#define DS_IS_DNS_NAME                  0x00020000
-
-#define DS_RETURN_DNS_NAME              0x40000000
-#define DS_RETURN_FLAT_NAME             0x80000000
-
-#if 0 /* unknown yet */
-#define DS_IP_VERSION_AGNOSTIC
-#define DS_TRY_NEXTCLOSEST_SITE
-#endif
-
 #define DSGETDC_VALID_FLAGS ( \
     DS_FORCE_REDISCOVERY | \
     DS_DIRECTORY_SERVICE_REQUIRED | \
@@ -1143,41 +1096,6 @@ typedef struct net_r_dsr_getdcname {
        WERROR result;
 } NET_R_DSR_GETDCNAME;
 
-/* NET_Q_DSR_GETDCNAMEEX */
-typedef struct net_q_dsr_getdcnameex {
-       uint32 ptr_server_unc;
-       UNISTR2 uni_server_unc;
-       uint32 ptr_domain_name;
-       UNISTR2 uni_domain_name;
-       uint32 ptr_domain_guid;
-       struct GUID *domain_guid;
-       uint32 ptr_site_name;
-       UNISTR2 uni_site_name;
-       uint32 flags;
-} NET_Q_DSR_GETDCNAMEEX;
-
-/* NET_R_DSR_GETDCNAMEEX */
-typedef struct net_r_dsr_getdcnameex NET_R_DSR_GETDCNAMEEX;
-
-/* NET_Q_DSR_GETDCNAMEEX2 */
-typedef struct net_q_dsr_getdcnameex2 {
-       uint32 ptr_server_unc;
-       UNISTR2 uni_server_unc;
-       uint32 ptr_client_account;
-       UNISTR2 uni_client_account;
-       uint32 mask;
-       uint32 ptr_domain_name;
-       UNISTR2 uni_domain_name;
-       uint32 ptr_domain_guid;
-       struct GUID *domain_guid;
-       uint32 ptr_site_name;
-       UNISTR2 uni_site_name;
-       uint32 flags;
-} NET_Q_DSR_GETDCNAMEEX2;
-
-/* NET_R_DSR_GETDCNAMEEX2 */
-typedef struct net_r_dsr_getdcnameex2 NET_R_DSR_GETDCNAMEEX2;
-
 /* NET_Q_DSR_GESITENAME */
 typedef struct net_q_dsr_getsitename {
        uint32 ptr_computer_name;
index 2273fba2e6c523fd96dd83a8b55ecf7bd4d28340..fa8bf07564f9c62f7beef836d9f0da399ff36ac9 100644 (file)
@@ -445,23 +445,6 @@ typedef struct sam_user_info_9
 } SAM_USER_INFO_9;
 
 
-/* SAMR_Q_CLOSE_HND - probably a policy handle close */
-typedef struct q_samr_close_hnd_info
-{
-    POLICY_HND pol;          /* policy handle */
-
-} SAMR_Q_CLOSE_HND;
-
-
-/* SAMR_R_CLOSE_HND - probably a policy handle close */
-typedef struct r_samr_close_hnd_info
-{
-       POLICY_HND pol;       /* policy handle */
-       NTSTATUS status;         /* return status */
-
-} SAMR_R_CLOSE_HND;
-
-
 /****************************************************************************
 SAMR_Q_GET_USRDOM_PWINFO - a "set user info" occurs just after this
 *****************************************************************************/
@@ -701,31 +684,6 @@ typedef struct r_samr_lookup_domain_info
 } SAMR_R_LOOKUP_DOMAIN;
 
 
-/****************************************************************************
-SAMR_Q_OPEN_DOMAIN - unknown_0 values seen associated with SIDs:
-
-0x0000 03f1 and a specific   domain sid - S-1-5-21-44c01ca6-797e5c3d-33f83fd0
-0x0000 0200 and a specific   domain sid - S-1-5-21-44c01ca6-797e5c3d-33f83fd0
-*****************************************************************************/
-
-/* SAMR_Q_OPEN_DOMAIN */
-typedef struct q_samr_open_domain_info
-{
-       POLICY_HND pol;   /* policy handle */
-       uint32 flags;               /* 0x2000 0000; 0x0000 0211; 0x0000 0280; 0x0000 0200 - flags? */
-       DOM_SID2 dom_sid;         /* domain SID */
-
-} SAMR_Q_OPEN_DOMAIN;
-
-
-/* SAMR_R_OPEN_DOMAIN - probably an open */
-typedef struct r_samr_open_domain_info
-{
-       POLICY_HND domain_pol; /* policy handle associated with the SID */
-       NTSTATUS status;         /* return status */
-
-} SAMR_R_OPEN_DOMAIN;
-
 #define MAX_SAM_ENTRIES_W2K 0x400
 #define MAX_SAM_ENTRIES_W95 50
 /* The following should be the greater of the preceeding two. */
@@ -1076,45 +1034,6 @@ typedef struct r_samr_get_dispenum_index
        
 } SAMR_R_GET_DISPENUM_INDEX;
 
-/* SAMR_Q_DELETE_DOM_GROUP - delete domain group */
-typedef struct q_samr_delete_dom_group_info
-{
-    POLICY_HND group_pol;          /* policy handle */
-
-} SAMR_Q_DELETE_DOM_GROUP;
-
-
-/* SAMR_R_DELETE_DOM_GROUP - delete domain group */
-typedef struct r_samr_delete_dom_group_info
-{
-       POLICY_HND pol;       /* policy handle */
-       NTSTATUS status;        /* return status */
-
-} SAMR_R_DELETE_DOM_GROUP;
-
-
-/* SAMR_Q_CREATE_DOM_GROUP - SAM create group */
-typedef struct q_samr_create_dom_group_info
-{
-       POLICY_HND pol;        /* policy handle */
-
-       UNIHDR hdr_acct_desc;
-       UNISTR2 uni_acct_desc;
-
-       uint32 access_mask;    
-
-} SAMR_Q_CREATE_DOM_GROUP;
-
-/* SAMR_R_CREATE_DOM_GROUP - SAM create group */
-typedef struct r_samr_create_dom_group_info
-{
-       POLICY_HND pol;        /* policy handle */
-
-       uint32 rid;    
-       NTSTATUS status;    
-
-} SAMR_R_CREATE_DOM_GROUP;
-
 /* SAMR_Q_QUERY_GROUPINFO - SAM Group Info */
 typedef struct q_samr_query_group_info
 {
@@ -1218,46 +1137,6 @@ typedef struct r_samr_set_group_info
 } SAMR_R_SET_GROUPINFO;
 
 
-/* SAMR_Q_DELETE_DOM_ALIAS - delete domain alias */
-typedef struct q_samr_delete_dom_alias_info
-{
-    POLICY_HND alias_pol;          /* policy handle */
-
-} SAMR_Q_DELETE_DOM_ALIAS;
-
-
-/* SAMR_R_DELETE_DOM_ALIAS - delete domain alias */
-typedef struct r_samr_delete_dom_alias_info
-{
-       POLICY_HND pol;       /* policy handle */
-       NTSTATUS status;        /* return status */
-
-} SAMR_R_DELETE_DOM_ALIAS;
-
-
-/* SAMR_Q_CREATE_DOM_ALIAS - SAM create alias */
-typedef struct q_samr_create_dom_alias_info
-{
-       POLICY_HND dom_pol;        /* policy handle */
-
-       UNIHDR hdr_acct_desc;
-       UNISTR2 uni_acct_desc;
-
-       uint32 access_mask;    /* 0x001f000f */
-
-} SAMR_Q_CREATE_DOM_ALIAS;
-
-/* SAMR_R_CREATE_DOM_ALIAS - SAM create alias */
-typedef struct r_samr_create_dom_alias_info
-{
-       POLICY_HND alias_pol;        /* policy handle */
-
-       uint32 rid;    
-       NTSTATUS status;    
-
-} SAMR_R_CREATE_DOM_ALIAS;
-
-
 /********************************************************/
 
 typedef struct {
@@ -1527,68 +1406,6 @@ typedef struct r_samr_lookup_rids_info
 } SAMR_R_LOOKUP_RIDS;
 
 
-/* SAMR_Q_OPEN_USER - probably an open */
-typedef struct q_samr_open_user_info
-{
-       POLICY_HND domain_pol;       /* policy handle */
-       uint32 access_mask;     /* 32 bit unknown - 0x02011b */
-       uint32 user_rid;      /* user RID */
-
-} SAMR_Q_OPEN_USER;
-
-
-/* SAMR_R_OPEN_USER - probably an open */
-typedef struct r_samr_open_user_info
-{
-       POLICY_HND user_pol;       /* policy handle associated with unknown id */
-       NTSTATUS status;         /* return status */
-
-} SAMR_R_OPEN_USER;
-
-
-/* SAMR_Q_CREATE_USER - probably a create */
-typedef struct q_samr_create_user_info
-{
-       POLICY_HND domain_pol;       /* policy handle */
-
-       UNIHDR  hdr_name;       /* unicode account name header */
-       UNISTR2 uni_name;       /* unicode account name */
-
-       uint32 acb_info;      /* account control info */
-       uint32 access_mask;     /* 0xe005 00b0 */
-
-} SAMR_Q_CREATE_USER;
-
-
-/* SAMR_R_CREATE_USER - probably a create */
-typedef struct r_samr_create_user_info
-{
-       POLICY_HND user_pol;       /* policy handle associated with user */
-
-       uint32 access_granted;
-       uint32 user_rid;      /* user RID */
-       NTSTATUS status;         /* return status */
-
-} SAMR_R_CREATE_USER;
-
-
-/* SAMR_Q_DELETE_DOM_USER - delete domain user */
-typedef struct q_samr_delete_dom_user_info
-{
-    POLICY_HND user_pol;          /* policy handle */
-
-} SAMR_Q_DELETE_DOM_USER;
-
-
-/* SAMR_R_DELETE_DOM_USER - delete domain user */
-typedef struct r_samr_delete_dom_user_info
-{
-       POLICY_HND pol;       /* policy handle */
-       NTSTATUS status;        /* return status */
-
-} SAMR_R_DELETE_DOM_USER;
-
-
 /* SAMR_Q_QUERY_GROUPMEM - query group members */
 typedef struct q_samr_query_groupmem_info
 {
@@ -1653,25 +1470,6 @@ typedef struct r_samr_add_group_mem_info
 } SAMR_R_ADD_GROUPMEM;
 
 
-/* SAMR_Q_OPEN_GROUP - probably an open */
-typedef struct q_samr_open_group_info
-{
-       POLICY_HND domain_pol;       /* policy handle */
-       uint32 access_mask;         /* 0x0000 0001, 0x0000 0003, 0x0000 001f */
-       uint32 rid_group;        /* rid */
-
-} SAMR_Q_OPEN_GROUP;
-
-
-/* SAMR_R_OPEN_GROUP - probably an open */
-typedef struct r_samr_open_group_info
-{
-       POLICY_HND pol;       /* policy handle */
-       NTSTATUS status;         /* return status */
-
-} SAMR_R_OPEN_GROUP;
-
-
 /* SAMR_Q_QUERY_ALIASMEM - query alias members */
 typedef struct q_samr_query_aliasmem_info
 {
@@ -1730,27 +1528,6 @@ typedef struct r_samr_del_alias_mem_info
 } SAMR_R_DEL_ALIASMEM;
 
 
-
-/* SAMR_Q_OPEN_ALIAS - probably an open */
-typedef struct q_samr_open_alias_info
-{
-       POLICY_HND dom_pol;
-
-       uint32 access_mask;         
-       uint32 rid_alias;
-
-} SAMR_Q_OPEN_ALIAS;
-
-
-/* SAMR_R_OPEN_ALIAS - probably an open */
-typedef struct r_samr_open_alias_info
-{
-       POLICY_HND pol;       /* policy handle */
-       NTSTATUS status;         /* return status */
-
-} SAMR_R_OPEN_ALIAS;
-
-
 /* SAMR_Q_CONNECT_ANON - probably an open */
 typedef struct q_samr_connect_anon_info {
        uint32 ptr;                  /* ptr? */
@@ -1823,31 +1600,6 @@ typedef struct r_samr_connect_info5
 } SAMR_R_CONNECT5;
 
 
-/* SAMR_Q_GET_DOM_PWINFO */
-typedef struct q_samr_get_dom_pwinfo
-{
-       uint32 ptr; 
-       UNIHDR  hdr_srv_name;
-       UNISTR2 uni_srv_name;
-
-} SAMR_Q_GET_DOM_PWINFO;
-
-#define DOMAIN_PASSWORD_COMPLEX                0x00000001
-#define DOMAIN_PASSWORD_NO_ANON_CHANGE 0x00000002
-#define DOMAIN_PASSWORD_NO_CLEAR_CHANGE        0x00000004
-#define DOMAIN_LOCKOUT_ADMINS          0x00000008
-#define DOMAIN_PASSWORD_STORE_CLEARTEXT        0x00000010
-#define DOMAIN_REFUSE_PASSWORD_CHANGE  0x00000020
-
-/* SAMR_R_GET_DOM_PWINFO */
-typedef struct r_samr_get_dom_pwinfo
-{
-       uint16 min_pwd_length;
-       uint32 password_properties;
-       NTSTATUS status;
-
-} SAMR_R_GET_DOM_PWINFO;
-
 /* SAMR_ENC_PASSWD */
 typedef struct enc_passwd_info
 {
@@ -1915,11 +1667,6 @@ typedef struct q_samr_chgpasswd_user3
 
 } SAMR_Q_CHGPASSWD_USER3;
 
-#define REJECT_REASON_OTHER            0x00000000
-#define REJECT_REASON_TOO_SHORT                0x00000001
-#define REJECT_REASON_IN_HISTORY       0x00000002
-#define REJECT_REASON_NOT_COMPLEX      0x00000005
-
 /* SAMR_CHANGE_REJECT */
 typedef struct samr_change_reject
 {
index 1222c9a73ad29b63b691d00ac30a3868ea1f6531..3e0c997997f00a22b11b08465cbc9d39f5ff0aea 100644 (file)
@@ -27,7 +27,7 @@
 #define _SMB_H
 
 /* logged when starting the various Samba daemons */
-#define COPYRIGHT_STARTUP_MESSAGE      "Copyright Andrew Tridgell and the Samba Team 1992-2007"
+#define COPYRIGHT_STARTUP_MESSAGE      "Copyright Andrew Tridgell and the Samba Team 1992-2008"
 
 
 #if defined(LARGE_SMB_OFF_T)
@@ -80,7 +80,8 @@ enum smb_read_errors {
        SMB_WRITE_ERROR, /* This error code can go into the client smb_rw_error. */
        SMB_READ_BAD_SIG,
        SMB_NO_MEMORY,
-       SMB_DO_NOT_DO_TDIS /* cli_close_connection() check for this when smbfs wants to keep tree connected */
+       SMB_DO_NOT_DO_TDIS, /* cli_close_connection() check for this when smbfs wants to keep tree connected */
+       SMB_READ_BAD_DECRYPT
 };
 
 #define DIR_STRUCT_SIZE 43
@@ -192,7 +193,7 @@ typedef uint32 codepoint_t;
 #define PIPE_NETLOGON_PLAIN "\\NETLOGON"
 
 #define PI_LSARPC              0
-#define PI_LSARPC_DS           1
+#define PI_DSSETUP             1
 #define PI_SAMR                        2
 #define PI_NETLOGON            3
 #define PI_SRVSVC              4
@@ -210,30 +211,6 @@ typedef uint32 codepoint_t;
 /* 64 bit time (100usec) since ????? - cifs6.txt, section 3.5, page 30 */
 typedef uint64_t NTTIME;
 
-
-/* Allowable account control bits */
-#define ACB_DISABLED                   0x00000001  /* 1 = User account disabled */
-#define ACB_HOMDIRREQ                  0x00000002  /* 1 = Home directory required */
-#define ACB_PWNOTREQ                   0x00000004  /* 1 = User password not required */
-#define ACB_TEMPDUP                    0x00000008  /* 1 = Temporary duplicate account */
-#define ACB_NORMAL                     0x00000010  /* 1 = Normal user account */
-#define ACB_MNS                                0x00000020  /* 1 = MNS logon user account */
-#define ACB_DOMTRUST                   0x00000040  /* 1 = Interdomain trust account */
-#define ACB_WSTRUST                    0x00000080  /* 1 = Workstation trust account */
-#define ACB_SVRTRUST                   0x00000100  /* 1 = Server trust account (BDC) */
-#define ACB_PWNOEXP                    0x00000200  /* 1 = User password does not expire */
-#define ACB_AUTOLOCK                   0x00000400  /* 1 = Account auto locked */
-
-/* only valid for > Windows 2000 */
-#define ACB_ENC_TXT_PWD_ALLOWED                0x00000800  /* 1 = Text password encryped */
-#define ACB_SMARTCARD_REQUIRED         0x00001000  /* 1 = Smart Card required */
-#define ACB_TRUSTED_FOR_DELEGATION     0x00002000  /* 1 = Trusted for Delegation */
-#define ACB_NOT_DELEGATED              0x00004000  /* 1 = Not delegated */
-#define ACB_USE_DES_KEY_ONLY           0x00008000  /* 1 = Use DES key only */
-#define ACB_DONT_REQUIRE_PREAUTH       0x00010000  /* 1 = Preauth not required */
-#define ACB_PWEXPIRED                  0x00020000  /* 1 = Password is expired */
-#define ACB_NO_AUTH_DATA_REQD          0x00080000  /* 1 = No authorization data required */
-
 #define MAX_HOURS_LEN 32
 
 #ifndef MAXSUBAUTHS
@@ -282,9 +259,6 @@ typedef struct dom_sid {
        uint32 sub_auths[MAXSUBAUTHS];  
 } DOM_SID;
 
-#define dom_sid2 dom_sid
-#define dom_sid28 dom_sid
-
 enum id_mapping {
        ID_UNKNOWN = 0,
        ID_MAPPED,
@@ -309,8 +283,17 @@ struct id_map {
        enum id_mapping status;
 };
 
-#include "librpc/ndr/misc.h"
-#include "librpc/ndr/security.h"
+/* used to hold an arbitrary blob of data */
+typedef struct data_blob {
+       uint8 *data;
+       size_t length;
+       void (*free)(struct data_blob *data_blob);
+} DATA_BLOB;
+
+extern const DATA_BLOB data_blob_null;
+
+#include "librpc/gen_ndr/misc.h"
+#include "librpc/gen_ndr/security.h"
 #include "librpc/ndr/libndr.h"
 #include "librpc/gen_ndr/lsa.h"
 #include "librpc/gen_ndr/dfs.h"
@@ -321,6 +304,10 @@ 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/netlogon.h"
+#include "librpc/gen_ndr/samr.h"
+#include "librpc/gen_ndr/dssetup.h"
+#include "librpc/gen_ndr/libnet_join.h"
 
 struct lsa_dom_info {
        bool valid;
@@ -524,20 +511,13 @@ typedef struct files_struct {
        FAKE_FILE_HANDLE *fake_file_handle;
 
        struct notify_change_buf *notify;
+
+       struct files_struct *base_fsp; /* placeholder for delete on close */
 } files_struct;
 
 #include "ntquotas.h"
 #include "sysquotas.h"
 
-/* used to hold an arbitrary blob of data */
-typedef struct data_blob {
-       uint8 *data;
-       size_t length;
-       void (*free)(struct data_blob *data_blob);
-} DATA_BLOB;
-
-extern const DATA_BLOB data_blob_null;
-
 /*
  * Structure used to keep directory state information around.
  * Used in NT change-notify code.
@@ -594,6 +574,16 @@ struct trans_state {
        char *data;
 };
 
+/*
+ * Info about an alternate data stream
+ */
+
+struct stream_struct {
+       SMB_OFF_T size;
+       SMB_OFF_T alloc_size;
+       char *name;
+};
+
 /* Include VFS stuff */
 
 #include "smb_acls.h"
@@ -657,11 +647,17 @@ typedef struct connection_struct {
        bool used;
        int num_files_open;
        unsigned int num_smb_operations; /* Count of smb operations on this tree. */
+       int encrypt_level;
+       bool encrypted_tid;
 
+       /* Semantics requested by the client or forced by the server config. */
        bool case_sensitive;
        bool case_preserve;
        bool short_case_preserve;
 
+       /* Semantics provided by the underlying filesystem. */
+       int fs_capabilities;
+
        name_compare_entry *hide_list; /* Per-share list of files to return as hidden. */
        name_compare_entry *veto_list; /* Per-share list of files to veto (never show). */
        name_compare_entry *veto_oplock_list; /* Per-share list of files to refuse oplocks on. */       
@@ -688,6 +684,8 @@ struct smb_request {
        const uint8 *inbuf;
        uint8 *outbuf;
        size_t unread_bytes;
+       bool encrypted;
+       connection_struct *conn;
 };
 
 /* Defines for the sent_oplock_break field above. */
@@ -751,6 +749,7 @@ struct pending_message_list {
        struct pending_message_list *next, *prev;
        struct timeval request_time; /* When was this first issued? */
        struct timeval end_time; /* When does this time out? */
+       bool encrypted;
        DATA_BLOB buf;
        DATA_BLOB private_data;
 };
@@ -1370,6 +1369,9 @@ struct bitmap {
 #define NTCREATEX_OPTIONS_PRIVATE_DENY_DOS     0x01000000
 #define NTCREATEX_OPTIONS_PRIVATE_DENY_FCB     0x02000000
 
+/* Private options for streams support */
+#define NTCREATEX_OPTIONS_PRIVATE_STREAM_DELETE 0x04000000
+
 /* Responses when opening a file. */
 #define FILE_WAS_SUPERSEDED 0
 #define FILE_WAS_OPENED 1
@@ -1900,6 +1902,8 @@ struct ea_list {
 #define SAMBA_POSIX_INHERITANCE_EA_NAME "user.SAMBA_PAI"
 /* EA to use for DOS attributes */
 #define SAMBA_XATTR_DOS_ATTRIB "user.DOSATTRIB"
+/* Prefix for DosStreams in the vfs_streams_xattr module */
+#define SAMBA_XATTR_DOSSTREAM_PREFIX "user.DosStream."
 
 #define UUID_SIZE 16
 
@@ -1930,4 +1934,15 @@ enum usershare_err {
 /* Different reasons for closing a file. */
 enum file_close_type {NORMAL_CLOSE=0,SHUTDOWN_CLOSE,ERROR_CLOSE};
 
+/* Used in SMB_FS_OBJECTID_INFORMATION requests.  Must be exactly 48 bytes. */
+#define SAMBA_EXTENDED_INFO_MAGIC 0x536d4261 /* "SmBa" */
+#define SAMBA_EXTENDED_INFO_VERSION_STRING_LENGTH 28
+struct smb_extended_info {
+       uint32 samba_magic;             /* Always SAMBA_EXTRA_INFO_MAGIC */
+       uint32 samba_version;           /* Major/Minor/Release/Revision */
+       uint32 samba_subversion;        /* Prerelease/RC/Vendor patch */
+       NTTIME samba_gitcommitdate;
+       char   samba_version_string[SAMBA_EXTENDED_INFO_VERSION_STRING_LENGTH];
+};
+
 #endif /* _SMB_H */
index 0dfb5969948c63d1b861247b06731eee64a757e0..463a2bdb0b8fc578f9cd3fad80471cb1a5f61ce6 100644 (file)
 
 #define ERROR_DOS(class,code) error_packet(outbuf,class,code,NT_STATUS_OK,__LINE__,__FILE__)
 #define ERROR_NT(status) error_packet(outbuf,0,0,status,__LINE__,__FILE__)
-#define ERROR_OPEN(status) error_open(outbuf,status,__LINE__,__FILE__)
 #define ERROR_FORCE_NT(status) error_packet(outbuf,-1,-1,status,__LINE__,__FILE__)
 #define ERROR_BOTH(status,class,code) error_packet(outbuf,class,code,status,__LINE__,__FILE__)
 
 #define reply_botherror(req,status,eclass,ecode) reply_both_error(req,eclass,ecode,status,__LINE__,__FILE__)
 #define reply_unixerror(req,defclass,deferror) reply_unix_error(req,defclass,deferror,NT_STATUS_OK,__LINE__,__FILE__)
 
-/* this is how errors are generated */
-#define UNIXERROR(defclass,deferror) unix_error_packet(outbuf,defclass,deferror,NT_STATUS_OK,__LINE__,__FILE__)
-
 /* these are the datagram types */
 #define DGRAM_DIRECT_UNIQUE 0x10
 
 #define smb_offset(p,buf) (PTR_DIFF(p,buf+4) + chain_size)
 
 #define smb_len(buf) (PVAL(buf,3)|(PVAL(buf,2)<<8)|((PVAL(buf,1)&1)<<16))
-#define _smb_setlen(buf,len) do { buf[0] = 0; buf[1] = (len&0x10000)>>16; \
-        buf[2] = (len&0xFF00)>>8; buf[3] = len&0xFF; } while (0)
+#define _smb_setlen(buf,len) do { buf[0] = 0; buf[1] = ((len)&0x10000)>>16; \
+        buf[2] = ((len)&0xFF00)>>8; buf[3] = (len)&0xFF; } while (0)
 
 #define smb_len_large(buf) (PVAL(buf,3)|(PVAL(buf,2)<<8)|(PVAL(buf,1)<<16))
 #define _smb_setlen_large(buf,len) do { buf[0] = 0; buf[1] = ((len)&0xFF0000)>>16; \
         buf[2] = ((len)&0xFF00)>>8; buf[3] = (len)&0xFF; } while (0)
 
+#define ENCRYPTION_REQUIRED(conn) ((conn) ? ((conn)->encrypt_level == Required) : false)
+#define IS_CONN_ENCRYPTED(conn) ((conn) ? (conn)->encrypted_tid : false)
+
 /*******************************************************************
 find the difference in milliseconds between two struct timeval
 values
@@ -386,4 +385,12 @@ do { \
 #define ISDOTDOT(p) (*(p) == '.' && *((p) + 1) == '.' && *((p) + 2) == '\0')
 #endif /* ISDOTDOT */
 
+#ifndef toupper_ascii_fast
+/* Warning - this must only be called with 0 <= c < 128. IT WILL
+ * GIVE GARBAGE if c > 128 or c < 0. JRA.
+ */
+extern char toupper_ascii_fast_table[];
+#define toupper_ascii_fast(c) toupper_ascii_fast_table[(unsigned int)(c)];
+#endif
+
 #endif /* _SMB_MACROS_H */
index 331893cbd6184e2367d82a4d27174f56f146f261..a2a12f8a633ba15c4785f69f0cccfd90db5fbf52 100644 (file)
@@ -45,6 +45,7 @@
  */
 
 TALLOC_CTX *talloc_stackframe(void);
+TALLOC_CTX *talloc_stackframe_pool(size_t poolsize);
 
 /*
  * Get us the current top of the talloc stack.
index f7f3ef21497579cbfc9063c978a7e1bb17c5d09f..3759d59681161aff4d1db6b3e29882404b60b4cf 100644 (file)
@@ -530,7 +530,8 @@ findfirst/findnext is SMB_FIND_FILE_UNIX_INFO2.
 #define CIFS_UNIX_POSIX_PATH_OPERATIONS_CAP       0x20 /* We can cope with POSIX open/mkdir/unlink etc. */
 #define CIFS_UNIX_LARGE_READ_CAP           0x40 /* We can cope with 24 bit reads in readX. */
 #define CIFS_UNIX_LARGE_WRITE_CAP          0x80 /* We can cope with 24 bit writes in writeX. */
-
+#define CIFS_UNIX_TRANSPORT_ENCRYPTION_CAP      0x100 /* We can do SPNEGO negotiations for encryption. */
+#define CIFS_UNIX_TRANSPORT_ENCRYPTION_MANDATORY_CAP    0x200 /* We *must* SPNEGO negotiations for encryption. */
 
 #define SMB_QUERY_POSIX_FS_INFO     0x201
 
@@ -566,7 +567,6 @@ findfirst/findnext is SMB_FIND_FILE_UNIX_INFO2.
         __u8 * psid_list  may be empty
 */
 
-
 /* ... more as we think of them :-). */
 
 /* SMB POSIX ACL definitions. */
@@ -653,6 +653,29 @@ enum smb_whoami_flags {
        DOM_SID[] -             list of SIDs (may be empty)
 */
 
+/*
+ * The following trans2 is done between client and server
+ * as a FSINFO call to set up the encryption state for transport
+ * encryption.
+ * This is a subcommand of the TRANS2_QFSINFO.
+ *
+ * The request looks like :
+ *
+ * [data block] -> SPNEGO framed GSSAPI request.
+ *
+ * The reply looks like :
+ *
+ * [data block] -> SPNEGO framed GSSAPI reply - if error
+ *                 is NT_STATUS_OK then we're done, if it's
+ *                 NT_STATUS_MORE_PROCESSING_REQUIRED then the
+ *                 client needs to keep going. If it's an
+ *                 error it can be any NT_STATUS error.
+ *
+ */
+
+#define SMB_REQUEST_TRANSPORT_ENCRYPTION     0x203 /* QFSINFO */
+
+
 /* The query/set info levels for POSIX ACLs. */
 #define SMB_QUERY_POSIX_ACL  0x204
 #define SMB_SET_POSIX_ACL  0x204
diff --git a/source/include/transfer_file.h b/source/include/transfer_file.h
new file mode 100644 (file)
index 0000000..79ad9c4
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * Unix SMB/CIFS implementation.
+ * Utility functions to transfer files.
+ *
+ * Copyright (C) Michael Adam 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 __TRANSFER_FILE_H__
+#define __TRANSFER_FILE_H__
+
+ssize_t transfer_file_internal(void *in_file,
+                              void *out_file,
+                              size_t n,
+                              ssize_t (*read_fn)(void *, void *, size_t),
+                              ssize_t (*write_fn)(void *, const void *, size_t));
+
+SMB_OFF_T transfer_file(int infd, int outfd, SMB_OFF_T n);
+
+#endif /* __TRANSFER_FILE_H__ */
index b45320dd8720a170b7dca4daab2d9b588724a0c5..ca176aabb2b2f257d19ae384b970f09078db36d3 100644 (file)
 /* Leave at 22 - not yet released. Change all BOOL parameters (int) to bool. jra. */
 /* Leave at 22 - not yet released. Added recvfile. */
 /* Leave at 22 - not yet released. Change get_nt_acl to return NTSTATUS - vl */
+/* Leave at 22 - not yet released. Change get_nt_acl to *not* take a
+ * files_struct. - obnox.*/
+/* Leave at 22 - not yet released. Remove parameter fd from fget_nt_acl. - obnox */
+/* Leave at 22 - not yet released. Remove parameter fd from gset_nt_acl. - obnox */
+/* Leave at 22 - not yet released. Remove parameter fd from pread. - obnox */
+/* Leave at 22 - not yet released. Remove parameter fd from pwrite. - obnox */
+/* Leave at 22 - not yet released. Remove parameter fd from lseek. - obnox */
+/* Leave at 22 - not yet released. Remove parameter fd from fsync. - obnox */
+/* Leave at 22 - not yet released. Remove parameter fd from fstat. - obnox */
+/* Leave at 22 - not yet released. Remove parameter fd from fchmod. - obnox */
+/* Leave at 22 - not yet released. Remove parameter fd from fchown. - obnox */
+/* Leave at 22 - not yet released. Remove parameter fd from ftruncate. - obnox */
+/* Leave at 22 - not yet released. Remove parameter fd from lock. - obnox */
+/* Leave at 22 - not yet released. Remove parameter fd from kernel_flock. - obnox */
+/* Leave at 22 - not yet released. Remove parameter fd from linux_setlease. - obnox */
+/* Leave at 22 - not yet released. Remove parameter fd from getlock. - obnox */
+/* Leave at 22 - not yet released. Remove parameter fd from sys_acl_get_fd. - obnox */
+/* Leave at 22 - not yet released. Remove parameter fd from fchmod_acl. - obnox */
+/* Leave at 22 - not yet released. Remove parameter fd from sys_acl_set_fd. - obnox */
+/* Leave at 22 - not yet released. Remove parameter fd from fgetxattr. - obnox */
+/* Leave at 22 - not yet released. Remove parameter fd from flistxattr. - obnox */
+/* Leave at 22 - not yet released. Remove parameter fd from fremovexattr. - obnox */
+/* Leave at 22 - not yet released. Remove parameter fd from fsetxattr. - obnox */
+/* Leave at 22 - not yet released. Remove parameter fd from aio_cancel. - obnox */
+/* Leave at 22 - not yet released. Remove parameter fd from read. - obnox */
+/* Leave at 22 - not yet released. Remove parameter fd from write. - obnox */
+/* Leave at 22 - not yet released. Remove parameter fromfd from sendfile. - obnox */
+/* Leave at 22 - not yet released. Remove parameter fromfd from recvfile. - obnox */
+/* Leave at 22 - not yet released. Additional change: add operations for offline files -- ab */
+/* Leave at 22 - not yet released. Add the streaminfo call. -- jpeach, vl */
+
 #define SMB_VFS_INTERFACE_VERSION 22
 
 
@@ -118,6 +149,7 @@ typedef enum _vfs_op_type {
        SMB_VFS_OP_SET_QUOTA,
        SMB_VFS_OP_GET_SHADOW_COPY_DATA,
        SMB_VFS_OP_STATVFS,
+       SMB_VFS_OP_FS_CAPABILITIES,
 
        /* Directory operations */
 
@@ -168,6 +200,7 @@ typedef enum _vfs_op_type {
        SMB_VFS_OP_NOTIFY_WATCH,
        SMB_VFS_OP_CHFLAGS,
        SMB_VFS_OP_FILE_ID_CREATE,
+       SMB_VFS_OP_STREAMINFO,
 
        /* NT ACL operations. */
 
@@ -226,9 +259,14 @@ typedef enum _vfs_op_type {
        SMB_VFS_OP_AIO_ERROR,
        SMB_VFS_OP_AIO_FSYNC,
        SMB_VFS_OP_AIO_SUSPEND,
+        SMB_VFS_OP_AIO_FORCE,
+
+       /* offline operations */
+       SMB_VFS_OP_IS_OFFLINE,
+       SMB_VFS_OP_SET_OFFLINE,
 
        /* This should always be last enum value */
-       
+
        SMB_VFS_OP_LAST
 } vfs_op_type;
 
@@ -238,7 +276,7 @@ typedef enum _vfs_op_type {
 struct vfs_ops {
        struct vfs_fn_pointers {
                /* Disk operations */
-               
+
                int (*connect_fn)(struct vfs_handle_struct *handle, const char *service, const char *user);
                void (*disconnect)(struct vfs_handle_struct *handle);
                SMB_BIG_UINT (*disk_free)(struct vfs_handle_struct *handle, const char *path, bool small_query, SMB_BIG_UINT *bsize,
@@ -247,9 +285,10 @@ struct vfs_ops {
                int (*set_quota)(struct vfs_handle_struct *handle, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *qt);
                int (*get_shadow_copy_data)(struct vfs_handle_struct *handle, struct files_struct *fsp, SHADOW_COPY_DATA *shadow_copy_data, bool labels);
                int (*statvfs)(struct vfs_handle_struct *handle, const char *path, struct vfs_statvfs_struct *statbuf);
-               
+               uint32_t (*fs_capabilities)(struct vfs_handle_struct *handle);
+
                /* Directory operations */
-               
+
                SMB_STRUCT_DIR *(*opendir)(struct vfs_handle_struct *handle, const char *fname, const char *mask, uint32 attributes);
                SMB_STRUCT_DIRENT *(*readdir)(struct vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp);
                void (*seekdir)(struct vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp, long offset);
@@ -258,37 +297,37 @@ struct vfs_ops {
                int (*mkdir)(struct vfs_handle_struct *handle, const char *path, mode_t mode);
                int (*rmdir)(struct vfs_handle_struct *handle, const char *path);
                int (*closedir)(struct vfs_handle_struct *handle, SMB_STRUCT_DIR *dir);
-               
+
                /* File operations */
-               
+
                int (*open)(struct vfs_handle_struct *handle, const char *fname, files_struct *fsp, int flags, mode_t mode);
                int (*close_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd);
-               ssize_t (*read)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, void *data, size_t n);
-               ssize_t (*pread)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, void *data, size_t n, SMB_OFF_T offset);
-               ssize_t (*write)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, const void *data, size_t n);
-               ssize_t (*pwrite)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, const void *data, size_t n, SMB_OFF_T offset);
-               SMB_OFF_T (*lseek)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, SMB_OFF_T offset, int whence);
-               ssize_t (*sendfile)(struct vfs_handle_struct *handle, int tofd, files_struct *fsp, int fromfd, const DATA_BLOB *header, SMB_OFF_T offset, size_t count);
-               ssize_t (*recvfile)(struct vfs_handle_struct *handle, int fromfd, files_struct *fsp, int tofd, SMB_OFF_T offset, size_t count);
+               ssize_t (*read)(struct vfs_handle_struct *handle, struct files_struct *fsp, void *data, size_t n);
+               ssize_t (*pread)(struct vfs_handle_struct *handle, struct files_struct *fsp, void *data, size_t n, SMB_OFF_T offset);
+               ssize_t (*write)(struct vfs_handle_struct *handle, struct files_struct *fsp, const void *data, size_t n);
+               ssize_t (*pwrite)(struct vfs_handle_struct *handle, struct files_struct *fsp, const void *data, size_t n, SMB_OFF_T offset);
+               SMB_OFF_T (*lseek)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_OFF_T offset, int whence);
+               ssize_t (*sendfile)(struct vfs_handle_struct *handle, int tofd, files_struct *fromfsp, const DATA_BLOB *header, SMB_OFF_T offset, size_t count);
+               ssize_t (*recvfile)(struct vfs_handle_struct *handle, int fromfd, files_struct *tofsp, SMB_OFF_T offset, size_t count);
                int (*rename)(struct vfs_handle_struct *handle, const char *oldname, const char *newname);
-               int (*fsync)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd);
+               int (*fsync)(struct vfs_handle_struct *handle, struct files_struct *fsp);
                int (*stat)(struct vfs_handle_struct *handle, const char *fname, SMB_STRUCT_STAT *sbuf);
-               int (*fstat)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, SMB_STRUCT_STAT *sbuf);
+               int (*fstat)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_STAT *sbuf);
                int (*lstat)(struct vfs_handle_struct *handle, const char *path, SMB_STRUCT_STAT *sbuf);
                int (*unlink)(struct vfs_handle_struct *handle, const char *path);
                int (*chmod)(struct vfs_handle_struct *handle, const char *path, mode_t mode);
-               int (*fchmod)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, mode_t mode);
+               int (*fchmod)(struct vfs_handle_struct *handle, struct files_struct *fsp, mode_t mode);
                int (*chown)(struct vfs_handle_struct *handle, const char *path, uid_t uid, gid_t gid);
-               int (*fchown)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, uid_t uid, gid_t gid);
+               int (*fchown)(struct vfs_handle_struct *handle, struct files_struct *fsp, uid_t uid, gid_t gid);
                int (*lchown)(struct vfs_handle_struct *handle, const char *path, uid_t uid, gid_t gid);
                int (*chdir)(struct vfs_handle_struct *handle, const char *path);
                char *(*getwd)(struct vfs_handle_struct *handle, char *buf);
                int (*ntimes)(struct vfs_handle_struct *handle, const char *path, const struct timespec ts[2]);
-               int (*ftruncate)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, SMB_OFF_T offset);
-               bool (*lock)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type);
-               int (*kernel_flock)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, uint32 share_mode);
-               int (*linux_setlease)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, int leasetype);
-               bool (*getlock)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid);
+               int (*ftruncate)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_OFF_T offset);
+               bool (*lock)(struct vfs_handle_struct *handle, struct files_struct *fsp, int op, SMB_OFF_T offset, SMB_OFF_T count, int type);
+               int (*kernel_flock)(struct vfs_handle_struct *handle, struct files_struct *fsp, uint32 share_mode);
+               int (*linux_setlease)(struct vfs_handle_struct *handle, struct files_struct *fsp, int leasetype);
+               bool (*getlock)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid);
                int (*symlink)(struct vfs_handle_struct *handle, const char *oldpath, const char *newpath);
                int (*readlink)(struct vfs_handle_struct *handle, const char *path, char *buf, size_t bufsiz);
                int (*link)(struct vfs_handle_struct *handle, const char *oldpath, const char *newpath);
@@ -304,31 +343,44 @@ struct vfs_ops {
                int (*chflags)(struct vfs_handle_struct *handle, const char *path, unsigned int flags);
                struct file_id (*file_id_create)(struct vfs_handle_struct *handle, SMB_DEV_T dev, SMB_INO_T inode);
 
+               NTSTATUS (*streaminfo)(struct vfs_handle_struct *handle,
+                                      struct files_struct *fsp,
+                                      const char *fname,
+                                      TALLOC_CTX *mem_ctx,
+                                      unsigned int *num_streams,
+                                      struct stream_struct **streams);
+
                /* NT ACL operations. */
-               
+
                NTSTATUS (*fget_nt_acl)(struct vfs_handle_struct *handle,
-                                       struct files_struct *fsp, int fd,
+                                       struct files_struct *fsp,
                                        uint32 security_info,
                                        struct security_descriptor **ppdesc);
                NTSTATUS (*get_nt_acl)(struct vfs_handle_struct *handle,
-                                      struct files_struct *fsp,
                                       const char *name,
                                       uint32 security_info,
                                       struct security_descriptor **ppdesc);
-               NTSTATUS (*fset_nt_acl)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, uint32 security_info_sent, struct security_descriptor *psd);
-               NTSTATUS (*set_nt_acl)(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name, uint32 security_info_sent, struct security_descriptor *psd);
-               
+               NTSTATUS (*fset_nt_acl)(struct vfs_handle_struct *handle,
+                                       struct files_struct *fsp,
+                                       uint32 security_info_sent,
+                                       struct security_descriptor *psd);
+               NTSTATUS (*set_nt_acl)(struct vfs_handle_struct *handle,
+                                      struct files_struct *fsp,
+                                      const char *name,
+                                      uint32 security_info_sent,
+                                      struct security_descriptor *psd);
+
                /* POSIX ACL operations. */
-               
+
                int (*chmod_acl)(struct vfs_handle_struct *handle, const char *name, mode_t mode);
-               int (*fchmod_acl)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, mode_t mode);
-               
+               int (*fchmod_acl)(struct vfs_handle_struct *handle, struct files_struct *fsp, mode_t mode);
+
                int (*sys_acl_get_entry)(struct vfs_handle_struct *handle, SMB_ACL_T theacl, int entry_id, SMB_ACL_ENTRY_T *entry_p);
                int (*sys_acl_get_tag_type)(struct vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *tag_type_p);
                int (*sys_acl_get_permset)(struct vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T *permset_p);
                void * (*sys_acl_get_qualifier)(struct vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry_d);
                SMB_ACL_T (*sys_acl_get_file)(struct vfs_handle_struct *handle, const char *path_p, SMB_ACL_TYPE_T type);
-               SMB_ACL_T (*sys_acl_get_fd)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd);
+               SMB_ACL_T (*sys_acl_get_fd)(struct vfs_handle_struct *handle, struct files_struct *fsp);
                int (*sys_acl_clear_perms)(struct vfs_handle_struct *handle, SMB_ACL_PERMSET_T permset);
                int (*sys_acl_add_perm)(struct vfs_handle_struct *handle, SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm);
                char * (*sys_acl_to_text)(struct vfs_handle_struct *handle, SMB_ACL_T theacl, ssize_t *plen);
@@ -339,7 +391,7 @@ struct vfs_ops {
                int (*sys_acl_set_permset)(struct vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry, SMB_ACL_PERMSET_T permset);
                int (*sys_acl_valid)(struct vfs_handle_struct *handle, SMB_ACL_T theacl );
                int (*sys_acl_set_file)(struct vfs_handle_struct *handle, const char *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl);
-               int (*sys_acl_set_fd)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, SMB_ACL_T theacl);
+               int (*sys_acl_set_fd)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_ACL_T theacl);
                int (*sys_acl_delete_def_file)(struct vfs_handle_struct *handle, const char *path);
                int (*sys_acl_get_perm)(struct vfs_handle_struct *handle, SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm);
                int (*sys_acl_free_text)(struct vfs_handle_struct *handle, char *text);
@@ -349,26 +401,30 @@ struct vfs_ops {
                /* EA operations. */
                ssize_t (*getxattr)(struct vfs_handle_struct *handle,const char *path, const char *name, void *value, size_t size);
                ssize_t (*lgetxattr)(struct vfs_handle_struct *handle,const char *path, const char *name, void *value, size_t size);
-               ssize_t (*fgetxattr)(struct vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *name, void *value, size_t size);
+               ssize_t (*fgetxattr)(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name, void *value, size_t size);
                ssize_t (*listxattr)(struct vfs_handle_struct *handle, const char *path, char *list, size_t size);
                ssize_t (*llistxattr)(struct vfs_handle_struct *handle, const char *path, char *list, size_t size);
-               ssize_t (*flistxattr)(struct vfs_handle_struct *handle, struct files_struct *fsp,int fd, char *list, size_t size);
+               ssize_t (*flistxattr)(struct vfs_handle_struct *handle, struct files_struct *fsp, char *list, size_t size);
                int (*removexattr)(struct vfs_handle_struct *handle, const char *path, const char *name);
                int (*lremovexattr)(struct vfs_handle_struct *handle, const char *path, const char *name);
-               int (*fremovexattr)(struct vfs_handle_struct *handle, struct files_struct *fsp,int filedes, const char *name);
+               int (*fremovexattr)(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name);
                int (*setxattr)(struct vfs_handle_struct *handle, const char *path, const char *name, const void *value, size_t size, int flags);
                int (*lsetxattr)(struct vfs_handle_struct *handle, const char *path, const char *name, const void *value, size_t size, int flags);
-               int (*fsetxattr)(struct vfs_handle_struct *handle, struct files_struct *fsp,int filedes, const char *name, const void *value, size_t size, int flags);
+               int (*fsetxattr)(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name, const void *value, size_t size, int flags);
 
                /* aio operations */
                int (*aio_read)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb);
                int (*aio_write)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb);
                ssize_t (*aio_return_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb);
-               int (*aio_cancel)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, SMB_STRUCT_AIOCB *aiocb);
+               int (*aio_cancel)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb);
                int (*aio_error_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb);
                int (*aio_fsync)(struct vfs_handle_struct *handle, struct files_struct *fsp, int op, SMB_STRUCT_AIOCB *aiocb);
                int (*aio_suspend)(struct vfs_handle_struct *handle, struct files_struct *fsp, const SMB_STRUCT_AIOCB * const aiocb[], int n, const struct timespec *timeout);
+               bool (*aio_force)(struct vfs_handle_struct *handle, struct files_struct *fsp);
 
+               /* offline operations */
+               bool (*is_offline)(struct vfs_handle_struct *handle, const char *path, SMB_STRUCT_STAT *sbuf);
+               int (*set_offline)(struct vfs_handle_struct *handle, const char *path);
        } ops;
 
        struct vfs_handles_pointers {
@@ -381,6 +437,7 @@ struct vfs_ops {
                struct vfs_handle_struct *set_quota;
                struct vfs_handle_struct *get_shadow_copy_data;
                struct vfs_handle_struct *statvfs;
+               struct vfs_handle_struct *fs_capabilities;
 
                /* Directory operations */
 
@@ -431,6 +488,7 @@ struct vfs_ops {
                struct vfs_handle_struct *notify_watch;
                struct vfs_handle_struct *chflags;
                struct vfs_handle_struct *file_id_create;
+               struct vfs_handle_struct *streaminfo;
 
                /* NT ACL operations. */
 
@@ -489,27 +547,32 @@ struct vfs_ops {
                struct vfs_handle_struct *aio_error;
                struct vfs_handle_struct *aio_fsync;
                struct vfs_handle_struct *aio_suspend;
+               struct vfs_handle_struct *aio_force;
+
+               /* offline operations */
+               struct vfs_handle_struct *is_offline;
+               struct vfs_handle_struct *set_offline;
        } handles;
 };
 
 /*
     Possible VFS operation layers (per-operation)
-    
+
     These values are used by VFS subsystem when building vfs_ops for connection
     from multiple VFS modules. Internally, Samba differentiates only opaque and
     transparent layers at this process. Other types are used for providing better
     diagnosing facilities.
-    
+
     Most modules will provide transparent layers. Opaque layer is for modules
     which implement actual file system calls (like DB-based VFS). For example,
     default POSIX VFS which is built in into Samba is an opaque VFS module.
-    
+
     Other layer types (audit, splitter, scanner) were designed to provide different 
     degree of transparency and for diagnosing VFS module behaviour.
-    
+
     Each module can implement several layers at the same time provided that only
     one layer is used per each operation.
-    
+
 */
 
 typedef enum _vfs_op_layer {
@@ -528,7 +591,7 @@ typedef enum _vfs_op_layer {
 
 /*
     VFS operation description. Each VFS module registers an array of vfs_op_tuple to VFS subsystem,
-    which describes all operations this module is willing to intercept. 
+    which describes all operations this module is willing to intercept.
     VFS subsystem initializes then the conn->vfs_ops and conn->vfs_opaque_ops structs
     using this information.
 */
@@ -553,12 +616,12 @@ typedef struct vfs_handle_struct {
 typedef struct vfs_statvfs_struct {
        /* For undefined recommended transfer size return -1 in that field */
        uint32 OptimalTransferSize;  /* bsize on some os, iosize on other os */
-       uint32 BlockSize; 
+       uint32 BlockSize;
 
        /*
         The next three fields are in terms of the block size.
         (above). If block size is unknown, 4096 would be a
-        reasonable block size for a server to report. 
+        reasonable block size for a server to report.
         Note that returning the blocks/blocksavail removes need
         to make a second call (to QFSInfo level 0x103 to get this info.
         UserBlockAvail is typically less than or equal to BlocksAvail,
@@ -575,14 +638,25 @@ typedef struct vfs_statvfs_struct {
        SMB_BIG_UINT FsIdentifier;   /* fsid */
        /* NB Namelen comes from FILE_SYSTEM_ATTRIBUTE_INFO call */
        /* NB flags can come from FILE_SYSTEM_DEVICE_INFO call   */
+
+       int FsCapabilities;
 } vfs_statvfs_struct;
 
+/* Add a new FSP extension of the given type. Returns a pointer to the
+ * extenstion data.
+ */
 #define VFS_ADD_FSP_EXTENSION(handle, fsp, type) \
     vfs_add_fsp_extension_notype(handle, (fsp), sizeof(type))
 
+/* Return a pointer to the existing FSP extension data. */
 #define VFS_FETCH_FSP_EXTENSION(handle, fsp) \
     vfs_fetch_fsp_extension(handle, (fsp))
 
+/* Return the talloc context associated with an FSP extension. */
+#define VFS_MEMCTX_FSP_EXTENSION(handle, fsp) \
+    vfs_memctx_fsp_extension(handle, (fsp))
+
+/* Remove and destroy an FSP extension. */
 #define VFS_REMOVE_FSP_EXTENSION(handle, fsp) \
     vfs_remove_fsp_extension((handle), (fsp))
 
index cc7780f35461a0665fea56db75d9be1ad2151961..1e64bd5ac3ef7ca8586c242322dc47b89c502857 100644 (file)
@@ -1,18 +1,18 @@
-/* 
+/*
    Unix SMB/CIFS implementation.
    VFS wrapper macros
    Copyright (C) Stefan (metze) Metzmacher     2003
-   
+
    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/>.
 */
@@ -26,7 +26,7 @@
  (Fixes should go also into the vfs_opaque_* and vfs_next_* macros!)
 ********************************************************************/
 
-/* Disk operations */    
+/* Disk operations */
 #define SMB_VFS_CONNECT(conn, service, user) ((conn)->vfs.ops.connect_fn((conn)->vfs.handles.connect_hnd, (service), (user)))
 #define SMB_VFS_DISCONNECT(conn) ((conn)->vfs.ops.disconnect((conn)->vfs.handles.disconnect))
 #define SMB_VFS_DISK_FREE(conn, path, small_query, bsize, dfree ,dsize) ((conn)->vfs.ops.disk_free((conn)->vfs.handles.disk_free, (path), (small_query), (bsize), (dfree), (dsize)))
@@ -34,6 +34,7 @@
 #define SMB_VFS_SET_QUOTA(conn, qtype, id, qt) ((conn)->vfs.ops.set_quota((conn)->vfs.handles.set_quota, (qtype), (id), (qt)))
 #define SMB_VFS_GET_SHADOW_COPY_DATA(fsp,shadow_copy_data,labels) ((fsp)->conn->vfs.ops.get_shadow_copy_data((fsp)->conn->vfs.handles.get_shadow_copy_data,(fsp),(shadow_copy_data),(labels)))
 #define SMB_VFS_STATVFS(conn, path, statbuf) ((conn)->vfs.ops.statvfs((conn)->vfs.handles.statvfs, (path), (statbuf)))
+#define SMB_VFS_FS_CAPABILITIES(conn) ((conn)->vfs.ops.fs_capabilities((conn)->vfs.handles.fs_capabilities))
 
 /* Directory operations */
 #define SMB_VFS_OPENDIR(conn, fname, mask, attr) ((conn)->vfs.ops.opendir((conn)->vfs.handles.opendir, (fname), (mask), (attr)))
 #define SMB_VFS_MKDIR(conn, path, mode) ((conn)->vfs.ops.mkdir((conn)->vfs.handles.mkdir,(path), (mode)))
 #define SMB_VFS_RMDIR(conn, path) ((conn)->vfs.ops.rmdir((conn)->vfs.handles.rmdir, (path)))
 #define SMB_VFS_CLOSEDIR(conn, dir) ((conn)->vfs.ops.closedir((conn)->vfs.handles.closedir, dir))
-    
+
 /* File operations */
 #define SMB_VFS_OPEN(conn, fname, fsp, flags, mode) (((conn)->vfs.ops.open)((conn)->vfs.handles.open, (fname), (fsp), (flags), (mode)))
 #define SMB_VFS_CLOSE(fsp, fd) ((fsp)->conn->vfs.ops.close_fn((fsp)->conn->vfs.handles.close_hnd, (fsp), (fd)))
-#define SMB_VFS_READ(fsp, fd, data, n) ((fsp)->conn->vfs.ops.read((fsp)->conn->vfs.handles.read, (fsp), (fd), (data), (n)))
-#define SMB_VFS_PREAD(fsp, fd, data, n, off) ((fsp)->conn->vfs.ops.pread((fsp)->conn->vfs.handles.pread, (fsp), (fd), (data), (n), (off)))
-#define SMB_VFS_WRITE(fsp, fd, data, n) ((fsp)->conn->vfs.ops.write((fsp)->conn->vfs.handles.write, (fsp), (fd), (data), (n)))
-#define SMB_VFS_PWRITE(fsp, fd, data, n, off) ((fsp)->conn->vfs.ops.pwrite((fsp)->conn->vfs.handles.pwrite, (fsp), (fd), (data), (n), (off)))
-#define SMB_VFS_LSEEK(fsp, fd, offset, whence) ((fsp)->conn->vfs.ops.lseek((fsp)->conn->vfs.handles.lseek, (fsp), (fd), (offset), (whence)))
-#define SMB_VFS_SENDFILE(tofd, fsp, fromfd, header, offset, count) ((fsp)->conn->vfs.ops.sendfile((fsp)->conn->vfs.handles.sendfile, (tofd), (fsp), (fromfd), (header), (offset), (count)))
-#define SMB_VFS_RECVFILE(fromfd, fsp, tofd, offset, count) ((fsp)->conn->vfs.ops.recvfile((fsp)->conn->vfs.handles.recvfile, (fromfd), (fsp), (tofd), (offset), (count)))
+#define SMB_VFS_READ(fsp, data, n) ((fsp)->conn->vfs.ops.read((fsp)->conn->vfs.handles.read, (fsp), (data), (n)))
+#define SMB_VFS_PREAD(fsp, data, n, off) ((fsp)->conn->vfs.ops.pread((fsp)->conn->vfs.handles.pread, (fsp), (data), (n), (off)))
+#define SMB_VFS_WRITE(fsp, data, n) ((fsp)->conn->vfs.ops.write((fsp)->conn->vfs.handles.write, (fsp), (data), (n)))
+#define SMB_VFS_PWRITE(fsp, data, n, off) ((fsp)->conn->vfs.ops.pwrite((fsp)->conn->vfs.handles.pwrite, (fsp), (data), (n), (off)))
+#define SMB_VFS_LSEEK(fsp, offset, whence) ((fsp)->conn->vfs.ops.lseek((fsp)->conn->vfs.handles.lseek, (fsp), (offset), (whence)))
+#define SMB_VFS_SENDFILE(tofd, fromfsp, header, offset, count) ((fsp)->conn->vfs.ops.sendfile((fsp)->conn->vfs.handles.sendfile, (tofd), (fromfsp), (header), (offset), (count)))
+#define SMB_VFS_RECVFILE(fromfd, tofsp, offset, count) ((fsp)->conn->vfs.ops.recvfile((fsp)->conn->vfs.handles.recvfile, (fromfd), (tofsp), (offset), (count)))
 #define SMB_VFS_RENAME(conn, old, new) ((conn)->vfs.ops.rename((conn)->vfs.handles.rename, (old), (new)))
-#define SMB_VFS_FSYNC(fsp, fd) ((fsp)->conn->vfs.ops.fsync((fsp)->conn->vfs.handles.fsync, (fsp), (fd)))
+#define SMB_VFS_FSYNC(fsp) ((fsp)->conn->vfs.ops.fsync((fsp)->conn->vfs.handles.fsync, (fsp)))
 #define SMB_VFS_STAT(conn, fname, sbuf) ((conn)->vfs.ops.stat((conn)->vfs.handles.stat, (fname), (sbuf)))
-#define SMB_VFS_FSTAT(fsp, fd, sbuf) ((fsp)->conn->vfs.ops.fstat((fsp)->conn->vfs.handles.fstat, (fsp) ,(fd) ,(sbuf)))
+#define SMB_VFS_FSTAT(fsp, sbuf) ((fsp)->conn->vfs.ops.fstat((fsp)->conn->vfs.handles.fstat, (fsp), (sbuf)))
 #define SMB_VFS_LSTAT(conn, path, sbuf) ((conn)->vfs.ops.lstat((conn)->vfs.handles.lstat, (path), (sbuf)))
 #define SMB_VFS_UNLINK(conn, path) ((conn)->vfs.ops.unlink((conn)->vfs.handles.unlink, (path)))
 #define SMB_VFS_CHMOD(conn, path, mode) ((conn)->vfs.ops.chmod((conn)->vfs.handles.chmod, (path), (mode)))
-#define SMB_VFS_FCHMOD(fsp, fd, mode) ((fsp)->conn->vfs.ops.fchmod((fsp)->conn->vfs.handles.fchmod, (fsp), (fd), (mode)))
+#define SMB_VFS_FCHMOD(fsp, mode) ((fsp)->conn->vfs.ops.fchmod((fsp)->conn->vfs.handles.fchmod, (fsp), (mode)))
 #define SMB_VFS_CHOWN(conn, path, uid, gid) ((conn)->vfs.ops.chown((conn)->vfs.handles.chown, (path), (uid), (gid)))
-#define SMB_VFS_FCHOWN(fsp, fd, uid, gid) ((fsp)->conn->vfs.ops.fchown((fsp)->conn->vfs.handles.fchown, (fsp), (fd), (uid), (gid)))
+#define SMB_VFS_FCHOWN(fsp, uid, gid) ((fsp)->conn->vfs.ops.fchown((fsp)->conn->vfs.handles.fchown, (fsp), (uid), (gid)))
 #define SMB_VFS_LCHOWN(conn, path, uid, gid) ((conn)->vfs.ops.lchown((conn)->vfs.handles.lchown, (path), (uid), (gid)))
 #define SMB_VFS_CHDIR(conn, path) ((conn)->vfs.ops.chdir((conn)->vfs.handles.chdir, (path)))
 #define SMB_VFS_GETWD(conn, buf) ((conn)->vfs.ops.getwd((conn)->vfs.handles.getwd, (buf)))
 #define SMB_VFS_NTIMES(conn, path, ts) ((conn)->vfs.ops.ntimes((conn)->vfs.handles.ntimes, (path), (ts)))
-#define SMB_VFS_FTRUNCATE(fsp, fd, offset) ((fsp)->conn->vfs.ops.ftruncate((fsp)->conn->vfs.handles.ftruncate, (fsp), (fd), (offset)))
-#define SMB_VFS_LOCK(fsp, fd, op, offset, count, type) ((fsp)->conn->vfs.ops.lock((fsp)->conn->vfs.handles.lock, (fsp), (fd) ,(op), (offset), (count), (type)))
-#define SMB_VFS_KERNEL_FLOCK(fsp, fd, share_mode) ((fsp)->conn->vfs.ops.kernel_flock((fsp)->conn->vfs.handles.kernel_flock, (fsp), (fd), (share_mode)))
-#define SMB_VFS_LINUX_SETLEASE(fsp, fd, leasetype) ((fsp)->conn->vfs.ops.linux_setlease((fsp)->conn->vfs.handles.linux_setlease, (fsp), (fd), (leasetype)))
-#define SMB_VFS_GETLOCK(fsp, fd, poffset, pcount, ptype, ppid) ((fsp)->conn->vfs.ops.getlock((fsp)->conn->vfs.handles.getlock, (fsp), (fd) ,(poffset), (pcount), (ptype), (ppid)))
+#define SMB_VFS_FTRUNCATE(fsp, offset) ((fsp)->conn->vfs.ops.ftruncate((fsp)->conn->vfs.handles.ftruncate, (fsp), (offset)))
+#define SMB_VFS_LOCK(fsp, op, offset, count, type) ((fsp)->conn->vfs.ops.lock((fsp)->conn->vfs.handles.lock, (fsp), (op), (offset), (count), (type)))
+#define SMB_VFS_KERNEL_FLOCK(fsp, share_mode) ((fsp)->conn->vfs.ops.kernel_flock((fsp)->conn->vfs.handles.kernel_flock, (fsp), (share_mode)))
+#define SMB_VFS_LINUX_SETLEASE(fsp, leasetype) ((fsp)->conn->vfs.ops.linux_setlease((fsp)->conn->vfs.handles.linux_setlease, (fsp), (leasetype)))
+#define SMB_VFS_GETLOCK(fsp, poffset, pcount, ptype, ppid) ((fsp)->conn->vfs.ops.getlock((fsp)->conn->vfs.handles.getlock, (fsp), (poffset), (pcount), (ptype), (ppid)))
 #define SMB_VFS_SYMLINK(conn, oldpath, newpath) ((conn)->vfs.ops.symlink((conn)->vfs.handles.symlink, (oldpath), (newpath)))
 #define SMB_VFS_READLINK(conn, path, buf, bufsiz) ((conn)->vfs.ops.readlink((conn)->vfs.handles.readlink, (path), (buf), (bufsiz)))
 #define SMB_VFS_LINK(conn, oldpath, newpath) ((conn)->vfs.ops.link((conn)->vfs.handles.link, (oldpath), (newpath)))
 #define SMB_VFS_NOTIFY_WATCH(conn, ctx, e, callback, private_data, handle_p) ((conn)->vfs.ops.notify_watch((conn)->vfs.handles.notify_watch, (ctx), (e), (callback), (private_data), (handle_p)))
 #define SMB_VFS_CHFLAGS(conn, path, flags) ((conn)->vfs.ops.chflags((conn)->vfs.handles.chflags, (path), (flags)))
 #define SMB_VFS_FILE_ID_CREATE(conn, dev, inode) ((conn)->vfs.ops.file_id_create((conn)->vfs.handles.file_id_create, (dev), (inode)))
+#define SMB_VFS_STREAMINFO(conn, fsp, fname, mem_ctx, num_streams, streams) ((conn)->vfs.ops.streaminfo((conn)->vfs.handles.streaminfo, (fsp), (fname), (mem_ctx), (num_streams), (streams)))
 
 /* NT ACL operations. */
-#define SMB_VFS_FGET_NT_ACL(fsp, fd, security_info, ppdesc) ((fsp)->conn->vfs.ops.fget_nt_acl((fsp)->conn->vfs.handles.fget_nt_acl, (fsp), (fd), (security_info), (ppdesc)))
-#define SMB_VFS_GET_NT_ACL(fsp, name, security_info, ppdesc) ((fsp)->conn->vfs.ops.get_nt_acl((fsp)->conn->vfs.handles.get_nt_acl, (fsp), (name), (security_info), (ppdesc)))
-#define SMB_VFS_FSET_NT_ACL(fsp, fd, security_info_sent, psd) ((fsp)->conn->vfs.ops.fset_nt_acl((fsp)->conn->vfs.handles.fset_nt_acl, (fsp), (fd), (security_info_sent), (psd)))
+#define SMB_VFS_FGET_NT_ACL(fsp, security_info, ppdesc) ((fsp)->conn->vfs.ops.fget_nt_acl((fsp)->conn->vfs.handles.fget_nt_acl, (fsp), (security_info), (ppdesc)))
+#define SMB_VFS_GET_NT_ACL(conn, name, security_info, ppdesc) ((conn)->vfs.ops.get_nt_acl((conn)->vfs.handles.get_nt_acl, (name), (security_info), (ppdesc)))
+#define SMB_VFS_FSET_NT_ACL(fsp, security_info_sent, psd) ((fsp)->conn->vfs.ops.fset_nt_acl((fsp)->conn->vfs.handles.fset_nt_acl, (fsp), (security_info_sent), (psd)))
 #define SMB_VFS_SET_NT_ACL(fsp, name, security_info_sent, psd) ((fsp)->conn->vfs.ops.set_nt_acl((fsp)->conn->vfs.handles.set_nt_acl, (fsp), (name), (security_info_sent), (psd)))
 
 /* POSIX ACL operations. */
 #define SMB_VFS_CHMOD_ACL(conn, name, mode) ((conn)->vfs.ops.chmod_acl((conn)->vfs.handles.chmod_acl, (name), (mode)))
-#define SMB_VFS_FCHMOD_ACL(fsp, fd, mode) ((fsp)->conn->vfs.ops.fchmod_acl((fsp)->conn->vfs.handles.chmod_acl, (fsp), (fd), (mode)))
+#define SMB_VFS_FCHMOD_ACL(fsp, mode) ((fsp)->conn->vfs.ops.fchmod_acl((fsp)->conn->vfs.handles.chmod_acl, (fsp), (mode)))
 
 #define SMB_VFS_SYS_ACL_GET_ENTRY(conn, theacl, entry_id, entry_p) ((conn)->vfs.ops.sys_acl_get_entry((conn)->vfs.handles.sys_acl_get_entry, (theacl), (entry_id), (entry_p)))
 #define SMB_VFS_SYS_ACL_GET_TAG_TYPE(conn, entry_d, tag_type_p) ((conn)->vfs.ops.sys_acl_get_tag_type((conn)->vfs.handles.sys_acl_get_tag_type, (entry_d), (tag_type_p)))
 #define SMB_VFS_SYS_ACL_GET_PERMSET(conn, entry_d, permset_p) ((conn)->vfs.ops.sys_acl_get_permset((conn)->vfs.handles.sys_acl_get_permset, (entry_d), (permset_p)))
 #define SMB_VFS_SYS_ACL_GET_QUALIFIER(conn, entry_d) ((conn)->vfs.ops.sys_acl_get_qualifier((conn)->vfs.handles.sys_acl_get_qualifier, (entry_d)))
 #define SMB_VFS_SYS_ACL_GET_FILE(conn, path_p, type) ((conn)->vfs.ops.sys_acl_get_file((conn)->vfs.handles.sys_acl_get_file, (path_p), (type)))
-#define SMB_VFS_SYS_ACL_GET_FD(fsp, fd) ((fsp)->conn->vfs.ops.sys_acl_get_fd((fsp)->conn->vfs.handles.sys_acl_get_fd, (fsp), (fd)))
+#define SMB_VFS_SYS_ACL_GET_FD(fsp) ((fsp)->conn->vfs.ops.sys_acl_get_fd((fsp)->conn->vfs.handles.sys_acl_get_fd, (fsp)))
 #define SMB_VFS_SYS_ACL_CLEAR_PERMS(conn, permset) ((conn)->vfs.ops.sys_acl_clear_perms((conn)->vfs.handles.sys_acl_clear_perms, (permset)))
 #define SMB_VFS_SYS_ACL_ADD_PERM(conn, permset, perm) ((conn)->vfs.ops.sys_acl_add_perm((conn)->vfs.handles.sys_acl_add_perm, (permset), (perm)))
 #define SMB_VFS_SYS_ACL_TO_TEXT(conn, theacl, plen) ((conn)->vfs.ops.sys_acl_to_text((conn)->vfs.handles.sys_acl_to_text, (theacl), (plen)))
 #define SMB_VFS_SYS_ACL_SET_PERMSET(conn, entry, permset) ((conn)->vfs.ops.sys_acl_set_permset((conn)->vfs.handles.sys_acl_set_permset, (entry), (permset)))
 #define SMB_VFS_SYS_ACL_VALID(conn, theacl) ((conn)->vfs.ops.sys_acl_valid((conn)->vfs.handles.sys_acl_valid, (theacl)))
 #define SMB_VFS_SYS_ACL_SET_FILE(conn, name, acltype, theacl) ((conn)->vfs.ops.sys_acl_set_file((conn)->vfs.handles.sys_acl_set_file, (name), (acltype), (theacl)))
-#define SMB_VFS_SYS_ACL_SET_FD(fsp, fd, theacl) ((fsp)->conn->vfs.ops.sys_acl_set_fd((fsp)->conn->vfs.handles.sys_acl_set_fd, (fsp), (fd), (theacl)))
+#define SMB_VFS_SYS_ACL_SET_FD(fsp, theacl) ((fsp)->conn->vfs.ops.sys_acl_set_fd((fsp)->conn->vfs.handles.sys_acl_set_fd, (fsp), (theacl)))
 #define SMB_VFS_SYS_ACL_DELETE_DEF_FILE(conn, path) ((conn)->vfs.ops.sys_acl_delete_def_file((conn)->vfs.handles.sys_acl_delete_def_file, (path)))
 #define SMB_VFS_SYS_ACL_GET_PERM(conn, permset, perm) ((conn)->vfs.ops.sys_acl_get_perm((conn)->vfs.handles.sys_acl_get_perm, (permset), (perm)))
 #define SMB_VFS_SYS_ACL_FREE_TEXT(conn, text) ((conn)->vfs.ops.sys_acl_free_text((conn)->vfs.handles.sys_acl_free_text, (text)))
 /* EA operations. */
 #define SMB_VFS_GETXATTR(conn,path,name,value,size) ((conn)->vfs.ops.getxattr((conn)->vfs.handles.getxattr,(path),(name),(value),(size)))
 #define SMB_VFS_LGETXATTR(conn,path,name,value,size) ((conn)->vfs.ops.lgetxattr((conn)->vfs.handles.lgetxattr,(path),(name),(value),(size)))
-#define SMB_VFS_FGETXATTR(fsp,fd,name,value,size) ((fsp)->conn->vfs.ops.fgetxattr((fsp)->conn->vfs.handles.fgetxattr,(fsp),(fd),(name),(value),(size)))
+#define SMB_VFS_FGETXATTR(fsp,name,value,size) ((fsp)->conn->vfs.ops.fgetxattr((fsp)->conn->vfs.handles.fgetxattr,(fsp),(name),(value),(size)))
 #define SMB_VFS_LISTXATTR(conn,path,list,size) ((conn)->vfs.ops.listxattr((conn)->vfs.handles.listxattr,(path),(list),(size)))
 #define SMB_VFS_LLISTXATTR(conn,path,list,size) ((conn)->vfs.ops.llistxattr((conn)->vfs.handles.llistxattr,(path),(list),(size)))
-#define SMB_VFS_FLISTXATTR(fsp,fd,list,size) ((fsp)->conn->vfs.ops.flistxattr((fsp)->conn->vfs.handles.flistxattr,(fsp),(fd),(list),(size)))
+#define SMB_VFS_FLISTXATTR(fsp,list,size) ((fsp)->conn->vfs.ops.flistxattr((fsp)->conn->vfs.handles.flistxattr,(fsp),(list),(size)))
 #define SMB_VFS_REMOVEXATTR(conn,path,name) ((conn)->vfs.ops.removexattr((conn)->vfs.handles.removexattr,(path),(name)))
 #define SMB_VFS_LREMOVEXATTR(conn,path,name) ((conn)->vfs.ops.lremovexattr((conn)->vfs.handles.lremovexattr,(path),(name)))
-#define SMB_VFS_FREMOVEXATTR(fsp,fd,name) ((fsp)->conn->vfs.ops.fremovexattr((fsp)->conn->vfs.handles.fremovexattr,(fsp),(fd),(name)))
+#define SMB_VFS_FREMOVEXATTR(fsp,name) ((fsp)->conn->vfs.ops.fremovexattr((fsp)->conn->vfs.handles.fremovexattr,(fsp),(name)))
 #define SMB_VFS_SETXATTR(conn,path,name,value,size,flags) ((conn)->vfs.ops.setxattr((conn)->vfs.handles.setxattr,(path),(name),(value),(size),(flags)))
 #define SMB_VFS_LSETXATTR(conn,path,name,value,size,flags) ((conn)->vfs.ops.lsetxattr((conn)->vfs.handles.lsetxattr,(path),(name),(value),(size),(flags)))
-#define SMB_VFS_FSETXATTR(fsp,fd,name,value,size,flags) ((fsp)->conn->vfs.ops.fsetxattr((fsp)->conn->vfs.handles.fsetxattr,(fsp),(fd),(name),(value),(size),(flags)))
+#define SMB_VFS_FSETXATTR(fsp,name,value,size,flags) ((fsp)->conn->vfs.ops.fsetxattr((fsp)->conn->vfs.handles.fsetxattr,(fsp),(name),(value),(size),(flags)))
 
 /* AIO operations. */
 #define SMB_VFS_AIO_READ(fsp,aiocb) ((fsp)->conn->vfs.ops.aio_read((fsp)->conn->vfs.handles.aio_read,(fsp),(aiocb)))
 #define SMB_VFS_AIO_WRITE(fsp,aiocb) ((fsp)->conn->vfs.ops.aio_write((fsp)->conn->vfs.handles.aio_write,(fsp),(aiocb)))
 #define SMB_VFS_AIO_RETURN(fsp,aiocb) ((fsp)->conn->vfs.ops.aio_return_fn((fsp)->conn->vfs.handles.aio_return,(fsp),(aiocb)))
-#define SMB_VFS_AIO_CANCEL(fsp,fd,aiocb) ((fsp)->conn->vfs.ops.aio_cancel((fsp)->conn->vfs.handles.aio_cancel,(fsp),(fd),(aiocb)))
+#define SMB_VFS_AIO_CANCEL(fsp,aiocb) ((fsp)->conn->vfs.ops.aio_cancel((fsp)->conn->vfs.handles.aio_cancel,(fsp),(aiocb)))
 #define SMB_VFS_AIO_ERROR(fsp,aiocb) ((fsp)->conn->vfs.ops.aio_error_fn((fsp)->conn->vfs.handles.aio_error,(fsp),(aiocb)))
 #define SMB_VFS_AIO_FSYNC(fsp,op,aiocb) ((fsp)->conn->vfs.ops.aio_fsync((fsp)->conn->vfs.handles.aio_fsync,(fsp),(op),(aiocb)))
 #define SMB_VFS_AIO_SUSPEND(fsp,aiocb,n,ts) ((fsp)->conn->vfs.ops.aio_suspend((fsp)->conn->vfs.handles.aio_suspend,(fsp),(aiocb),(n),(ts)))
+#define SMB_VFS_AIO_FORCE(fsp) ((fsp)->conn->vfs.ops.aio_force((fsp)->conn->vfs.handles.aio_force,(fsp)))
+
+/* Offline operations */
+#define SMB_VFS_IS_OFFLINE(conn,path,sbuf) ((conn)->vfs.ops.is_offline((conn)->vfs.handles.is_offline,(path),(sbuf)))
+#define SMB_VFS_SET_OFFLINE(conn,path) ((conn)->vfs.ops.set_offline((conn)->vfs.handles.set_offline,(path)))
 
 /*******************************************************************
  Don't access conn->vfs_opaque.ops directly!!!
  (Fixes should also go into the vfs_* and vfs_next_* macros!)
 ********************************************************************/
 
-/* Disk operations */    
+/* Disk operations */
 #define SMB_VFS_OPAQUE_CONNECT(conn, service, user) ((conn)->vfs_opaque.ops.connect_fn((conn)->vfs_opaque.handles.connect_hnd, (service), (user)))
 #define SMB_VFS_OPAQUE_DISCONNECT(conn) ((conn)->vfs_opaque.ops.disconnect((conn)->vfs_opaque.handles.disconnect))
 #define SMB_VFS_OPAQUE_DISK_FREE(conn, path, small_query, bsize, dfree ,dsize) ((conn)->vfs_opaque.ops.disk_free((conn)->vfs_opaque.handles.disk_free, (path), (small_query), (bsize), (dfree), (dsize)))
 #define SMB_VFS_OPAQUE_SET_QUOTA(conn, qtype, id, qt) ((conn)->vfs_opaque.ops.set_quota((conn)->vfs_opaque.handles.set_quota, (qtype), (id), (qt)))
 #define SMB_VFS_OPAQUE_GET_SHADOW_COPY_DATA(fsp,shadow_copy_data,labels) ((fsp)->conn->vfs_opaque.ops.get_shadow_copy_data((fsp)->conn->vfs_opaque.handles.get_shadow_copy_data,(fsp),(shadow_copy_data),(labels)))
 #define SMB_VFS_OPAQUE_STATVFS(conn, path, statbuf) ((conn)->vfs_opaque.ops.statvfs((conn)->vfs_opaque.handles.statvfs, (path), (statbuf)))
+#define SMB_VFS_OPAQUE_FS_CAPABILITIES(conn) ((conn)->vfs_opaque.ops.fs_capabilities((conn)->vfs_opaque.handles.fs_capabilities))
 
 /* Directory operations */
 #define SMB_VFS_OPAQUE_OPENDIR(conn, fname, mask, attr) ((conn)->vfs_opaque.ops.opendir((conn)->vfs_opaque.handles.opendir, (fname), (mask), (attr)))
 #define SMB_VFS_OPAQUE_MKDIR(conn, path, mode) ((conn)->vfs_opaque.ops.mkdir((conn)->vfs_opaque.handles.mkdir,(path), (mode)))
 #define SMB_VFS_OPAQUE_RMDIR(conn, path) ((conn)->vfs_opaque.ops.rmdir((conn)->vfs_opaque.handles.rmdir, (path)))
 #define SMB_VFS_OPAQUE_CLOSEDIR(conn, dir) ((conn)->vfs_opaque.ops.closedir((conn)->vfs_opaque.handles.closedir, dir))
-    
+
 /* File operations */
 #define SMB_VFS_OPAQUE_OPEN(conn, fname, fsp, flags, mode) (((conn)->vfs_opaque.ops.open)((conn)->vfs_opaque.handles.open, (fname), (fsp), (flags), (mode)))
 #define SMB_VFS_OPAQUE_CLOSE(fsp, fd) ((fsp)->conn->vfs_opaque.ops.close_fn((fsp)->conn->vfs_opaque.handles.close_hnd, (fsp), (fd)))
-#define SMB_VFS_OPAQUE_READ(fsp, fd, data, n) ((fsp)->conn->vfs_opaque.ops.read((fsp)->conn->vfs_opaque.handles.read, (fsp), (fd), (data), (n)))
-#define SMB_VFS_OPAQUE_PREAD(fsp, fd, data, n, off) ((fsp)->conn->vfs_opaque.ops.pread((fsp)->conn->vfs_opaque.handles.pread, (fsp), (fd), (data), (n), (off)))
-#define SMB_VFS_OPAQUE_WRITE(fsp, fd, data, n) ((fsp)->conn->vfs_opaque.ops.write((fsp)->conn->vfs_opaque.handles.write, (fsp), (fd), (data), (n)))
-#define SMB_VFS_OPAQUE_PWRITE(fsp, fd, data, n, off) ((fsp)->conn->vfs_opaque.ops.pwrite((fsp)->conn->vfs_opaque.handles.pwrite, (fsp), (fd), (data), (n), (off)))
-#define SMB_VFS_OPAQUE_LSEEK(fsp, fd, offset, whence) ((fsp)->conn->vfs_opaque.ops.lseek((fsp)->conn->vfs_opaque.handles.lseek, (fsp), (fd), (offset), (whence)))
-#define SMB_VFS_OPAQUE_SENDFILE(tofd, fsp, fromfd, header, offset, count) ((fsp)->conn->vfs_opaque.ops.sendfile((fsp)->conn->vfs_opaque.handles.sendfile, (tofd), (fsp), (fromfd), (header), (offset), (count)))
-#define SMB_VFS_OPAQUE_RECVFILE(fromfd, fsp, tofd, offset, count) ((fsp)->conn->vfs_opaque.ops.recvfile((fsp)->conn->vfs_opaque.handles.recvfile, (fromfd), (fsp), (tofd), (offset), (count)))
+#define SMB_VFS_OPAQUE_READ(fsp, data, n) ((fsp)->conn->vfs_opaque.ops.read((fsp)->conn->vfs_opaque.handles.read, (fsp), (data), (n)))
+#define SMB_VFS_OPAQUE_PREAD(fsp, data, n, off) ((fsp)->conn->vfs_opaque.ops.pread((fsp)->conn->vfs_opaque.handles.pread, (fsp), (data), (n), (off)))
+#define SMB_VFS_OPAQUE_WRITE(fsp, data, n) ((fsp)->conn->vfs_opaque.ops.write((fsp)->conn->vfs_opaque.handles.write, (fsp), (data), (n)))
+#define SMB_VFS_OPAQUE_PWRITE(fsp, data, n, off) ((fsp)->conn->vfs_opaque.ops.pwrite((fsp)->conn->vfs_opaque.handles.pwrite, (fsp), (data), (n), (off)))
+#define SMB_VFS_OPAQUE_LSEEK(fsp, offset, whence) ((fsp)->conn->vfs_opaque.ops.lseek((fsp)->conn->vfs_opaque.handles.lseek, (fsp), (offset), (whence)))
+#define SMB_VFS_OPAQUE_SENDFILE(tofd, fromfsp, header, offset, count) ((fsp)->conn->vfs_opaque.ops.sendfile((fsp)->conn->vfs_opaque.handles.sendfile, (tofd), (fromfsp), (header), (offset), (count)))
+#define SMB_VFS_OPAQUE_RECVFILE(fromfd, tofsp, offset, count) ((fsp)->conn->vfs_opaque.ops.recvfile((fsp)->conn->vfs_opaque.handles.recvfile, (fromfd), (tofsp), (offset), (count)))
 #define SMB_VFS_OPAQUE_RENAME(conn, old, new) ((conn)->vfs_opaque.ops.rename((conn)->vfs_opaque.handles.rename, (old), (new)))
-#define SMB_VFS_OPAQUE_FSYNC(fsp, fd) ((fsp)->conn->vfs_opaque.ops.fsync((fsp)->conn->vfs_opaque.handles.fsync, (fsp), (fd)))
+#define SMB_VFS_OPAQUE_FSYNC(fsp) ((fsp)->conn->vfs_opaque.ops.fsync((fsp)->conn->vfs_opaque.handles.fsync, (fsp)))
 #define SMB_VFS_OPAQUE_STAT(conn, fname, sbuf) ((conn)->vfs_opaque.ops.stat((conn)->vfs_opaque.handles.stat, (fname), (sbuf)))
-#define SMB_VFS_OPAQUE_FSTAT(fsp, fd, sbuf) ((fsp)->conn->vfs_opaque.ops.fstat((fsp)->conn->vfs_opaque.handles.fstat, (fsp) ,(fd) ,(sbuf)))
+#define SMB_VFS_OPAQUE_FSTAT(fsp, sbuf) ((fsp)->conn->vfs_opaque.ops.fstat((fsp)->conn->vfs_opaque.handles.fstat, (fsp), (sbuf)))
 #define SMB_VFS_OPAQUE_LSTAT(conn, path, sbuf) ((conn)->vfs_opaque.ops.lstat((conn)->vfs_opaque.handles.lstat, (path), (sbuf)))
 #define SMB_VFS_OPAQUE_UNLINK(conn, path) ((conn)->vfs_opaque.ops.unlink((conn)->vfs_opaque.handles.unlink, (path)))
 #define SMB_VFS_OPAQUE_CHMOD(conn, path, mode) ((conn)->vfs_opaque.ops.chmod((conn)->vfs_opaque.handles.chmod, (path), (mode)))
-#define SMB_VFS_OPAQUE_FCHMOD(fsp, fd, mode) ((fsp)->conn->vfs_opaque.ops.fchmod((fsp)->conn->vfs_opaque.handles.fchmod, (fsp), (fd), (mode)))
+#define SMB_VFS_OPAQUE_FCHMOD(fsp, mode) ((fsp)->conn->vfs_opaque.ops.fchmod((fsp)->conn->vfs_opaque.handles.fchmod, (fsp), (mode)))
 #define SMB_VFS_OPAQUE_CHOWN(conn, path, uid, gid) ((conn)->vfs_opaque.ops.chown((conn)->vfs_opaque.handles.chown, (path), (uid), (gid)))
-#define SMB_VFS_OPAQUE_FCHOWN(fsp, fd, uid, gid) ((fsp)->conn->vfs_opaque.ops.fchown((fsp)->conn->vfs_opaque.handles.fchown, (fsp), (fd), (uid), (gid)))
+#define SMB_VFS_OPAQUE_FCHOWN(fsp, uid, gid) ((fsp)->conn->vfs_opaque.ops.fchown((fsp)->conn->vfs_opaque.handles.fchown, (fsp), (uid), (gid)))
 #define SMB_VFS_OPAQUE_LCHOWN(conn, path, uid, gid) ((conn)->vfs_opaque.ops.lchown((conn)->vfs_opaque.handles.lchown, (path), (uid), (gid)))
 #define SMB_VFS_OPAQUE_CHDIR(conn, path) ((conn)->vfs_opaque.ops.chdir((conn)->vfs_opaque.handles.chdir, (path)))
 #define SMB_VFS_OPAQUE_GETWD(conn, buf) ((conn)->vfs_opaque.ops.getwd((conn)->vfs_opaque.handles.getwd, (buf)))
 #define SMB_VFS_OPAQUE_NTIMES(conn, path, ts) ((conn)->vfs_opaque.ops.ntimes((conn)->vfs_opaque.handles.ntimes, (path), (ts)))
-#define SMB_VFS_OPAQUE_FTRUNCATE(fsp, fd, offset) ((fsp)->conn->vfs_opaque.ops.ftruncate((fsp)->conn->vfs_opaque.handles.ftruncate, (fsp), (fd), (offset)))
-#define SMB_VFS_OPAQUE_LOCK(fsp, fd, op, offset, count, type) ((fsp)->conn->vfs_opaque.ops.lock((fsp)->conn->vfs_opaque.handles.lock, (fsp), (fd) ,(op), (offset), (count), (type)))
-#define SMB_VFS_OPAQUE_FLOCK(fsp, fd, share_mode) ((fsp)->conn->vfs_opaque.ops.lock((fsp)->conn->vfs_opaque.handles.kernel_flock, (fsp), (fd), (share_mode)))
-#define SMB_VFS_OPAQUE_LINUX_SETLEASE(fsp, fd, leasetype) ((fsp)->conn->vfs_opaque.ops.linux_setlease((fsp)->conn->vfs_opaque.handles.linux_setlease, (fsp), (fd), (leasetype)))
-#define SMB_VFS_OPAQUE_GETLOCK(fsp, fd, poffset, pcount, ptype, ppid) ((fsp)->conn->vfs_opaque.ops.getlock((fsp)->conn->vfs_opaque.handles.getlock, (fsp), (fd), (poffset), (pcount), (ptype), (ppid)))
+#define SMB_VFS_OPAQUE_FTRUNCATE(fsp, offset) ((fsp)->conn->vfs_opaque.ops.ftruncate((fsp)->conn->vfs_opaque.handles.ftruncate, (fsp), (offset)))
+#define SMB_VFS_OPAQUE_LOCK(fsp, op, offset, count, type) ((fsp)->conn->vfs_opaque.ops.lock((fsp)->conn->vfs_opaque.handles.lock, (fsp), (op), (offset), (count), (type)))
+#define SMB_VFS_OPAQUE_KERNEL_FLOCK(fsp, share_mode) ((fsp)->conn->vfs_opaque.ops.kernel_flock((fsp)->conn->vfs_opaque.handles.kernel_flock, (fsp), (share_mode)))
+#define SMB_VFS_OPAQUE_LINUX_SETLEASE(fsp, leasetype) ((fsp)->conn->vfs_opaque.ops.linux_setlease((fsp)->conn->vfs_opaque.handles.linux_setlease, (fsp), (leasetype)))
+#define SMB_VFS_OPAQUE_GETLOCK(fsp, poffset, pcount, ptype, ppid) ((fsp)->conn->vfs_opaque.ops.getlock((fsp)->conn->vfs_opaque.handles.getlock, (fsp), (poffset), (pcount), (ptype), (ppid)))
 #define SMB_VFS_OPAQUE_SYMLINK(conn, oldpath, newpath) ((conn)->vfs_opaque.ops.symlink((conn)->vfs_opaque.handles.symlink, (oldpath), (newpath)))
 #define SMB_VFS_OPAQUE_READLINK(conn, path, buf, bufsiz) ((conn)->vfs_opaque.ops.readlink((conn)->vfs_opaque.handles.readlink, (path), (buf), (bufsiz)))
 #define SMB_VFS_OPAQUE_LINK(conn, oldpath, newpath) ((conn)->vfs_opaque.ops.link((conn)->vfs_opaque.handles.link, (oldpath), (newpath)))
 #define SMB_VFS_OPAQUE_NOTIFY_WATCH(conn, ctx, e, callback, private_data, handle_p) ((conn)->vfs_opaque.ops.notify_watch((conn)->vfs_opaque.handles.notify_watch, (ctx), (e), (callback), (private_data), (handle_p)))
 #define SMB_VFS_OPAQUE_CHFLAGS(conn, path, flags) ((conn)->vfs_opaque.ops.chflags((conn)->vfs_opaque.handles.chflags, (path), (flags)))
 #define SMB_VFS_OPAQUE_FILE_ID_CREATE(conn, dev, inode) ((conn)->vfs.ops_opaque.file_id_create((conn)->vfs_opaque.handles.file_id_create, (dev), (inode)))
+#define SMB_VFS_OPAQUE_STREAMINFO(conn, fsp, fname, mem_ctx, num_streams, streams) ((conn)->vfs_opaque.ops.streaminfo((conn)->vfs_opaque.handles.streaminfo, (fsp), (fname), (mem_ctx), (num_streams), (streams)))
 
 /* NT ACL operations. */
-#define SMB_VFS_OPAQUE_FGET_NT_ACL(fsp, fd, security_info, ppdesc) ((fsp)->conn->vfs_opaque.ops.fget_nt_acl((fsp)->conn->vfs_opaque.handles.fget_nt_acl, (fsp), (fd), (security_info), (ppdesc)))
-#define SMB_VFS_OPAQUE_GET_NT_ACL(fsp, name, security_info, ppdesc) ((fsp)->conn->vfs_opaque.ops.get_nt_acl((fsp)->conn->vfs_opaque.handles.get_nt_acl, (fsp), (name), (security_info), (ppdesc)))
-#define SMB_VFS_OPAQUE_FSET_NT_ACL(fsp, fd, security_info_sent, psd) ((fsp)->conn->vfs_opaque.ops.fset_nt_acl((fsp)->conn->vfs_opaque.handles.fset_nt_acl, (fsp), (fd), (security_info_sent), (psd)))
+#define SMB_VFS_OPAQUE_FGET_NT_ACL(fsp, security_info, ppdesc) ((fsp)->conn->vfs_opaque.ops.fget_nt_acl((fsp)->conn->vfs_opaque.handles.fget_nt_acl, (fsp), (security_info), (ppdesc)))
+#define SMB_VFS_OPAQUE_GET_NT_ACL(conn, name, security_info, ppdesc) ((conn)->vfs_opaque.ops.get_nt_acl((conn)->vfs_opaque.handles.get_nt_acl, (name), (security_info), (ppdesc)))
+#define SMB_VFS_OPAQUE_FSET_NT_ACL(fsp, security_info_sent, psd) ((fsp)->conn->vfs_opaque.ops.fset_nt_acl((fsp)->conn->vfs_opaque.handles.fset_nt_acl, (fsp), (security_info_sent), (psd)))
 #define SMB_VFS_OPAQUE_SET_NT_ACL(fsp, name, security_info_sent, psd) ((fsp)->conn->vfs_opaque.ops.set_nt_acl((fsp)->conn->vfs_opaque.handles.set_nt_acl, (fsp), (name), (security_info_sent), (psd)))
 
 /* POSIX ACL operations. */
 #define SMB_VFS_OPAQUE_CHMOD_ACL(conn, name, mode) ((conn)->vfs_opaque.ops.chmod_acl((conn)->vfs_opaque.handles.chmod_acl, (name), (mode)))
-#define SMB_VFS_OPAQUE_FCHMOD_ACL(fsp, fd, mode) ((fsp)->conn->vfs_opaque.ops.fchmod_acl((fsp)->conn->vfs_opaque.handles.chmod_acl, (fsp), (fd), (mode)))
+#define SMB_VFS_OPAQUE_FCHMOD_ACL(fsp, mode) ((fsp)->conn->vfs_opaque.ops.fchmod_acl((fsp)->conn->vfs_opaque.handles.chmod_acl, (fsp), (mode)))
 
 #define SMB_VFS_OPAQUE_SYS_ACL_GET_ENTRY(conn, theacl, entry_id, entry_p) ((conn)->vfs_opaque.ops.sys_acl_get_entry((conn)->vfs_opaque.handles.sys_acl_get_entry, (theacl), (entry_id), (entry_p)))
 #define SMB_VFS_OPAQUE_SYS_ACL_GET_TAG_TYPE(conn, entry_d, tag_type_p) ((conn)->vfs_opaque.ops.sys_acl_get_tag_type((conn)->vfs_opaque.handles.sys_acl_get_tag_type, (entry_d), (tag_type_p)))
 #define SMB_VFS_OPAQUE_SYS_ACL_GET_PERMSET(conn, entry_d, permset_p) ((conn)->vfs_opaque.ops.sys_acl_get_permset((conn)->vfs_opaque.handles.sys_acl_get_permset, (entry_d), (permset_p)))
 #define SMB_VFS_OPAQUE_SYS_ACL_GET_QUALIFIER(conn, entry_d) ((conn)->vfs_opaque.ops.sys_acl_get_qualifier((conn)->vfs_opaque.handles.sys_acl_get_qualifier, (entry_d)))
 #define SMB_VFS_OPAQUE_SYS_ACL_GET_FILE(conn, path_p, type) ((conn)->vfs_opaque.ops.sys_acl_get_file((conn)->vfs_opaque.handles.sys_acl_get_file, (path_p), (type)))
-#define SMB_VFS_OPAQUE_SYS_ACL_GET_FD(fsp, fd) ((fsp)->conn->vfs_opaque.ops.sys_acl_get_fd((fsp)->conn->vfs_opaque.handles.sys_acl_get_fd, (fsp), (fd)))
+#define SMB_VFS_OPAQUE_SYS_ACL_GET_FD(fsp) ((fsp)->conn->vfs_opaque.ops.sys_acl_get_fd((fsp)->conn->vfs_opaque.handles.sys_acl_get_fd, (fsp)))
 #define SMB_VFS_OPAQUE_SYS_ACL_CLEAR_PERMS(conn, permset) ((conn)->vfs_opaque.ops.sys_acl_clear_perms((conn)->vfs_opaque.handles.sys_acl_clear_perms, (permset)))
 #define SMB_VFS_OPAQUE_SYS_ACL_ADD_PERM(conn, permset, perm) ((conn)->vfs_opaque.ops.sys_acl_add_perm((conn)->vfs_opaque.handles.sys_acl_add_perm, (permset), (perm)))
 #define SMB_VFS_OPAQUE_SYS_ACL_TO_TEXT(conn, theacl, plen) ((conn)->vfs_opaque.ops.sys_acl_to_text((conn)->vfs_opaque.handles.sys_acl_to_text, (theacl), (plen)))
 #define SMB_VFS_OPAQUE_SYS_ACL_SET_PERMSET(conn, entry, permset) ((conn)->vfs_opaque.ops.sys_acl_set_permset((conn)->vfs_opaque.handles.sys_acl_set_permset, (entry), (permset)))
 #define SMB_VFS_OPAQUE_SYS_ACL_VALID(conn, theacl) ((conn)->vfs_opaque.ops.sys_acl_valid((conn)->vfs_opaque.handles.sys_acl_valid, (theacl)))
 #define SMB_VFS_OPAQUE_SYS_ACL_SET_FILE(conn, name, acltype, theacl) ((conn)->vfs_opaque.ops.sys_acl_set_file((conn)->vfs_opaque.handles.sys_acl_set_file, (name), (acltype), (theacl)))
-#define SMB_VFS_OPAQUE_SYS_ACL_SET_FD(fsp, fd, theacl) ((fsp)->conn->vfs_opaque.ops.sys_acl_set_fd((fsp)->conn->vfs_opaque.handles.sys_acl_set_fd, (fsp), (fd), (theacl)))
+#define SMB_VFS_OPAQUE_SYS_ACL_SET_FD(fsp, theacl) ((fsp)->conn->vfs_opaque.ops.sys_acl_set_fd((fsp)->conn->vfs_opaque.handles.sys_acl_set_fd, (fsp), (theacl)))
 #define SMB_VFS_OPAQUE_SYS_ACL_DELETE_DEF_FILE(conn, path) ((conn)->vfs_opaque.ops.sys_acl_delete_def_file((conn)->vfs_opaque.handles.sys_acl_delete_def_file, (path)))
 #define SMB_VFS_OPAQUE_SYS_ACL_GET_PERM(conn, permset, perm) ((conn)->vfs_opaque.ops.sys_acl_get_perm((conn)->vfs_opaque.handles.sys_acl_get_perm, (permset), (perm)))
 #define SMB_VFS_OPAQUE_SYS_ACL_FREE_TEXT(conn, text) ((conn)->vfs_opaque.ops.sys_acl_free_text((conn)->vfs_opaque.handles.sys_acl_free_text, (text)))
 /* EA operations. */
 #define SMB_VFS_OPAQUE_GETXATTR(conn,path,name,value,size) ((conn)->vfs_opaque.ops.getxattr((conn)->vfs_opaque.handles.getxattr,(path),(name),(value),(size)))
 #define SMB_VFS_OPAQUE_LGETXATTR(conn,path,name,value,size) ((conn)->vfs_opaque.ops.lgetxattr((conn)->vfs_opaque.handles.lgetxattr,(path),(name),(value),(size)))
-#define SMB_VFS_OPAQUE_FGETXATTR(fsp,fd,name,value,size) ((fsp)->conn->vfs_opaque.ops.fgetxattr((fsp)->conn->vfs_opaque.handles.fgetxattr,(fsp),(fd),(name),(value),(size)))
+#define SMB_VFS_OPAQUE_FGETXATTR(fsp,name,value,size) ((fsp)->conn->vfs_opaque.ops.fgetxattr((fsp)->conn->vfs_opaque.handles.fgetxattr,(fsp),(name),(value),(size)))
 #define SMB_VFS_OPAQUE_LISTXATTR(conn,path,list,size) ((conn)->vfs_opaque.ops.listxattr((conn)->vfs_opaque.handles.listxattr,(path),(list),(size)))
 #define SMB_VFS_OPAQUE_LLISTXATTR(conn,path,list,size) ((conn)->vfs_opaque.ops.llistxattr((conn)->vfs_opaque.handles.llistxattr,(path),(list),(size)))
-#define SMB_VFS_OPAQUE_FLISTXATTR(fsp,fd,list,size) ((fsp)->conn->vfs_opaque.ops.flistxattr((fsp)->conn->vfs_opaque.handles.flistxattr,(fsp),(fd),(list),(size)))
+#define SMB_VFS_OPAQUE_FLISTXATTR(fsp,list,size) ((fsp)->conn->vfs_opaque.ops.flistxattr((fsp)->conn->vfs_opaque.handles.flistxattr,(fsp),(list),(size)))
 #define SMB_VFS_OPAQUE_REMOVEXATTR(conn,path,name) ((conn)->vfs_opaque.ops.removexattr((conn)->vfs_opaque.handles.removexattr,(path),(name)))
 #define SMB_VFS_OPAQUE_LREMOVEXATTR(conn,path,name) ((conn)->vfs_opaque.ops.lremovexattr((conn)->vfs_opaque.handles.lremovexattr,(path),(name)))
-#define SMB_VFS_OPAQUE_FREMOVEXATTR(fsp,fd,name) ((fsp)->conn->vfs_opaque.ops.fremovexattr((fsp)->conn->vfs_opaque.handles.fremovexattr,(fsp),(fd),(name)))
+#define SMB_VFS_OPAQUE_FREMOVEXATTR(fsp,name) ((fsp)->conn->vfs_opaque.ops.fremovexattr((fsp)->conn->vfs_opaque.handles.fremovexattr,(fsp),(name)))
 #define SMB_VFS_OPAQUE_SETXATTR(conn,path,name,value,size,flags) ((conn)->vfs_opaque.ops.setxattr((conn)->vfs_opaque.handles.setxattr,(path),(name),(value),(size),(flags)))
 #define SMB_VFS_OPAQUE_LSETXATTR(conn,path,name,value,size,flags) ((conn)->vfs_opaque.ops.lsetxattr((conn)->vfs_opaque.handles.lsetxattr,(path),(name),(value),(size),(flags)))
-#define SMB_VFS_OPAQUE_FSETXATTR(fsp,fd,name,value,size,flags) ((fsp)->conn->vfs_opaque.ops.fsetxattr((fsp)->conn->vfs_opaque.handles.fsetxattr,(fsp),(fd),(name),(value),(size),(flags)))
+#define SMB_VFS_OPAQUE_FSETXATTR(fsp,name,value,size,flags) ((fsp)->conn->vfs_opaque.ops.fsetxattr((fsp)->conn->vfs_opaque.handles.fsetxattr,(fsp),(name),(value),(size),(flags)))
 
 /* AIO operations. */
 #define SMB_VFS_OPAQUE_AIO_READ(fsp,aiocb) ((fsp)->conn->vfs_opaque.ops.aio_read((fsp)->conn->vfs_opaque.handles.aio_read,(fsp),(aiocb)))
 #define SMB_VFS_OPAQUE_AIO_WRITE(fsp,aiocb) ((fsp)->conn->vfs_opaque.ops.aio_write((fsp)->conn->vfs_opaque.handles.aio_write,(fsp),(aiocb)))
 #define SMB_VFS_OPAQUE_AIO_RETURN(fsp,aiocb) ((fsp)->conn->vfs_opaque.ops.aio_return_fn((fsp)->conn->vfs_opaque.handles.aio_return,(fsp),(aiocb)))
-#define SMB_VFS_OPAQUE_AIO_CANCEL(fsp,fd,aiocb) ((fsp)->conn->vfs_opaque.ops.aio_cancel((fsp)->conn->vfs_opaque.handles.cancel,(fsp),(fd),(aiocb)))
+#define SMB_VFS_OPAQUE_AIO_CANCEL(fsp,aiocb) ((fsp)->conn->vfs_opaque.ops.aio_cancel((fsp)->conn->vfs_opaque.handles.cancel,(fsp),(aiocb)))
 #define SMB_VFS_OPAQUE_AIO_ERROR(fsp,aiocb) ((fsp)->conn->vfs_opaque.ops.aio_error_fn((fsp)->conn->vfs_opaque.handles.aio_error,(fsp),(aiocb)))
 #define SMB_VFS_OPAQUE_AIO_FSYNC(fsp,op,aiocb) ((fsp)->conn->vfs_opaque.ops.aio_fsync((fsp)->conn->vfs_opaque.handles.aio_fsync,(fsp),(op),(aiocb)))
 #define SMB_VFS_OPAQUE_AIO_SUSPEND(fsp,aiocb,n,ts) ((fsp)->conn->vfs_opaque.ops.aio_suspend((fsp)->conn->vfs_opaque.handles.aio_suspend,(fsp),(aiocb),(n),(ts)))
+#define SMB_VFS_OPAQUE_AIO_FORCE(fsp) ((fsp)->conn->vfs_opaque.ops.aio_force((fsp)->conn->vfs_opaque.handles.aio_force,(fsp)))
+
+/* Offline operations */
+#define SMB_VFS_OPAQUE_IS_OFFLINE(conn,path,sbuf) ((conn)->vfs_opaque.ops.is_offline((conn)->vfs_opaque.handles.is_offline,(path),(sbuf)))
+#define SMB_VFS_OPAQUE_SET_OFFLINE(conn,path) ((conn)->vfs_opaque.ops.set_offline((conn)->vfs_opaque.handles.set_offline,(path)))
 
 /*******************************************************************
  Don't access handle->vfs_next.ops.* directly!!!
  (Fixes should go also into the vfs_* and vfs_opaque_* macros!)
 ********************************************************************/
 
-/* Disk operations */    
+/* Disk operations */
 #define SMB_VFS_NEXT_CONNECT(handle, service, user) ((handle)->vfs_next.ops.connect_fn((handle)->vfs_next.handles.connect_hnd, (service), (user)))
 #define SMB_VFS_NEXT_DISCONNECT(handle) ((handle)->vfs_next.ops.disconnect((handle)->vfs_next.handles.disconnect))
 #define SMB_VFS_NEXT_DISK_FREE(handle, path, small_query, bsize, dfree ,dsize) ((handle)->vfs_next.ops.disk_free((handle)->vfs_next.handles.disk_free, (path), (small_query), (bsize), (dfree), (dsize)))
 #define SMB_VFS_NEXT_SET_QUOTA(handle, qtype, id, qt) ((handle)->vfs_next.ops.set_quota((handle)->vfs_next.handles.set_quota, (qtype), (id), (qt)))
 #define SMB_VFS_NEXT_GET_SHADOW_COPY_DATA(handle, fsp, shadow_copy_data ,labels) ((handle)->vfs_next.ops.get_shadow_copy_data((handle)->vfs_next.handles.get_shadow_copy_data,(fsp),(shadow_copy_data),(labels)))
 #define SMB_VFS_NEXT_STATVFS(handle, path, statbuf) ((handle)->vfs_next.ops.statvfs((handle)->vfs_next.handles.statvfs, (path), (statbuf)))
+#define SMB_VFS_NEXT_FS_CAPABILITIES(handle) ((handle)->vfs_next.ops.fs_capabilities((handle)->vfs_next.handles.fs_capabilities))
 
 /* Directory operations */
 #define SMB_VFS_NEXT_OPENDIR(handle, fname, mask, attr) ((handle)->vfs_next.ops.opendir((handle)->vfs_next.handles.opendir, (fname), (mask), (attr)))
 #define SMB_VFS_NEXT_MKDIR(handle, path, mode) ((handle)->vfs_next.ops.mkdir((handle)->vfs_next.handles.mkdir,(path), (mode)))
 #define SMB_VFS_NEXT_RMDIR(handle, path) ((handle)->vfs_next.ops.rmdir((handle)->vfs_next.handles.rmdir, (path)))
 #define SMB_VFS_NEXT_CLOSEDIR(handle, dir) ((handle)->vfs_next.ops.closedir((handle)->vfs_next.handles.closedir, dir))
-    
+
 /* File operations */
 #define SMB_VFS_NEXT_OPEN(handle, fname, fsp, flags, mode) (((handle)->vfs_next.ops.open)((handle)->vfs_next.handles.open, (fname), (fsp), (flags), (mode)))
 #define SMB_VFS_NEXT_CLOSE(handle, fsp, fd) ((handle)->vfs_next.ops.close_fn((handle)->vfs_next.handles.close_hnd, (fsp), (fd)))
-#define SMB_VFS_NEXT_READ(handle, fsp, fd, data, n) ((handle)->vfs_next.ops.read((handle)->vfs_next.handles.read, (fsp), (fd), (data), (n)))
-#define SMB_VFS_NEXT_PREAD(handle, fsp, fd, data, n, off) ((handle)->vfs_next.ops.pread((handle)->vfs_next.handles.pread, (fsp), (fd), (data), (n), (off)))
-#define SMB_VFS_NEXT_WRITE(handle, fsp, fd, data, n) ((handle)->vfs_next.ops.write((handle)->vfs_next.handles.write, (fsp), (fd), (data), (n)))
-#define SMB_VFS_NEXT_PWRITE(handle, fsp, fd, data, n, off) ((handle)->vfs_next.ops.pwrite((handle)->vfs_next.handles.pwrite, (fsp), (fd), (data), (n), (off)))
-#define SMB_VFS_NEXT_LSEEK(handle, fsp, fd, offset, whence) ((handle)->vfs_next.ops.lseek((handle)->vfs_next.handles.lseek, (fsp), (fd), (offset), (whence)))
-#define SMB_VFS_NEXT_SENDFILE(handle, tofd, fsp, fromfd, header, offset, count) ((handle)->vfs_next.ops.sendfile((handle)->vfs_next.handles.sendfile, (tofd), (fsp), (fromfd), (header), (offset), (count)))
-#define SMB_VFS_NEXT_RECVFILE(handle, fromfd, fsp, tofd, offset, count) ((handle)->vfs_next.ops.recvfile((handle)->vfs_next.handles.recvfile, (fromfd), (fsp), (tofd), (offset), (count)))
+#define SMB_VFS_NEXT_READ(handle, fsp, data, n) ((handle)->vfs_next.ops.read((handle)->vfs_next.handles.read, (fsp), (data), (n)))
+#define SMB_VFS_NEXT_PREAD(handle, fsp, data, n, off) ((handle)->vfs_next.ops.pread((handle)->vfs_next.handles.pread, (fsp), (data), (n), (off)))
+#define SMB_VFS_NEXT_WRITE(handle, fsp, data, n) ((handle)->vfs_next.ops.write((handle)->vfs_next.handles.write, (fsp), (data), (n)))
+#define SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, off) ((handle)->vfs_next.ops.pwrite((handle)->vfs_next.handles.pwrite, (fsp), (data), (n), (off)))
+#define SMB_VFS_NEXT_LSEEK(handle, fsp, offset, whence) ((handle)->vfs_next.ops.lseek((handle)->vfs_next.handles.lseek, (fsp), (offset), (whence)))
+#define SMB_VFS_NEXT_SENDFILE(handle, tofd, fromfsp, header, offset, count) ((handle)->vfs_next.ops.sendfile((handle)->vfs_next.handles.sendfile, (tofd), (fromfsp), (header), (offset), (count)))
+#define SMB_VFS_NEXT_RECVFILE(handle, fromfd, tofsp, offset, count) ((handle)->vfs_next.ops.recvfile((handle)->vfs_next.handles.recvfile, (fromfd), (tofsp), (offset), (count)))
 #define SMB_VFS_NEXT_RENAME(handle, old, new) ((handle)->vfs_next.ops.rename((handle)->vfs_next.handles.rename, (old), (new)))
-#define SMB_VFS_NEXT_FSYNC(handle, fsp, fd) ((handle)->vfs_next.ops.fsync((handle)->vfs_next.handles.fsync, (fsp), (fd)))
+#define SMB_VFS_NEXT_FSYNC(handle, fsp) ((handle)->vfs_next.ops.fsync((handle)->vfs_next.handles.fsync, (fsp)))
 #define SMB_VFS_NEXT_STAT(handle, fname, sbuf) ((handle)->vfs_next.ops.stat((handle)->vfs_next.handles.stat, (fname), (sbuf)))
-#define SMB_VFS_NEXT_FSTAT(handle, fsp, fd, sbuf) ((handle)->vfs_next.ops.fstat((handle)->vfs_next.handles.fstat, (fsp) ,(fd) ,(sbuf)))
+#define SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf) ((handle)->vfs_next.ops.fstat((handle)->vfs_next.handles.fstat, (fsp), (sbuf)))
 #define SMB_VFS_NEXT_LSTAT(handle, path, sbuf) ((handle)->vfs_next.ops.lstat((handle)->vfs_next.handles.lstat, (path), (sbuf)))
 #define SMB_VFS_NEXT_UNLINK(handle, path) ((handle)->vfs_next.ops.unlink((handle)->vfs_next.handles.unlink, (path)))
 #define SMB_VFS_NEXT_CHMOD(handle, path, mode) ((handle)->vfs_next.ops.chmod((handle)->vfs_next.handles.chmod, (path), (mode)))
-#define SMB_VFS_NEXT_FCHMOD(handle, fsp, fd, mode) ((handle)->vfs_next.ops.fchmod((handle)->vfs_next.handles.fchmod, (fsp), (fd), (mode)))
+#define SMB_VFS_NEXT_FCHMOD(handle, fsp, mode) ((handle)->vfs_next.ops.fchmod((handle)->vfs_next.handles.fchmod, (fsp), (mode)))
 #define SMB_VFS_NEXT_CHOWN(handle, path, uid, gid) ((handle)->vfs_next.ops.chown((handle)->vfs_next.handles.chown, (path), (uid), (gid)))
-#define SMB_VFS_NEXT_FCHOWN(handle, fsp, fd, uid, gid) ((handle)->vfs_next.ops.fchown((handle)->vfs_next.handles.fchown, (fsp), (fd), (uid), (gid)))
+#define SMB_VFS_NEXT_FCHOWN(handle, fsp, uid, gid) ((handle)->vfs_next.ops.fchown((handle)->vfs_next.handles.fchown, (fsp), (uid), (gid)))
 #define SMB_VFS_NEXT_LCHOWN(handle, path, uid, gid) ((handle)->vfs_next.ops.lchown((handle)->vfs_next.handles.lchown, (path), (uid), (gid)))
 #define SMB_VFS_NEXT_CHDIR(handle, path) ((handle)->vfs_next.ops.chdir((handle)->vfs_next.handles.chdir, (path)))
 #define SMB_VFS_NEXT_GETWD(handle, buf) ((handle)->vfs_next.ops.getwd((handle)->vfs_next.handles.getwd, (buf)))
 #define SMB_VFS_NEXT_NTIMES(handle, path, ts) ((handle)->vfs_next.ops.ntimes((handle)->vfs_next.handles.ntimes, (path), (ts)))
-#define SMB_VFS_NEXT_FTRUNCATE(handle, fsp, fd, offset) ((handle)->vfs_next.ops.ftruncate((handle)->vfs_next.handles.ftruncate, (fsp), (fd), (offset)))
-#define SMB_VFS_NEXT_LOCK(handle, fsp, fd, op, offset, count, type) ((handle)->vfs_next.ops.lock((handle)->vfs_next.handles.lock, (fsp), (fd) ,(op), (offset), (count), (type)))
-#define SMB_VFS_NEXT_KERNEL_FLOCK(handle, fsp, fd, share_mode)((handle)->vfs_next.ops.kernel_flock((handle)->vfs_next.handles.kernel_flock, (fsp), (fd), (share_mode)))
-#define SMB_VFS_NEXT_LINUX_SETLEASE(handle, fsp, fd, leasetype)((handle)->vfs_next.ops.linux_setlease((handle)->vfs_next.handles.linux_setlease, (fsp), (fd), (leasetype)))
-#define SMB_VFS_NEXT_GETLOCK(handle, fsp, fd, poffset, pcount, ptype, ppid) ((handle)->vfs_next.ops.getlock((handle)->vfs_next.handles.getlock, (fsp), (fd), (poffset), (pcount), (ptype), (ppid)))
+#define SMB_VFS_NEXT_FTRUNCATE(handle, fsp, offset) ((handle)->vfs_next.ops.ftruncate((handle)->vfs_next.handles.ftruncate, (fsp), (offset)))
+#define SMB_VFS_NEXT_LOCK(handle, fsp, op, offset, count, type) ((handle)->vfs_next.ops.lock((handle)->vfs_next.handles.lock, (fsp), (op), (offset), (count), (type)))
+#define SMB_VFS_NEXT_KERNEL_FLOCK(handle, fsp, share_mode)((handle)->vfs_next.ops.kernel_flock((handle)->vfs_next.handles.kernel_flock, (fsp), (share_mode)))
+#define SMB_VFS_NEXT_LINUX_SETLEASE(handle, fsp, leasetype)((handle)->vfs_next.ops.linux_setlease((handle)->vfs_next.handles.linux_setlease, (fsp), (leasetype)))
+#define SMB_VFS_NEXT_GETLOCK(handle, fsp, poffset, pcount, ptype, ppid) ((handle)->vfs_next.ops.getlock((handle)->vfs_next.handles.getlock, (fsp), (poffset), (pcount), (ptype), (ppid)))
 #define SMB_VFS_NEXT_SYMLINK(handle, oldpath, newpath) ((handle)->vfs_next.ops.symlink((handle)->vfs_next.handles.symlink, (oldpath), (newpath)))
 #define SMB_VFS_NEXT_READLINK(handle, path, buf, bufsiz) ((handle)->vfs_next.ops.readlink((handle)->vfs_next.handles.readlink, (path), (buf), (bufsiz)))
 #define SMB_VFS_NEXT_LINK(handle, oldpath, newpath) ((handle)->vfs_next.ops.link((handle)->vfs_next.handles.link, (oldpath), (newpath)))
 #define SMB_VFS_NEXT_NOTIFY_WATCH(conn, ctx, e, callback, private_data, handle_p) ((conn)->vfs_next.ops.notify_watch((conn)->vfs_next.handles.notify_watch, (ctx), (e), (callback), (private_data), (handle_p)))
 #define SMB_VFS_NEXT_CHFLAGS(handle, path, flags) ((handle)->vfs_next.ops.chflags((handle)->vfs_next.handles.chflags, (path), (flags)))
 #define SMB_VFS_NEXT_FILE_ID_CREATE(handle, dev, inode) ((handle)->vfs_next.ops.file_id_create((handle)->vfs_next.handles.file_id_create, (dev), (inode)))
+#define SMB_VFS_NEXT_STREAMINFO(handle, fsp, fname, mem_ctx, num_streams, streams) ((handle)->vfs.ops.streaminfo((handle)->vfs.handles.streaminfo, (fsp), (fname), (mem_ctx), (num_streams), (streams)))
 
 /* NT ACL operations. */
-#define SMB_VFS_NEXT_FGET_NT_ACL(handle, fsp, fd, security_info, ppdesc) ((handle)->vfs_next.ops.fget_nt_acl((handle)->vfs_next.handles.fget_nt_acl, (fsp), (fd), (security_info), (ppdesc)))
-#define SMB_VFS_NEXT_GET_NT_ACL(handle, fsp, name, security_info, ppdesc) ((handle)->vfs_next.ops.get_nt_acl((handle)->vfs_next.handles.get_nt_acl, (fsp), (name), (security_info), (ppdesc)))
-#define SMB_VFS_NEXT_FSET_NT_ACL(handle, fsp, fd, security_info_sent, psd) ((handle)->vfs_next.ops.fset_nt_acl((handle)->vfs_next.handles.fset_nt_acl, (fsp), (fd), (security_info_sent), (psd)))
+#define SMB_VFS_NEXT_FGET_NT_ACL(handle, fsp, security_info, ppdesc) ((handle)->vfs_next.ops.fget_nt_acl((handle)->vfs_next.handles.fget_nt_acl, (fsp), (security_info), (ppdesc)))
+#define SMB_VFS_NEXT_GET_NT_ACL(handle, name, security_info, ppdesc) ((handle)->vfs_next.ops.get_nt_acl((handle)->vfs_next.handles.get_nt_acl, (name), (security_info), (ppdesc)))
+#define SMB_VFS_NEXT_FSET_NT_ACL(handle, fsp, security_info_sent, psd) ((handle)->vfs_next.ops.fset_nt_acl((handle)->vfs_next.handles.fset_nt_acl, (fsp), (security_info_sent), (psd)))
 #define SMB_VFS_NEXT_SET_NT_ACL(handle, fsp, name, security_info_sent, psd) ((handle)->vfs_next.ops.set_nt_acl((handle)->vfs_next.handles.set_nt_acl, (fsp), (name), (security_info_sent), (psd)))
 
 /* POSIX ACL operations. */
 #define SMB_VFS_NEXT_CHMOD_ACL(handle, name, mode) ((handle)->vfs_next.ops.chmod_acl((handle)->vfs_next.handles.chmod_acl, (name), (mode)))
-#define SMB_VFS_NEXT_FCHMOD_ACL(handle, fsp, fd, mode) ((handle)->vfs_next.ops.fchmod_acl((handle)->vfs_next.handles.chmod_acl, (fsp), (fd), (mode)))
+#define SMB_VFS_NEXT_FCHMOD_ACL(handle, fsp, mode) ((handle)->vfs_next.ops.fchmod_acl((handle)->vfs_next.handles.chmod_acl, (fsp), (mode)))
 
 #define SMB_VFS_NEXT_SYS_ACL_GET_ENTRY(handle, theacl, entry_id, entry_p) ((handle)->vfs_next.ops.sys_acl_get_entry((handle)->vfs_next.handles.sys_acl_get_entry, (theacl), (entry_id), (entry_p)))
 #define SMB_VFS_NEXT_SYS_ACL_GET_TAG_TYPE(handle, entry_d, tag_type_p) ((handle)->vfs_next.ops.sys_acl_get_tag_type((handle)->vfs_next.handles.sys_acl_get_tag_type, (entry_d), (tag_type_p)))
 #define SMB_VFS_NEXT_SYS_ACL_GET_PERMSET(handle, entry_d, permset_p) ((handle)->vfs_next.ops.sys_acl_get_permset((handle)->vfs_next.handles.sys_acl_get_permset, (entry_d), (permset_p)))
 #define SMB_VFS_NEXT_SYS_ACL_GET_QUALIFIER(handle, entry_d) ((handle)->vfs_next.ops.sys_acl_get_qualifier((handle)->vfs_next.handles.sys_acl_get_qualifier, (entry_d)))
 #define SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, path_p, type) ((handle)->vfs_next.ops.sys_acl_get_file((handle)->vfs_next.handles.sys_acl_get_file, (path_p), (type)))
-#define SMB_VFS_NEXT_SYS_ACL_GET_FD(handle, fsp, fd) ((handle)->vfs_next.ops.sys_acl_get_fd((handle)->vfs_next.handles.sys_acl_get_fd, (fsp), (fd)))
+#define SMB_VFS_NEXT_SYS_ACL_GET_FD(handle, fsp) ((handle)->vfs_next.ops.sys_acl_get_fd((handle)->vfs_next.handles.sys_acl_get_fd, (fsp)))
 #define SMB_VFS_NEXT_SYS_ACL_CLEAR_PERMS(handle, permset) ((handle)->vfs_next.ops.sys_acl_clear_perms((handle)->vfs_next.handles.sys_acl_clear_perms, (permset)))
 #define SMB_VFS_NEXT_SYS_ACL_ADD_PERM(handle, permset, perm) ((handle)->vfs_next.ops.sys_acl_add_perm((handle)->vfs_next.handles.sys_acl_add_perm, (permset), (perm)))
 #define SMB_VFS_NEXT_SYS_ACL_TO_TEXT(handle, theacl, plen) ((handle)->vfs_next.ops.sys_acl_to_text((handle)->vfs_next.handles.sys_acl_to_text, (theacl), (plen)))
 #define SMB_VFS_NEXT_SYS_ACL_SET_PERMSET(handle, entry, permset) ((handle)->vfs_next.ops.sys_acl_set_permset((handle)->vfs_next.handles.sys_acl_set_permset, (entry), (permset)))
 #define SMB_VFS_NEXT_SYS_ACL_VALID(handle, theacl) ((handle)->vfs_next.ops.sys_acl_valid((handle)->vfs_next.handles.sys_acl_valid, (theacl)))
 #define SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, name, acltype, theacl) ((handle)->vfs_next.ops.sys_acl_set_file((handle)->vfs_next.handles.sys_acl_set_file, (name), (acltype), (theacl)))
-#define SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, fd, theacl) ((handle)->vfs_next.ops.sys_acl_set_fd((handle)->vfs_next.handles.sys_acl_set_fd, (fsp), (fd), (theacl)))
+#define SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, theacl) ((handle)->vfs_next.ops.sys_acl_set_fd((handle)->vfs_next.handles.sys_acl_set_fd, (fsp), (theacl)))
 #define SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle, path) ((handle)->vfs_next.ops.sys_acl_delete_def_file((handle)->vfs_next.handles.sys_acl_delete_def_file, (path)))
 #define SMB_VFS_NEXT_SYS_ACL_GET_PERM(handle, permset, perm) ((handle)->vfs_next.ops.sys_acl_get_perm((handle)->vfs_next.handles.sys_acl_get_perm, (permset), (perm)))
 #define SMB_VFS_NEXT_SYS_ACL_FREE_TEXT(handle, text) ((handle)->vfs_next.ops.sys_acl_free_text((handle)->vfs_next.handles.sys_acl_free_text, (text)))
 /* EA operations. */
 #define SMB_VFS_NEXT_GETXATTR(handle,path,name,value,size) ((handle)->vfs_next.ops.getxattr((handle)->vfs_next.handles.getxattr,(path),(name),(value),(size)))
 #define SMB_VFS_NEXT_LGETXATTR(handle,path,name,value,size) ((handle)->vfs_next.ops.lgetxattr((handle)->vfs_next.handles.lgetxattr,(path),(name),(value),(size)))
-#define SMB_VFS_NEXT_FGETXATTR(handle,fsp,fd,name,value,size) ((handle)->vfs_next.ops.fgetxattr((handle)->vfs_next.handles.fgetxattr,(fsp),(fd),(name),(value),(size)))
+#define SMB_VFS_NEXT_FGETXATTR(handle,fsp,name,value,size) ((handle)->vfs_next.ops.fgetxattr((handle)->vfs_next.handles.fgetxattr,(fsp),(name),(value),(size)))
 #define SMB_VFS_NEXT_LISTXATTR(handle,path,list,size) ((handle)->vfs_next.ops.listxattr((handle)->vfs_next.handles.listxattr,(path),(list),(size)))
 #define SMB_VFS_NEXT_LLISTXATTR(handle,path,list,size) ((handle)->vfs_next.ops.llistxattr((handle)->vfs_next.handles.llistxattr,(path),(list),(size)))
-#define SMB_VFS_NEXT_FLISTXATTR(handle,fsp,fd,list,size) ((handle)->vfs_next.ops.flistxattr((handle)->vfs_next.handles.flistxattr,(fsp),(fd),(list),(size)))
+#define SMB_VFS_NEXT_FLISTXATTR(handle,fsp,list,size) ((handle)->vfs_next.ops.flistxattr((handle)->vfs_next.handles.flistxattr,(fsp),(list),(size)))
 #define SMB_VFS_NEXT_REMOVEXATTR(handle,path,name) ((handle)->vfs_next.ops.removexattr((handle)->vfs_next.handles.removexattr,(path),(name)))
 #define SMB_VFS_NEXT_LREMOVEXATTR(handle,path,name) ((handle)->vfs_next.ops.lremovexattr((handle)->vfs_next.handles.lremovexattr,(path),(name)))
-#define SMB_VFS_NEXT_FREMOVEXATTR(handle,fsp,fd,name) ((handle)->vfs_next.ops.fremovexattr((handle)->vfs_next.handles.fremovexattr,(fsp),(fd),(name)))
+#define SMB_VFS_NEXT_FREMOVEXATTR(handle,fsp,name) ((handle)->vfs_next.ops.fremovexattr((handle)->vfs_next.handles.fremovexattr,(fsp),(name)))
 #define SMB_VFS_NEXT_SETXATTR(handle,path,name,value,size,flags) ((handle)->vfs_next.ops.setxattr((handle)->vfs_next.handles.setxattr,(path),(name),(value),(size),(flags)))
 #define SMB_VFS_NEXT_LSETXATTR(handle,path,name,value,size,flags) ((handle)->vfs_next.ops.lsetxattr((handle)->vfs_next.handles.lsetxattr,(path),(name),(value),(size),(flags)))
-#define SMB_VFS_NEXT_FSETXATTR(handle,fsp,fd,name,value,size,flags) ((handle)->vfs_next.ops.fsetxattr((handle)->vfs_next.handles.fsetxattr,(fsp),(fd),(name),(value),(size),(flags)))
+#define SMB_VFS_NEXT_FSETXATTR(handle,fsp,name,value,size,flags) ((handle)->vfs_next.ops.fsetxattr((handle)->vfs_next.handles.fsetxattr,(fsp),(name),(value),(size),(flags)))
 
 /* AIO operations. */
 #define SMB_VFS_NEXT_AIO_READ(handle,fsp,aiocb) ((handle)->vfs_next.ops.aio_read((handle)->vfs_next.handles.aio_read,(fsp),(aiocb)))
 #define SMB_VFS_NEXT_AIO_WRITE(handle,fsp,aiocb) ((handle)->vfs_next.ops.aio_write((handle)->vfs_next.handles.aio_write,(fsp),(aiocb)))
 #define SMB_VFS_NEXT_AIO_RETURN(handle,fsp,aiocb) ((handle)->vfs_next.ops.aio_return_fn((handle)->vfs_next.handles.aio_return,(fsp),(aiocb)))
-#define SMB_VFS_NEXT_AIO_CANCEL(handle,fsp,fd,aiocb) ((handle)->vfs_next.ops.aio_cancel((handle)->vfs_next.handles.aio_cancel,(fsp),(fd),(aiocb)))
+#define SMB_VFS_NEXT_AIO_CANCEL(handle,fsp,aiocb) ((handle)->vfs_next.ops.aio_cancel((handle)->vfs_next.handles.aio_cancel,(fsp),(aiocb)))
 #define SMB_VFS_NEXT_AIO_ERROR(handle,fsp,aiocb) ((handle)->vfs_next.ops.aio_error_fn((handle)->vfs_next.handles.aio_error,(fsp),(aiocb)))
 #define SMB_VFS_NEXT_AIO_FSYNC(handle,fsp,op,aiocb) ((handle)->vfs_next.ops.aio_fsync((handle)->vfs_next.handles.aio_fsync,(fsp),(op),(aiocb)))
 #define SMB_VFS_NEXT_AIO_SUSPEND(handle,fsp,aiocb,n,ts) ((handle)->vfs_next.ops.aio_suspend((handle)->vfs_next.handles.aio_suspend,(fsp),(aiocb),(n),(ts)))
+#define SMB_VFS_NEXT_AIO_FORCE(handle,fsp) ((handle)->vfs_next.ops.aio_force((handle)->vfs_next.handles.aio_force,(fsp)))
+
+/* Offline operations */
+#define SMB_VFS_NEXT_IS_OFFLINE(handle,path,sbuf) ((handle)->vfs_next.ops.is_offline((handle)->vfs_next.handles.is_offline,(path),(sbuf)))
+#define SMB_VFS_NEXT_SET_OFFLINE(handle,path) ((handle)->vfs_next.ops.set_offline((handle)->vfs_next.handles.set_offline,(path)))
 
 #endif /* _VFS_MACROS_H */
index 1e4df83607912d8627b8582e6ed52a4087771d82..6a463446d1a0ae926a5d828b96d8aba239109c8b 100644 (file)
@@ -97,13 +97,29 @@ static bool string_match(const char *tok,const char *s)
                }
        } else if (tok[0] == '@') { /* netgroup: look it up */
 #ifdef HAVE_NETGROUP
-               static char *mydomain = NULL;
+               DATA_BLOB tmp;
+               char *mydomain = NULL;
                char *hostname = NULL;
                bool netgroup_ok = false;
 
-               if (!mydomain)
+               if (memcache_lookup(
+                           NULL, SINGLETON_CACHE,
+                           data_blob_string_const("yp_default_domain"),
+                           &tmp)) {
+
+                       SMB_ASSERT(tmp.length > 0);
+                       mydomain = (tmp.data[0] == '\0')
+                               ? NULL : (char *)tmp.data;
+               }
+               else {
                        yp_get_default_domain(&mydomain);
 
+                       memcache_add(
+                               NULL, SINGLETON_CACHE,
+                               data_blob_string_const("yp_default_domain"),
+                               data_blob_string_const(mydomain?mydomain:""));
+               }
+
                if (!mydomain) {
                        DEBUG(0,("Unable to get default yp domain. "
                                "Try without it.\n"));
index a7d6f6c9f7fecd6df62aa8be1a4e3099a5120a82..9f5d81f44280cf39a6027facb3a781e62c1568a0 100644 (file)
@@ -42,20 +42,23 @@ static char *afs_encode_token(const char *cell, const DATA_BLOB ticket,
                              const struct ClearToken *ct)
 {
        char *base64_ticket;
-       char *result;
+       char *result = NULL;
 
        DATA_BLOB key = data_blob(ct->HandShakeKey, 8);
        char *base64_key;
+       TALLOC_CTX *mem_ctx;
+
+       mem_ctx = talloc_stackframe();
+       if (mem_ctx == NULL)
+               goto done;
 
-       base64_ticket = base64_encode_data_blob(ticket);
+       base64_ticket = base64_encode_data_blob(mem_ctx, ticket);
        if (base64_ticket == NULL)
-               return NULL;
+               goto done;
 
-       base64_key = base64_encode_data_blob(key);
-       if (base64_key == NULL) {
-               TALLOC_FREE(base64_ticket);
-               return NULL;
-       }
+       base64_key = base64_encode_data_blob(mem_ctx, key);
+       if (base64_key == NULL)
+               goto done;
 
        asprintf(&result, "%s\n%u\n%s\n%u\n%u\n%u\n%s\n", cell,
                 ct->AuthHandle, base64_key, ct->ViceId, ct->BeginTimestamp,
@@ -63,8 +66,8 @@ static char *afs_encode_token(const char *cell, const DATA_BLOB ticket,
 
        DEBUG(10, ("Got ticket string:\n%s\n", result));
 
-       TALLOC_FREE(base64_ticket);
-       TALLOC_FREE(base64_key);
+done:
+       TALLOC_FREE(mem_ctx);
 
        return result;
 }
index aeef1c35203da77bb8cdc75d0e67c66a6fbe8d20..444f09efca09edaa6c064bbe0db26eaf177e1dac 100644 (file)
@@ -53,20 +53,21 @@ static bool afs_decode_token(const char *string, char **cell,
 {
        DATA_BLOB blob;
        struct ClearToken result_ct;
+       char *saveptr;
 
        char *s = SMB_STRDUP(string);
 
        char *t;
 
-       if ((t = strtok(s, "\n")) == NULL) {
-               DEBUG(10, ("strtok failed\n"));
+       if ((t = strtok_r(s, "\n", &saveptr)) == NULL) {
+               DEBUG(10, ("strtok_r failed\n"));
                return False;
        }
 
        *cell = SMB_STRDUP(t);
 
-       if ((t = strtok(NULL, "\n")) == NULL) {
-               DEBUG(10, ("strtok failed\n"));
+       if ((t = strtok_r(NULL, "\n", &saveptr)) == NULL) {
+               DEBUG(10, ("strtok_r failed\n"));
                return False;
        }
 
@@ -75,8 +76,8 @@ static bool afs_decode_token(const char *string, char **cell,
                return False;
        }
                
-       if ((t = strtok(NULL, "\n")) == NULL) {
-               DEBUG(10, ("strtok failed\n"));
+       if ((t = strtok_r(NULL, "\n", &saveptr)) == NULL) {
+               DEBUG(10, ("strtok_r failed\n"));
                return False;
        }
 
@@ -93,8 +94,8 @@ static bool afs_decode_token(const char *string, char **cell,
 
        data_blob_free(&blob);
 
-       if ((t = strtok(NULL, "\n")) == NULL) {
-               DEBUG(10, ("strtok failed\n"));
+       if ((t = strtok_r(NULL, "\n", &saveptr)) == NULL) {
+               DEBUG(10, ("strtok_r failed\n"));
                return False;
        }
 
@@ -103,8 +104,8 @@ static bool afs_decode_token(const char *string, char **cell,
                return False;
        }
                
-       if ((t = strtok(NULL, "\n")) == NULL) {
-               DEBUG(10, ("strtok failed\n"));
+       if ((t = strtok_r(NULL, "\n", &saveptr)) == NULL) {
+               DEBUG(10, ("strtok_r failed\n"));
                return False;
        }
 
@@ -113,8 +114,8 @@ static bool afs_decode_token(const char *string, char **cell,
                return False;
        }
                
-       if ((t = strtok(NULL, "\n")) == NULL) {
-               DEBUG(10, ("strtok failed\n"));
+       if ((t = strtok_r(NULL, "\n", &saveptr)) == NULL) {
+               DEBUG(10, ("strtok_r failed\n"));
                return False;
        }
 
@@ -123,8 +124,8 @@ static bool afs_decode_token(const char *string, char **cell,
                return False;
        }
                
-       if ((t = strtok(NULL, "\n")) == NULL) {
-               DEBUG(10, ("strtok failed\n"));
+       if ((t = strtok_r(NULL, "\n", &saveptr)) == NULL) {
+               DEBUG(10, ("strtok_r failed\n"));
                return False;
        }
 
index 8a00b235ccc10c99eac953afed06d22ee47ff666..eeff80545905587e530adf431cb96be000c81c73 100644 (file)
@@ -614,10 +614,16 @@ size_t convert_string_allocate(TALLOC_CTX *ctx, charset_t from, charset_t to,
   out:
 
        destlen = destlen - o_len;
-       if (ctx) {
-               ob = (char *)TALLOC_REALLOC(ctx,ob,destlen);
-       } else {
-               ob = (char *)SMB_REALLOC(ob,destlen);
+       /* Don't shrink unless we're reclaiming a lot of
+        * space. This is in the hot codepath and these
+        * reallocs *cost*. JRA.
+        */
+       if (o_len > 1024) {
+               if (ctx) {
+                       ob = (char *)TALLOC_REALLOC(ctx,ob,destlen);
+               } else {
+                       ob = (char *)SMB_REALLOC(ob,destlen);
+               }
        }
 
        if (destlen && !ob) {
@@ -778,7 +784,7 @@ char *strdup_upper(const char *s)
        while (*p) {
                if (*p & 0x80)
                        break;
-               *q++ = toupper_ascii(*p);
+               *q++ = toupper_ascii_fast(*p);
                p++;
        }
 
@@ -844,7 +850,7 @@ char *talloc_strdup_upper(TALLOC_CTX *ctx, const char *s)
        while (*p) {
                if (*p & 0x80)
                        break;
-               *q++ = toupper_ascii(*p);
+               *q++ = toupper_ascii_fast(*p);
                p++;
        }
 
index dd0a354a85169564b01b5290bc23c55a4d84d08b..22d85c873d3399c1791c5af15df9a216ea97eb16 100644 (file)
@@ -34,7 +34,7 @@ static struct db_context *connections_db_ctx(bool rw)
        }
        else {
                db_ctx = db_open(NULL, lock_path("connections.tdb"), 0,
-                                TDB_DEFAULT, O_RDONLY, 0);
+                                TDB_CLEAR_IF_FIRST|TDB_DEFAULT, O_RDONLY, 0);
        }
 
        return db_ctx;
index 899bbcfcce6147f5db00ccd4b1f1a6c09787c270..18e9879601735466cbf575583477ee6adaf774bb 100644 (file)
@@ -1203,6 +1203,42 @@ NTSTATUS ctdbd_register_reconfigure(struct ctdbd_connection *conn)
        return register_with_ctdbd(conn, CTDB_SRVID_RECONFIGURE);
 }
 
+/*
+  persstent store. Used when we update a record in a persistent database
+ */
+NTSTATUS ctdbd_persistent_store(struct ctdbd_connection *conn, uint32_t db_id, TDB_DATA key, TDB_DATA data)
+{
+       int cstatus=0;
+       struct ctdb_rec_data *rec;
+       TDB_DATA recdata;
+       size_t length;
+       NTSTATUS status;
+
+       length = offsetof(struct ctdb_rec_data, data) + key.dsize + data.dsize;
+
+       rec = (struct ctdb_rec_data *)talloc_size(conn, length);
+       NT_STATUS_HAVE_NO_MEMORY(rec);
+
+       rec->length = length;
+       rec->reqid  = db_id;
+       rec->keylen = key.dsize;
+       rec->datalen= data.dsize;
+       memcpy(&rec->data[0], key.dptr, key.dsize);
+       memcpy(&rec->data[key.dsize], data.dptr, data.dsize);
+
+       recdata.dptr  = (uint8_t *)rec;
+       recdata.dsize = length;
+
+       status = ctdbd_control(conn, CTDB_CURRENT_NODE, 
+                              CTDB_CONTROL_PERSISTENT_STORE, 
+                              0, recdata, NULL, NULL, &cstatus);
+       if (cstatus != 0) {
+               return NT_STATUS_INTERNAL_DB_CORRUPTION;
+       }
+       return status;
+}
+
+
 #else
 
 NTSTATUS ctdbd_init_connection(TALLOC_CTX *mem_ctx,
index e64e6a19a1632b3cc23d2c9b06e47f537483abd1..8bbbc32d7b1d62d9481ef8bfc8a0b5fbca520f23 100644 (file)
@@ -128,7 +128,7 @@ DATA_BLOB data_blob_string_const(const char *str)
 {
        DATA_BLOB blob;
        blob.data = CONST_DISCARD(uint8 *, str);
-       blob.length = strlen(str);
+       blob.length = strlen(str) + 1;
        blob.free = NULL;
        return blob;
 }
index 4e16d1868235c8a594816799733808c9b21056eb..001424a6c0ffe598d5e7ca016d7a03fae79ba822 100644 (file)
@@ -20,7 +20,9 @@
 */
 
 #include "includes.h"
-
+#ifdef CLUSTER_SUPPORT
+#include "ctdb_private.h"
+#endif
 /*
  * Fall back using fetch_locked if no genuine fetch operation is provided
  */
@@ -46,10 +48,16 @@ struct db_context *db_open(TALLOC_CTX *mem_ctx,
                           int open_flags, mode_t mode)
 {
        struct db_context *result = NULL;
+#ifdef CLUSTER_SUPPORT
+       const char *sockname = lp_ctdbd_socket();
+#endif
 
 #ifdef CLUSTER_SUPPORT
+       if(!sockname || !*sockname) {
+               sockname = CTDB_PATH;
+       }
 
-       if (lp_clustering()) {
+       if (lp_clustering() && socket_exist(sockname)) {
                const char *partname;
                /* ctdb only wants the file part of the name */
                partname = strrchr(name, '/');
index 90d0b260c5409ea675250b0a1aa0736445bfef61..f497f871d2030e3483a0ce5be9b8945c2936808a 100644 (file)
 */
 
 #include "includes.h"
-
 #ifdef CLUSTER_SUPPORT
-
 #include "ctdb.h"
 #include "ctdb_private.h"
+#include "ctdbd_conn.h"
 
 struct db_ctdb_ctx {
        struct tdb_wrap *wtdb;
        uint32 db_id;
-       struct ctdbd_connection *conn;
 };
 
 struct db_ctdb_rec {
@@ -35,8 +33,6 @@ struct db_ctdb_rec {
        struct ctdb_ltdb_header header;
 };
 
-static struct ctdbd_connection *db_ctdbd_conn(struct db_ctdb_ctx *ctx);
-
 static NTSTATUS db_ctdb_store(struct db_record *rec, TDB_DATA data, int flag)
 {
        struct db_ctdb_rec *crec = talloc_get_type_abort(
@@ -60,6 +56,42 @@ static NTSTATUS db_ctdb_store(struct db_record *rec, TDB_DATA data, int flag)
        return (ret == 0) ? NT_STATUS_OK : NT_STATUS_INTERNAL_DB_CORRUPTION;
 }
 
+
+/* for persistent databases the store is a bit different. We have to
+   ask the ctdb daemon to push the record to all nodes after the
+   store */
+static NTSTATUS db_ctdb_store_persistent(struct db_record *rec, TDB_DATA data, int flag)
+{
+       struct db_ctdb_rec *crec = talloc_get_type_abort(
+               rec->private_data, struct db_ctdb_rec);
+       TDB_DATA cdata;
+       int ret;
+       NTSTATUS status;
+
+       cdata.dsize = sizeof(crec->header) + data.dsize;
+
+       if (!(cdata.dptr = SMB_MALLOC_ARRAY(uint8, cdata.dsize))) {
+               return NT_STATUS_NO_MEMORY;
+       }
+
+       crec->header.rsn++;
+
+       memcpy(cdata.dptr, &crec->header, sizeof(crec->header));
+       memcpy(cdata.dptr + sizeof(crec->header), data.dptr, data.dsize);
+
+       ret = tdb_store(crec->ctdb_ctx->wtdb->tdb, rec->key, cdata, TDB_REPLACE);
+       status = (ret == 0) ? NT_STATUS_OK : NT_STATUS_INTERNAL_DB_CORRUPTION;
+       
+       /* now tell ctdbd to update this record on all other nodes */
+       if (NT_STATUS_IS_OK(status)) {
+               status = ctdbd_persistent_store(messaging_ctdbd_connection(), crec->ctdb_ctx->db_id, rec->key, cdata);
+       }
+
+       SAFE_FREE(cdata.dptr);
+
+       return status;
+}
+
 static NTSTATUS db_ctdb_delete(struct db_record *rec)
 {
        struct db_ctdb_rec *crec = talloc_get_type_abort(
@@ -110,6 +142,7 @@ static struct db_record *db_ctdb_fetch_locked(struct db_context *db,
        struct db_ctdb_rec *crec;
        NTSTATUS status;
        TDB_DATA ctdb_data;
+       int migrate_attempts = 0;
 
        if (!(result = talloc(mem_ctx, struct db_record))) {
                DEBUG(0, ("talloc failed\n"));
@@ -153,7 +186,11 @@ again:
                return NULL;
        }
 
-       result->store = db_ctdb_store;
+       if (db->persistent) {
+               result->store = db_ctdb_store_persistent;
+       } else {
+               result->store = db_ctdb_store;
+       }
        result->delete_rec = db_ctdb_delete;
        talloc_set_destructor(result, db_ctdb_record_destr);
 
@@ -175,12 +212,14 @@ again:
                tdb_chainunlock(ctx->wtdb->tdb, key);
                talloc_set_destructor(result, NULL);
 
+               migrate_attempts += 1;
+
                DEBUG(10, ("ctdb_data.dptr = %p, dmaster = %u (%u)\n",
                           ctdb_data.dptr, ctdb_data.dptr ?
                           ((struct ctdb_ltdb_header *)ctdb_data.dptr)->dmaster : -1,
                           get_my_vnn()));
 
-               status = ctdbd_migrate(db_ctdbd_conn(ctx), ctx->db_id, key);
+               status = ctdbd_migrate(messaging_ctdbd_connection(),ctx->db_id, key);
                if (!NT_STATUS_IS_OK(status)) {
                        DEBUG(5, ("ctdb_migrate failed: %s\n",
                                  nt_errstr(status)));
@@ -191,6 +230,11 @@ again:
                goto again;
        }
 
+       if (migrate_attempts > 10) {
+               DEBUG(0, ("db_ctdb_fetch_locked needed %d attempts\n",
+                         migrate_attempts));
+       }
+
        memcpy(&crec->header, ctdb_data.dptr, sizeof(crec->header));
 
        result->value.dsize = ctdb_data.dsize - sizeof(crec->header);
@@ -226,10 +270,12 @@ static int db_ctdb_fetch(struct db_context *db, TALLOC_CTX *mem_ctx,
        /*
         * See if we have a valid record and we are the dmaster. If so, we can
         * take the shortcut and just return it.
+        * we bypass the dmaster check for persistent databases
         */
        if ((ctdb_data.dptr != NULL) &&
            (ctdb_data.dsize >= sizeof(struct ctdb_ltdb_header)) &&
-           ((struct ctdb_ltdb_header *)ctdb_data.dptr)->dmaster == get_my_vnn()) {
+           (db->persistent ||
+            ((struct ctdb_ltdb_header *)ctdb_data.dptr)->dmaster == get_my_vnn())) {
                /* we are the dmaster - avoid the ctdb protocol op */
 
                data->dsize = ctdb_data.dsize - sizeof(struct ctdb_ltdb_header);
@@ -254,8 +300,7 @@ static int db_ctdb_fetch(struct db_context *db, TALLOC_CTX *mem_ctx,
        SAFE_FREE(ctdb_data.dptr);
 
        /* we weren't able to get it locally - ask ctdb to fetch it for us */
-       status = ctdbd_fetch(db_ctdbd_conn(ctx), ctx->db_id, key, mem_ctx,
-                            data);
+       status = ctdbd_fetch(messaging_ctdbd_connection(),ctx->db_id, key, mem_ctx, data);
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(5, ("ctdbd_fetch failed: %s\n", nt_errstr(status)));
                return -1;
@@ -283,6 +328,22 @@ static void traverse_callback(TDB_DATA key, TDB_DATA data, void *private_data)
        talloc_free(tmp_ctx);
 }
 
+static int traverse_persistent_callback(TDB_CONTEXT *tdb, TDB_DATA kbuf, TDB_DATA dbuf,
+                                       void *private_data)
+{
+       struct traverse_state *state = (struct traverse_state *)private_data;
+       struct db_record *rec;
+       TALLOC_CTX *tmp_ctx = talloc_new(state->db);
+       int ret = 0;
+       /* we have to give them a locked record to prevent races */
+       rec = db_ctdb_fetch_locked(state->db, tmp_ctx, kbuf);
+       if (rec && rec->value.dsize > 0) {
+               ret = state->fn(rec, state->private_data);
+       }
+       talloc_free(tmp_ctx);
+       return ret;
+}
+
 static int db_ctdb_traverse(struct db_context *db,
                            int (*fn)(struct db_record *rec,
                                      void *private_data),
@@ -296,6 +357,13 @@ static int db_ctdb_traverse(struct db_context *db,
        state.fn = fn;
        state.private_data = private_data;
 
+       if (db->persistent) {
+               /* for persistent databases we don't need to do a ctdb traverse,
+                  we can do a faster local traverse */
+               return tdb_traverse(ctx->wtdb->tdb, traverse_persistent_callback, &state);
+       }
+
+
        ctdbd_traverse(ctx->db_id, traverse_callback, &state);
        return 0;
 }
@@ -322,6 +390,27 @@ static void traverse_read_callback(TDB_DATA key, TDB_DATA data, void *private_da
        state->fn(&rec, state->private_data);
 }
 
+static int traverse_persistent_callback_read(TDB_CONTEXT *tdb, TDB_DATA kbuf, TDB_DATA dbuf,
+                                       void *private_data)
+{
+       struct traverse_state *state = (struct traverse_state *)private_data;
+       struct db_record rec;
+       rec.key = kbuf;
+       rec.value = dbuf;
+       rec.store = db_ctdb_store_deny;
+       rec.delete_rec = db_ctdb_delete_deny;
+       rec.private_data = state->db;
+
+       if (rec.value.dsize <= sizeof(struct ctdb_ltdb_header)) {
+               /* a deleted record */
+               return 0;
+       }
+       rec.value.dsize -= sizeof(struct ctdb_ltdb_header);
+       rec.value.dptr += sizeof(struct ctdb_ltdb_header);
+
+       return state->fn(&rec, state->private_data);
+}
+
 static int db_ctdb_traverse_read(struct db_context *db,
                                 int (*fn)(struct db_record *rec,
                                           void *private_data),
@@ -335,6 +424,12 @@ static int db_ctdb_traverse_read(struct db_context *db,
        state.fn = fn;
        state.private_data = private_data;
 
+       if (db->persistent) {
+               /* for persistent databases we don't need to do a ctdb traverse,
+                  we can do a faster local traverse */
+               return tdb_traverse_read(ctx->wtdb->tdb, traverse_persistent_callback_read, &state);
+       }
+
        ctdbd_traverse(ctx->db_id, traverse_read_callback, &state);
        return 0;
 }
@@ -346,41 +441,6 @@ static int db_ctdb_get_seqnum(struct db_context *db)
        return tdb_get_seqnum(ctx->wtdb->tdb);
 }
 
-/*
- * Get the ctdbd connection for a database. If possible, re-use the messaging
- * ctdbd connection
- */
-static struct ctdbd_connection *db_ctdbd_conn(struct db_ctdb_ctx *ctx)
-{
-       struct ctdbd_connection *result;
-
-       result = messaging_ctdbd_connection();
-
-       if (result != NULL) {
-
-               if (ctx->conn == NULL) {
-                       /*
-                        * Someone has initialized messaging since we
-                        * initialized our own connection, we don't need it
-                        * anymore.
-                        */
-                       TALLOC_FREE(ctx->conn);
-               }
-
-               return result;
-       }
-
-       if (ctx->conn == NULL) {
-               NTSTATUS status;
-               status = ctdbd_init_connection(ctx, &ctx->conn);
-               if (!NT_STATUS_IS_OK(status)) {
-                       return NULL;
-               }
-               set_my_vnn(ctdbd_vnn(ctx->conn));
-       }
-
-       return ctx->conn;
-}
 
 struct db_context *db_open_ctdb(TALLOC_CTX *mem_ctx,
                                const char *name,
@@ -390,7 +450,6 @@ struct db_context *db_open_ctdb(TALLOC_CTX *mem_ctx,
        struct db_context *result;
        struct db_ctdb_ctx *db_ctdb;
        char *db_path;
-       NTSTATUS status;
 
        if (!lp_clustering()) {
                DEBUG(10, ("Clustering disabled -- no ctdb\n"));
@@ -409,20 +468,15 @@ struct db_context *db_open_ctdb(TALLOC_CTX *mem_ctx,
                return NULL;
        }
 
-       db_ctdb->conn = NULL;
-
-       status = ctdbd_db_attach(db_ctdbd_conn(db_ctdb), name,
-                                &db_ctdb->db_id, tdb_flags);
-
-       if (!NT_STATUS_IS_OK(status)) {
-               DEBUG(0, ("ctdbd_db_attach failed for %s: %s\n", name,
-                         nt_errstr(status)));
+       if (!NT_STATUS_IS_OK(ctdbd_db_attach(messaging_ctdbd_connection(),name, &db_ctdb->db_id, tdb_flags))) {
+               DEBUG(0, ("ctdbd_db_attach failed for %s\n", name));
                TALLOC_FREE(result);
                return NULL;
        }
 
-       db_path = ctdbd_dbpath(db_ctdbd_conn(db_ctdb), db_ctdb,
-                              db_ctdb->db_id);
+       db_path = ctdbd_dbpath(messaging_ctdbd_connection(), db_ctdb, db_ctdb->db_id);
+
+       result->persistent = ((tdb_flags & TDB_CLEAR_IF_FIRST) == 0);
 
        /* only pass through specific flags */
        tdb_flags &= TDB_SEQNUM;
@@ -447,16 +501,4 @@ struct db_context *db_open_ctdb(TALLOC_CTX *mem_ctx,
 
        return result;
 }
-
-#else
-
-struct db_context *db_open_ctdb(TALLOC_CTX *mem_ctx,
-                               const char *name,
-                               int hash_size, int tdb_flags,
-                               int open_flags, mode_t mode)
-{
-       DEBUG(0, ("no clustering compiled in\n"));
-       return NULL;
-}
-
 #endif
index 5b41f5941b05f95ad60c0dae7df54e175814c4cf..e3779de1e47effda998f93ba7b996cc0243a5f44 100644 (file)
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-/*
- * Be aware that this is just sample code that has not seen too much testing
- */
-
 #include "includes.h"
 
 struct db_file_ctx {
@@ -367,6 +363,7 @@ struct db_context *db_open_file(TALLOC_CTX *mem_ctx,
        result->fetch_locked = db_file_fetch_locked;
        result->traverse = db_file_traverse;
        result->traverse_read = db_file_traverse;
+       result->persistent = ((tdb_flags & TDB_CLEAR_IF_FIRST) == 0);
 
        ctx->locked_record = NULL;
        if (!(ctx->dirname = talloc_strdup(ctx, name))) {
index df568a04105c329e480d9d2ffc8fab35abf40f55..633b695b52f4916b6c606b199c88f5125ba8870d 100644 (file)
@@ -1,7 +1,7 @@
 /*
    Unix SMB/CIFS implementation.
    Database interface wrapper around red-black trees
-   Copyright (C) Volker Lendecke 2007
+   Copyright (C) Volker Lendecke 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
@@ -20,6 +20,8 @@
 #include "includes.h"
 #include "rbtree.h"
 
+#define ALIGN(_size_) (((_size_)+15)&~15)
+
 struct db_rbt_ctx {
        struct rb_root tree;
 };
@@ -43,6 +45,35 @@ struct db_rbt_node {
        char data[];
 };
 
+/*
+ * Hide the ugly pointer calculations in a function
+ */
+
+static struct db_rbt_node *db_rbt2node(struct rb_node *node)
+{
+       return (struct db_rbt_node *)
+               ((char *)node - offsetof(struct db_rbt_node, rb_node));
+}
+
+/*
+ * Compare two keys
+ */
+
+static int db_rbt_compare(TDB_DATA a, TDB_DATA b)
+{
+       int res;
+
+       res = memcmp(a.dptr, b.dptr, MIN(a.dsize, b.dsize));
+
+       if ((res < 0) || ((res == 0) && (a.dsize < b.dsize))) {
+               return -1;
+       }
+       if ((res > 0) || ((res == 0) && (a.dsize > b.dsize))) {
+               return 1;
+       }
+       return 0;
+}
+
 /*
  * dissect a db_rbt_node into its implicit key and value parts
  */
@@ -58,9 +89,7 @@ static void db_rbt_parse_node(struct db_rbt_node *node,
 
 static NTSTATUS db_rbt_store(struct db_record *rec, TDB_DATA data, int flag)
 {
-       struct db_rbt_rec *rec_priv = talloc_get_type_abort(
-               rec->private_data, struct db_rbt_rec);
-
+       struct db_rbt_rec *rec_priv = (struct db_rbt_rec *)rec->private_data;
        struct db_rbt_node *node;
 
        struct rb_node ** p;
@@ -95,7 +124,11 @@ static NTSTATUS db_rbt_store(struct db_record *rec, TDB_DATA data, int flag)
                 */
 
                rb_erase(&rec_priv->node->rb_node, &rec_priv->db_ctx->tree);
-               SAFE_FREE(rec_priv->node);
+
+               /*
+                * Keep the existing node around for a while: If the record
+                * existed before, we reference the key data in there.
+                */
        }
 
        node = (struct db_rbt_node *)SMB_MALLOC(
@@ -103,6 +136,7 @@ static NTSTATUS db_rbt_store(struct db_record *rec, TDB_DATA data, int flag)
                + data.dsize);
 
        if (node == NULL) {
+               SAFE_FREE(rec_priv->node);
                return NT_STATUS_NO_MEMORY;
        }
 
@@ -114,6 +148,8 @@ static NTSTATUS db_rbt_store(struct db_record *rec, TDB_DATA data, int flag)
        db_rbt_parse_node(node, &this_key, &this_val);
 
        memcpy(this_key.dptr, rec->key.dptr, node->keysize);
+       SAFE_FREE(rec_priv->node);
+
        memcpy(this_val.dptr, data.dptr, node->valuesize);
 
        parent = NULL;
@@ -126,22 +162,16 @@ static NTSTATUS db_rbt_store(struct db_record *rec, TDB_DATA data, int flag)
 
                parent = (*p);
 
-               r = (struct db_rbt_node *)
-                       ((char *)(*p) - offsetof(struct db_rbt_node, rb_node));
+               r = db_rbt2node(*p);
 
                db_rbt_parse_node(r, &search_key, &search_val);
 
-               res = memcmp(this_key.dptr, search_key.dptr,
-                            MIN(this_key.dsize, search_key.dsize));
+               res = db_rbt_compare(this_key, search_key);
 
-               if ((res < 0)
-                   || ((res == 0)
-                       && (this_key.dsize < search_key.dsize))) {
+               if (res == -1) {
                        p = &(*p)->rb_left;
                }
-               else if ((res > 0)
-                        || ((res == 0)
-                            && (this_key.dsize > search_key.dsize))) {
+               else if (res == 1) {
                        p = &(*p)->rb_right;
                }
                else {
@@ -157,8 +187,7 @@ static NTSTATUS db_rbt_store(struct db_record *rec, TDB_DATA data, int flag)
 
 static NTSTATUS db_rbt_delete(struct db_record *rec)
 {
-       struct db_rbt_rec *rec_priv = talloc_get_type_abort(
-               rec->private_data, struct db_rbt_rec);
+       struct db_rbt_rec *rec_priv = (struct db_rbt_rec *)rec->private_data;
 
        if (rec_priv->node == NULL) {
                return NT_STATUS_OK;
@@ -180,85 +209,128 @@ static struct db_record *db_rbt_fetch_locked(struct db_context *db_ctx,
        struct db_rbt_rec *rec_priv;
        struct db_record *result;
        struct rb_node *n;
+       size_t size;
+       bool found = false;
+       struct db_rbt_node *r = NULL;
+       TDB_DATA search_key = tdb_null, search_val = tdb_null;
 
-       result = talloc(mem_ctx, struct db_record);
+       n = ctx->tree.rb_node;
 
-       if (result == NULL) {
-               return NULL;
+       while (n != NULL) {
+               int res;
+
+               r = db_rbt2node(n);
+
+               db_rbt_parse_node(r, &search_key, &search_val);
+
+               res = db_rbt_compare(key, search_key);
+
+               if (res == -1) {
+                       n = n->rb_left;
+               }
+               else if (res == 1) {
+                       n = n->rb_right;
+               }
+               else {
+                       found = true;
+                       break;
+               }
        }
 
-       rec_priv = talloc(result, struct db_rbt_rec);
+       /*
+        * In this low-level routine, play tricks to reduce the number of
+        * tallocs to one. Not recommened for general use, but here it pays
+        * off.
+        */
+
+       size = ALIGN(sizeof(struct db_record)) + sizeof(struct db_rbt_rec);
 
-       if (rec_priv == NULL) {
-               TALLOC_FREE(result);
+       if (!found) {
+               /*
+                * We need to keep the key around for later store
+                */
+               size += key.dsize;
+       }
+
+       result = (struct db_record *)talloc_size(mem_ctx, size);
+       if (result == NULL) {
                return NULL;
        }
 
+       rec_priv = (struct db_rbt_rec *)
+               ((char *)result + ALIGN(sizeof(struct db_record)));
        rec_priv->db_ctx = ctx;
 
        result->store = db_rbt_store;
        result->delete_rec = db_rbt_delete;
        result->private_data = rec_priv;
 
+       if (found) {
+               rec_priv->node = r;
+               result->key = search_key;
+               result->value = search_val;
+       }
+       else {
+               rec_priv->node = NULL;
+               result->key.dptr = (uint8 *)
+                       ((char *)rec_priv + sizeof(*rec_priv));
+               result->key.dsize = key.dsize;
+               memcpy(result->key.dptr, key.dptr, key.dsize);
+
+               result->value = tdb_null;
+       }
+
+       return result;
+}
+
+static int db_rbt_fetch(struct db_context *db, TALLOC_CTX *mem_ctx,
+                       TDB_DATA key, TDB_DATA *data)
+{
+       struct db_rbt_ctx *ctx = talloc_get_type_abort(
+               db->private_data, struct db_rbt_ctx);
+
+       struct rb_node *n;
+       bool found = false;
+       struct db_rbt_node *r = NULL;
+       TDB_DATA search_key, search_val;
+       uint8_t *result;
+
        n = ctx->tree.rb_node;
 
        while (n != NULL) {
-               struct db_rbt_node *r;
-               TDB_DATA search_key, search_val;
                int res;
 
-               r = (struct db_rbt_node *)
-                       ((char *)n - offsetof(struct db_rbt_node, rb_node));
+               r = db_rbt2node(n);
 
                db_rbt_parse_node(r, &search_key, &search_val);
 
-               res = memcmp(key.dptr, search_key.dptr,
-                            MIN(key.dsize, search_key.dsize));
+               res = db_rbt_compare(key, search_key);
 
-               if ((res < 0)
-                   || ((res == 0) && (key.dsize < search_key.dsize))) {
+               if (res == -1) {
                        n = n->rb_left;
                }
-               else if ((res > 0)
-                        || ((res == 0) && (key.dsize > search_key.dsize))) {
+               else if (res == 1) {
                        n = n->rb_right;
                }
                else {
-                       rec_priv->node = r;
-                       result->key = search_key;
-                       result->value = search_val;
-                       return result;
+                       found = true;
+                       break;
                }
        }
 
-       result->key.dsize = key.dsize;
-       result->key.dptr = (uint8_t *)talloc_memdup(
-               result, key.dptr, key.dsize);
-
-       if (result->key.dptr == NULL) {
-               TALLOC_FREE(result);
-               return NULL;
+       if (!found) {
+               *data = tdb_null;
+               return 0;
        }
 
-       rec_priv->node = NULL;
-       result->value.dsize = 0;
-       result->value.dptr = NULL;
-       return result;
-}
-
-static int db_rbt_fetch(struct db_context *db, TALLOC_CTX *mem_ctx,
-                       TDB_DATA key, TDB_DATA *data)
-{
-       struct db_record *rec;
-
-       if (!(rec = db->fetch_locked(db, mem_ctx, key))) {
+       result = (uint8 *)talloc_memdup(mem_ctx, search_val.dptr,
+                                       search_val.dsize);
+       if (result == NULL) {
                return -1;
        }
 
-       data->dsize = rec->value.dsize;
-       data->dptr = (uint8 *)talloc_memdup(mem_ctx, rec->value.dptr,
-                                           rec->value.dsize);
-       TALLOC_FREE(rec);
+       data->dptr = result;
+       data->dsize = search_val.dsize;
        return 0;
 }
 
@@ -268,6 +340,9 @@ static int db_rbt_traverse(struct db_context *db,
                                    void *private_data),
                           void *private_data)
 {
+       /*
+        * Nobody uses this so far, and unused code is broken code :-)
+        */
        return -1;
 }
 
index b24fd0618a47885428a12c0bdce7c003dcae76be..18f94959315e4357e3cd032b81b1fcb08ccbc6e9 100644 (file)
@@ -31,6 +31,11 @@ static int db_tdb_record_destr(struct db_record* data)
        struct db_tdb_ctx *ctx =
                talloc_get_type_abort(data->private_data, struct db_tdb_ctx);
 
+       /* This hex_encode() call allocates memory on data context. By way how current 
+          __talloc_free() code works, it is OK to allocate in the destructor as 
+          the children of data will be freed after call to the destructor and this 
+          new 'child' will be caught and freed correctly.
+        */
        DEBUG(10, (DEBUGLEVEL > 10
                   ? "Unlocking key %s\n" : "Unlocking key %.20s\n",
                   hex_encode(data, (unsigned char *)data->key.dptr,
@@ -43,36 +48,53 @@ static int db_tdb_record_destr(struct db_record* data)
        return 0;
 }
 
-static struct db_record *db_tdb_fetch_locked(struct db_context *db,
-                                    TALLOC_CTX *mem_ctx, TDB_DATA key)
-{
-       struct db_tdb_ctx *ctx = talloc_get_type_abort(db->private_data,
-                                                      struct db_tdb_ctx);
+struct tdb_fetch_locked_state {
+       TALLOC_CTX *mem_ctx;
        struct db_record *result;
-       TDB_DATA value;
+};
 
-       result = TALLOC_P(mem_ctx, struct db_record);
-       if (result == NULL) {
-               DEBUG(0, ("talloc failed\n"));
-               return NULL;
+static int db_tdb_fetchlock_parse(TDB_DATA key, TDB_DATA data,
+                                 void *private_data)
+{
+       struct tdb_fetch_locked_state *state =
+               (struct tdb_fetch_locked_state *)private_data;
+
+       state->result = (struct db_record *)talloc_size(
+               state->mem_ctx,
+               sizeof(struct db_record) + key.dsize + data.dsize);
+
+       if (state->result == NULL) {
+               return 0;
        }
 
-       result->key.dsize = key.dsize;
-       result->key.dptr = (uint8 *)talloc_memdup(result, key.dptr, key.dsize);
-       if (result->key.dptr == NULL) {
-               DEBUG(0, ("talloc failed\n"));
-               TALLOC_FREE(result);
-               return NULL;
+       state->result->key.dsize = key.dsize;
+       state->result->key.dptr = ((uint8 *)state->result)
+               + sizeof(struct db_record);
+       memcpy(state->result->key.dptr, key.dptr, key.dsize);
+
+       state->result->value.dsize = data.dsize;
+
+       if (data.dsize > 0) {
+               state->result->value.dptr = state->result->key.dptr+key.dsize;
+               memcpy(state->result->value.dptr, data.dptr, data.dsize);
+       }
+       else {
+               state->result->value.dptr = NULL;
        }
 
-       result->value.dptr = NULL;
-       result->value.dsize = 0;
-       result->private_data = talloc_reference(result, ctx);
-       result->store = db_tdb_store;
-       result->delete_rec = db_tdb_delete;
+       return 0;
+}
 
-       if (DEBUGLEVEL >= 10) {
-               char *keystr = hex_encode(NULL, key.dptr, key.dsize);
+static struct db_record *db_tdb_fetch_locked(struct db_context *db,
+                                    TALLOC_CTX *mem_ctx, TDB_DATA key)
+{
+       struct db_tdb_ctx *ctx = talloc_get_type_abort(db->private_data,
+                                                      struct db_tdb_ctx);
+       struct tdb_fetch_locked_state state;
+
+       /* Do not accidently allocate/deallocate w/o need when debug level is lower than needed */
+       if(DEBUGLEVEL >= 10) {
+               char *keystr = hex_encode(NULL, (unsigned char*)key.dptr, key.dsize);
                DEBUG(10, (DEBUGLEVEL > 10
                           ? "Locking key %s\n" : "Locking key %.20s\n",
                           keystr));
@@ -81,32 +103,55 @@ static struct db_record *db_tdb_fetch_locked(struct db_context *db,
 
        if (tdb_chainlock(ctx->wtdb->tdb, key) != 0) {
                DEBUG(3, ("tdb_chainlock failed\n"));
-               TALLOC_FREE(result);
                return NULL;
        }
 
-       talloc_set_destructor(result, db_tdb_record_destr);
+       state.mem_ctx = mem_ctx;
+       state.result = NULL;
 
-       value = tdb_fetch(ctx->wtdb->tdb, key);
+       tdb_parse_record(ctx->wtdb->tdb, key, db_tdb_fetchlock_parse, &state);
 
-       if (value.dptr == NULL) {
-               return result;
+       if (state.result == NULL) {
+               db_tdb_fetchlock_parse(key, tdb_null, &state);
        }
 
-       result->value.dsize = value.dsize;
-       result->value.dptr = (uint8 *)talloc_memdup(result, value.dptr,
-                                                   value.dsize);
-       if (result->value.dptr == NULL) {
-               DEBUG(3, ("talloc failed\n"));
-               TALLOC_FREE(result);
+       if (state.result == NULL) {
+               tdb_chainunlock(ctx->wtdb->tdb, key);
                return NULL;
        }
 
-       SAFE_FREE(value.dptr);
+       talloc_set_destructor(state.result, db_tdb_record_destr);
 
-       DEBUG(10, ("Allocated locked data 0x%p\n", result));
+       state.result->private_data = talloc_reference(state.result, ctx);
+       state.result->store = db_tdb_store;
+       state.result->delete_rec = db_tdb_delete;
 
-       return result;
+       DEBUG(10, ("Allocated locked data 0x%p\n", state.result));
+
+       return state.result;
+}
+
+struct tdb_fetch_state {
+       TALLOC_CTX *mem_ctx;
+       int result;
+       TDB_DATA data;
+};
+
+static int db_tdb_fetch_parse(TDB_DATA key, TDB_DATA data,
+                             void *private_data)
+{
+       struct tdb_fetch_state *state =
+               (struct tdb_fetch_state *)private_data;
+
+       state->data.dptr = (uint8 *)talloc_memdup(state->mem_ctx, data.dptr,
+                                                 data.dsize);
+       if (state->data.dptr == NULL) {
+               state->result = -1;
+               return 0;
+       }
+
+       state->data.dsize = data.dsize;
+       return 0;
 }
 
 static int db_tdb_fetch(struct db_context *db, TALLOC_CTX *mem_ctx,
@@ -115,23 +160,19 @@ static int db_tdb_fetch(struct db_context *db, TALLOC_CTX *mem_ctx,
        struct db_tdb_ctx *ctx = talloc_get_type_abort(
                db->private_data, struct db_tdb_ctx);
 
-       TDB_DATA data;
-
-       data = tdb_fetch(ctx->wtdb->tdb, key);
+       struct tdb_fetch_state state;
 
-       if (data.dptr == NULL) {
-               pdata->dptr = NULL;
-               pdata->dsize = 0;
-               return 0;
-       }
+       state.mem_ctx = mem_ctx;
+       state.result = 0;
+       state.data = tdb_null;
 
-       pdata->dptr = (uint8 *)talloc_memdup(mem_ctx, data.dptr, data.dsize);
-       SAFE_FREE(data.dptr);
+       tdb_parse_record(ctx->wtdb->tdb, key, db_tdb_fetch_parse, &state);
 
-       if (pdata->dptr == NULL) {
+       if (state.result == -1) {
                return -1;
        }
-       pdata->dsize = data.dsize;
+
+       *pdata = state.data;
        return 0;
 }
 
@@ -154,15 +195,9 @@ static NTSTATUS db_tdb_delete(struct db_record *rec)
 {
        struct db_tdb_ctx *ctx = talloc_get_type_abort(rec->private_data,
                                                       struct db_tdb_ctx);
-       int res;
-       
-       res = tdb_delete(ctx->wtdb->tdb, rec->key);
 
-       if (res == 0) {
-               return NT_STATUS_OK;
-       }
-
-       return map_nt_error_from_tdb(tdb_error(ctx->wtdb->tdb));
+       return (tdb_delete(ctx->wtdb->tdb, rec->key) == 0) ?
+               NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL;
 }
 
 struct db_tdb_traverse_ctx {
@@ -281,6 +316,7 @@ struct db_context *db_open_tdb(TALLOC_CTX *mem_ctx,
        result->traverse = db_tdb_traverse;
        result->traverse_read = db_tdb_traverse_read;
        result->get_seqnum = db_tdb_get_seqnum;
+       result->persistent = ((tdb_flags & TDB_CLEAR_IF_FIRST) == 0);
        return result;
 
  fail:
diff --git a/source/lib/dbwrap_util.c b/source/lib/dbwrap_util.c
new file mode 100644 (file)
index 0000000..002d572
--- /dev/null
@@ -0,0 +1,90 @@
+/* 
+   Unix SMB/CIFS implementation.
+   Utility functions for the dbwrap API
+   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 2 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, write to the Free Software
+   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include "includes.h"
+
+int32_t dbwrap_fetch_int32(struct db_context *db, const char *keystr)
+{
+       TDB_DATA dbuf;
+       int32 ret;
+
+       if (db->fetch(db, NULL, string_term_tdb_data(keystr), &dbuf) != 0) {
+               return -1;
+       }
+
+       if ((dbuf.dptr == NULL) || (dbuf.dsize != sizeof(int32_t))) {
+               TALLOC_FREE(dbuf.dptr);
+               return -1;
+       }
+
+       ret = IVAL(dbuf.dptr, 0);
+       TALLOC_FREE(dbuf.dptr);
+       return ret;
+}
+
+int dbwrap_store_int32(struct db_context *db, const char *keystr, int32_t v)
+{
+       struct db_record *rec;
+       int32 v_store;
+       NTSTATUS status;
+
+       rec = db->fetch_locked(db, NULL, string_term_tdb_data(keystr));
+       if (rec == NULL) {
+               return -1;
+       }
+
+       SIVAL(&v_store, 0, v);
+
+       status = rec->store(rec, make_tdb_data((const uint8 *)&v_store,
+                                              sizeof(v_store)),
+                           TDB_REPLACE);
+       TALLOC_FREE(rec);
+       return NT_STATUS_IS_OK(status) ? 0 : -1;
+}
+
+uint32_t dbwrap_change_uint32_atomic(struct db_context *db, const char *keystr,
+                                    uint32_t *oldval, uint32_t change_val)
+{
+       struct db_record *rec;
+       uint32 val = -1;
+       TDB_DATA data;
+
+       if (!(rec = db->fetch_locked(db, NULL,
+                                    string_term_tdb_data(keystr)))) {
+               return -1;
+       }
+
+       if ((rec->value.dptr != NULL)
+           && (rec->value.dsize == sizeof(val))) {
+               val = IVAL(rec->value.dptr, 0);
+       }
+
+       val += change_val;
+
+       data.dsize = sizeof(val);
+       data.dptr = (uint8 *)&val;
+
+       rec->store(rec, data, TDB_REPLACE);
+
+       TALLOC_FREE(rec);
+
+       return 0;
+}
+
index 87ec9ed8f577a9f948b404a296aaaea6067953a8..51bb0d754182a99d880d2c56f11e2e772e346a80 100644 (file)
@@ -199,6 +199,8 @@ void gfree_debugsyms(void)
 
        if ( DEBUGLEVEL_CLASS_ISSET != &debug_all_class_isset_hack )
                SAFE_FREE( DEBUGLEVEL_CLASS_ISSET );
+
+       SAFE_FREE(format_bufr);
 }
 
 /****************************************************************************
@@ -427,8 +429,9 @@ static bool debug_parse_params(char **params)
 
        /* Fill in new debug class levels */
        for (; i < debug_num_classes && params[i]; i++) {
-               if ((class_name=strtok(params[i],":")) &&
-                       (class_level=strtok(NULL, "\0")) &&
+               char *saveptr;
+               if ((class_name = strtok_r(params[i],":", &saveptr)) &&
+                       (class_level = strtok_r(NULL, "\0", &saveptr)) &&
             ((ndx = debug_lookup_classname(class_name)) != -1)) {
                                DEBUGLEVEL_CLASS[ndx] = atoi(class_level);
                                DEBUGLEVEL_CLASS_ISSET[ndx] = True;
@@ -785,13 +788,13 @@ void check_log_size( void )
                        (void)x_vfprintf( dbf, format_str, ap );
                va_end( ap );
                errno = old_errno;
-               return( 0 );
+               goto done;
        }
 
        /* prevent recursion by checking if reopen_logs() has temporaily
           set the debugf string to NULL */
        if( debugf == NULL)
-               return( 0 );
+               goto done;
 
 #ifdef WITH_SYSLOG
        if( !lp_syslog_only() )
@@ -806,7 +809,7 @@ void check_log_size( void )
                                x_setbuf( dbf, NULL );
                        } else {
                                errno = old_errno;
-                               return(0);
+                               goto done;
                        }
                }
        }
@@ -855,10 +858,11 @@ void check_log_size( void )
                        (void)x_fflush( dbf );
        }
 
-       errno = old_errno;
-
+ done:
        TALLOC_FREE(tmp_debug_ctx);
 
+       errno = old_errno;
+
        return( 0 );
 }
 
index f6a6bb64655b8298a4573359eca9052b2e666845..67392e45688c5478ddc7c06d3570a7e96535ebea 100644 (file)
 /****************************************************************************
 convert a security permissions into a string
 ****************************************************************************/
-char *get_sec_mask_str(uint32 type)
+
+char *get_sec_mask_str(TALLOC_CTX *ctx, uint32 type)
 {
-       static fstring typestr="";
+       char *typestr = talloc_strdup(ctx, "");
 
-       typestr[0] = 0;
+       if (!typestr) {
+               return NULL;
+       }
 
-       if (type & GENERIC_ALL_ACCESS)
-               fstrcat(typestr, "Generic all access ");
-       if (type & GENERIC_EXECUTE_ACCESS)
-               fstrcat(typestr, "Generic execute access ");
-       if (type & GENERIC_WRITE_ACCESS)
-               fstrcat(typestr, "Generic write access ");
-       if (type & GENERIC_READ_ACCESS)
-               fstrcat(typestr, "Generic read access ");
-       if (type & MAXIMUM_ALLOWED_ACCESS)
-               fstrcat(typestr, "MAXIMUM_ALLOWED_ACCESS ");
-       if (type & SYSTEM_SECURITY_ACCESS)
-               fstrcat(typestr, "SYSTEM_SECURITY_ACCESS ");
-       if (type & SYNCHRONIZE_ACCESS)
-               fstrcat(typestr, "SYNCHRONIZE_ACCESS ");
-       if (type & WRITE_OWNER_ACCESS)
-               fstrcat(typestr, "WRITE_OWNER_ACCESS ");
-       if (type & WRITE_DAC_ACCESS)
-               fstrcat(typestr, "WRITE_DAC_ACCESS ");
-       if (type & READ_CONTROL_ACCESS)
-               fstrcat(typestr, "READ_CONTROL_ACCESS ");
-       if (type & DELETE_ACCESS)
-               fstrcat(typestr, "DELETE_ACCESS ");
+       if (type & GENERIC_ALL_ACCESS) {
+               typestr = talloc_asprintf_append(typestr,
+                               "Generic all access ");
+               if (!typestr) {
+                       return NULL;
+               }
+       }
+       if (type & GENERIC_EXECUTE_ACCESS) {
+               typestr = talloc_asprintf_append(typestr,
+                               "Generic execute access");
+               if (!typestr) {
+                       return NULL;
+               }
+       }
+       if (type & GENERIC_WRITE_ACCESS) {
+               typestr = talloc_asprintf_append(typestr,
+                               "Generic write access ");
+               if (!typestr) {
+                       return NULL;
+               }
+       }
+       if (type & GENERIC_READ_ACCESS) {
+               typestr = talloc_asprintf_append(typestr,
+                               "Generic read access ");
+               if (!typestr) {
+                       return NULL;
+               }
+       }
+       if (type & MAXIMUM_ALLOWED_ACCESS) {
+               typestr = talloc_asprintf_append(typestr,
+                               "MAXIMUM_ALLOWED_ACCESS ");
+               if (!typestr) {
+                       return NULL;
+               }
+       }
+       if (type & SYSTEM_SECURITY_ACCESS) {
+               typestr = talloc_asprintf_append(typestr,
+                               "SYSTEM_SECURITY_ACCESS ");
+               if (!typestr) {
+                       return NULL;
+               }
+       }
+       if (type & SYNCHRONIZE_ACCESS) {
+               typestr = talloc_asprintf_append(typestr,
+                               "SYNCHRONIZE_ACCESS ");
+               if (!typestr) {
+                       return NULL;
+               }
+       }
+       if (type & WRITE_OWNER_ACCESS) {
+               typestr = talloc_asprintf_append(typestr,
+                               "WRITE_OWNER_ACCESS ");
+               if (!typestr) {
+                       return NULL;
+               }
+       }
+       if (type & WRITE_DAC_ACCESS) {
+               typestr = talloc_asprintf_append(typestr,
+                               "WRITE_DAC_ACCESS ");
+               if (!typestr) {
+                       return NULL;
+               }
+       }
+       if (type & READ_CONTROL_ACCESS) {
+               typestr = talloc_asprintf_append(typestr,
+                               "READ_CONTROL_ACCESS ");
+               if (!typestr) {
+                       return NULL;
+               }
+       }
+       if (type & DELETE_ACCESS) {
+               typestr = talloc_asprintf_append(typestr,
+                               "DELETE_ACCESS ");
+               if (!typestr) {
+                       return NULL;
+               }
+       }
 
        printf("\t\tSpecific bits: 0x%lx\n", (unsigned long)type&SPECIFIC_RIGHTS_MASK);
 
@@ -62,7 +120,9 @@ char *get_sec_mask_str(uint32 type)
  ****************************************************************************/
 void display_sec_access(SEC_ACCESS *info)
 {
-       printf("\t\tPermissions: 0x%x: %s\n", *info, get_sec_mask_str(*info));
+       char *mask_str = get_sec_mask_str(NULL, *info);
+       printf("\t\tPermissions: 0x%x: %s\n", *info, mask_str ? mask_str : "");
+       TALLOC_FREE(mask_str);
 }
 
 /****************************************************************************
index 18b261623e693d30c7f22b983bf24d348a131d1c..a3bb5be43af53c226de31b8d2101cbc6d1a7f081 100644 (file)
 
        lang_msg_free(msgstr);
 
-       if (ret <= 0) return ret;
+       if (ret <= 0) {
+         va_end(ap2);
+         return ret;
+       }
 
        /* now we have the string in unix format, convert it to the display
           charset, but beware of it growing */
@@ -56,6 +59,7 @@ again:
        p2 = (char *)SMB_MALLOC(maxlen);
        if (!p2) {
                SAFE_FREE(p);
+               va_end(ap2);
                return -1;
        }
        clen = convert_string(CH_UNIX, CH_DISPLAY, p, ret, p2, maxlen, True);
@@ -72,6 +76,8 @@ again:
        ret = fwrite(p2, 1, clen, f);
        SAFE_FREE(p2);
 
+       va_end(ap2);
+
        return ret;
 }
 
index e3b179b7634efda38818eb5a72f01428d54a55f8..dbe886e3d130c776753a41fbd93405621d0a4e52 100644 (file)
@@ -51,4 +51,3 @@ NTSTATUS can_delete_directory(struct connection_struct *conn,
 {
        return NT_STATUS_OK;
 }
-
index 885a1c55b29170d2bdb1afc885b73da7c00343c9..8194cf80cce48ae9760a1bb7d3b277e2d6060e2a 100644 (file)
@@ -92,6 +92,9 @@ const struct unix_error_map unix_dos_nt_errmap[] = {
 #ifdef EWOULDBLOCK
        { EWOULDBLOCK, ERRDOS, 111, NT_STATUS_NETWORK_BUSY },
 #endif
+#ifdef ENOATTR
+       { ENOATTR, ERRDOS, ERRbadfile, NT_STATUS_NOT_FOUND },
+#endif
 
        { 0, 0, 0, NT_STATUS_OK }
 };
index 33e1401d7aac4d76e13e842c35c24a6f997fbb16..1964955f1b814693cc1b99dd527413af60d59de6 100644 (file)
@@ -132,7 +132,6 @@ void dump_core_setup(const char *progname)
        sys_chown(corepath,getuid(),getgid());
        chmod(corepath,0700);
 
-       SAFE_FREE(corepath);
        SAFE_FREE(logbase);
 
 #ifdef HAVE_GETRLIMIT
index a50e5d01fac0d9f9aad5681c8c189f9f5a14cc2a..663385cfe3d6dd08f99d98981ad0f780ec1f5055 100644 (file)
@@ -32,7 +32,6 @@
 #define BLOB_TYPE_LEN 9
 
 static TDB_CONTEXT *cache;
-static bool cache_readonly;
 
 /**
  * @file gencache.c
@@ -67,7 +66,6 @@ bool gencache_init(void)
        if (!cache && (errno == EACCES)) {
                cache = tdb_open_log(cache_fname, 0, TDB_DEFAULT, O_RDONLY, 0644);
                if (cache) {
-                       cache_readonly = True;
                        DEBUG(5, ("gencache_init: Opening cache file %s read-only.\n", cache_fname));
                }
        }
@@ -95,7 +93,6 @@ bool gencache_shutdown(void)
        DEBUG(5, ("Closing cache file\n"));
        ret = tdb_close(cache);
        cache = NULL;
-       cache_readonly = False;
        return ret != -1;
 }
 
@@ -123,10 +120,6 @@ bool gencache_set(const char *keystr, const char *value, time_t timeout)
 
        if (!gencache_init()) return False;
        
-       if (cache_readonly) {
-               return False;
-       }
-
        asprintf(&valstr, CACHE_DATA_FMT, (int)timeout, value);
        if (!valstr)
                return False;
@@ -161,10 +154,6 @@ bool gencache_del(const char *keystr)
 
        if (!gencache_init()) return False;     
        
-       if (cache_readonly) {
-               return False;
-       }
-
        DEBUG(10, ("Deleting cache entry (key = %s)\n", keystr));
        ret = tdb_delete_bystring(cache, keystr);
        
@@ -351,10 +340,6 @@ bool gencache_set_data_blob(const char *keystr, DATA_BLOB *blob, time_t timeout)
                return False;
        }
 
-       if (cache_readonly) {
-               return False;
-       }
-
        asprintf(&valstr, "%12u/%s", (int)timeout, BLOB_TYPE);
        if (!valstr) {
                return False;
index 722ab56abd4edba80d8f5611b44bf3263573e93c..3797fc679dc99bca6e971c4afd2f8b6d5208a300 100644 (file)
@@ -84,6 +84,7 @@
 #include <net/if.h>
 #endif
 
+#define SOCKET_WRAPPER_NOT_REPLACE
 #include "interfaces.h"
 #include "lib/replace/replace.h"
 
index 61d5848aaef9bdffedd3e9989f8e185eed27765f..bae0091e3635f9c7d0c0b1d80d47cdbedc3e95c4 100644 (file)
    It assumes that a int is at least 32 bits long
 */
 
+#if 0
 static uint32 A, B, C, D;
+#else
+#define A (state[0])
+#define B (state[1])
+#define C (state[2])
+#define D (state[3])
+#endif
 
 static uint32 F(uint32 X, uint32 Y, uint32 Z)
 {
@@ -52,7 +59,7 @@ static uint32 lshift(uint32 x, int s)
 #define ROUND3(a,b,c,d,k,s) a = lshift(a + H(b,c,d) + X[k] + (uint32)0x6ED9EBA1,s)
 
 /* this applies md4 to 64 byte chunks */
-static void mdfour64(uint32 *M)
+static void mdfour64(uint32_t *state, uint32 *M)
 {
        int j;
        uint32 AA, BB, CC, DD;
@@ -121,6 +128,7 @@ void mdfour(unsigned char *out, const unsigned char *in, int n)
 {
        unsigned char buf[128];
        uint32 M[16];
+       uint32 state[4];
        uint32 b = n * 8;
        int i;
 
@@ -131,7 +139,7 @@ void mdfour(unsigned char *out, const unsigned char *in, int n)
 
        while (n > 64) {
                copy64(M, in);
-               mdfour64(M);
+               mdfour64(state, M);
                in += 64;
                n -= 64;
        }
@@ -144,13 +152,13 @@ void mdfour(unsigned char *out, const unsigned char *in, int n)
        if (n <= 55) {
                copy4(buf+56, b);
                copy64(M, buf);
-               mdfour64(M);
+               mdfour64(state, M);
        } else {
                copy4(buf+120, b); 
                copy64(M, buf);
-               mdfour64(M);
+               mdfour64(state, M);
                copy64(M, buf+64);
-               mdfour64(M);
+               mdfour64(state, M);
        }
 
        for (i=0;i<128;i++)
@@ -161,8 +169,6 @@ void mdfour(unsigned char *out, const unsigned char *in, int n)
        copy4(out+4, B);
        copy4(out+8, C);
        copy4(out+12, D);
-
-       A = B = C = D = 0;
 }
 
 
diff --git a/source/lib/memcache.c b/source/lib/memcache.c
new file mode 100644 (file)
index 0000000..6dee61a
--- /dev/null
@@ -0,0 +1,388 @@
+/*
+   Unix SMB/CIFS implementation.
+   In-memory cache
+   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 "memcache.h"
+#include "rbtree.h"
+
+static struct memcache *global_cache;
+
+struct memcache_element {
+       struct rb_node rb_node;
+       struct memcache_element *prev, *next;
+       size_t keylength, valuelength;
+       uint8 n;                /* This is really an enum, but save memory */
+       char data[1];           /* placeholder for offsetof */
+};
+
+struct memcache {
+       struct memcache_element *mru, *lru;
+       struct rb_root tree;
+       size_t size;
+       size_t max_size;
+};
+
+static void memcache_element_parse(struct memcache_element *e,
+                                  DATA_BLOB *key, DATA_BLOB *value);
+
+static bool memcache_is_talloc(enum memcache_number n)
+{
+       bool result;
+
+       switch (n) {
+       case GETPWNAM_CACHE:
+       case PDB_GETPWSID_CACHE:
+       case SINGLETON_CACHE_TALLOC:
+               result = true;
+               break;
+       default:
+               result = false;
+               break;
+       }
+
+       return result;
+}
+
+static int memcache_destructor(struct memcache *cache) {
+       struct memcache_element *e, *next;
+
+       for (e = cache->mru; e != NULL; e = next) {
+               next = e->next;
+               if (memcache_is_talloc((enum memcache_number)e->n)
+                   && (e->valuelength == sizeof(void *))) {
+                       DATA_BLOB key, value;
+                       void *ptr;
+                       memcache_element_parse(e, &key, &value);
+                       memcpy(&ptr, value.data, sizeof(ptr));
+                       TALLOC_FREE(ptr);
+               }
+               SAFE_FREE(e);
+       }
+       return 0;
+}
+
+struct memcache *memcache_init(TALLOC_CTX *mem_ctx, size_t max_size)
+{
+       struct memcache *result;
+
+       result = TALLOC_ZERO_P(mem_ctx, struct memcache);
+       if (result == NULL) {
+               return NULL;
+       }
+       result->max_size = max_size;
+       talloc_set_destructor(result, memcache_destructor);
+       return result;
+}
+
+void memcache_set_global(struct memcache *cache)
+{
+       TALLOC_FREE(global_cache);
+       global_cache = cache;
+}
+
+static struct memcache_element *memcache_node2elem(struct rb_node *node)
+{
+       return (struct memcache_element *)
+               ((char *)node - offsetof(struct memcache_element, rb_node));
+}
+
+static void memcache_element_parse(struct memcache_element *e,
+                                  DATA_BLOB *key, DATA_BLOB *value)
+{
+       key->data = ((uint8 *)e) + offsetof(struct memcache_element, data);
+       key->length = e->keylength;
+       value->data = key->data + e->keylength;
+       value->length = e->valuelength;
+}
+
+static size_t memcache_element_size(size_t key_length, size_t value_length)
+{
+       return sizeof(struct memcache_element) - 1 + key_length + value_length;
+}
+
+static int memcache_compare(struct memcache_element *e, enum memcache_number n,
+                           DATA_BLOB key)
+{
+       DATA_BLOB this_key, this_value;
+
+       if ((int)e->n < (int)n) return -1;
+       if ((int)e->n > (int)n) return 1;
+
+       if (e->keylength < key.length) return -1;
+       if (e->keylength > key.length) return 1;
+
+       memcache_element_parse(e, &this_key, &this_value);
+       return memcmp(this_key.data, key.data, key.length);
+}
+
+static struct memcache_element *memcache_find(
+       struct memcache *cache, enum memcache_number n, DATA_BLOB key)
+{
+       struct rb_node *node;
+
+       node = cache->tree.rb_node;
+
+       while (node != NULL) {
+               struct memcache_element *elem = memcache_node2elem(node);
+               int cmp;
+
+               cmp = memcache_compare(elem, n, key);
+               if (cmp == 0) {
+                       return elem;
+               }
+               node = (cmp < 0) ? node->rb_left : node->rb_right;
+       }
+
+       return NULL;
+}
+
+bool memcache_lookup(struct memcache *cache, enum memcache_number n,
+                    DATA_BLOB key, DATA_BLOB *value)
+{
+       struct memcache_element *e;
+
+       if (cache == NULL) {
+               cache = global_cache;
+       }
+       if (cache == NULL) {
+               return false;
+       }
+
+       e = memcache_find(cache, n, key);
+       if (e == NULL) {
+               return false;
+       }
+
+       if (cache->size != 0) {
+               /*
+                * Do LRU promotion only when we will ever shrink
+                */
+               if (e == cache->lru) {
+                       cache->lru = e->prev;
+               }
+               DLIST_PROMOTE(cache->mru, e);
+               if (cache->mru == NULL) {
+                       cache->mru = e;
+               }
+       }
+
+       memcache_element_parse(e, &key, value);
+       return true;
+}
+
+void *memcache_lookup_talloc(struct memcache *cache, enum memcache_number n,
+                            DATA_BLOB key)
+{
+       DATA_BLOB value;
+       void *result;
+
+       if (!memcache_lookup(cache, n, key, &value)) {
+               return NULL;
+       }
+
+       if (value.length != sizeof(result)) {
+               return NULL;
+       }
+
+       memcpy(&result, value.data, sizeof(result));
+
+       return result;
+}
+
+static void memcache_delete_element(struct memcache *cache,
+                                   struct memcache_element *e)
+{
+       rb_erase(&e->rb_node, &cache->tree);
+
+       if (e == cache->lru) {
+               cache->lru = e->prev;
+       }
+       DLIST_REMOVE(cache->mru, e);
+
+       cache->size -= memcache_element_size(e->keylength, e->valuelength);
+
+       SAFE_FREE(e);
+}
+
+static void memcache_trim(struct memcache *cache)
+{
+       if (cache->max_size == 0) {
+               return;
+       }
+
+       while ((cache->size > cache->max_size) && (cache->lru != NULL)) {
+               memcache_delete_element(cache, cache->lru);
+       }
+}
+
+void memcache_delete(struct memcache *cache, enum memcache_number n,
+                    DATA_BLOB key)
+{
+       struct memcache_element *e;
+
+       if (cache == NULL) {
+               cache = global_cache;
+       }
+       if (cache == NULL) {
+               return;
+       }
+
+       e = memcache_find(cache, n, key);
+       if (e == NULL) {
+               return;
+       }
+
+       memcache_delete_element(cache, e);
+}
+
+void memcache_add(struct memcache *cache, enum memcache_number n,
+                 DATA_BLOB key, DATA_BLOB value)
+{
+       struct memcache_element *e;
+       struct rb_node **p;
+       struct rb_node *parent;
+       DATA_BLOB cache_key, cache_value;
+       size_t element_size;
+
+       if (cache == NULL) {
+               cache = global_cache;
+       }
+       if (cache == NULL) {
+               return;
+       }
+
+       if (key.length == 0) {
+               return;
+       }
+
+       e = memcache_find(cache, n, key);
+
+       if (e != NULL) {
+               memcache_element_parse(e, &cache_key, &cache_value);
+
+               if (value.length <= cache_value.length) {
+                       /*
+                        * We can reuse the existing record
+                        */
+                       memcpy(cache_value.data, value.data, value.length);
+                       e->valuelength = value.length;
+                       return;
+               }
+
+               memcache_delete_element(cache, e);
+       }
+
+       element_size = memcache_element_size(key.length, value.length);
+
+
+       e = (struct memcache_element *)SMB_MALLOC(element_size);
+
+       if (e == NULL) {
+               DEBUG(0, ("malloc failed\n"));
+               return;
+       }
+
+       e->n = n;
+       e->keylength = key.length;
+       e->valuelength = value.length;
+
+       memcache_element_parse(e, &cache_key, &cache_value);
+       memcpy(cache_key.data, key.data, key.length);
+       memcpy(cache_value.data, value.data, value.length);
+
+       parent = NULL;
+       p = &cache->tree.rb_node;
+
+       while (*p) {
+               struct memcache_element *elem = memcache_node2elem(*p);
+               int cmp;
+
+               parent = (*p);
+
+               cmp = memcache_compare(elem, n, key);
+
+               p = (cmp < 0) ? &(*p)->rb_left : &(*p)->rb_right;
+       }
+
+       rb_link_node(&e->rb_node, parent, p);
+       rb_insert_color(&e->rb_node, &cache->tree);
+
+       DLIST_ADD(cache->mru, e);
+       if (cache->lru == NULL) {
+               cache->lru = e;
+       }
+
+       cache->size += element_size;
+       memcache_trim(cache);
+}
+
+void memcache_add_talloc(struct memcache *cache, enum memcache_number n,
+                        DATA_BLOB key, void *ptr)
+{
+       memcache_add(cache, n, key, data_blob_const(&ptr, sizeof(ptr)));
+}
+
+void memcache_flush(struct memcache *cache, enum memcache_number n)
+{
+       struct rb_node *node;
+
+       if (cache == NULL) {
+               cache = global_cache;
+       }
+       if (cache == NULL) {
+               return;
+       }
+
+       /*
+        * Find the smallest element of number n
+        */
+
+       node = cache->tree.rb_node;
+       if (node == NULL) {
+               return;
+       }
+
+       while (true) {
+               struct memcache_element *elem = memcache_node2elem(node);
+               struct rb_node *next;
+
+               if ((int)elem->n < (int)n) {
+                       next = node->rb_right;
+               }
+               else {
+                       next = node->rb_left;
+               }
+               if (next == NULL) {
+                       break;
+               }
+               node = next;
+       }
+
+       node = rb_next(node);
+       if (node == NULL) {
+               return;
+       }
+
+       while (node != NULL) {
+               struct memcache_element *e = memcache_node2elem(node);
+               struct rb_node *next = rb_next(node);
+
+               memcache_delete_element(cache, e);
+               node = next;
+       }
+}
index 6e9b934a7576a9d922bfa1346492223a76b803e1..f1a02e6af9fdb3d6cc8ff86c2c888b17b531b7b5 100644 (file)
 #ifdef CLUSTER_SUPPORT
 
 #include "librpc/gen_ndr/messaging.h"
+#include "ctdb.h"
+#include "ctdb_private.h"
+#include "ctdbd_conn.h"
+
 
 struct messaging_ctdbd_context {
        struct ctdbd_connection *conn;
index fa06d14b49d20abb9e0523ae3e25ad361af8bb29..285bd9c4c07e32dc2963cb47556397d82926b767 100644 (file)
@@ -57,6 +57,7 @@ static NTSTATUS do_smb_load_module(const char *module_name, bool is_probe)
        if (error) {
                DEBUG(0, ("Error trying to resolve symbol 'init_module' in %s: %s\n", 
                          module_name, error));
+               sys_dlclose(handle);
                return NT_STATUS_UNSUCCESSFUL;
        }
 
@@ -66,6 +67,7 @@ static NTSTATUS do_smb_load_module(const char *module_name, bool is_probe)
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(0, ("Module '%s' initialization failed: %s\n",
                            module_name, get_friendly_nt_error_msg(status)));
+               sys_dlclose(handle);
        }
 
        return status;
index a839b42588f1b7d779f6e284f8adda7bf1af14d9..8b69f1c2d2ca7c39cad7e1b2eb14abd1bf7411e4 100644 (file)
@@ -152,6 +152,8 @@ int ms_fnmatch(const char *pattern, const char *string, bool translate_pattern,
        smb_ucs2_t *s = NULL;
        int ret, count, i;
        struct max_n *max_n = NULL;
+       struct max_n *max_n_free = NULL;
+       struct max_n one_max_n;
 
        if (ISDOTDOT(string)) {
                string = ".";
@@ -201,17 +203,27 @@ int ms_fnmatch(const char *pattern, const char *string, bool translate_pattern,
        }
 
        if (count != 0) {
-               max_n = SMB_CALLOC_ARRAY(struct max_n, count);
-               if (!max_n) {
-                       SAFE_FREE(p);
-                       SAFE_FREE(s);
-                       return -1;
+               if (count == 1) {
+                       /*
+                        * We're doing this a LOT, so save the effort to allocate
+                        */
+                       ZERO_STRUCT(one_max_n);
+                       max_n = &one_max_n;
+               }
+               else {
+                       max_n = SMB_CALLOC_ARRAY(struct max_n, count);
+                       if (!max_n) {
+                               SAFE_FREE(p);
+                               SAFE_FREE(s);
+                               return -1;
+                       }
+                       max_n_free = max_n;
                }
        }
 
        ret = ms_fnmatch_core(p, s, max_n, strrchr_w(s, UCS2_CHAR('.')), is_case_sensitive);
 
-       SAFE_FREE(max_n);
+       SAFE_FREE(max_n_free);
        SAFE_FREE(p);
        SAFE_FREE(s);
        return ret;
diff --git a/source/lib/netapi/examples/Makefile.in b/source/lib/netapi/examples/Makefile.in
new file mode 100644 (file)
index 0000000..86e1b1b
--- /dev/null
@@ -0,0 +1,67 @@
+GTK_FLAGS=`pkg-config gtk+-2.0 --cflags`
+GTK_LIBS=`pkg-config gtk+-2.0 --libs`
+
+KRB5LIBS=@KRB5_LIBS@
+LDAP_LIBS=@LDAP_LIBS@
+LIBS=@LIBS@ -lnetapi
+DEVELOPER_CFLAGS=@DEVELOPER_CFLAGS@
+FLAGS=-I../ -L../../../bin @CFLAGS@ $(GTK_FLAGS)
+CC=@CC@
+LDFLAGS=@PIE_LDFLAGS@ @LDFLAGS@
+DYNEXP=@DYNEXP@
+
+# Compile a source file.
+COMPILE_CC = $(CC) -I. $(FLAGS) $(PICFLAG) -c $< -o $@
+COMPILE = $(COMPILE_CC)
+
+BINARY_PREREQS = proto_exists bin/.dummy
+
+MAKEDIR = || exec false; \
+         if test -d "$$dir"; then :; else \
+         echo mkdir "$$dir"; \
+         mkdir -p "$$dir" >/dev/null 2>&1 || \
+         test -d "$$dir" || \
+         mkdir "$$dir" || \
+         exec false; fi || exec false
+
+.c.o:
+       @if (: >> $@ || : > $@) >/dev/null 2>&1; then rm -f $@; else \
+        dir=`echo $@ | sed 's,/[^/]*$$,,;s,^$$,.,'` $(MAKEDIR); fi
+       @echo Compiling $*.c
+       @$(COMPILE) && exit 0;\
+               echo "The following command failed:" 1>&2;\
+               echo "$(COMPILE_CC)" 1>&2;\
+               $(COMPILE_CC) >/dev/null 2>&1
+
+GETDC_OBJ = getdc/getdc.o
+NETDOMJOIN_OBJ = netdomjoin/netdomjoin.o
+NETDOMJOIN_GUI_OBJ = netdomjoin-gui/netdomjoin-gui.o
+GETJOINABLEOUS_OBJ = getjoinableous/getjoinableous.o
+
+PROGS = bin/getdc@EXEEXT@ \
+       bin/netdomjoin@EXEEXT@ \
+       bin/netdomjoin-gui@EXEEXT@ \
+       bin/getjoinableous@EXEEXT@
+
+all: $(PROGS)
+
+bin/getdc@EXEEXT@: $(GETDC_OBJ)
+       @echo Linking $@
+       @$(CC) $(FLAGS) -o $@ $(GETDC_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) $(KRB5LIBS) $(LDAP_LIBS)
+
+bin/getjoinableous@EXEEXT@: $(GETJOINABLEOUS_OBJ)
+       @echo Linking $@
+       @$(CC) $(FLAGS) -o $@ $(GETJOINABLEOUS_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) $(KRB5LIBS) $(LDAP_LIBS)
+
+bin/netdomjoin@EXEEXT@: $(NETDOMJOIN_OBJ)
+       @echo Linking $@
+       @$(CC) $(FLAGS) -o $@ $(NETDOMJOIN_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) $(KRB5LIBS) $(LDAP_LIBS)
+
+bin/netdomjoin-gui@EXEEXT@: $(NETDOMJOIN_GUI_OBJ)
+       @echo Linking $@
+       @$(CC) $(FLAGS) $(GTK_FLAGS) -o $@ $(NETDOMJOIN_GUI_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) $(KRB5LIBS) $(LDAP_LIBS) $(GTK_LIBS)
+
+clean:
+       -rm -f $(PROGS)
+       -rm -f core */*~ *~ \
+               */*.o */*/*.o */*/*/*.o \
diff --git a/source/lib/netapi/examples/getdc/getdc.c b/source/lib/netapi/examples/getdc/getdc.c
new file mode 100644 (file)
index 0000000..272ba10
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ *  Unix SMB/CIFS implementation.
+ *  GetDCName query
+ *  Copyright (C) Guenther Deschner 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 <sys/types.h>
+#include <inttypes.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <netapi.h>
+
+int main(int argc, char **argv)
+{
+       NET_API_STATUS status;
+       struct libnetapi_ctx *ctx = NULL;
+       uint8_t *buffer = NULL;
+
+       if (argc < 3) {
+               printf("usage: getdc <hostname> <domain>\n");
+               return -1;
+       }
+
+       status = libnetapi_init(&ctx);
+       if (status != 0) {
+               return status;
+       }
+
+       libnetapi_set_username(ctx, "");
+       libnetapi_set_password(ctx, "");
+
+       status = NetGetDCName(argv[1], argv[2], &buffer);
+       if (status != 0) {
+               printf("GetDcName failed with: %s\n", libnetapi_errstr(status));
+       } else {
+               printf("%s\n", (char *)buffer);
+       }
+       NetApiBufferFree(buffer);
+       libnetapi_free(ctx);
+
+       return status;
+}
diff --git a/source/lib/netapi/examples/getjoinableous/getjoinableous.c b/source/lib/netapi/examples/getjoinableous/getjoinableous.c
new file mode 100644 (file)
index 0000000..5a3366c
--- /dev/null
@@ -0,0 +1,104 @@
+/*
+ *  Unix SMB/CIFS implementation.
+ *  Join Support (cmdline + netapi)
+ *  Copyright (C) Guenther Deschner 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/>.
+ */
+
+#include <string.h>
+#include <stdio.h>
+
+#include <netapi.h>
+
+char *get_string_param(const char *param)
+{
+       char *p;
+
+       p = strchr(param, '=');
+       if (!p) {
+               return NULL;
+       }
+
+       return (p+1);
+}
+
+int main(int argc, char **argv)
+{
+       NET_API_STATUS status;
+       const char *server_name = NULL;
+       const char *domain_name = NULL;
+       const char *account = NULL;
+       const char *password = NULL;
+       const char **ous = NULL;
+       uint32_t num_ous = 0;
+       struct libnetapi_ctx *ctx = NULL;
+       int i;
+
+       status = libnetapi_init(&ctx);
+       if (status != 0) {
+               return status;
+       }
+
+       if (argc < 2) {
+               printf("usage: getjoinableous\n");
+               printf("\t<hostname> [domain=DOMAIN] <user=USER> <password=PASSWORD>\n");
+               return 0;
+       }
+
+       if (argc > 2) {
+               server_name = argv[1];
+       }
+
+       for (i=0; i<argc; i++) {
+               if (strncasecmp(argv[i], "domain", strlen("domain"))== 0) {
+                       domain_name = get_string_param(argv[i]);
+               }
+               if (strncasecmp(argv[i], "user", strlen("user"))== 0) {
+                       account = get_string_param(argv[i]);
+                       libnetapi_set_username(ctx, account);
+               }
+               if (strncasecmp(argv[i], "password", strlen("password"))== 0) {
+                       password = get_string_param(argv[i]);
+                       libnetapi_set_password(ctx, password);
+               }
+               if (strncasecmp(argv[i], "debug", strlen("debug"))== 0) {
+                       const char *str = NULL;
+                       str = get_string_param(argv[i]);
+                       libnetapi_set_debuglevel(ctx, str);
+               }
+       }
+
+       status = NetGetJoinableOUs(server_name,
+                                  domain_name,
+                                  account,
+                                  password,
+                                  &num_ous,
+                                  &ous);
+       if (status != 0) {
+               printf("failed with: %s\n",
+                       libnetapi_get_error_string(ctx, status));
+       } else {
+               printf("Successfully queried joinable ous:\n");
+               for (i=0; i<num_ous; i++) {
+                       printf("ou: %s\n", ous[i]);
+               }
+       }
+
+       NetApiBufferFree(ous);
+
+       libnetapi_free(ctx);
+
+       return status;
+}
diff --git a/source/lib/netapi/examples/netdomjoin-gui/logo-small.png b/source/lib/netapi/examples/netdomjoin-gui/logo-small.png
new file mode 100644 (file)
index 0000000..f041198
Binary files /dev/null and b/source/lib/netapi/examples/netdomjoin-gui/logo-small.png differ
diff --git a/source/lib/netapi/examples/netdomjoin-gui/logo.png b/source/lib/netapi/examples/netdomjoin-gui/logo.png
new file mode 100644 (file)
index 0000000..6df4ace
Binary files /dev/null and b/source/lib/netapi/examples/netdomjoin-gui/logo.png differ
diff --git a/source/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c b/source/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c
new file mode 100644 (file)
index 0000000..73b14d4
--- /dev/null
@@ -0,0 +1,1408 @@
+/*
+ *  Unix SMB/CIFS implementation.
+ *  Join Support (gtk + netapi)
+ *  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/>.
+ */
+
+#define _GNU_SOURCE
+#include <stdio.h>
+#include <sys/types.h>
+#include <inttypes.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <netdb.h>
+
+#include <gtk/gtk.h>
+#include <glib/gprintf.h>
+
+#include <netapi.h>
+
+#define MAX_CRED_LEN 256
+#define MAX_NETBIOS_NAME_LEN 15
+
+#define SAMBA_ICON_PATH  "/usr/share/pixmaps/samba/samba.ico"
+#define SAMBA_IMAGE_PATH "/usr/share/pixmaps/samba/logo.png"
+#define SAMBA_IMAGE_PATH_SMALL "/usr/share/pixmaps/samba/logo-small.png"
+
+#define WKSSVC_JOIN_FLAGS_DOMAIN_JOIN_IF_JOINED ( 0x00000020 )
+#define WKSSVC_JOIN_FLAGS_ACCOUNT_DELETE ( 0x00000004 )
+#define WKSSVC_JOIN_FLAGS_ACCOUNT_CREATE ( 0x00000002 )
+#define WKSSVC_JOIN_FLAGS_JOIN_TYPE ( 0x00000001 )
+
+#define NetSetupWorkgroupName ( 2 )
+#define NetSetupDomainName ( 3 )
+
+#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
+
+struct srvsvc_NetSrvInfo1005 {
+       const char *comment;/* [unique,charset(UTF16)] */
+};
+
+static gboolean verbose = FALSE;
+
+typedef struct join_state {
+       struct libnetapi_ctx *ctx;
+       GtkWidget *window_main;
+       GtkWidget *window_parent;
+       GtkWidget *window_do_change;
+       GtkWidget *window_creds_prompt;
+       GtkWidget *entry_account;
+       GtkWidget *entry_password;
+       GtkWidget *entry_domain;
+       GtkWidget *entry_workgroup;
+       GtkWidget *button_ok;
+       GtkWidget *button_apply;
+       GtkWidget *button_ok_creds;
+       GtkWidget *label_reboot;
+       GtkWidget *label_current_name_buffer;
+       GtkWidget *label_current_name_type;
+       GtkWidget *label_full_computer_name;
+       uint16_t name_type_initial;
+       uint16_t name_type_new;
+       char *name_buffer_initial;
+       char *name_buffer_new;
+       char *password;
+       char *account;
+       char *comment;
+       char *comment_new;
+       char *my_fqdn;
+       char *my_dnsdomain;
+       char *my_hostname;
+       uint16_t server_role;
+       gboolean settings_changed;
+       gboolean hostname_changed;
+} join_state;
+
+static void debug(const char *format, ...)
+{
+       va_list args;
+
+       if (!verbose) {
+               return;
+       }
+
+       va_start(args, format);
+       g_vprintf(format, args);
+       va_end(args);
+}
+
+static gboolean callback_delete_event(GtkWidget *widget,
+                                     GdkEvent *event,
+                                     gpointer data)
+{
+       gtk_main_quit();
+       return FALSE;
+}
+
+static void callback_do_close(GtkWidget *widget,
+                             gpointer data)
+{
+       debug("Closing now...\n");
+       gtk_widget_destroy(data);
+}
+
+static void free_join_state(struct join_state *s)
+{
+       SAFE_FREE(s->name_buffer_initial);
+       SAFE_FREE(s->name_buffer_new);
+       SAFE_FREE(s->password);
+       SAFE_FREE(s->account);
+       SAFE_FREE(s->comment);
+       SAFE_FREE(s->comment_new);
+       SAFE_FREE(s->my_fqdn);
+       SAFE_FREE(s->my_dnsdomain);
+       SAFE_FREE(s->my_hostname);
+}
+
+static void do_cleanup(struct join_state *state)
+{
+       libnetapi_free(state->ctx);
+       free_join_state(state);
+}
+
+static void callback_apply_description_change(GtkWidget *widget,
+                                             gpointer data)
+{
+       struct join_state *state = (struct join_state *)data;
+       NET_API_STATUS status = 0;
+       uint32_t parm_err = 0;
+       struct srvsvc_NetSrvInfo1005 info1005;
+       GtkWidget *dialog;
+
+       info1005.comment = state->comment_new;
+
+       status = NetServerSetInfo(NULL, 1005, (uint8_t *)&info1005, &parm_err); 
+       if (status) {
+               debug("NetServerSetInfo failed with: %s\n",
+                       libnetapi_errstr(status));
+               dialog = gtk_message_dialog_new(GTK_WINDOW(state->window_main),
+                                               GTK_DIALOG_DESTROY_WITH_PARENT,
+                                               GTK_MESSAGE_ERROR,
+                                               GTK_BUTTONS_OK,
+                                               "Failed to change computer description: %s.",
+                                               libnetapi_errstr(status));
+               g_signal_connect_swapped(dialog, "response",
+                                        G_CALLBACK(gtk_widget_destroy),
+                                        dialog);
+
+               gtk_widget_show(dialog);
+               return;
+       }
+
+       gtk_widget_set_sensitive(GTK_WIDGET(state->button_apply), FALSE);
+}
+
+static void callback_do_exit(GtkWidget *widget,
+                            gpointer data)
+{
+       GtkWidget *dialog;
+       gint result;
+       struct join_state *state = (struct join_state *)data;
+
+       if (!state->settings_changed) {
+               callback_delete_event(NULL, NULL, NULL);
+               return;
+       }
+
+       dialog = gtk_message_dialog_new(GTK_WINDOW(state->window_main),
+                                       GTK_DIALOG_DESTROY_WITH_PARENT,
+                                       GTK_MESSAGE_QUESTION,
+                                       GTK_BUTTONS_YES_NO,
+                                       "You must restart your computer before the new settings will take effect.");
+       result = gtk_dialog_run(GTK_DIALOG(dialog));
+       switch (result) {
+               case GTK_RESPONSE_YES:
+                       g_print("would reboot here\n");
+                       break;
+               case GTK_RESPONSE_NO:
+               default:
+                       break;
+       }
+       gtk_widget_destroy(dialog);
+       gtk_widget_destroy(state->window_main);
+       do_cleanup(state);
+       exit(0);
+}
+
+
+static void callback_do_reboot(GtkWidget *widget,
+                              gpointer data,
+                              gpointer data2)
+{
+       GtkWidget *dialog;
+       struct join_state *state = (struct join_state *)data2;
+
+       debug("callback_do_reboot\n");
+
+       state->settings_changed = TRUE;
+       dialog = gtk_message_dialog_new(GTK_WINDOW(data),
+                                       GTK_DIALOG_DESTROY_WITH_PARENT,
+                                       GTK_MESSAGE_INFO,
+                                       GTK_BUTTONS_OK,
+                                       "You must restart this computer for the changes to take effect.");
+#if 0
+       g_signal_connect_swapped(dialog, "response",
+                                G_CALLBACK(gtk_widget_destroy),
+                                dialog);
+
+       debug("showing dialog\n");
+       gtk_widget_show(dialog);
+#else
+       gtk_dialog_run(GTK_DIALOG(dialog));
+       gtk_widget_destroy(dialog);
+#endif
+
+       gtk_label_set_text(GTK_LABEL(state->label_reboot),
+                          "Changes will take effect after you restart this computer");
+
+       debug("destroying do_change window\n");
+       gtk_widget_destroy(GTK_WIDGET(state->window_do_change));
+
+       {
+               uint32_t status;
+               const char *buffer;
+               uint16_t type;
+
+               status = NetGetJoinInformation(NULL, &buffer, &type);
+               if (status != 0) {
+                       g_print("failed to query status\n");
+                       return;
+               }
+
+               debug("got new status: %s\n", buffer);
+#if 0
+               SAFE_FREE(state->name_buffer_new);
+               state->name_buffer_new = strdup(buffer);
+               SAFE_FREE(buffer);
+               state->name_type_new = type;
+#endif
+               NetApiBufferFree((void *)buffer);
+
+               gtk_label_set_text(GTK_LABEL(state->label_current_name_buffer),
+                                  state->name_buffer_new);
+               if (state->name_type_new == NetSetupDomainName) {
+                       gtk_label_set_text(GTK_LABEL(state->label_current_name_type),
+                                          "Domain:");
+               } else {
+                       gtk_label_set_text(GTK_LABEL(state->label_current_name_type),
+                                          "Workgroup:");
+               }
+       }
+}
+
+static void callback_return_username(GtkWidget *widget,
+                                    gpointer data)
+{
+       const gchar *entry_text;
+       struct join_state *state = (struct join_state *)data;
+       if (!widget) {
+               return;
+       }
+       entry_text = gtk_entry_get_text(GTK_ENTRY(widget));
+       debug("callback_return_username: %s\n", entry_text);
+       SAFE_FREE(state->account);
+       state->account = strdup(entry_text);
+}
+
+static void callback_return_username_and_enter(GtkWidget *widget,
+                                              gpointer data)
+{
+       const gchar *entry_text;
+       struct join_state *state = (struct join_state *)data;
+       if (!widget) {
+               return;
+       }
+       entry_text = gtk_entry_get_text(GTK_ENTRY(widget));
+       debug("callback_return_username: %s\n", entry_text);
+       SAFE_FREE(state->account);
+       state->account = strdup(entry_text);
+       g_signal_emit_by_name(state->button_ok_creds, "clicked");
+}
+
+static void callback_return_password(GtkWidget *widget,
+                                    gpointer data)
+{
+       const gchar *entry_text;
+       struct join_state *state = (struct join_state *)data;
+       if (!widget) {
+               return;
+       }
+       entry_text = gtk_entry_get_text(GTK_ENTRY(widget));
+#ifdef DEBUG_PASSWORD
+       debug("callback_return_password: %s\n", entry_text);
+#else
+       debug("callback_return_password: (not printed)\n");
+#endif
+       SAFE_FREE(state->password);
+       state->password = strdup(entry_text);
+}
+
+static void callback_return_password_and_enter(GtkWidget *widget,
+                                              gpointer data)
+{
+       const gchar *entry_text;
+       struct join_state *state = (struct join_state *)data;
+       if (!widget) {
+               return;
+       }
+       entry_text = gtk_entry_get_text(GTK_ENTRY(widget));
+#ifdef DEBUG_PASSWORD
+       debug("callback_return_password: %s\n", entry_text);
+#else
+       debug("callback_return_password: (not printed)\n");
+#endif
+       SAFE_FREE(state->password);
+       state->password = strdup(entry_text);
+       g_signal_emit_by_name(state->button_ok_creds, "clicked");
+}
+
+static void callback_do_hostname_change(GtkWidget *widget,
+                                       gpointer data)
+{
+       GtkWidget *dialog;
+       const char *str = NULL;
+
+       struct join_state *state = (struct join_state *)data;
+
+       switch (state->name_type_initial) {
+               case NetSetupDomainName:
+                       str = "To be implemented: call NetRenameMachineInDomain\n";
+                       break;
+               case NetSetupWorkgroupName:
+                       str = "To be implemented: call SetComputerNameEx\n";
+                       break;
+               default:
+                       break;
+       }
+
+       dialog = gtk_message_dialog_new(GTK_WINDOW(state->window_parent),
+                                       GTK_DIALOG_DESTROY_WITH_PARENT,
+                                       GTK_MESSAGE_ERROR,
+                                       GTK_BUTTONS_CLOSE,
+                                       str);
+
+       g_signal_connect_swapped(dialog, "response",
+                                G_CALLBACK(gtk_widget_destroy),
+                                dialog);
+       gtk_widget_show(dialog);
+}
+
+static void callback_do_join(GtkWidget *widget,
+                            gpointer data)
+{
+       GtkWidget *dialog;
+
+       NET_API_STATUS status;
+       const char *err_str = NULL;
+       uint32_t join_flags = 0;
+       uint32_t unjoin_flags = 0;
+       gboolean domain_join = FALSE;
+       gboolean try_unjoin = FALSE;
+       const char *new_workgroup_type = NULL;
+       const char *initial_workgroup_type = NULL;
+
+       struct join_state *state = (struct join_state *)data;
+
+       callback_return_username(state->entry_account, state);
+       callback_return_password(state->entry_password, state);
+
+       if (state->window_creds_prompt) {
+               gtk_widget_destroy(GTK_WIDGET(state->window_creds_prompt));
+       }
+
+       switch (state->name_type_initial) {
+               case NetSetupWorkgroupName:
+                       initial_workgroup_type = "workgroup";
+                       break;
+               case NetSetupDomainName:
+                       initial_workgroup_type = "domain";
+                       break;
+               default:
+                       break;
+       }
+
+       switch (state->name_type_new) {
+               case NetSetupWorkgroupName:
+                       new_workgroup_type = "workgroup";
+                       break;
+               case NetSetupDomainName:
+                       new_workgroup_type = "domain";
+                       break;
+               default:
+                       break;
+       }
+
+       if (state->name_type_new == NetSetupDomainName) {
+               domain_join = TRUE;
+               join_flags = WKSSVC_JOIN_FLAGS_JOIN_TYPE |
+                            WKSSVC_JOIN_FLAGS_ACCOUNT_CREATE |
+                            WKSSVC_JOIN_FLAGS_DOMAIN_JOIN_IF_JOINED; /* for testing */
+       }
+
+       if ((state->name_type_initial == NetSetupDomainName) &&
+           (state->name_type_new == NetSetupWorkgroupName)) {
+               try_unjoin = TRUE;
+               unjoin_flags = WKSSVC_JOIN_FLAGS_JOIN_TYPE |
+                              WKSSVC_JOIN_FLAGS_ACCOUNT_DELETE;
+       }
+
+       debug("callback_do_join: Joining a %s named %s using join_flags 0x%08x ",
+               new_workgroup_type,
+               state->name_buffer_new,
+               join_flags);
+       if (domain_join) {
+               debug("as %s ", state->account);
+#ifdef DEBUG_PASSWORD
+               debug("with %s ", state->password);
+#endif
+       }
+       debug("\n");
+       if (try_unjoin) {
+
+               debug("callback_do_join: Unjoining\n");
+
+               status = NetUnjoinDomain(NULL,
+                                        state->account,
+                                        state->password,
+                                        unjoin_flags);
+               if (status != 0) {
+                       err_str = libnetapi_get_error_string(state->ctx, status);
+                       g_print("callback_do_join: failed to unjoin (%s)\n",
+                               err_str);
+
+                       dialog = gtk_message_dialog_new(GTK_WINDOW(state->window_parent),
+                                                       GTK_DIALOG_DESTROY_WITH_PARENT,
+                                                       GTK_MESSAGE_ERROR,
+                                                       GTK_BUTTONS_CLOSE,
+                                                       "The following error occured attempting to unjoin the %s: \"%s\": %s",
+                                                       initial_workgroup_type,
+                                                       state->name_buffer_initial,
+                                                       err_str);
+                       gtk_dialog_run(GTK_DIALOG(dialog));
+                       gtk_widget_destroy(dialog);
+               }
+
+       }
+       status = NetJoinDomain(NULL,
+                              state->name_buffer_new,
+                              NULL,
+                              state->account,
+                              state->password,
+                              join_flags);
+       if (status != 0) {
+               err_str = libnetapi_get_error_string(state->ctx, status);
+               g_print("callback_do_join: failed to join (%s)\n", err_str);
+
+               dialog = gtk_message_dialog_new(GTK_WINDOW(state->window_parent),
+                                               GTK_DIALOG_DESTROY_WITH_PARENT,
+                                               GTK_MESSAGE_ERROR,
+                                               GTK_BUTTONS_CLOSE,
+                                               "The following error occured attempting to join the %s: \"%s\": %s",
+                                               new_workgroup_type,
+                                               state->name_buffer_new,
+                                               err_str);
+
+               g_signal_connect_swapped(dialog, "response",
+                                        G_CALLBACK(gtk_widget_destroy),
+                                        dialog);
+
+               gtk_widget_show(dialog);
+
+               return;
+       }
+
+       debug("callback_do_join: Successfully joined %s\n",
+               new_workgroup_type);
+
+       dialog = gtk_message_dialog_new(GTK_WINDOW(state->window_parent),
+                                       GTK_DIALOG_DESTROY_WITH_PARENT,
+                                       GTK_MESSAGE_INFO,
+                                       GTK_BUTTONS_OK,
+                                       "Welcome to the %s %s.",
+                                       state->name_buffer_new,
+                                       new_workgroup_type);
+
+       gtk_dialog_run(GTK_DIALOG(dialog));
+       gtk_widget_destroy(dialog);
+
+       callback_do_reboot(NULL, state->window_parent, state);
+}
+
+static void callback_creds_prompt(GtkWidget *widget,
+                                 gpointer data)
+{
+       GtkWidget *window;
+       GtkWidget *box1;
+       GtkWidget *bbox;
+       GtkWidget *button;
+       GtkWidget *label;
+
+       struct join_state *state = (struct join_state *)data;
+
+       debug("callback_creds_prompt:\n");
+
+       state->window_parent = state->window_do_change;
+
+       if (state->hostname_changed) {
+               return callback_do_hostname_change(NULL, state);
+       }
+
+       if ((state->name_type_initial != NetSetupDomainName) &&
+           (state->name_type_new != NetSetupDomainName)) {
+               return callback_do_join(NULL, state);
+       }
+
+       window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+
+       gtk_window_set_title(GTK_WINDOW(window), "Computer Name Changes");
+       gtk_window_set_resizable(GTK_WINDOW(window), FALSE);
+       gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
+       gtk_widget_set_size_request(GTK_WIDGET(window), 380, 280);
+       gtk_window_set_icon_from_file(GTK_WINDOW(window), SAMBA_ICON_PATH, NULL);
+/*     gtk_window_set_icon_name(GTK_WIDGET(window), GTK_STOCK_DIALOG_AUTHENTICATION); */
+       state->window_creds_prompt = window;
+
+       g_signal_connect(G_OBJECT(window), "delete_event",
+                        G_CALLBACK(callback_do_close), window);
+
+       gtk_container_set_border_width(GTK_CONTAINER(window), 10);
+
+       box1 = gtk_vbox_new(FALSE, 0);
+
+       gtk_container_add(GTK_CONTAINER(window), box1);
+
+       if ((state->name_type_initial == NetSetupDomainName) &&
+           (state->name_type_new == NetSetupWorkgroupName)) {
+               label = gtk_label_new("Enter the name and password of an account with permission to leave the domain.\n");
+       } else {
+               label = gtk_label_new("Enter the name and password of an account with permission to join the domain.\n");
+       }
+       gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
+       gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
+
+       gtk_box_pack_start(GTK_BOX(box1), label, FALSE, FALSE, 0);
+
+       gtk_widget_show(label);
+
+       /* USER NAME */
+       label = gtk_label_new("User name:");
+       gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
+       gtk_box_pack_start(GTK_BOX(box1), label, FALSE, FALSE, 0);
+       gtk_widget_show(label);
+
+       state->entry_account = gtk_entry_new();
+       gtk_entry_set_max_length(GTK_ENTRY(state->entry_account), MAX_CRED_LEN);
+       g_signal_connect(G_OBJECT(state->entry_account), "activate",
+                        G_CALLBACK(callback_return_username_and_enter),
+                        (gpointer)state);
+       gtk_editable_select_region(GTK_EDITABLE(state->entry_account),
+                                  0, GTK_ENTRY(state->entry_account)->text_length);
+       gtk_box_pack_start(GTK_BOX(box1), state->entry_account, TRUE, TRUE, 0);
+       gtk_widget_show(state->entry_account);
+
+       /* PASSWORD */
+       label = gtk_label_new("Password:");
+       gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
+       gtk_box_pack_start(GTK_BOX(box1), label, FALSE, FALSE, 0);
+       gtk_widget_show(label);
+
+       state->entry_password = gtk_entry_new();
+       gtk_entry_set_max_length(GTK_ENTRY(state->entry_password), MAX_CRED_LEN);
+       gtk_entry_set_visibility(GTK_ENTRY(state->entry_password), FALSE);
+       g_signal_connect(G_OBJECT(state->entry_password), "activate",
+                        G_CALLBACK(callback_return_password_and_enter),
+                        (gpointer)state);
+       gtk_editable_set_editable(GTK_EDITABLE(state->entry_password), TRUE);
+       gtk_editable_select_region(GTK_EDITABLE(state->entry_password),
+                                  0, GTK_ENTRY(state->entry_password)->text_length);
+       gtk_box_pack_start(GTK_BOX(box1), state->entry_password, TRUE, TRUE, 0);
+       gtk_widget_show(state->entry_password);
+
+       bbox = gtk_hbutton_box_new();
+       gtk_container_set_border_width(GTK_CONTAINER(bbox), 5);
+       gtk_container_add(GTK_CONTAINER(box1), bbox);
+       gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END);
+       gtk_box_set_spacing(GTK_BOX(bbox), 10);
+
+       state->button_ok_creds = gtk_button_new_from_stock(GTK_STOCK_OK);
+       gtk_widget_grab_focus(GTK_WIDGET(state->button_ok_creds));
+       gtk_container_add(GTK_CONTAINER(bbox), state->button_ok_creds);
+       g_signal_connect(G_OBJECT(state->button_ok_creds), "clicked",
+                        G_CALLBACK(callback_do_join),
+                        (gpointer)state);
+       gtk_widget_show(state->button_ok_creds);
+
+       button = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
+       gtk_container_add(GTK_CONTAINER(bbox), button);
+       g_signal_connect(G_OBJECT(button), "clicked",
+                        G_CALLBACK(callback_do_close), (gpointer) window);
+       gtk_widget_show_all(window);
+}
+
+static void callback_enter_hostname_and_unlock(GtkWidget *widget,
+                                              gpointer data)
+{
+       const gchar *entry_text = NULL;
+       char *str = NULL;
+       struct join_state *state = (struct join_state *)data;
+
+       entry_text = gtk_entry_get_text(GTK_ENTRY(widget));
+       debug("callback_enter_hostname_and_unlock: %s\n", entry_text);
+       if (!entry_text || entry_text[0] == 0) {
+               state->hostname_changed = FALSE;
+               gtk_widget_set_sensitive(GTK_WIDGET(state->button_ok), FALSE);
+               return;
+       }
+       if (strcasecmp(state->my_hostname, entry_text) == 0) {
+               state->hostname_changed = FALSE;
+               gtk_widget_set_sensitive(GTK_WIDGET(state->button_ok), FALSE);
+               return;
+       }
+       state->hostname_changed = TRUE;
+       if (state->name_type_initial == NetSetupDomainName) {
+               asprintf(&str, "%s.%s", entry_text, state->my_dnsdomain);
+       } else {
+               asprintf(&str, "%s.", entry_text);
+       }
+       gtk_label_set_text(GTK_LABEL(state->label_full_computer_name), str);
+       free(str);
+
+       if (state->hostname_changed && str && str[0] != 0 && str[0] != '.') {
+               gtk_widget_set_sensitive(GTK_WIDGET(state->button_ok), TRUE);
+       }
+}
+
+static void callback_enter_computer_description_and_unlock(GtkWidget *widget,
+                                                          gpointer data)
+{
+       const gchar *entry_text = NULL;
+       struct join_state *state = (struct join_state *)data;
+       int string_unchanged = 0;
+
+       entry_text = gtk_entry_get_text(GTK_ENTRY(widget));
+       debug("callback_enter_computer_description_and_unlock: %s\n",
+               entry_text);
+#if 0
+       if (!entry_text || entry_text[0] == 0) {
+               string_unchanged = 1;
+               gtk_widget_set_sensitive(GTK_WIDGET(state->button_apply),
+                                        FALSE);
+               return;
+       }
+#endif
+       if (entry_text && strcasecmp(state->comment, entry_text) == 0) {
+               string_unchanged = 1;
+               gtk_widget_set_sensitive(GTK_WIDGET(state->button_apply),
+                                        FALSE);
+               return;
+       }
+
+       gtk_widget_set_sensitive(GTK_WIDGET(state->button_apply), TRUE);
+       SAFE_FREE(state->comment_new);
+       state->comment_new = strdup(entry_text);
+
+}
+
+
+static void callback_enter_workgroup_and_unlock(GtkWidget *widget,
+                                               gpointer data)
+{
+       const gchar *entry_text = NULL;
+       struct join_state *state = (struct join_state *)data;
+
+       entry_text = gtk_entry_get_text(GTK_ENTRY(widget));
+       debug("callback_enter_workgroup_and_unlock: %s\n", entry_text);
+       if (!entry_text || entry_text[0] == 0) {
+               gtk_widget_set_sensitive(GTK_WIDGET(state->button_ok), FALSE);
+               return;
+       }
+       if (strcasecmp(state->name_buffer_initial, entry_text) == 0) {
+               gtk_widget_set_sensitive(GTK_WIDGET(state->button_ok), FALSE);
+               return;
+       }
+       gtk_widget_set_sensitive(GTK_WIDGET(state->button_ok), TRUE);
+       SAFE_FREE(state->name_buffer_new);
+       state->name_buffer_new = strdup(entry_text);
+       state->name_type_new = NetSetupWorkgroupName;
+}
+
+static void callback_enter_domain_and_unlock(GtkWidget *widget,
+                                            gpointer data)
+{
+       const gchar *entry_text = NULL;
+       struct join_state *state = (struct join_state *)data;
+
+       entry_text = gtk_entry_get_text(GTK_ENTRY(widget));
+       debug("callback_enter_domain_and_unlock: %s\n", entry_text);
+       if (!entry_text || entry_text[0] == 0) {
+               gtk_widget_set_sensitive(GTK_WIDGET(state->button_ok), FALSE);
+               return;
+       }
+       if (strcasecmp(state->name_buffer_initial, entry_text) == 0) {
+               gtk_widget_set_sensitive(GTK_WIDGET(state->button_ok), FALSE);
+               return;
+       }
+       gtk_widget_set_sensitive(GTK_WIDGET(state->button_ok), TRUE);
+       SAFE_FREE(state->name_buffer_new);
+       state->name_buffer_new = strdup(entry_text);
+       state->name_type_new = NetSetupDomainName;
+}
+
+static void callback_continue(GtkWidget *widget,
+                             gpointer data)
+{
+       struct join_state *state = (struct join_state *)data;
+
+       gtk_widget_grab_focus(GTK_WIDGET(state->button_ok));
+       g_signal_emit_by_name(state->button_ok, "clicked");
+}
+
+static void callback_apply_continue(GtkWidget *widget,
+                                   gpointer data)
+{
+       struct join_state *state = (struct join_state *)data;
+
+       gtk_widget_grab_focus(GTK_WIDGET(state->button_apply));
+       g_signal_emit_by_name(state->button_apply, "clicked");
+}
+
+static void callback_do_join_workgroup(GtkWidget *widget,
+                                      gpointer data)
+{
+       struct join_state *state = (struct join_state *)data;
+       debug("callback_do_join_workgroup choosen\n");
+       gtk_widget_set_sensitive(GTK_WIDGET(state->entry_workgroup), TRUE);
+       gtk_widget_grab_focus(GTK_WIDGET(state->entry_workgroup));
+       gtk_widget_set_sensitive(GTK_WIDGET(state->entry_domain), FALSE);
+       callback_enter_workgroup_and_unlock(state->entry_workgroup, state); /* TEST */
+}
+
+static void callback_do_join_domain(GtkWidget *widget,
+                                   gpointer data)
+{
+       struct join_state *state = (struct join_state *)data;
+       debug("callback_do_join_domain choosen\n");
+       gtk_widget_set_sensitive(GTK_WIDGET(state->entry_domain), TRUE);
+       gtk_widget_grab_focus(GTK_WIDGET(state->entry_domain));
+       gtk_widget_set_sensitive(GTK_WIDGET(state->entry_workgroup), FALSE);
+       callback_enter_domain_and_unlock(state->entry_domain, state); /* TEST */
+}
+
+static void callback_do_change(GtkWidget *widget,
+                              gpointer data)
+{
+       GtkWidget *window;
+       GtkWidget *box1;
+       GtkWidget *bbox;
+       GtkWidget *button_workgroup;
+       GtkWidget *button_domain;
+       GtkWidget *button;
+       GtkWidget *label;
+       GtkWidget *frame_horz;
+       GtkWidget *vbox;
+       GtkWidget *entry;
+       GSList *group;
+
+       struct join_state *state = (struct join_state *)data;
+
+       debug("callback_do_change called\n");
+
+#if 0
+       /* FIXME: add proper warnings for Samba as a DC */
+       if (state->server_role == 3) {
+               GtkWidget *dialog;
+               dialog = gtk_message_dialog_new(GTK_WINDOW(state->window_main),
+                                               GTK_DIALOG_DESTROY_WITH_PARENT,
+                                               GTK_MESSAGE_ERROR,
+                                               GTK_BUTTONS_OK,
+                                               "Domain controller cannot be moved from one domain to another, they must first be demoted. Renaming this domain controller may cause it to become temporarily unavailable to users and computers. For information on renaming domain controllers, including alternate renaming methods, see Help and Support. To continue renaming this domain controller, click OK.");
+               g_signal_connect_swapped(dialog, "response",
+                                        G_CALLBACK(gtk_widget_destroy),
+                                        dialog);
+
+               gtk_widget_show(dialog);
+               return;
+       }
+#endif
+
+       state->button_ok = gtk_button_new_from_stock(GTK_STOCK_OK);
+       window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+
+       gtk_window_set_title(GTK_WINDOW(window), "Computer Name Changes");
+       gtk_window_set_resizable(GTK_WINDOW(window), FALSE);
+       gtk_widget_set_size_request(GTK_WIDGET(window), 480, 500);
+       gtk_window_set_icon_from_file(GTK_WINDOW(window), SAMBA_ICON_PATH, NULL);
+
+       g_signal_connect(G_OBJECT(window), "delete_event",
+                        G_CALLBACK(callback_do_close), window);
+
+       gtk_container_set_border_width(GTK_CONTAINER(window), 10);
+
+       box1 = gtk_vbox_new(FALSE, 0);
+       gtk_container_add(GTK_CONTAINER(window), box1);
+
+       label = gtk_label_new("You can change the name and membership of this computer. Changes may affect access to network ressources.");
+       gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
+       gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
+       gtk_box_pack_start(GTK_BOX(box1), label, TRUE, TRUE, 0);
+       gtk_widget_show(label);
+
+       /* COMPUTER NAME */
+       label = gtk_label_new("Computer name:");
+       gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
+       gtk_box_pack_start(GTK_BOX(box1), label, TRUE, TRUE, 0);
+       gtk_widget_show(label);
+
+       state->label_full_computer_name = gtk_label_new(NULL);
+       {
+               entry = gtk_entry_new();
+               gtk_entry_set_max_length(GTK_ENTRY(entry), MAX_NETBIOS_NAME_LEN);
+               g_signal_connect(G_OBJECT(entry), "changed",
+                                G_CALLBACK(callback_enter_hostname_and_unlock),
+                                (gpointer)state);
+               gtk_entry_set_text(GTK_ENTRY(entry), state->my_hostname);
+               gtk_editable_select_region(GTK_EDITABLE(entry),
+                                          0, GTK_ENTRY(entry)->text_length);
+
+               gtk_editable_set_editable(GTK_EDITABLE(entry), TRUE); /* ! */
+               gtk_box_pack_start(GTK_BOX(box1), entry, TRUE, TRUE, 0);
+               gtk_widget_show(entry);
+       }
+
+       /* FULL COMPUTER NAME */
+       label = gtk_label_new("Full computer name:");
+       gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
+       gtk_box_pack_start(GTK_BOX(box1), label, TRUE, TRUE, 0);
+       gtk_widget_show(label);
+
+       {
+               const gchar *entry_text;
+               char *str = NULL;
+               entry_text = gtk_entry_get_text(GTK_ENTRY(entry));
+               if (state->name_type_initial == NetSetupDomainName) {
+                       asprintf(&str, "%s.%s", entry_text,
+                                state->my_dnsdomain);
+               } else {
+                       asprintf(&str, "%s.", entry_text);
+               }
+               gtk_label_set_text(GTK_LABEL(state->label_full_computer_name),
+                                  str);
+               free(str);
+               gtk_misc_set_alignment(GTK_MISC(state->label_full_computer_name), 0, 0);
+               gtk_box_pack_start(GTK_BOX(box1),
+                                  state->label_full_computer_name, TRUE, TRUE, 0);
+               gtk_widget_show(state->label_full_computer_name);
+       }
+
+       /* BOX */
+       frame_horz = gtk_frame_new ("Member Of");
+       gtk_box_pack_start(GTK_BOX(box1), frame_horz, TRUE, TRUE, 10);
+
+       vbox = gtk_vbox_new(FALSE, 0);
+       gtk_container_set_border_width(GTK_CONTAINER(vbox), 10);
+       gtk_container_add(GTK_CONTAINER(frame_horz), vbox);
+
+       /* TWO ENTRIES */
+       state->entry_workgroup = gtk_entry_new();
+       state->entry_domain = gtk_entry_new();
+
+       /* DOMAIN */
+       button_domain = gtk_radio_button_new_with_label(NULL, "Domain");
+       if (state->name_type_initial == NetSetupDomainName) {
+               gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button_domain), TRUE);
+       }
+       gtk_box_pack_start(GTK_BOX(vbox), button_domain, TRUE, TRUE, 0);
+       g_signal_connect(G_OBJECT(button_domain), "clicked",
+                        G_CALLBACK(callback_do_join_domain),
+                        (gpointer)state);
+
+       {
+               gtk_entry_set_max_length(GTK_ENTRY(state->entry_domain), 50);
+               g_signal_connect(G_OBJECT(state->entry_domain), "changed",
+                                G_CALLBACK(callback_enter_domain_and_unlock),
+                                (gpointer)state);
+               g_signal_connect(G_OBJECT(state->entry_domain), "activate",
+                                G_CALLBACK(callback_continue),
+                                (gpointer)state);
+               if (state->name_type_initial == NetSetupDomainName) {
+                       gtk_entry_set_text(GTK_ENTRY(state->entry_domain),
+                                          state->name_buffer_initial);
+                       gtk_widget_set_sensitive(state->entry_workgroup, FALSE);
+                       gtk_widget_set_sensitive(state->entry_domain, TRUE);
+               }
+               gtk_editable_set_editable(GTK_EDITABLE(state->entry_domain), TRUE);
+               gtk_box_pack_start(GTK_BOX(vbox), state->entry_domain, TRUE, TRUE, 0);
+               gtk_widget_show(state->entry_domain);
+       }
+       gtk_widget_show(button_domain);
+
+       /* WORKGROUP */
+       group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(button_domain));
+       button_workgroup = gtk_radio_button_new_with_label(group, "Workgroup");
+       if (state->name_type_initial == NetSetupWorkgroupName) {
+               gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button_workgroup), TRUE);
+       }
+       gtk_box_pack_start(GTK_BOX(vbox), button_workgroup, TRUE, TRUE, 0);
+       g_signal_connect(G_OBJECT(button_workgroup), "clicked",
+                        G_CALLBACK(callback_do_join_workgroup),
+                        (gpointer)state);
+       {
+               gtk_entry_set_max_length(GTK_ENTRY(state->entry_workgroup),
+                                        MAX_NETBIOS_NAME_LEN);
+               g_signal_connect(G_OBJECT(state->entry_workgroup), "changed",
+                                G_CALLBACK(callback_enter_workgroup_and_unlock),
+                                (gpointer)state);
+               g_signal_connect(G_OBJECT(state->entry_workgroup), "activate",
+                                G_CALLBACK(callback_continue),
+                                (gpointer)state);
+
+               if (state->name_type_initial == NetSetupWorkgroupName) {
+                       gtk_entry_set_text(GTK_ENTRY(state->entry_workgroup),
+                                          state->name_buffer_initial);
+                       gtk_widget_set_sensitive(GTK_WIDGET(state->entry_domain), FALSE);
+                       gtk_widget_set_sensitive(GTK_WIDGET(state->entry_workgroup), TRUE);
+               }
+               gtk_box_pack_start(GTK_BOX(vbox), state->entry_workgroup, TRUE, TRUE, 0);
+               gtk_widget_show(state->entry_workgroup);
+       }
+       gtk_widget_show(button_workgroup);
+
+       /* BUTTONS */
+       bbox = gtk_hbutton_box_new();
+       gtk_container_set_border_width(GTK_CONTAINER(bbox), 5);
+       gtk_container_add(GTK_CONTAINER(box1), bbox);
+       gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END);
+       gtk_box_set_spacing(GTK_BOX(bbox), 10);
+
+       state->window_do_change = window;
+       gtk_widget_set_sensitive(GTK_WIDGET(state->button_ok), FALSE); /* !!! */
+       gtk_container_add(GTK_CONTAINER(bbox), state->button_ok);
+       g_signal_connect(G_OBJECT(state->button_ok), "clicked",
+                        G_CALLBACK(callback_creds_prompt),
+                        (gpointer)state);
+
+       button = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
+       gtk_container_add(GTK_CONTAINER(bbox), button);
+       g_signal_connect(G_OBJECT(button), "clicked",
+                        G_CALLBACK(callback_do_close),
+                        (gpointer)window);
+
+       gtk_widget_show_all(window);
+
+}
+
+static void callback_do_about(GtkWidget *widget,
+                            gpointer data)
+{
+       GdkPixbuf *logo;
+       GError    *error = NULL;
+
+       debug("callback_do_about called\n");
+
+       logo = gdk_pixbuf_new_from_file(SAMBA_IMAGE_PATH,
+                                       &error);
+       if (logo == NULL) {
+               g_print("failed to load logo from %s: %s\n",
+                       SAMBA_IMAGE_PATH, error->message);
+       }
+
+       gtk_show_about_dialog(data,
+                             "name", "Samba",
+                             "version", "3.2.0pre2-GIT-904a90-test",
+                             "copyright", "Copyright Andrew Tridgell and the Samba Team 1992-2007",
+                             "website", "http://www.samba.org",
+                             "license", "GPLv3",
+                             "logo", logo,
+                             "comments", "Samba gtk domain join utility",
+                             NULL);
+}
+
+static int draw_main_window(struct join_state *state)
+{
+       GtkWidget *window;
+       GtkWidget *button;
+       GtkWidget *label;
+       GtkWidget *main_vbox;
+       GtkWidget *vbox;
+       GtkWidget *hbox;
+       GtkWidget *bbox;
+       GtkWidget *image;
+       GtkWidget *table;
+       GtkWidget *entry;
+       GdkPixbuf *icon;
+       GError    *error = NULL;
+
+       icon = gdk_pixbuf_new_from_file(SAMBA_ICON_PATH,
+                                       &error);
+       if (icon == NULL) {
+               g_print("failed to load icon from %s : %s\n",
+                       SAMBA_ICON_PATH, error->message);
+       }
+
+#if 1
+       image = gtk_image_new_from_file(SAMBA_IMAGE_PATH_SMALL);
+#else
+       image = gtk_image_new_from_file("/usr/share/pixmaps/redhat-system_settings.png");
+#endif
+       if (image == NULL) {
+               g_print("failed to load logo from %s : %s\n",
+                       SAMBA_IMAGE_PATH_SMALL, error->message);
+       }
+
+       window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+       state->window_main = window;
+
+       gtk_window_set_title(GTK_WINDOW(window), "Samba - Join Domain dialogue");
+       gtk_widget_set_size_request(GTK_WIDGET(window), 600, 600);
+       gtk_window_set_resizable(GTK_WINDOW(window), FALSE);
+       gtk_window_set_icon_from_file(GTK_WINDOW(window), SAMBA_ICON_PATH, NULL);
+
+       g_signal_connect(G_OBJECT(window), "delete_event",
+                        G_CALLBACK(callback_delete_event), NULL);
+
+       gtk_container_set_border_width(GTK_CONTAINER(window), 10);
+
+       main_vbox = gtk_vbox_new(FALSE, 10);
+       gtk_container_add(GTK_CONTAINER(window), main_vbox);
+
+#if 0
+       gtk_box_pack_start(GTK_BOX(main_vbox), image, TRUE, TRUE, 10);
+       gtk_widget_show(image);
+#endif
+       /* Hbox */
+       hbox = gtk_hbox_new(FALSE, 10);
+       gtk_container_add(GTK_CONTAINER(main_vbox), hbox);
+
+       {
+/*             gtk_box_pack_start(GTK_BOX(main_vbox), image, TRUE, TRUE, 10); */
+/*             gtk_misc_set_alignment(GTK_MISC(image), 0, 0); */
+               gtk_widget_set_size_request(GTK_WIDGET(image), 150, 40);
+               gtk_box_pack_start(GTK_BOX(hbox), image, FALSE, FALSE, 10);
+               gtk_widget_show(image);
+
+               /* Label */
+               label = gtk_label_new("Samba uses the following information to identify your computer on the network.");
+/*             gtk_misc_set_alignment(GTK_MISC(label), 0, 0); */
+               gtk_widget_set_size_request(GTK_WIDGET(label), 400, 40);
+               gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
+               gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
+               gtk_widget_show(label);
+       }
+
+       gtk_widget_show(hbox);
+
+       vbox = gtk_vbox_new(FALSE, 0);
+       gtk_container_set_border_width(GTK_CONTAINER(vbox), 10);
+       gtk_container_add(GTK_CONTAINER(main_vbox), vbox);
+
+       /* Table */
+       table = gtk_table_new(6, 3, TRUE);
+       gtk_table_set_row_spacings(GTK_TABLE(table), 5);
+       gtk_table_set_col_spacings(GTK_TABLE(table), 5);
+       gtk_container_add(GTK_CONTAINER(vbox), table);
+
+       {
+               /* Label */
+               label = gtk_label_new("Computer description:");
+/*             gtk_misc_set_alignment(GTK_MISC(label), 0, 0); */
+               gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1);
+               gtk_widget_show(label);
+
+               state->button_apply = gtk_button_new_from_stock(GTK_STOCK_APPLY);
+
+               /* Entry */
+               entry = gtk_entry_new();
+               gtk_entry_set_max_length(GTK_ENTRY(entry), 256);
+               g_signal_connect(G_OBJECT(entry), "changed",
+                                G_CALLBACK(callback_enter_computer_description_and_unlock),
+                                state);
+               g_signal_connect(G_OBJECT(entry), "activate",
+                                G_CALLBACK(callback_apply_continue),
+                                (gpointer)state);
+
+               gtk_entry_set_text(GTK_ENTRY(entry), (char *)state->comment);
+               gtk_editable_set_editable(GTK_EDITABLE(entry), TRUE); /* ! */
+               gtk_table_attach_defaults(GTK_TABLE(table), entry, 1, 3, 0, 1);
+               gtk_widget_show(entry);
+       }
+
+       /* Label */
+       label = gtk_label_new("For example: \"Samba \%v\".");
+       gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
+       gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
+       gtk_table_attach_defaults(GTK_TABLE(table), label, 1, 3, 1, 2);
+       gtk_widget_show(label);
+
+       /* Label */
+       label = gtk_label_new("Full computer name:");
+       gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
+       gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 2, 3);
+       gtk_widget_show(label);
+
+       {
+               /* Label */
+               char *str = NULL;
+               if (state->name_type_initial == NetSetupDomainName) {
+                       asprintf(&str, "%s.%s", state->my_hostname,
+                                state->my_dnsdomain);
+               } else {
+                       asprintf(&str, "%s.", state->my_hostname);
+               }
+
+               label = gtk_label_new(str);
+               SAFE_FREE(str);
+               gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
+               gtk_table_attach_defaults(GTK_TABLE(table), label, 1, 3, 2, 3);
+               gtk_widget_show(label);
+       }
+
+       /* Label */
+       if (state->name_type_initial == NetSetupDomainName) {
+               label = gtk_label_new("Domain:");
+       } else {
+               label = gtk_label_new("Workgroup:");
+       }
+       gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
+       gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 3, 4);
+       gtk_widget_show(label);
+       state->label_current_name_type = label;
+
+       /* Label */
+       label = gtk_label_new(state->name_buffer_initial);
+       gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
+       gtk_table_attach_defaults(GTK_TABLE(table), label, 1, 3, 3, 4);
+       gtk_widget_show(label);
+       state->label_current_name_buffer = label;
+
+       {
+               hbox = gtk_hbox_new(FALSE, 0);
+               gtk_container_add(GTK_CONTAINER(vbox), hbox);
+               label = gtk_label_new("To rename this computer or join a domain, click Change.");
+               gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
+
+
+       }
+
+       /* bbox */
+       bbox = gtk_hbutton_box_new();
+       gtk_container_set_border_width(GTK_CONTAINER(bbox), 5);
+       gtk_container_add(GTK_CONTAINER(hbox), bbox);
+       gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END);
+       gtk_box_set_spacing(GTK_BOX(bbox), 10);
+
+       button = gtk_button_new_with_mnemonic("Ch_ange");
+       g_signal_connect(G_OBJECT(button), "clicked",
+                        G_CALLBACK(callback_do_change),
+                        (gpointer)state);
+       gtk_box_pack_start(GTK_BOX(bbox), button, TRUE, TRUE, 0);
+       gtk_widget_show(button);
+
+       /* Label (hidden) */
+       state->label_reboot = gtk_label_new(NULL);
+       gtk_label_set_line_wrap(GTK_LABEL(state->label_reboot), TRUE);
+       gtk_misc_set_alignment(GTK_MISC(state->label_reboot), 0, 0);
+       gtk_box_pack_start(GTK_BOX(vbox), state->label_reboot, TRUE, TRUE, 0);
+       gtk_widget_show(state->label_reboot);
+
+#if 0
+       gtk_box_pack_start(GTK_BOX(vbox),
+          create_bbox(window, TRUE, NULL, 10, 85, 20, GTK_BUTTONBOX_END),
+                     TRUE, TRUE, 5);
+#endif
+       {
+
+               GtkWidget *frame;
+               GtkWidget *bbox2;
+               GtkWidget *button2;
+
+               frame = gtk_frame_new(NULL);
+               bbox2 = gtk_hbutton_box_new();
+
+               gtk_container_set_border_width(GTK_CONTAINER(bbox2), 5);
+               gtk_container_add(GTK_CONTAINER(frame), bbox2);
+
+               /* Set the appearance of the Button Box */
+               gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox2), GTK_BUTTONBOX_END);
+               gtk_box_set_spacing(GTK_BOX(bbox2), 10);
+               /*gtk_button_box_set_child_size(GTK_BUTTON_BOX(bbox2), child_w, child_h);*/
+
+               button2 = gtk_button_new_from_stock(GTK_STOCK_OK);
+               gtk_container_add(GTK_CONTAINER(bbox2), button2);
+               g_signal_connect(G_OBJECT(button2), "clicked", G_CALLBACK(callback_do_exit), state);
+
+               button2 = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
+               gtk_container_add(GTK_CONTAINER(bbox2), button2);
+               g_signal_connect(G_OBJECT(button2), "clicked",
+                                G_CALLBACK(callback_delete_event),
+                                window);
+
+               gtk_container_add(GTK_CONTAINER(bbox2), state->button_apply);
+               g_signal_connect(G_OBJECT(state->button_apply), "clicked",
+                                G_CALLBACK(callback_apply_description_change),
+                                state);
+               gtk_widget_set_sensitive(GTK_WIDGET(state->button_apply), FALSE);
+
+               button2 = gtk_button_new_from_stock(GTK_STOCK_ABOUT);
+               gtk_container_add(GTK_CONTAINER(bbox2), button2);
+               g_signal_connect(G_OBJECT(button2), "clicked",
+                                G_CALLBACK(callback_do_about),
+                                window);
+
+               gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 5);
+       }
+
+       gtk_widget_show_all(window);
+
+       return 0;
+}
+
+static int init_join_state(struct join_state **state)
+{
+       struct join_state *s;
+
+       s = malloc(sizeof(struct join_state));
+       if (!s) {
+               return -1;
+       }
+
+       memset(s, '\0', sizeof(struct join_state));
+
+       *state = s;
+
+       return 0;
+}
+
+static int initialize_join_state(struct join_state *state,
+                                const char *debug_level)
+{
+       struct libnetapi_ctx *ctx = NULL;
+       NET_API_STATUS status = 0;
+
+       status = libnetapi_init(&ctx);
+       if (status) {
+               return status;
+       }
+
+       if (debug_level) {
+               libnetapi_set_debuglevel(ctx, debug_level);
+       }
+
+       {
+               char my_hostname[HOST_NAME_MAX];
+               const char *p = NULL;
+               struct hostent *hp = NULL;
+
+               if (gethostname(my_hostname, sizeof(my_hostname)) == -1) {
+                       return -1;
+               }
+
+               p = strchr(my_hostname, '.');
+               if (p) {
+                       my_hostname[strlen(my_hostname)-strlen(p)] = '\0';
+               }
+               state->my_hostname = strdup(my_hostname);
+               if (!state->my_hostname) {
+                       return -1;
+               }
+               debug("state->my_hostname: %s\n", state->my_hostname);
+
+               hp = gethostbyname(my_hostname);
+               if (!hp || !hp->h_name || !*hp->h_name) {
+                       return -1;
+               }
+
+               state->my_fqdn = strdup(hp->h_name);
+               if (!state->my_fqdn) {
+                       return -1;
+               }
+               debug("state->my_fqdn: %s\n", state->my_fqdn);
+
+               p = strchr(state->my_fqdn, '.');
+               if (p) {
+                       p++;
+                       state->my_dnsdomain = strdup(p);
+               } else {
+                       state->my_dnsdomain = strdup("");
+               }
+               if (!state->my_dnsdomain) {
+                       return -1;
+               }
+               debug("state->my_dnsdomain: %s\n", state->my_dnsdomain);
+       }
+
+       {
+               const char *buffer = NULL;
+               uint16_t type = 0;
+               status = NetGetJoinInformation(NULL, &buffer, &type);
+               if (status != 0) {
+                       printf("NetGetJoinInformation failed with: %s\n",
+                               libnetapi_get_error_string(state->ctx, status));
+                       return status;
+               }
+               debug("NetGetJoinInformation gave: %s and %d\n", buffer, type);
+               state->name_buffer_initial = strdup(buffer);
+               if (!state->name_buffer_initial) {
+                       return -1;
+               }
+               state->name_type_initial = type;
+               NetApiBufferFree((void *)buffer);
+       }
+
+       {
+               struct srvsvc_NetSrvInfo1005 *info1005 = NULL;
+               uint8_t *buffer = NULL;
+
+               status = NetServerGetInfo(NULL, 1005, &buffer);
+               if (status != 0) {
+                       printf("NetServerGetInfo failed with: %s\n",
+                               libnetapi_get_error_string(state->ctx, status));
+                       return status;
+               }
+
+               info1005 = (struct srvsvc_NetSrvInfo1005 *)buffer;
+
+               state->comment = strdup(info1005->comment);
+               if (!state->comment) {
+                       return -1;
+               }
+               NetApiBufferFree(buffer);
+       }
+#if 0
+       {
+               struct srvsvc_NetSrvInfo100 *info100 = NULL;
+               uint8_t *buffer = NULL;
+
+               status = NetServerGetInfo(NULL, 100, &buffer);
+               if (status) {
+                       return status;
+               }
+
+               info100 = (struct srvsvc_NetSrvInfo100 *)buffer;
+
+               state->comment = strdup(info100->comment);
+               if (!state->comment) {
+                       return -1;
+               }
+       }
+#endif
+
+       state->ctx = ctx;
+
+       return 0;
+}
+
+int main(int argc, char **argv)
+{
+       GOptionContext *context = NULL;
+       static const char *debug_level = NULL;
+       struct join_state *state = NULL;
+       GError *error = NULL;
+       int ret = 0;
+
+       static GOptionEntry entries[] = {
+               { "debug", 'd', 0, G_OPTION_ARG_STRING, &debug_level, "Debug level (for samba)", "N" },
+               { "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose, "Verbose output", 0 },
+               { NULL }
+       };
+
+       context = g_option_context_new("- Samba domain join utility");
+       g_option_context_add_main_entries(context, entries, NULL);
+/*     g_option_context_add_main_entries(context, entries, GETTEXT_PACKAGE); */
+       g_option_context_add_group(context, gtk_get_option_group(TRUE));
+       g_option_context_parse(context, &argc, &argv, &error);
+
+       gtk_init(&argc, &argv);
+       g_set_application_name("Samba");
+
+       ret = init_join_state(&state);
+       if (ret) {
+               return ret;
+       }
+
+       ret = initialize_join_state(state, debug_level);
+       if (ret) {
+               return ret;
+       }
+
+       draw_main_window(state);
+
+       gtk_main();
+
+       do_cleanup(state);
+
+       return 0;
+}
diff --git a/source/lib/netapi/examples/netdomjoin-gui/samba.ico b/source/lib/netapi/examples/netdomjoin-gui/samba.ico
new file mode 100755 (executable)
index 0000000..b70c959
Binary files /dev/null and b/source/lib/netapi/examples/netdomjoin-gui/samba.ico differ
diff --git a/source/lib/netapi/examples/netdomjoin/netdomjoin.c b/source/lib/netapi/examples/netdomjoin/netdomjoin.c
new file mode 100644 (file)
index 0000000..29f66a1
--- /dev/null
@@ -0,0 +1,120 @@
+/*
+ *  Unix SMB/CIFS implementation.
+ *  Join Support (cmdline + netapi)
+ *  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/>.
+ */
+
+#include <sys/types.h>
+#include <inttypes.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <netapi.h>
+
+char *get_string_param(const char *param)
+{
+       char *p;
+
+       p = strchr(param, '=');
+       if (!p) {
+               return NULL;
+       }
+
+       return (p+1);
+}
+
+int main(int argc, char **argv)
+{
+       NET_API_STATUS status;
+       const char *server_name = NULL;
+       const char *domain_name = NULL;
+       const char *account_ou = NULL;
+       const char *Account = NULL;
+       const char *password = NULL;
+       uint32_t join_flags = 3;
+       struct libnetapi_ctx *ctx = NULL;
+       int i;
+
+       status = libnetapi_init(&ctx);
+       if (status != 0) {
+               return status;
+       }
+
+       if (argc < 2) {
+               printf("usage: netdomjoin\n");
+               printf("\t[hostname] [domain=DOMAIN] <ou=OU> "
+                      "<usero=USERO> <passwordo=PASSWORDO> "
+                      "<userd=USERD> <passwordd=PASSWORDD> "
+                      "<debug=DEBUGLEVEL>\n");
+               return 0;
+       }
+
+       if (argc > 2) {
+               server_name = argv[1];
+       }
+
+       for (i=0; i<argc; i++) {
+               if (strncasecmp(argv[i], "ou", strlen("ou")) == 0) {
+                       account_ou = get_string_param(argv[i]);
+               }
+               if (strncasecmp(argv[i], "domain", strlen("domain"))== 0) {
+                       domain_name = get_string_param(argv[i]);
+               }
+               if (strncasecmp(argv[i], "userd", strlen("userd"))== 0) {
+                       Account = get_string_param(argv[i]);
+               }
+               if (strncasecmp(argv[i], "passwordd", strlen("passwordd"))== 0) {
+                       password = get_string_param(argv[i]);
+               }
+               if (strncasecmp(argv[i], "usero", strlen("usero"))== 0) {
+                       const char *str = NULL;
+                       str = get_string_param(argv[i]);
+                       libnetapi_set_username(ctx, str);
+               }
+               if (strncasecmp(argv[i], "passwordo", strlen("passwordo"))== 0) {
+                       const char *str = NULL;
+                       str = get_string_param(argv[i]);
+                       libnetapi_set_password(ctx, str);
+               }
+               if (strncasecmp(argv[i], "debug", strlen("debug"))== 0) {
+                       const char *str = NULL;
+                       str = get_string_param(argv[i]);
+                       libnetapi_set_debuglevel(ctx, str);
+               }
+       }
+
+       status = NetJoinDomain(server_name,
+                              domain_name,
+                              account_ou,
+                              Account,
+                              password,
+                              join_flags);
+       if (status != 0) {
+               const char *errstr = NULL;
+               errstr = libnetapi_get_error_string(ctx, status);
+               if (!errstr) {
+                       errstr = libnetapi_errstr(status);
+               }
+               printf("Join failed with: %s\n", errstr);
+       } else {
+               printf("Successfully joined\n");
+       }
+
+       libnetapi_free(ctx);
+
+       return status;
+}
diff --git a/source/lib/netapi/getdc.c b/source/lib/netapi/getdc.c
new file mode 100644 (file)
index 0000000..2626eb0
--- /dev/null
@@ -0,0 +1,239 @@
+/*
+ *  Unix SMB/CIFS implementation.
+ *  NetApi GetDC Support
+ *  Copyright (C) Guenther Deschner 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 "lib/netapi/netapi.h"
+#include "libnet/libnet.h"
+
+/********************************************************************
+********************************************************************/
+
+static WERROR NetGetDCNameLocal(struct libnetapi_ctx *ctx,
+                               const char *server_name,
+                               const char *domain_name,
+                               uint8_t **buffer)
+{
+       return WERR_NOT_SUPPORTED;
+}
+
+/********************************************************************
+********************************************************************/
+
+static WERROR NetGetDCNameRemote(struct libnetapi_ctx *ctx,
+                                const char *server_name,
+                                const char *domain_name,
+                                uint8_t **buffer)
+{
+       struct cli_state *cli = NULL;
+       struct rpc_pipe_client *pipe_cli = NULL;
+       NTSTATUS status;
+       WERROR werr;
+
+       status = cli_full_connection(&cli, NULL, server_name,
+                                    NULL, 0,
+                                    "IPC$", "IPC",
+                                    ctx->username,
+                                    ctx->workgroup,
+                                    ctx->password,
+                                    0, Undefined, NULL);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               werr = ntstatus_to_werror(status);
+               goto done;
+       }
+
+       pipe_cli = cli_rpc_pipe_open_noauth(cli, PI_NETLOGON,
+                                           &status);
+       if (!pipe_cli) {
+               werr = ntstatus_to_werror(status);
+               goto done;
+       };
+
+       status = rpccli_netr_GetDcName(pipe_cli, ctx,
+                                      server_name,
+                                      domain_name,
+                                      (const char **)buffer,
+                                      &werr);
+ done:
+       if (cli) {
+               cli_shutdown(cli);
+       }
+
+       return werr;
+}
+
+/********************************************************************
+********************************************************************/
+
+static WERROR libnetapi_NetGetDCName(struct libnetapi_ctx *ctx,
+                                    const char *server_name,
+                                    const char *domain_name,
+                                    uint8_t **buffer)
+{
+       if (!server_name || is_myname_or_ipaddr(server_name)) {
+               return NetGetDCNameLocal(ctx,
+                                        server_name,
+                                        domain_name,
+                                        buffer);
+       }
+
+       return NetGetDCNameRemote(ctx,
+                                 server_name,
+                                 domain_name,
+                                 buffer);
+}
+
+/****************************************************************
+ NetGetDCName
+****************************************************************/
+
+NET_API_STATUS NetGetDCName(const char *server_name,
+                           const char *domain_name,
+                           uint8_t **buffer)
+{
+       struct libnetapi_ctx *ctx = NULL;
+       NET_API_STATUS status;
+       WERROR werr;
+
+       status = libnetapi_getctx(&ctx);
+       if (status != 0) {
+               return status;
+       }
+
+       werr = libnetapi_NetGetDCName(ctx,
+                                     server_name,
+                                     domain_name,
+                                     buffer);
+       if (!W_ERROR_IS_OK(werr)) {
+               return W_ERROR_V(werr);
+       }
+
+       return NET_API_STATUS_SUCCESS;
+}
+
+/********************************************************************
+********************************************************************/
+
+static WERROR NetGetAnyDCNameLocal(struct libnetapi_ctx *ctx,
+                                  const char *server_name,
+                                  const char *domain_name,
+                                  uint8_t **buffer)
+{
+       return WERR_NOT_SUPPORTED;
+}
+
+/********************************************************************
+********************************************************************/
+
+static WERROR NetGetAnyDCNameRemote(struct libnetapi_ctx *ctx,
+                                   const char *server_name,
+                                   const char *domain_name,
+                                   uint8_t **buffer)
+{
+       struct cli_state *cli = NULL;
+       struct rpc_pipe_client *pipe_cli = NULL;
+       NTSTATUS status;
+       WERROR werr;
+
+       status = cli_full_connection(&cli, NULL, server_name,
+                                    NULL, 0,
+                                    "IPC$", "IPC",
+                                    ctx->username,
+                                    ctx->workgroup,
+                                    ctx->password,
+                                    0, Undefined, NULL);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               werr = ntstatus_to_werror(status);
+               goto done;
+       }
+
+       pipe_cli = cli_rpc_pipe_open_noauth(cli, PI_NETLOGON,
+                                           &status);
+       if (!pipe_cli) {
+               werr = ntstatus_to_werror(status);
+               goto done;
+       };
+
+       status = rpccli_netr_GetAnyDCName(pipe_cli, ctx,
+                                         server_name,
+                                         domain_name,
+                                         (const char **)buffer,
+                                         &werr);
+       if (!NT_STATUS_IS_OK(status)) {
+               goto done;
+       }
+ done:
+       if (cli) {
+               cli_shutdown(cli);
+       }
+
+       return werr;
+
+}
+
+/********************************************************************
+********************************************************************/
+
+static WERROR libnetapi_NetGetAnyDCName(struct libnetapi_ctx *ctx,
+                                       const char *server_name,
+                                       const char *domain_name,
+                                       uint8_t **buffer)
+{
+       if (!server_name || is_myname_or_ipaddr(server_name)) {
+               return NetGetAnyDCNameLocal(ctx,
+                                           server_name,
+                                           domain_name,
+                                           buffer);
+       }
+
+       return NetGetAnyDCNameRemote(ctx,
+                                    server_name,
+                                    domain_name,
+                                    buffer);
+}
+
+/****************************************************************
+ NetGetAnyDCName
+****************************************************************/
+
+NET_API_STATUS NetGetAnyDCName(const char *server_name,
+                              const char *domain_name,
+                              uint8_t **buffer)
+{
+       struct libnetapi_ctx *ctx = NULL;
+       NET_API_STATUS status;
+       WERROR werr;
+
+       status = libnetapi_getctx(&ctx);
+       if (status != 0) {
+               return status;
+       }
+
+       werr = libnetapi_NetGetAnyDCName(ctx,
+                                        server_name,
+                                        domain_name,
+                                        buffer);
+       if (!W_ERROR_IS_OK(werr)) {
+               return W_ERROR_V(werr);
+       }
+
+       return NET_API_STATUS_SUCCESS;
+}
index 210763174e76c009d23d4d69ad3e80e6e752e3c4..55f334b5e1cd4bd24adabfaa8b094c1b5218ae9f 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *  Unix SMB/CIFS implementation.
  *  NetApi Join Support
- *  Copyright (C) Guenther Deschner 2007
+ *  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
 
 #include "includes.h"
 
-extern const char *opt_user_name;
-extern const char *opt_workgroup;
-extern const char *opt_password;
+#include "lib/netapi/netapi.h"
+#include "libnet/libnet.h"
 
-WERROR NetJoinDomain(const char *server_name,
-                    const char *domain_name,
-                    const char *account_ou,
-                    const char *Account,
-                    const char *password,
-                    uint32_t join_flags)
+/****************************************************************
+****************************************************************/
+
+static WERROR NetJoinDomainLocal(struct libnetapi_ctx *mem_ctx,
+                                const char *server_name,
+                                const char *domain_name,
+                                const char *account_ou,
+                                const char *Account,
+                                const char *password,
+                                uint32_t join_flags)
+{
+       struct libnet_JoinCtx *r = NULL;
+       WERROR werr;
+
+       if (!domain_name) {
+               return WERR_INVALID_PARAM;
+       }
+
+       werr = libnet_init_JoinCtx(mem_ctx, &r);
+       W_ERROR_NOT_OK_RETURN(werr);
+
+       r->in.domain_name = talloc_strdup(mem_ctx, domain_name);
+       W_ERROR_HAVE_NO_MEMORY(r->in.domain_name);
+
+       if (join_flags & WKSSVC_JOIN_FLAGS_JOIN_TYPE) {
+               NTSTATUS status;
+               struct DS_DOMAIN_CONTROLLER_INFO *info = NULL;
+               uint32_t flags = DS_DIRECTORY_SERVICE_REQUIRED |
+                                DS_WRITABLE_REQUIRED |
+                                DS_RETURN_DNS_NAME;
+               status = dsgetdcname(mem_ctx, domain_name,
+                                    NULL, NULL, flags, &info);
+               if (!NT_STATUS_IS_OK(status)) {
+                       libnetapi_set_error_string(mem_ctx,
+                               "%s", get_friendly_nt_error_msg(status));
+                       return ntstatus_to_werror(status);
+               }
+               r->in.dc_name = talloc_strdup(mem_ctx,
+                                             info->domain_controller_name);
+               W_ERROR_HAVE_NO_MEMORY(r->in.dc_name);
+       }
+
+       if (account_ou) {
+               r->in.account_ou = talloc_strdup(mem_ctx, account_ou);
+               W_ERROR_HAVE_NO_MEMORY(r->in.account_ou);
+       }
+
+       if (Account) {
+               r->in.admin_account = talloc_strdup(mem_ctx, Account);
+               W_ERROR_HAVE_NO_MEMORY(r->in.admin_account);
+       }
+
+       if (password) {
+               r->in.admin_password = talloc_strdup(mem_ctx, password);
+               W_ERROR_HAVE_NO_MEMORY(r->in.admin_password);
+       }
+
+       r->in.join_flags = join_flags;
+       r->in.modify_config = true;
+
+       werr = libnet_Join(mem_ctx, r);
+       if (!W_ERROR_IS_OK(werr) && r->out.error_string) {
+               libnetapi_set_error_string(mem_ctx, "%s", r->out.error_string);
+       }
+       TALLOC_FREE(r);
+
+       return werr;
+}
+
+/****************************************************************
+****************************************************************/
+
+static WERROR NetJoinDomainRemote(struct libnetapi_ctx *ctx,
+                                 const char *server_name,
+                                 const char *domain_name,
+                                 const char *account_ou,
+                                 const char *Account,
+                                 const char *password,
+                                 uint32_t join_flags)
 {
-       TALLOC_CTX *mem_ctx = NULL;
        struct cli_state *cli = NULL;
        struct rpc_pipe_client *pipe_cli = NULL;
-       struct wkssvc_PasswordBuffer encrypted_password;
+       struct wkssvc_PasswordBuffer *encrypted_password = NULL;
        NTSTATUS status;
        WERROR werr;
        unsigned int old_timeout = 0;
 
-       ZERO_STRUCT(encrypted_password);
+       status = cli_full_connection(&cli, NULL, server_name,
+                                    NULL, 0,
+                                    "IPC$", "IPC",
+                                    ctx->username,
+                                    ctx->workgroup,
+                                    ctx->password,
+                                    0, Undefined, NULL);
 
-       mem_ctx = talloc_init("NetJoinDomain");
-       if (!mem_ctx) {
-               werr = WERR_NOMEM;
+       if (!NT_STATUS_IS_OK(status)) {
+               werr = ntstatus_to_werror(status);
                goto done;
        }
 
-       if (!server_name || is_myname_or_ipaddr(server_name)) {
-               werr = WERR_NOT_SUPPORTED;
+       pipe_cli = cli_rpc_pipe_open_noauth(cli, PI_WKSSVC,
+                                           &status);
+       if (!pipe_cli) {
+               werr = ntstatus_to_werror(status);
                goto done;
        }
 
-       if (!domain_name) {
-               werr = WERR_INVALID_PARAM;
+       if (password) {
+               encode_wkssvc_join_password_buffer(ctx,
+                                                  password,
+                                                  &cli->user_session_key,
+                                                  &encrypted_password);
+       }
+
+       old_timeout = cli_set_timeout(cli, 60000);
+
+       status = rpccli_wkssvc_NetrJoinDomain2(pipe_cli, ctx,
+                                              server_name, domain_name,
+                                              account_ou, Account,
+                                              encrypted_password,
+                                              join_flags, &werr);
+       if (!NT_STATUS_IS_OK(status)) {
+               werr = ntstatus_to_werror(status);
                goto done;
        }
 
+ done:
+       if (cli) {
+               cli_set_timeout(cli, old_timeout);
+               cli_shutdown(cli);
+       }
+
+       return werr;
+}
+
+/****************************************************************
+****************************************************************/
+
+static WERROR libnetapi_NetJoinDomain(struct libnetapi_ctx *ctx,
+                                     const char *server_name,
+                                     const char *domain_name,
+                                     const char *account_ou,
+                                     const char *Account,
+                                     const char *password,
+                                     uint32_t join_flags)
+{
+       if (!domain_name) {
+               return WERR_INVALID_PARAM;
+       }
+
+       if (!server_name || is_myname_or_ipaddr(server_name)) {
+
+               return NetJoinDomainLocal(ctx,
+                                         server_name,
+                                         domain_name,
+                                         account_ou,
+                                         Account,
+                                         password,
+                                         join_flags);
+       }
+
+       return NetJoinDomainRemote(ctx,
+                                  server_name,
+                                  domain_name,
+                                  account_ou,
+                                  Account,
+                                  password,
+                                  join_flags);
+}
+
+/****************************************************************
+ NetJoinDomain
+****************************************************************/
+
+NET_API_STATUS NetJoinDomain(const char *server_name,
+                            const char *domain_name,
+                            const char *account_ou,
+                            const char *Account,
+                            const char *password,
+                            uint32_t join_flags)
+{
+       struct libnetapi_ctx *ctx = NULL;
+       NET_API_STATUS status;
+       WERROR werr;
+
+       status = libnetapi_getctx(&ctx);
+       if (status != 0) {
+               return status;
+       }
+
+       werr = libnetapi_NetJoinDomain(ctx,
+                                      server_name,
+                                      domain_name,
+                                      account_ou,
+                                      Account,
+                                      password,
+                                      join_flags);
+       if (!W_ERROR_IS_OK(werr)) {
+               return W_ERROR_V(werr);
+       }
+
+       return NET_API_STATUS_SUCCESS;
+}
+
+/****************************************************************
+****************************************************************/
+
+static WERROR NetUnjoinDomainLocal(struct libnetapi_ctx *mem_ctx,
+                                  const char *server_name,
+                                  const char *account,
+                                  const char *password,
+                                  uint32_t unjoin_flags)
+{
+       struct libnet_UnjoinCtx *r = NULL;
+       struct dom_sid domain_sid;
+       WERROR werr;
+
+       if (!secrets_fetch_domain_sid(lp_workgroup(), &domain_sid)) {
+               return WERR_SETUP_NOT_JOINED;
+       }
+
+       werr = libnet_init_UnjoinCtx(mem_ctx, &r);
+       W_ERROR_NOT_OK_RETURN(werr);
+
+       if (server_name) {
+               r->in.dc_name = talloc_strdup(mem_ctx, server_name);
+               W_ERROR_HAVE_NO_MEMORY(r->in.dc_name);
+       } else {
+               NTSTATUS status;
+               const char *domain = NULL;
+               struct DS_DOMAIN_CONTROLLER_INFO *info = NULL;
+               uint32_t flags = DS_DIRECTORY_SERVICE_REQUIRED |
+                                DS_WRITABLE_REQUIRED |
+                                DS_RETURN_DNS_NAME;
+               if (lp_realm()) {
+                       domain = lp_realm();
+               } else {
+                       domain = lp_workgroup();
+               }
+               status = dsgetdcname(mem_ctx, domain,
+                                    NULL, NULL, flags, &info);
+               if (!NT_STATUS_IS_OK(status)) {
+                       libnetapi_set_error_string(mem_ctx,
+                               "%s", get_friendly_nt_error_msg(status));
+                       return ntstatus_to_werror(status);
+               }
+               r->in.dc_name = talloc_strdup(mem_ctx,
+                                             info->domain_controller_name);
+               W_ERROR_HAVE_NO_MEMORY(r->in.dc_name);
+       }
+
+       if (account) {
+               r->in.admin_account = talloc_strdup(mem_ctx, account);
+               W_ERROR_HAVE_NO_MEMORY(r->in.admin_account);
+       }
+
+       if (password) {
+               r->in.admin_password = talloc_strdup(mem_ctx, password);
+               W_ERROR_HAVE_NO_MEMORY(r->in.admin_password);
+       }
+
+       r->in.unjoin_flags = unjoin_flags;
+       r->in.modify_config = true;
+       r->in.debug = true;
+
+       r->in.domain_sid = &domain_sid;
+
+       werr = libnet_Unjoin(mem_ctx, r);
+       if (!W_ERROR_IS_OK(werr) && r->out.error_string) {
+               libnetapi_set_error_string(mem_ctx, "%s", r->out.error_string);
+       }
+       TALLOC_FREE(r);
+
+       return werr;
+}
+
+/****************************************************************
+****************************************************************/
+
+static WERROR NetUnjoinDomainRemote(struct libnetapi_ctx *ctx,
+                                   const char *server_name,
+                                   const char *account,
+                                   const char *password,
+                                   uint32_t unjoin_flags)
+{
+       struct cli_state *cli = NULL;
+       struct rpc_pipe_client *pipe_cli = NULL;
+       struct wkssvc_PasswordBuffer *encrypted_password = NULL;
+       NTSTATUS status;
+       WERROR werr;
+       unsigned int old_timeout = 0;
+
        status = cli_full_connection(&cli, NULL, server_name,
                                     NULL, 0,
                                     "IPC$", "IPC",
-                                    opt_user_name, opt_workgroup,
-                                    opt_password, 0, Undefined, NULL);
+                                    ctx->username,
+                                    ctx->workgroup,
+                                    ctx->password,
+                                    0, Undefined, NULL);
 
        if (!NT_STATUS_IS_OK(status)) {
                werr = ntstatus_to_werror(status);
                goto done;
        }
 
-       old_timeout = cli_set_timeout(cli, 60000);
-
        pipe_cli = cli_rpc_pipe_open_noauth(cli, PI_WKSSVC,
                                            &status);
        if (!pipe_cli) {
                werr = ntstatus_to_werror(status);
                goto done;
-       };
+       }
 
        if (password) {
-               encode_wkssvc_join_password_buffer(mem_ctx,
+               encode_wkssvc_join_password_buffer(ctx,
                                                   password,
                                                   &cli->user_session_key,
                                                   &encrypted_password);
@@ -85,11 +343,12 @@ WERROR NetJoinDomain(const char *server_name,
 
        old_timeout = cli_set_timeout(cli, 60000);
 
-       status = rpccli_wkssvc_NetrJoinDomain2(pipe_cli, mem_ctx,
-                                              server_name, domain_name,
-                                              account_ou, Account,
-                                              &encrypted_password,
-                                              join_flags, &werr);
+       status = rpccli_wkssvc_NetrUnjoinDomain2(pipe_cli, ctx,
+                                                server_name,
+                                                account,
+                                                encrypted_password,
+                                                unjoin_flags,
+                                                &werr);
        if (!NT_STATUS_IS_OK(status)) {
                werr = ntstatus_to_werror(status);
                goto done;
@@ -100,72 +359,313 @@ WERROR NetJoinDomain(const char *server_name,
                cli_set_timeout(cli, old_timeout);
                cli_shutdown(cli);
        }
-       TALLOC_FREE(mem_ctx);
 
        return werr;
 }
 
-WERROR NetUnjoinDomain(const char *server_name,
-                      const char *account,
-                      const char *password,
-                      uint32_t unjoin_flags)
+/****************************************************************
+****************************************************************/
+
+static WERROR libnetapi_NetUnjoinDomain(struct libnetapi_ctx *ctx,
+                                       const char *server_name,
+                                       const char *account,
+                                       const char *password,
+                                       uint32_t unjoin_flags)
+{
+       if (!server_name || is_myname_or_ipaddr(server_name)) {
+
+               return NetUnjoinDomainLocal(ctx,
+                                           server_name,
+                                           account,
+                                           password,
+                                           unjoin_flags);
+       }
+
+       return NetUnjoinDomainRemote(ctx,
+                                    server_name,
+                                    account,
+                                    password,
+                                    unjoin_flags);
+}
+
+/****************************************************************
+ NetUnjoinDomain
+****************************************************************/
+
+NET_API_STATUS NetUnjoinDomain(const char *server_name,
+                              const char *account,
+                              const char *password,
+                              uint32_t unjoin_flags)
+{
+       struct libnetapi_ctx *ctx = NULL;
+       NET_API_STATUS status;
+       WERROR werr;
+
+       status = libnetapi_getctx(&ctx);
+       if (status != 0) {
+               return status;
+       }
+
+       werr = libnetapi_NetUnjoinDomain(ctx,
+                                        server_name,
+                                        account,
+                                        password,
+                                        unjoin_flags);
+       if (!W_ERROR_IS_OK(werr)) {
+               return W_ERROR_V(werr);
+       }
+
+       return NET_API_STATUS_SUCCESS;
+}
+
+/****************************************************************
+****************************************************************/
+
+static WERROR NetGetJoinInformationRemote(struct libnetapi_ctx *ctx,
+                                         const char *server_name,
+                                         const char **name_buffer,
+                                         uint16_t *name_type)
 {
-       TALLOC_CTX *mem_ctx = NULL;
        struct cli_state *cli = NULL;
        struct rpc_pipe_client *pipe_cli = NULL;
-       struct wkssvc_PasswordBuffer encrypted_password;
        NTSTATUS status;
        WERROR werr;
-       unsigned int old_timeout = 0;
 
-       ZERO_STRUCT(encrypted_password);
+       status = cli_full_connection(&cli, NULL, server_name,
+                                    NULL, 0,
+                                    "IPC$", "IPC",
+                                    ctx->username,
+                                    ctx->workgroup,
+                                    ctx->password,
+                                    0, Undefined, NULL);
 
-       mem_ctx = talloc_init("NetUnjoinDomain");
-       if (!mem_ctx) {
-               werr = WERR_NOMEM;
+       if (!NT_STATUS_IS_OK(status)) {
+               werr = ntstatus_to_werror(status);
                goto done;
        }
 
-       if (!server_name || is_myname_or_ipaddr(server_name)) {
-               werr = WERR_NOT_SUPPORTED;
+       pipe_cli = cli_rpc_pipe_open_noauth(cli, PI_WKSSVC,
+                                           &status);
+       if (!pipe_cli) {
+               werr = ntstatus_to_werror(status);
+               goto done;
+       }
+
+       status = rpccli_wkssvc_NetrGetJoinInformation(pipe_cli, ctx,
+                                                     server_name,
+                                                     name_buffer,
+                                                     (enum wkssvc_NetJoinStatus *)name_type,
+                                                     &werr);
+       if (!NT_STATUS_IS_OK(status)) {
+               werr = ntstatus_to_werror(status);
                goto done;
        }
 
+ done:
+       if (cli) {
+               cli_shutdown(cli);
+       }
+
+       return werr;
+}
+
+/****************************************************************
+****************************************************************/
+
+static WERROR NetGetJoinInformationLocal(struct libnetapi_ctx *ctx,
+                                        const char *server_name,
+                                        const char **name_buffer,
+                                        uint16_t *name_type)
+{
+       if ((lp_security() == SEC_ADS) && lp_realm()) {
+               *name_buffer = talloc_strdup(ctx, lp_realm());
+       } else {
+               *name_buffer = talloc_strdup(ctx, lp_workgroup());
+       }
+       if (!*name_buffer) {
+               return WERR_NOMEM;
+       }
+
+       switch (lp_server_role()) {
+               case ROLE_DOMAIN_MEMBER:
+               case ROLE_DOMAIN_PDC:
+               case ROLE_DOMAIN_BDC:
+                       *name_type = NetSetupDomainName;
+                       break;
+               case ROLE_STANDALONE:
+               default:
+                       *name_type = NetSetupWorkgroupName;
+                       break;
+       }
+
+       return WERR_OK;
+}
+
+static WERROR libnetapi_NetGetJoinInformation(struct libnetapi_ctx *ctx,
+                                             const char *server_name,
+                                             const char **name_buffer,
+                                             uint16_t *name_type)
+{
+       if (!server_name || is_myname_or_ipaddr(server_name)) {
+               return NetGetJoinInformationLocal(ctx,
+                                                 server_name,
+                                                 name_buffer,
+                                                 name_type);
+       }
+
+       return NetGetJoinInformationRemote(ctx,
+                                          server_name,
+                                          name_buffer,
+                                          name_type);
+}
+
+/****************************************************************
+ NetGetJoinInformation
+****************************************************************/
+
+NET_API_STATUS NetGetJoinInformation(const char *server_name,
+                                    const char **name_buffer,
+                                    uint16_t *name_type)
+{
+       struct libnetapi_ctx *ctx = NULL;
+       NET_API_STATUS status;
+       WERROR werr;
+
+       status = libnetapi_getctx(&ctx);
+       if (status != 0) {
+               return status;
+       }
+
+       werr = libnetapi_NetGetJoinInformation(ctx,
+                                              server_name,
+                                              name_buffer,
+                                              name_type);
+       if (!W_ERROR_IS_OK(werr)) {
+               return W_ERROR_V(werr);
+       }
+
+       return NET_API_STATUS_SUCCESS;
+}
+
+/****************************************************************
+****************************************************************/
+
+static WERROR NetGetJoinableOUsLocal(struct libnetapi_ctx *ctx,
+                                    const char *server_name,
+                                    const char *domain,
+                                    const char *account,
+                                    const char *password,
+                                    uint32_t *ou_count,
+                                    const char ***ous)
+{
+#ifdef WITH_ADS
+       NTSTATUS status;
+       ADS_STATUS ads_status;
+       ADS_STRUCT *ads = NULL;
+       struct DS_DOMAIN_CONTROLLER_INFO *info = NULL;
+       uint32_t flags = DS_DIRECTORY_SERVICE_REQUIRED |
+                        DS_RETURN_DNS_NAME;
+
+       status = dsgetdcname(ctx, domain,
+                            NULL, NULL, flags, &info);
+       if (!NT_STATUS_IS_OK(status)) {
+               libnetapi_set_error_string(ctx, "%s",
+                       get_friendly_nt_error_msg(status));
+               return ntstatus_to_werror(status);
+       }
+
+       ads = ads_init(domain, domain, info->domain_controller_name);
+       if (!ads) {
+               return WERR_GENERAL_FAILURE;
+       }
+
+       SAFE_FREE(ads->auth.user_name);
+       if (account) {
+               ads->auth.user_name = SMB_STRDUP(account);
+       } else if (ctx->username) {
+               ads->auth.user_name = SMB_STRDUP(ctx->username);
+       }
+
+       SAFE_FREE(ads->auth.password);
+       if (password) {
+               ads->auth.password = SMB_STRDUP(password);
+       } else if (ctx->password) {
+               ads->auth.password = SMB_STRDUP(ctx->password);
+       }
+
+       ads_status = ads_connect(ads);
+       if (!ADS_ERR_OK(ads_status)) {
+               ads_destroy(&ads);
+               return WERR_DEFAULT_JOIN_REQUIRED;
+       }
+
+       ads_status = ads_get_joinable_ous(ads, ctx,
+                                         (char ***)ous,
+                                         (size_t *)ou_count);
+       if (!ADS_ERR_OK(ads_status)) {
+               ads_destroy(&ads);
+               return WERR_DEFAULT_JOIN_REQUIRED;
+       }
+
+       ads_destroy(&ads);
+       return WERR_OK;
+#else
+       return WERR_NOT_SUPPORTED;
+#endif
+}
+
+/****************************************************************
+****************************************************************/
+
+static WERROR NetGetJoinableOUsRemote(struct libnetapi_ctx *ctx,
+                                     const char *server_name,
+                                     const char *domain,
+                                     const char *account,
+                                     const char *password,
+                                     uint32_t *ou_count,
+                                     const char ***ous)
+{
+       struct cli_state *cli = NULL;
+       struct rpc_pipe_client *pipe_cli = NULL;
+       struct wkssvc_PasswordBuffer *encrypted_password = NULL;
+       NTSTATUS status;
+       WERROR werr;
+
        status = cli_full_connection(&cli, NULL, server_name,
                                     NULL, 0,
                                     "IPC$", "IPC",
-                                    opt_user_name, opt_workgroup,
-                                    opt_password, 0, Undefined, NULL);
+                                    ctx->username,
+                                    ctx->workgroup,
+                                    ctx->password,
+                                    0, Undefined, NULL);
 
        if (!NT_STATUS_IS_OK(status)) {
                werr = ntstatus_to_werror(status);
                goto done;
        }
 
-       old_timeout = cli_set_timeout(cli, 60000);
-
        pipe_cli = cli_rpc_pipe_open_noauth(cli, PI_WKSSVC,
                                            &status);
        if (!pipe_cli) {
                werr = ntstatus_to_werror(status);
                goto done;
-       };
+       }
 
        if (password) {
-               encode_wkssvc_join_password_buffer(mem_ctx,
+               encode_wkssvc_join_password_buffer(ctx,
                                                   password,
                                                   &cli->user_session_key,
                                                   &encrypted_password);
        }
 
-       old_timeout = cli_set_timeout(cli, 60000);
-
-       status = rpccli_wkssvc_NetrUnjoinDomain2(pipe_cli, mem_ctx,
-                                                server_name,
-                                                account,
-                                                &encrypted_password,
-                                                unjoin_flags,
-                                                &werr);
+       status = rpccli_wkssvc_NetrGetJoinableOus2(pipe_cli, ctx,
+                                                  server_name,
+                                                  domain,
+                                                  account,
+                                                  encrypted_password,
+                                                  ou_count,
+                                                  ous,
+                                                  &werr);
        if (!NT_STATUS_IS_OK(status)) {
                werr = ntstatus_to_werror(status);
                goto done;
@@ -173,10 +673,72 @@ WERROR NetUnjoinDomain(const char *server_name,
 
  done:
        if (cli) {
-               cli_set_timeout(cli, old_timeout);
                cli_shutdown(cli);
        }
-       TALLOC_FREE(mem_ctx);
 
        return werr;
 }
+
+/****************************************************************
+****************************************************************/
+
+static WERROR libnetapi_NetGetJoinableOUs(struct libnetapi_ctx *ctx,
+                                         const char *server_name,
+                                         const char *domain,
+                                         const char *account,
+                                         const char *password,
+                                         uint32_t *ou_count,
+                                         const char ***ous)
+{
+       if (!server_name || is_myname_or_ipaddr(server_name)) {
+               return NetGetJoinableOUsLocal(ctx,
+                                             server_name,
+                                             domain,
+                                             account,
+                                             password,
+                                             ou_count,
+                                             ous);
+       }
+
+       return NetGetJoinableOUsRemote(ctx,
+                                      server_name,
+                                      domain,
+                                      account,
+                                      password,
+                                      ou_count,
+                                      ous);
+}
+
+/****************************************************************
+ NetGetJoinableOUs
+****************************************************************/
+
+NET_API_STATUS NetGetJoinableOUs(const char *server_name,
+                                const char *domain,
+                                const char *account,
+                                const char *password,
+                                uint32_t *ou_count,
+                                const char ***ous)
+{
+       struct libnetapi_ctx *ctx = NULL;
+       NET_API_STATUS status;
+       WERROR werr;
+
+       status = libnetapi_getctx(&ctx);
+       if (status != 0) {
+               return status;
+       }
+
+       werr = libnetapi_NetGetJoinableOUs(ctx,
+                                          server_name,
+                                          domain,
+                                          account,
+                                          password,
+                                          ou_count,
+                                          ous);
+       if (!W_ERROR_IS_OK(werr)) {
+               return W_ERROR_V(werr);
+       }
+
+       return NET_API_STATUS_SUCCESS;
+}
diff --git a/source/lib/netapi/netapi.c b/source/lib/netapi/netapi.c
new file mode 100644 (file)
index 0000000..47b3ba9
--- /dev/null
@@ -0,0 +1,257 @@
+/*
+ *  Unix SMB/CIFS implementation.
+ *  NetApi 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/>.
+ */
+
+#include "includes.h"
+#include "lib/netapi/netapi.h"
+
+extern bool AllowDebugChange;
+
+struct libnetapi_ctx *stat_ctx = NULL;
+TALLOC_CTX *frame = NULL;
+static bool libnetapi_initialized = false;
+
+/****************************************************************
+****************************************************************/
+
+NET_API_STATUS libnetapi_init(struct libnetapi_ctx **context)
+{
+       struct libnetapi_ctx *ctx = NULL;
+       char *krb5_cc_env = NULL;
+
+       if (stat_ctx && libnetapi_initialized) {
+               *context = stat_ctx;
+               return NET_API_STATUS_SUCCESS;
+       }
+
+#ifdef DEVELOPER
+       talloc_enable_leak_report();
+#endif
+       frame = talloc_stackframe();
+
+       ctx = talloc_zero(frame, struct libnetapi_ctx);
+       if (!ctx) {
+               TALLOC_FREE(frame);
+               return W_ERROR_V(WERR_NOMEM);
+       }
+
+       DEBUGLEVEL = 0;
+       setup_logging("libnetapi", true);
+
+       dbf = x_stderr;
+       x_setbuf(x_stderr, NULL);
+       AllowDebugChange = false;
+
+       load_case_tables();
+
+       if (!lp_load(get_dyn_CONFIGFILE(), true, false, false, false)) {
+               TALLOC_FREE(frame);
+               return W_ERROR_V(WERR_GENERAL_FAILURE);
+       }
+
+       AllowDebugChange = true;
+
+       init_names();
+       load_interfaces();
+       reopen_logs();
+
+       BlockSignals(True, SIGPIPE);
+
+       krb5_cc_env = getenv(KRB5_ENV_CCNAME);
+       if (!krb5_cc_env || (strlen(krb5_cc_env) == 0)) {
+               ctx->krb5_cc_env = talloc_strdup(frame, "MEMORY:libnetapi");
+               setenv(KRB5_ENV_CCNAME, ctx->krb5_cc_env, 1);
+       }
+
+       libnetapi_initialized = true;
+
+       *context = stat_ctx = ctx;
+
+       return NET_API_STATUS_SUCCESS;
+}
+
+/****************************************************************
+****************************************************************/
+
+NET_API_STATUS libnetapi_getctx(struct libnetapi_ctx **ctx)
+{
+       if (stat_ctx) {
+               *ctx = stat_ctx;
+               return NET_API_STATUS_SUCCESS;
+       }
+
+       return libnetapi_init(ctx);
+}
+
+/****************************************************************
+****************************************************************/
+
+NET_API_STATUS libnetapi_free(struct libnetapi_ctx *ctx)
+{
+
+       if (ctx->krb5_cc_env) {
+               char *env = getenv(KRB5_ENV_CCNAME);
+               if (env && (strequal(ctx->krb5_cc_env, env))) {
+                       unsetenv(KRB5_ENV_CCNAME);
+               }
+       }
+
+       gfree_names();
+       gfree_loadparm();
+       gfree_case_tables();
+       gfree_charcnv();
+       gfree_interfaces();
+
+       gencache_shutdown();
+       secrets_shutdown();
+
+       TALLOC_FREE(ctx);
+       TALLOC_FREE(frame);
+
+       gfree_debugsyms();
+
+       return NET_API_STATUS_SUCCESS;
+}
+
+/****************************************************************
+****************************************************************/
+
+NET_API_STATUS libnetapi_set_debuglevel(struct libnetapi_ctx *ctx,
+                                       const char *debuglevel)
+{
+       AllowDebugChange = true;
+       ctx->debuglevel = talloc_strdup(ctx, debuglevel);
+       if (!debug_parse_levels(debuglevel)) {
+               return W_ERROR_V(WERR_GENERAL_FAILURE);
+       }
+       return NET_API_STATUS_SUCCESS;
+}
+
+/****************************************************************
+****************************************************************/
+
+NET_API_STATUS libnetapi_get_debuglevel(struct libnetapi_ctx *ctx,
+                                       char **debuglevel)
+{
+       *debuglevel = ctx->debuglevel;
+       return NET_API_STATUS_SUCCESS;
+}
+
+/****************************************************************
+****************************************************************/
+
+NET_API_STATUS libnetapi_set_username(struct libnetapi_ctx *ctx,
+                                     const char *username)
+{
+       TALLOC_FREE(ctx->username);
+       ctx->username = talloc_strdup(ctx, username);
+       if (!ctx->username) {
+               return W_ERROR_V(WERR_NOMEM);
+       }
+       return NET_API_STATUS_SUCCESS;
+}
+
+NET_API_STATUS libnetapi_set_password(struct libnetapi_ctx *ctx,
+                                     const char *password)
+{
+       TALLOC_FREE(ctx->password);
+       ctx->password = talloc_strdup(ctx, password);
+       if (!ctx->password) {
+               return W_ERROR_V(WERR_NOMEM);
+       }
+       return NET_API_STATUS_SUCCESS;
+}
+
+NET_API_STATUS libnetapi_set_workgroup(struct libnetapi_ctx *ctx,
+                                      const char *workgroup)
+{
+       TALLOC_FREE(ctx->workgroup);
+       ctx->workgroup = talloc_strdup(ctx, workgroup);
+       if (!ctx->workgroup) {
+               return W_ERROR_V(WERR_NOMEM);
+       }
+       return NET_API_STATUS_SUCCESS;
+}
+
+/****************************************************************
+****************************************************************/
+
+const char *libnetapi_errstr(NET_API_STATUS status)
+{
+       if (status & 0xc0000000) {
+               return get_friendly_nt_error_msg(NT_STATUS(status));
+       }
+
+       return get_friendly_werror_msg(W_ERROR(status));
+}
+
+/****************************************************************
+****************************************************************/
+
+NET_API_STATUS libnetapi_set_error_string(struct libnetapi_ctx *ctx,
+                                         const char *format, ...)
+{
+       va_list args;
+
+       TALLOC_FREE(ctx->error_string);
+
+       va_start(args, format);
+       ctx->error_string = talloc_vasprintf(ctx, format, args);
+       va_end(args);
+
+       if (!ctx->error_string) {
+               return W_ERROR_V(WERR_NOMEM);
+       }
+       return NET_API_STATUS_SUCCESS;
+}
+
+/****************************************************************
+****************************************************************/
+
+const char *libnetapi_get_error_string(struct libnetapi_ctx *ctx,
+                                      NET_API_STATUS status)
+{
+       struct libnetapi_ctx *tmp_ctx = ctx;
+
+       if (!tmp_ctx) {
+               status = libnetapi_getctx(&tmp_ctx);
+               if (status != 0) {
+                       return NULL;
+               }
+       }
+
+       if (tmp_ctx->error_string) {
+               return tmp_ctx->error_string;
+       }
+
+       return libnetapi_errstr(status);
+}
+
+/****************************************************************
+****************************************************************/
+
+NET_API_STATUS NetApiBufferFree(void *buffer)
+{
+       if (!buffer) {
+               return W_ERROR_V(WERR_INSUFFICIENT_BUFFER);
+       }
+
+       talloc_free(buffer);
+
+       return NET_API_STATUS_SUCCESS;
+}
diff --git a/source/lib/netapi/netapi.h b/source/lib/netapi/netapi.h
new file mode 100644 (file)
index 0000000..002fc37
--- /dev/null
@@ -0,0 +1,147 @@
+/*
+ *  Unix SMB/CIFS implementation.
+ *  NetApi 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 __LIB_NETAPI_H__
+#define __LIB_NETAPI_H__
+
+/****************************************************************
+ include some basic headers
+****************************************************************/
+
+#include <inttypes.h>
+
+/****************************************************************
+ NET_API_STATUS
+****************************************************************/
+
+#define NET_API_STATUS uint32_t
+#define NET_API_STATUS_SUCCESS 0
+
+/****************************************************************
+****************************************************************/
+
+#define LIBNETAPI_LOCAL_SERVER(x) (!x || is_myname_or_ipaddr(x))
+
+/****************************************************************
+****************************************************************/
+
+struct libnetapi_ctx {
+       char *debuglevel;
+       char *error_string;
+       char *username;
+       char *workgroup;
+       char *password;
+       char *krb5_cc_env;
+};
+
+/****************************************************************
+****************************************************************/
+
+NET_API_STATUS libnetapi_init(struct libnetapi_ctx **ctx);
+NET_API_STATUS libnetapi_getctx(struct libnetapi_ctx **ctx);
+NET_API_STATUS libnetapi_free(struct libnetapi_ctx *ctx);
+NET_API_STATUS libnetapi_set_debuglevel(struct libnetapi_ctx *ctx, const char *debuglevel);
+NET_API_STATUS libnetapi_get_debuglevel(struct libnetapi_ctx *ctx, char **debuglevel);
+NET_API_STATUS libnetapi_set_username(struct libnetapi_ctx *ctx, const char *username);
+NET_API_STATUS libnetapi_set_password(struct libnetapi_ctx *ctx, const char *password);
+NET_API_STATUS libnetapi_set_workgroup(struct libnetapi_ctx *ctx, const char *workgroup);
+const char *libnetapi_errstr(NET_API_STATUS status);
+NET_API_STATUS libnetapi_set_error_string(struct libnetapi_ctx *ctx, const char *format, ...);
+const char *libnetapi_get_error_string(struct libnetapi_ctx *ctx, NET_API_STATUS status);
+
+
+/****************************************************************
+ NetApiBufferFree
+****************************************************************/
+
+NET_API_STATUS NetApiBufferFree(void *buffer);
+
+/****************************************************************
+ NetJoinDomain
+****************************************************************/
+
+NET_API_STATUS NetJoinDomain(const char *server,
+                            const char *domain,
+                            const char *account_ou,
+                            const char *account,
+                            const char *password,
+                            uint32_t join_options);
+
+/****************************************************************
+ NetUnjoinDomain
+****************************************************************/
+
+NET_API_STATUS NetUnjoinDomain(const char *server_name,
+                              const char *account,
+                              const char *password,
+                              uint32_t unjoin_flags);
+
+/****************************************************************
+ NetGetJoinInformation
+****************************************************************/
+
+NET_API_STATUS NetGetJoinInformation(const char *server_name,
+                                    const char **name_buffer,
+                                    uint16_t *name_type);
+
+/****************************************************************
+ NetGetJoinableOUs
+****************************************************************/
+
+NET_API_STATUS NetGetJoinableOUs(const char *server_name,
+                                const char *domain,
+                                const char *account,
+                                const char *password,
+                                uint32_t *ou_count,
+                                const char ***ous);
+
+/****************************************************************
+ NetServerGetInfo
+****************************************************************/
+
+NET_API_STATUS NetServerGetInfo(const char *server_name,
+                               uint32_t level,
+                               uint8_t **buffer);
+
+/****************************************************************
+ NetServerSetInfo
+****************************************************************/
+
+NET_API_STATUS NetServerSetInfo(const char *server_name,
+                               uint32_t level,
+                               uint8_t *buffer,
+                               uint32_t *parm_error);
+
+/****************************************************************
+ NetGetDCName
+****************************************************************/
+
+NET_API_STATUS NetGetDCName(const char *server_name,
+                           const char *domain_name,
+                           uint8_t **buffer);
+
+/****************************************************************
+ NetGetAnyDCName
+****************************************************************/
+
+NET_API_STATUS NetGetAnyDCName(const char *server_name,
+                              const char *domain_name,
+                              uint8_t **buffer);
+
+#endif
diff --git a/source/lib/netapi/serverinfo.c b/source/lib/netapi/serverinfo.c
new file mode 100644 (file)
index 0000000..7fa166e
--- /dev/null
@@ -0,0 +1,339 @@
+/*
+ *  Unix SMB/CIFS implementation.
+ *  NetApi Server Support
+ *  Copyright (C) Guenther Deschner 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 "lib/netapi/netapi.h"
+#include "libnet/libnet.h"
+
+/****************************************************************
+****************************************************************/
+
+static WERROR NetServerGetInfoLocal_1005(struct libnetapi_ctx *ctx,
+                                        uint8_t **buffer)
+{
+       struct srvsvc_NetSrvInfo1005 info1005;
+
+       info1005.comment = lp_serverstring();
+       *buffer = (uint8_t *)talloc_memdup(ctx, &info1005, sizeof(info1005));
+       if (!*buffer) {
+               return WERR_NOMEM;
+       }
+
+       return WERR_OK;
+}
+
+/****************************************************************
+****************************************************************/
+
+static WERROR NetServerGetInfoLocal(struct libnetapi_ctx *ctx,
+                                   const char *server_name,
+                                   uint32_t level,
+                                   uint8_t **buffer)
+{
+       switch (level) {
+               case 1005:
+                       return NetServerGetInfoLocal_1005(ctx, buffer);
+               default:
+                       return WERR_UNKNOWN_LEVEL;
+       }
+
+       return WERR_UNKNOWN_LEVEL;
+}
+
+/****************************************************************
+****************************************************************/
+
+static WERROR NetServerGetInfoRemote(struct libnetapi_ctx *ctx,
+                                    const char *server_name,
+                                    uint32_t level,
+                                    uint8_t **buffer)
+{
+       struct cli_state *cli = NULL;
+       struct rpc_pipe_client *pipe_cli = NULL;
+       NTSTATUS status;
+       WERROR werr;
+       union srvsvc_NetSrvInfo info;
+
+       status = cli_full_connection(&cli, NULL, server_name,
+                                    NULL, 0,
+                                    "IPC$", "IPC",
+                                    ctx->username,
+                                    ctx->workgroup,
+                                    ctx->password,
+                                    0, Undefined, NULL);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               werr = ntstatus_to_werror(status);
+               goto done;
+       }
+
+       pipe_cli = cli_rpc_pipe_open_noauth(cli, PI_SRVSVC,
+                                           &status);
+       if (!pipe_cli) {
+               werr = ntstatus_to_werror(status);
+               goto done;
+       };
+
+       status = rpccli_srvsvc_NetSrvGetInfo(pipe_cli, ctx,
+                                            server_name,
+                                            level,
+                                            &info,
+                                            &werr);
+       if (!NT_STATUS_IS_OK(status)) {
+               werr = ntstatus_to_werror(status);
+               goto done;
+       }
+
+       *buffer = (uint8_t *)&info;
+
+ done:
+       if (cli) {
+               cli_shutdown(cli);
+       }
+
+       return werr;
+}
+
+/****************************************************************
+****************************************************************/
+
+static WERROR libnetapi_NetServerGetInfo(struct libnetapi_ctx *ctx,
+                                        const char *server_name,
+                                        uint32_t level,
+                                        uint8_t **buffer)
+{
+       if (!server_name || is_myname_or_ipaddr(server_name)) {
+               return NetServerGetInfoLocal(ctx,
+                                            server_name,
+                                            level,
+                                            buffer);
+       }
+
+       return NetServerGetInfoRemote(ctx,
+                                     server_name,
+                                     level,
+                                     buffer);
+
+}
+
+/****************************************************************
+ NetServerGetInfo
+****************************************************************/
+
+NET_API_STATUS NetServerGetInfo(const char *server_name,
+                               uint32_t level,
+                               uint8_t **buffer)
+{
+       struct libnetapi_ctx *ctx = NULL;
+       NET_API_STATUS status;
+       WERROR werr;
+
+       status = libnetapi_getctx(&ctx);
+       if (status != 0) {
+               return status;
+       }
+
+       werr = libnetapi_NetServerGetInfo(ctx,
+                                         server_name,
+                                         level,
+                                         buffer);
+       if (!W_ERROR_IS_OK(werr)) {
+               return W_ERROR_V(werr);
+       }
+
+       return NET_API_STATUS_SUCCESS;
+}
+
+/****************************************************************
+****************************************************************/
+
+static WERROR NetServerSetInfoLocal_1005(struct libnetapi_ctx *ctx,
+                                        uint8_t *buffer,
+                                        uint32_t *parm_error)
+{
+       WERROR werr;
+       struct libnet_conf_ctx *conf_ctx;
+       struct srvsvc_NetSrvInfo1005 *info1005;
+
+       if (!buffer) {
+               *parm_error = 1005; /* sure here ? */
+               return WERR_INVALID_PARAM;
+       }
+
+       info1005 = (struct srvsvc_NetSrvInfo1005 *)buffer;
+
+       if (!info1005->comment) {
+               *parm_error = 1005;
+               return WERR_INVALID_PARAM;
+       }
+
+       if (!lp_config_backend_is_registry()) {
+               return WERR_NOT_SUPPORTED;
+       }
+
+       werr = libnet_conf_open(ctx, &conf_ctx);
+       if (!W_ERROR_IS_OK(werr)) {
+               goto done;
+       }
+
+       werr = libnet_conf_set_global_parameter(conf_ctx,
+                                               "server string",
+                                               info1005->comment);
+
+ done:
+       libnet_conf_close(conf_ctx);
+       return werr;
+}
+
+/****************************************************************
+****************************************************************/
+
+static WERROR NetServerSetInfoLocal(struct libnetapi_ctx *ctx,
+                                   const char *server_name,
+                                   uint32_t level,
+                                   uint8_t *buffer,
+                                   uint32_t *parm_error)
+{
+       switch (level) {
+               case 1005:
+                       return NetServerSetInfoLocal_1005(ctx, buffer, parm_error);
+               default:
+                       return WERR_UNKNOWN_LEVEL;
+       }
+
+       return WERR_UNKNOWN_LEVEL;
+}
+
+/****************************************************************
+****************************************************************/
+
+static WERROR NetServerSetInfoRemote(struct libnetapi_ctx *ctx,
+                                    const char *server_name,
+                                    uint32_t level,
+                                    uint8_t *buffer,
+                                    uint32_t *parm_error)
+{
+       struct cli_state *cli = NULL;
+       struct rpc_pipe_client *pipe_cli = NULL;
+       NTSTATUS status;
+       WERROR werr;
+       union srvsvc_NetSrvInfo info;
+
+       status = cli_full_connection(&cli, NULL, server_name,
+                                    NULL, 0,
+                                    "IPC$", "IPC",
+                                    ctx->username,
+                                    ctx->workgroup,
+                                    ctx->password,
+                                    0, Undefined, NULL);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               werr = ntstatus_to_werror(status);
+               goto done;
+       }
+
+       pipe_cli = cli_rpc_pipe_open_noauth(cli, PI_SRVSVC,
+                                           &status);
+       if (!pipe_cli) {
+               werr = ntstatus_to_werror(status);
+               goto done;
+       };
+
+       switch (level) {
+               case 1005:
+                       info.info1005 = (struct srvsvc_NetSrvInfo1005 *)buffer;
+                       break;
+               default:
+                       werr = WERR_NOT_SUPPORTED;
+                       goto done;
+       }
+
+       status = rpccli_srvsvc_NetSrvSetInfo(pipe_cli, ctx,
+                                            server_name,
+                                            level,
+                                            info,
+                                            parm_error,
+                                            &werr);
+       if (!NT_STATUS_IS_OK(status)) {
+               werr = ntstatus_to_werror(status);
+               goto done;
+       }
+
+ done:
+       if (cli) {
+               cli_shutdown(cli);
+       }
+
+       return werr;
+}
+
+/****************************************************************
+****************************************************************/
+
+static WERROR libnetapi_NetServerSetInfo(struct libnetapi_ctx *ctx,
+                                        const char *server_name,
+                                        uint32_t level,
+                                        uint8_t *buffer,
+                                        uint32_t *parm_error)
+{
+       if (!server_name || is_myname_or_ipaddr(server_name)) {
+               return NetServerSetInfoLocal(ctx,
+                                            server_name,
+                                            level,
+                                            buffer,
+                                            parm_error);
+       }
+
+       return NetServerSetInfoRemote(ctx,
+                                     server_name,
+                                     level,
+                                     buffer,
+                                     parm_error);
+}
+
+/****************************************************************
+ NetServerSetInfo
+****************************************************************/
+
+NET_API_STATUS NetServerSetInfo(const char *server_name,
+                               uint32_t level,
+                               uint8_t *buffer,
+                               uint32_t *parm_error)
+{
+       struct libnetapi_ctx *ctx = NULL;
+       NET_API_STATUS status;
+       WERROR werr;
+
+       status = libnetapi_getctx(&ctx);
+       if (status != 0) {
+               return status;
+       }
+
+       werr = libnetapi_NetServerSetInfo(ctx,
+                                         server_name,
+                                         level,
+                                         buffer,
+                                         parm_error);
+       if (!W_ERROR_IS_OK(werr)) {
+               return W_ERROR_V(werr);
+       }
+
+       return NET_API_STATUS_SUCCESS;
+}
index b3a84a6f7cad019ed9c2ae7920d9a1d4a57338db..5a9d39d181a36e57093d8ddf7092c01fe8872205 100644 (file)
@@ -414,6 +414,7 @@ static void get_credentials_file(const char *file)
  *             -N,--no-pass
  *             -S,--signing
  *              -P --machine-pass
+ *             -e --encrypt
  */
 
 
@@ -532,6 +533,10 @@ static void popt_common_credentials_callback(poptContext con,
        case 'N':
                set_cmdline_auth_info_password("");
                break;
+       case 'e':
+               set_cmdline_auth_info_smb_encrypt();
+               break;
+
        }
 }
 
@@ -543,5 +548,6 @@ struct poptOption popt_common_credentials[] = {
        { "authentication-file", 'A', POPT_ARG_STRING, NULL, 'A', "Get the credentials from a file", "FILE" },
        { "signing", 'S', POPT_ARG_STRING, NULL, 'S', "Set the client signing state", "on|off|required" },
        {"machine-pass", 'P', POPT_ARG_NONE, NULL, 'P', "Use stored machine account password" },
+       {"encrypt", 'e', POPT_ARG_NONE, NULL, 'e', "Encrypt SMB transport (UNIX extended servers only)" },
        POPT_TABLEEND
 };
index 63fb462e32d72a32265340704fb0798f24b74423..509da80785334cf6b4bc0d9d5ea7c829443f4c7b 100644 (file)
@@ -184,8 +184,10 @@ static int priv_traverse_fn(TDB_CONTEXT *t, TDB_DATA key, TDB_DATA data, void *s
                return 0;
        }
 
-       if (!add_sid_to_array( priv->mem_ctx, &sid, &priv->sids.list,
-                              &priv->sids.count )) {
+       if (!NT_STATUS_IS_OK(add_sid_to_array(priv->mem_ctx, &sid,
+                                             &priv->sids.list,
+                                             &priv->sids.count)))
+       {
                return 0;
        }
        
index c10a4b23817c8e2c2474a62eaa9254eaa1025f00..f866b3648fcf977b87e94e7681e051210a773aad 100644 (file)
@@ -100,6 +100,7 @@ AC_CHECK_HEADERS(sys/socket.h netinet/in.h netdb.h arpa/inet.h)
 AC_CHECK_HEADERS(netinet/ip.h netinet/tcp.h netinet/in_systm.h netinet/in_ip.h)
 AC_CHECK_HEADERS(sys/sockio.h sys/un.h)
 AC_CHECK_HEADERS(sys/mount.h mntent.h)
+AC_CHECK_HEADERS(stropts.h)
 
 dnl we need to check that net/if.h really can be used, to cope with hpux
 dnl where including it always fails
@@ -152,6 +153,26 @@ AC_HAVE_TYPE([struct sockaddr_in6], [
 #include <netinet/in.h>
 ])
 
+if test x"$ac_cv_type_struct_sockaddr_storage" = x"yes"; then
+AC_CHECK_MEMBER(struct sockaddr_storage.ss_family,
+                AC_DEFINE(HAVE_SS_FAMILY, 1, [Defined if struct sockaddr_storage has ss_family field]),,
+                [
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <netinet/in.h>
+               ])
+
+if test x"$ac_cv_member_struct_sockaddr_storage_ss_family" != x"yes"; then
+AC_CHECK_MEMBER(struct sockaddr_storage.__ss_family,
+                AC_DEFINE(HAVE___SS_FAMILY, 1, [Defined if struct sockaddr_storage has __ss_family field]),,
+                [
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <netinet/in.h>
+               ])
+fi
+fi
+
 AC_CHECK_FUNCS(seteuid setresuid setegid setresgid chroot bzero strerror)
 AC_CHECK_FUNCS(vsyslog setlinebuf mktime ftruncate chsize rename)
 AC_CHECK_FUNCS(waitpid strlcpy strlcat initgroups memmove strdup)
index a01bf1b2904df87b2a5365bb10b8d2a462365b8c..bf5056838d0ca2a30539ca5bc75f1104f38bf562 100644 (file)
@@ -48,8 +48,7 @@ LIBREPLACE_C99_STRUCT_INIT([],[AC_MSG_WARN([c99 structure initializer are not su
 AC_PROG_INSTALL
 
 AC_ISC_POSIX
-AC_EXTENSION_FLAG(_XOPEN_SOURCE_EXTENDED)
-AC_EXTENSION_FLAG(_OSF_SOURCE)
+AC_N_DEFINE(_XOPEN_SOURCE_EXTENDED)
 
 AC_SYS_LARGEFILE
 
@@ -77,6 +76,11 @@ case "$host_os" in
                        CFLAGS="$CFLAGS -D_LINUX_SOURCE_COMPAT -qmaxmem=32000"
                fi
                ;;
+       *osf*)
+               # this brings in socklen_t
+               AC_N_DEFINE(_XOPEN_SOURCE,600)
+               AC_N_DEFINE(_OSF_SOURCE)
+               ;;
        #
        # VOS may need to have POSIX support and System V compatibility enabled.
        #
index fd85ef9fc45f1a353ebd80813fe36838b4c3a4fe..2aec69896702500a159b858de2dcca4863a045e8 100644 (file)
@@ -1,3 +1,23 @@
+#
+# This offers a nice overview how to build shared libraries on all platforms
+#        http://www.fortran-2000.com/ArnaudRecipes/sharedlib.html
+#
+
+AC_DEFUN([AC_LIBREPLACE_STLD],
+[
+       AC_PATH_PROG(PROG_AR, ar)
+
+       STLD=${PROG_AR}
+
+       AC_SUBST(STLD)
+])
+
+AC_DEFUN([AC_LIBREPLACE_STLD_FLAGS],
+[
+       STLD_FLAGS="-rcs"
+       AC_SUBST(STLD_FLAGS)
+])
+
 AC_DEFUN([AC_LD_EXPORT_DYNAMIC],
 [
 saved_LDFLAGS="$LDFLAGS"
@@ -67,48 +87,102 @@ case "$host_os" in
                PICFLAG="-KPIC"
                ;;
        *darwin*)
+               PICFLAG="-fno-common"
                ;;
 esac
 AC_SUBST(PICFLAG)
 ])
 
-AC_DEFUN([AC_LD_SHLDFLAGS],
+AC_DEFUN([AC_LIBREPLACE_LD_SHLIB_LINKER],
+[
+       LD_SHLIB_LINKER="${CC}"
+
+       case "$host_os" in
+               *irix*)
+                       LD_SHLIB_LINKER="${PROG_LD}"
+                       ;;
+       esac
+
+       AC_SUBST(LD_SHLIB_LINKER)
+])
+
+AC_DEFUN([AC_LIBREPLACE_LD_SHLIB_FLAGS],
 [
-       SHLD_FLAGS="-shared"
+       LD_SHLIB_FLAGS="-shared"
 
        case "$host_os" in
                *linux*)
-                       SHLD_FLAGS="-shared -Wl,-Bsymbolic"
+                       LD_SHLIB_FLAGS="-shared -Wl,-Bsymbolic"
                        ;;
                *solaris*)
-                       SHLD_FLAGS="-G"
+                       LD_SHLIB_FLAGS="-G"
                        if test "${GCC}" = "no"; then
                                ## ${CFLAGS} added for building 64-bit shared 
                                ## libs using Sun's Compiler
-                               SHLD_FLAGS="-G \${CFLAGS}"
+                               LD_SHLIB_FLAGS="-G \${CFLAGS}"
                        fi
                        ;;
                *sunos*)
-                       SHLD_FLAGS="-G"
+                       LD_SHLIB_FLAGS="-G"
                        ;;
                *irix*)
-                       SHLD_FLAGS="-shared"
+                       LD_SHLIB_FLAGS="-shared"
                        ;;
                *aix*)
-                       SHLD_FLAGS="-Wl,-G,-bexpall,-bbigtoc"
+                       LD_SHLIB_FLAGS="-Wl,-G,-bexpall,-bbigtoc"
                        ;;
                *hpux*)
                        if test "${GCC}" = "yes"; then
-                               SHLD_FLAGS="-shared"
+                               LD_SHLIB_FLAGS="-shared"
                        else
-                               SHLD_FLAGS="-b"
+                               LD_SHLIB_FLAGS="-b"
                        fi
                        ;;
+               *osf*)
+                       LD_SHLIB_FLAGS="-shared"
+                       ;;
                *darwin*)
-                       SHLD_FLAGS="-dynamiclib"
+                       LD_SHLIB_FLAGS="-dynamiclib -Wl,-search_paths_first"
                        ;;
        esac
 
+       AC_SUBST(LD_SHLIB_FLAGS)
+])
+
+AC_DEFUN([AC_LIBREPLACE_LD_SHLIB_DISALLOW_UNDEF_FLAG],
+[
+       LD_SHLIB_DISALLOW_UNDEF_FLAG=""
+
+       #
+       # TODO: enforce error not only warnings
+       #
+       # NOTE: -Wl,--no-allow-shlib-undefined isn't what we want...
+       #       as it bails out on broken system libraries
+       #
+       case "$host_os" in
+               *osf*)
+                       LD_SHLIB_DISALLOW_UNDEF_FLAG="-warning_unresolved"
+                       ;;
+               *darwin*)
+                       LD_SHLIB_DISALLOW_UNDEF_FLAG="-undefined error"
+                       ;;
+       esac
+
+       AC_SUBST(LD_SHLIB_DISALLOW_UNDEF_FLAG)
+])
+
+AC_DEFUN([AC_LIBREPLACE_SHLD],
+[
+       AC_REQUIRE([AC_LIBREPLACE_LD_SHLIB_LINKER])
+       SHLD="$LD_SHLIB_LINKER"
+       AC_SUBST(SHLD)
+])
+
+AC_DEFUN([AC_LIBREPLACE_SHLD_FLAGS],
+[
+       AC_REQUIRE([AC_LIBREPLACE_LD_SHLIB_FLAGS])
+       AC_REQUIRE([AC_LIBREPLACE_LD_SHLIB_DISALLOW_UNDEF_FLAG])
+       SHLD_FLAGS="$LD_SHLIB_FLAGS $LD_SHLIB_DISALLOW_UNDEF_FLAG"
        AC_SUBST(SHLD_FLAGS)
 ])
 
@@ -157,7 +231,7 @@ AC_DEFUN([AC_LD_SONAMEFLAG],
                        SONAMEFLAG="-Wl,-soname,"
                        ;;
                *hpux*)
-                       SONAMEFLAG="-Wl,+h "
+                       SONAMEFLAG="-Wl,+h,"
                        ;;
                *osf*)
                        SONAMEFLAG="-Wl,-soname,"
@@ -166,7 +240,74 @@ AC_DEFUN([AC_LD_SONAMEFLAG],
                        SONAMEFLAG="-Wl,-soname,"
                        ;;
                *darwin*)
-                       SONAMEFLAG="-install_name "
+                       SONAMEFLAG="#"
+                       ;;
+               *aix*)
+                       # Not supported
+                       SONAMEFLAG="#"
                        ;;
                esac
 ])
+
+AC_DEFUN([AC_LIBREPLACE_MDLD],
+[
+       AC_REQUIRE([AC_LIBREPLACE_LD_SHLIB_LINKER])
+       MDLD="$LD_SHLIB_LINKER"
+       AC_SUBST(MDLD)
+])
+
+AC_DEFUN([AC_LIBREPLACE_LD_SHLIB_ALLOW_UNDEF_FLAG],
+[
+       LD_ALLOW_SHLIB_UNDEF_FLAG=""
+
+       case "$host_os" in
+               *linux*)
+                       LD_SHLIB_ALLOW_UNDEF_FLAG="-Wl,--allow-shlib-undefined"
+                       ;;
+               *osf*)
+                       LD_SHLIB_ALLOW_UNDEF_FLAG="-Wl,-expect_unresolved,\"*\""
+                       ;;
+               *darwin*)
+                       LD_SHLIB_ALLOW_UNDEF_FLAG="-undefined dynamic_lookup"
+                       ;;
+       esac
+
+       AC_SUBST(LD_SHLIB_ALLOW_UNDEF_FLAG)
+])
+
+AC_DEFUN([AC_LIBREPLACE_MDLD_FLAGS],
+[
+       AC_REQUIRE([AC_LIBREPLACE_LD_SHLIB_FLAGS])
+       AC_REQUIRE([AC_LIBREPLACE_LD_SHLIB_ALLOW_UNDEF_FLAG])
+       MDLD_FLAGS="$LD_SHLIB_FLAGS $LD_SHLIB_ALLOW_UNDEF_FLAG"
+       AC_SUBST(MDLD_FLAGS)
+])
+
+AC_DEFUN([AC_LIBREPLACE_RUNTIME_LIB_PATH_VAR],
+[
+       case "$host_os" in
+               *linux*)
+                       LIB_PATH_VAR=LD_LIBRARY_PATH
+               ;;
+               *solaris*)
+                       LIB_PATH_VAR=LD_LIBRARY_PATH
+               ;;
+               *hpux*)
+                       LIB_PATH_VAR=SHLIB_PATH
+               ;;
+               *osf*)
+                       LIB_PATH_VAR=LD_LIBRARY_PATH
+               ;;
+               *aix*)
+                       LIB_PATH_VAR=LIB_PATH
+                       ;;
+               *irix*)
+                       LIB_PATH_VAR=LD_LIBRARY_PATH
+                       ;;
+               *darwin*)
+                       LIB_PATH_VAR=DYLD_LIBRARY_PATH
+                       ;;
+       esac
+
+       AC_SUBST(LIB_PATH_VAR)
+])
index 92fecd3db84aad32e3e2840e1a3e019b8a828ecb..1856eacf66e4fc31f1fd1af1abdb7a626b5ff72f 100644 (file)
@@ -87,19 +87,6 @@ fi
 rm -f conftest*
 ])])
 
-AC_DEFUN([AC_EXTENSION_FLAG],
-[
-  cat >>confdefs.h <<\EOF
-#ifndef $1
-# define $1 1
-#endif
-EOF
-AH_VERBATIM([$1], [#ifndef $1
-# define $1 1
-#endif])
-])
-
-
 dnl see if a declaration exists for a function or variable
 dnl defines HAVE_function_DECL if it exists
 dnl AC_HAVE_DECL(var, includes)
@@ -248,11 +235,18 @@ m4_define([AH_CHECK_FUNC_EXT],
 
 dnl Define an AC_DEFINE with ifndef guard.
 dnl AC_N_DEFINE(VARIABLE [, VALUE])
-define(AC_N_DEFINE,
-[cat >> confdefs.h <<\EOF
-[#ifndef] $1
-[#define] $1 ifelse($#, 2, [$2], $#, 3, [$2], 1)
-[#endif]
+AC_DEFUN([AC_N_DEFINE],
+[
+AH_VERBATIM([$1], [
+#ifndef $1
+# undef $1
+#endif
+])
+
+ cat >>confdefs.h <<\EOF
+#ifndef $1
+[#define] $1 m4_if($#, 1, 1, [$2])
+#endif
 EOF
 ])
 
index 799187af7d47d00eb914238a6a699a5207161165..1c05733126d81c208b30435ce04c3ed6e77f8b89 100644 (file)
@@ -73,6 +73,18 @@ AC_VERIFY_C_PROTOTYPE([struct passwd *getpwent_r(struct passwd *src, char *buf,
        #include <unistd.h>
        #include <pwd.h>
        ])
+AC_VERIFY_C_PROTOTYPE([struct passwd *getpwent_r(struct passwd *src, char *buf, size_t buflen)],
+       [
+       #ifndef HAVE_GETPWENT_R_DECL
+       #error missing getpwent_r prototype
+       #endif
+       return NULL;
+       ],[
+       AC_DEFINE(SOLARIS_GETPWENT_R, 1, [getpwent_r irix (similar to solaris) function prototype])
+       ],[],[
+       #include <unistd.h>
+       #include <pwd.h>
+       ])
 AC_CHECK_FUNCS(getgrnam_r getgrgid_r getgrent_r)
 AC_HAVE_DECL(getgrent_r, [
        #include <unistd.h>
@@ -91,6 +103,19 @@ AC_VERIFY_C_PROTOTYPE([struct group *getgrent_r(struct group *src, char *buf, in
        #include <grp.h>
        ])
 
+AC_VERIFY_C_PROTOTYPE([struct group *getgrent_r(struct group *src, char *buf, size_t buflen)],
+       [
+       #ifndef HAVE_GETGRENT_R_DECL
+       #error missing getgrent_r prototype
+       #endif
+       return NULL;
+       ],[
+       AC_DEFINE(SOLARIS_GETGRENT_R, 1, [getgrent_r irix (similar to solaris)  function prototype])
+       ],[],[
+       #include <unistd.h>
+       #include <grp.h>
+       ])
+
 # locale
 AC_CHECK_HEADERS(ctype.h locale.h)
 
index d3ae2bf398ff1427e7ddcd38a98ffd565ffc028c..aff8a841daef6e39a5e709eba0d4fee24d3dcd22 100644 (file)
 #include <sys/ioctl.h>
 #endif
 
+#ifdef HAVE_STROPTS_H
+#include <stropts.h>
+#endif
+
 #ifdef REPLACE_INET_NTOA
 /* define is in "replace.h" */
 char *rep_inet_ntoa(struct in_addr ip);
@@ -133,8 +137,15 @@ const char *rep_inet_ntop(int af, const void *src, char *dst, socklen_t size);
 #endif
 
 #ifndef AI_ADDRCONFIG
+/*
+ * logic copied from AI_NUMERICHOST
+ */
+#if defined(HAVE_STRUCT_ADDRINFO) && defined(HAVE_GETADDRINFO)
+#define AI_ADDRCONFIG  0
+#else
 #define AI_ADDRCONFIG  0x0020
 #endif
+#endif
 
 #ifndef AI_NUMERICSERV
 /*
@@ -223,9 +234,18 @@ typedef unsigned short int sa_family_t;
 #ifdef HAVE_STRUCT_SOCKADDR_IN6
 #define sockaddr_storage sockaddr_in6
 #define ss_family sin6_family
+#define HAVE_SS_FAMILY 1
 #else
 #define sockaddr_storage sockaddr_in
 #define ss_family sin_family
+#define HAVE_SS_FAMILY 1
+#endif
+#endif
+
+#ifndef HAVE_SS_FAMILY
+#ifdef HAVE___SS_FAMILY
+#define ss_family __ss_family
+#define HAVE_SS_FAMILY 1
 #endif
 #endif
 
diff --git a/source/lib/replace/system/printing.h b/source/lib/replace/system/printing.h
deleted file mode 100644 (file)
index 7eb02d0..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-#ifndef _system_printing_h
-#define _system_printing_h
-
-/* 
-   Unix SMB/CIFS implementation.
-
-   printing system include wrappers
-
-   Copyright (C) Andrew Tridgell 2004
-   
-     ** NOTE! The following LGPL license applies to the replace
-     ** library. This does NOT imply that all of Samba is released
-     ** under the LGPL
-   
-   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
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with this library; if not, see <http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef AIX
-#define DEFAULT_PRINTING PRINT_AIX
-#define PRINTCAP_NAME "/etc/qconfig"
-#endif
-
-#ifdef HPUX
-#define DEFAULT_PRINTING PRINT_HPUX
-#endif
-
-#ifdef QNX
-#define DEFAULT_PRINTING PRINT_QNX
-#endif
-
-#ifndef DEFAULT_PRINTING
-#define DEFAULT_PRINTING PRINT_BSD
-#endif
-#ifndef PRINTCAP_NAME
-#define PRINTCAP_NAME "/etc/printcap"
-#endif
-
-#endif
index 269a2ff5d625cd26c7daf720efb90edf9c97fb2f..5b95ae395ce3b19d634c25174d056790148f5ef5 100644 (file)
@@ -37,7 +37,6 @@
 #include "system/locale.h"
 #include "system/network.h"
 #include "system/passwd.h"
-#include "system/printing.h"
 #include "system/readline.h"
 #include "system/select.h"
 #include "system/shmem.h"
index 9e533a5a280f37206edb51c1b98687535361c09e..8760a6109a7ba95f30e5c7f2bf7b4c80317baa61 100644 (file)
@@ -54,11 +54,12 @@ void sec_ace_copy(SEC_ACE *ace_dest, SEC_ACE *ace_src)
  Sets up a SEC_ACE structure.
 ********************************************************************/
 
-void init_sec_ace(SEC_ACE *t, const DOM_SID *sid, uint8 type, uint32 mask, uint8 flag)
+void init_sec_ace(SEC_ACE *t, const DOM_SID *sid, enum security_ace_type type,
+                 uint32 mask, uint8 flag)
 {
        t->type = type;
        t->flags = flag;
-       t->size = sid_size(sid) + 8;
+       t->size = ndr_size_dom_sid(sid, 0) + 8;
        t->access_mask = mask;
 
        ZERO_STRUCTP(&t->trustee);
@@ -83,9 +84,9 @@ NTSTATUS sec_ace_add_sid(TALLOC_CTX *ctx, SEC_ACE **pp_new, SEC_ACE *old, unsign
        for (i = 0; i < *num - 1; i ++)
                sec_ace_copy(&(*pp_new)[i], &old[i]);
 
-       (*pp_new)[i].type  = 0;
+       (*pp_new)[i].type  = SEC_ACE_TYPE_ACCESS_ALLOWED;
        (*pp_new)[i].flags = 0;
-       (*pp_new)[i].size  = SEC_ACE_HEADER_SIZE + sid_size(sid);
+       (*pp_new)[i].size  = SEC_ACE_HEADER_SIZE + ndr_size_dom_sid(sid, 0);
        (*pp_new)[i].access_mask = mask;
        sid_copy(&(*pp_new)[i].trustee, sid);
        return NT_STATUS_OK;
index 328bc1b4b415f05197aebdaad86d1392dbf763f0..5e82242e1b0e55b690bb362a8784cb93f1721a27 100644 (file)
@@ -26,7 +26,8 @@
  Create a SEC_ACL structure.  
 ********************************************************************/
 
-SEC_ACL *make_sec_acl(TALLOC_CTX *ctx, uint16 revision, int num_aces, SEC_ACE *ace_list)
+SEC_ACL *make_sec_acl(TALLOC_CTX *ctx, enum security_acl_revision revision,
+                     int num_aces, SEC_ACE *ace_list)
 {
        SEC_ACL *dst;
        int i;
index 4a9785009b28efb7bbfa86d386c3933ee02e4e7e..44ae23271ef45261ea1d6a4a0cce868e78e31703 100644 (file)
@@ -31,35 +31,6 @@ const struct generic_mapping file_generic_mapping = {
        FILE_GENERIC_ALL
 };
 
-/*******************************************************************
- Works out the linearization size of a SEC_DESC.
-********************************************************************/
-
-size_t sec_desc_size(SEC_DESC *psd)
-{
-       size_t offset;
-
-       if (!psd) return 0;
-
-       offset = SEC_DESC_HEADER_SIZE;
-
-       /* don't align */
-
-       if (psd->owner_sid != NULL)
-               offset += sid_size(psd->owner_sid);
-
-       if (psd->group_sid != NULL)
-               offset += sid_size(psd->group_sid);
-
-       if (psd->sacl != NULL)
-               offset += psd->sacl->size;
-
-       if (psd->dacl != NULL)
-               offset += psd->dacl->size;
-
-       return offset;
-}
-
 /*******************************************************************
  Compares two SEC_DESC structures
 ********************************************************************/
@@ -182,7 +153,9 @@ SEC_DESC_BUF *sec_desc_merge(TALLOC_CTX *ctx, SEC_DESC_BUF *new_sdb, SEC_DESC_BU
  Creates a SEC_DESC structure
 ********************************************************************/
 
-SEC_DESC *make_sec_desc(TALLOC_CTX *ctx, uint16 revision, uint16 type,
+SEC_DESC *make_sec_desc(TALLOC_CTX *ctx,
+                       enum security_descriptor_revision revision,
+                       uint16 type,
                        const DOM_SID *owner_sid, const DOM_SID *grp_sid,
                        SEC_ACL *sacl, SEC_ACL *dacl, size_t *sd_size)
 {
@@ -233,11 +206,11 @@ SEC_DESC *make_sec_desc(TALLOC_CTX *ctx, uint16 revision, uint16 type,
        }
 
        if (dst->owner_sid != NULL) {
-               offset += sid_size(dst->owner_sid);
+               offset += ndr_size_dom_sid(dst->owner_sid, 0);
        }
 
        if (dst->group_sid != NULL) {
-               offset += sid_size(dst->group_sid);
+               offset += ndr_size_dom_sid(dst->group_sid, 0);
        }
 
        *sd_size = (size_t)offset;
@@ -272,25 +245,21 @@ NTSTATUS marshall_sec_desc(TALLOC_CTX *mem_ctx,
                           struct security_descriptor *secdesc,
                           uint8 **data, size_t *len)
 {
-       prs_struct ps;
-       
-       if (!prs_init(&ps, sec_desc_size(secdesc), mem_ctx, MARSHALL)) {
-               return NT_STATUS_NO_MEMORY;
-       }
+       DATA_BLOB blob;
+       enum ndr_err_code ndr_err;
 
-       if (!sec_io_desc("security_descriptor", &secdesc, &ps, 1)) {
-               prs_mem_free(&ps);
-               return NT_STATUS_INVALID_PARAMETER;
-       }
+       ndr_err = ndr_push_struct_blob(
+               &blob, mem_ctx, secdesc,
+               (ndr_push_flags_fn_t)ndr_push_security_descriptor);
 
-       if (!(*data = (uint8 *)talloc_memdup(mem_ctx, ps.data_p,
-                                            prs_offset(&ps)))) {
-               prs_mem_free(&ps);
-               return NT_STATUS_NO_MEMORY;
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               DEBUG(0, ("ndr_push_security_descriptor failed: %s\n",
+                         ndr_errstr(ndr_err)));
+               return ndr_map_error2ntstatus(ndr_err);;
        }
 
-       *len = prs_offset(&ps);
-       prs_mem_free(&ps);
+       *data = blob.data;
+       *len = blob.length;
        return NT_STATUS_OK;
 }
 
@@ -300,25 +269,33 @@ NTSTATUS marshall_sec_desc(TALLOC_CTX *mem_ctx,
 NTSTATUS unmarshall_sec_desc(TALLOC_CTX *mem_ctx, uint8 *data, size_t len,
                             struct security_descriptor **psecdesc)
 {
-       prs_struct ps;
-       struct security_descriptor *secdesc = NULL;
+       DATA_BLOB blob;
+       enum ndr_err_code ndr_err;
+       struct security_descriptor *result;
 
-       if (!(secdesc = TALLOC_ZERO_P(mem_ctx, struct security_descriptor))) {
-               return NT_STATUS_NO_MEMORY;
+       if ((data == NULL) || (len == 0)) {
+               return NT_STATUS_INVALID_PARAMETER;
        }
 
-       if (!prs_init(&ps, 0, secdesc, UNMARSHALL)) {
+       result = TALLOC_ZERO_P(mem_ctx, struct security_descriptor);
+       if (result == NULL) {
                return NT_STATUS_NO_MEMORY;
        }
 
-       prs_give_memory(&ps, (char *)data, len, False);
+       blob = data_blob_const(data, len);
 
-       if (!sec_io_desc("security_descriptor", &secdesc, &ps, 1)) {
-               return NT_STATUS_INVALID_PARAMETER;
+       ndr_err = ndr_pull_struct_blob(
+               &blob, result, result,
+               (ndr_pull_flags_fn_t)ndr_pull_security_descriptor);
+
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               DEBUG(0, ("ndr_pull_security_descriptor failed: %s\n",
+                         ndr_errstr(ndr_err)));
+               TALLOC_FREE(result);
+               return ndr_map_error2ntstatus(ndr_err);;
        }
 
-       prs_mem_free(&ps);
-       *psecdesc = secdesc;
+       *psecdesc = result;
        return NT_STATUS_OK;
 }
 
@@ -329,8 +306,9 @@ NTSTATUS unmarshall_sec_desc(TALLOC_CTX *mem_ctx, uint8 *data, size_t len,
 SEC_DESC *make_standard_sec_desc(TALLOC_CTX *ctx, const DOM_SID *owner_sid, const DOM_SID *grp_sid,
                                 SEC_ACL *dacl, size_t *sd_size)
 {
-       return make_sec_desc(ctx, SEC_DESC_REVISION, SEC_DESC_SELF_RELATIVE,
-                            owner_sid, grp_sid, NULL, dacl, sd_size);
+       return make_sec_desc(ctx, SECURITY_DESCRIPTOR_REVISION_1,
+                            SEC_DESC_SELF_RELATIVE, owner_sid, grp_sid, NULL,
+                            dacl, sd_size);
 }
 
 /*******************************************************************
@@ -557,7 +535,8 @@ SEC_DESC_BUF *se_create_child_secdesc(TALLOC_CTX *ctx, SEC_DESC *parent_ctr,
           correct.  Perhaps the user and group should be passed in as
           parameters by the caller? */
 
-       sd = make_sec_desc(ctx, SEC_DESC_REVISION, SEC_DESC_SELF_RELATIVE,
+       sd = make_sec_desc(ctx, SECURITY_DESCRIPTOR_REVISION_1,
+                          SEC_DESC_SELF_RELATIVE,
                           parent_ctr->owner_sid,
                           parent_ctr->group_sid,
                           parent_ctr->sacl,
index b3b000579f1b9539320e932aa44e494f741292de..f6ff701d5b79ae587dcab9c19950d2dfed7ed675 100644 (file)
@@ -92,7 +92,9 @@ SEC_DESC *get_share_security_default( TALLOC_CTX *ctx, size_t *psize, uint32 def
        init_sec_ace(&ace, &global_sid_World, SEC_ACE_TYPE_ACCESS_ALLOWED, sa, 0);
 
        if ((psa = make_sec_acl(ctx, NT4_ACL_REVISION, 1, &ace)) != NULL) {
-               psd = make_sec_desc(ctx, SEC_DESC_REVISION, SEC_DESC_SELF_RELATIVE, NULL, NULL, NULL, psa, psize);
+               psd = make_sec_desc(ctx, SECURITY_DESCRIPTOR_REVISION_1,
+                                   SEC_DESC_SELF_RELATIVE, NULL, NULL, NULL,
+                                   psa, psize);
        }
 
        if (!psd) {
@@ -142,7 +144,7 @@ SEC_DESC *get_share_security( TALLOC_CTX *ctx, const char *servicename,
        }
 
        if (psd)
-               *psize = sec_desc_size(psd);
+               *psize = ndr_size_security_descriptor(psd, 0);
 
        return psd;
 }
@@ -226,25 +228,20 @@ bool share_access_check(const NT_USER_TOKEN *token, const char *sharename,
 {
        uint32 granted;
        NTSTATUS status;
-       TALLOC_CTX *mem_ctx = NULL;
        SEC_DESC *psd = NULL;
        size_t sd_size;
        bool ret = True;
 
-       if (!(mem_ctx = talloc_init("share_access_check"))) {
-               return False;
-       }
-
-       psd = get_share_security(mem_ctx, sharename, &sd_size);
+       psd = get_share_security(talloc_tos(), sharename, &sd_size);
 
        if (!psd) {
-               TALLOC_FREE(mem_ctx);
                return True;
        }
 
        ret = se_access_check(psd, token, desired_access, &granted, &status);
 
-       talloc_destroy(mem_ctx);
+       TALLOC_FREE(psd);
+
        return ret;
 }
 
@@ -291,7 +288,7 @@ bool parse_usershare_acl(TALLOC_CTX *ctx, const char *acl_str, SEC_DESC **ppsd)
                uint32 s_access;
                DOM_SID sid;
                char *sidstr;
-               uint8 type = SEC_ACE_TYPE_ACCESS_ALLOWED;
+               enum security_ace_type type = SEC_ACE_TYPE_ACCESS_ALLOWED;
 
                if (!next_token_talloc(ctx, &pacl, &sidstr, ":")) {
                        DEBUG(0,("parse_usershare_acl: malformed usershare acl looking "
@@ -339,7 +336,9 @@ bool parse_usershare_acl(TALLOC_CTX *ctx, const char *acl_str, SEC_DESC **ppsd)
        }
 
        if ((psa = make_sec_acl(ctx, NT4_ACL_REVISION, num_aces, ace_list)) != NULL) {
-               psd = make_sec_desc(ctx, SEC_DESC_REVISION, SEC_DESC_SELF_RELATIVE, NULL, NULL, NULL, psa, &sd_size);
+               psd = make_sec_desc(ctx, SECURITY_DESCRIPTOR_REVISION_1,
+                                   SEC_DESC_SELF_RELATIVE, NULL, NULL, NULL,
+                                   psa, &sd_size);
        }
 
        if (!psd) {
index 3a72c5a74a0ecd0826c2b751110eaaa857f1d98c..5b8052e5ed69f6a97f7e8ae010992d3bbc0cd918 100644 (file)
@@ -571,8 +571,8 @@ static const char *socket_wrapper_pcap_file(void)
 {
        static int initialized = 0;
        static const char *s = NULL;
-       static const struct swrap_file_hdr h;
-       static const struct swrap_packet p;
+       static const struct swrap_file_hdr h = { 0, };
+       static const struct swrap_packet p = { { 0, }, { { 0, }, { { 0, } } } };
 
        if (initialized == 1) {
                return s;
index e06917c8fbe24d3140526236503a04dd18c67e33..59b54c4dff00b06875ebfef8cad2e56a5987746f 100644 (file)
@@ -34,6 +34,11 @@ fstring remote_proto="UNKNOWN";
 
 static char *local_machine;
 
+void free_local_machine_name(void)
+{
+       SAFE_FREE(local_machine);
+}
+
 bool set_local_machine_name(const char *local_name, bool perm)
 {
        static bool already_perm = false;
@@ -408,7 +413,7 @@ static const char *automount_path(const char *user_name)
        /* use the passwd entry as the default */
        /* this will be the default if WITH_AUTOMOUNT is not used or fails */
 
-       server_path = talloc_strdup(ctx, get_user_home_dir(user_name));
+       server_path = talloc_strdup(ctx, get_user_home_dir(ctx, user_name));
        if (!server_path) {
                return "";
        }
@@ -541,7 +546,6 @@ char *alloc_sub_basic(const char *smb_name, const char *domain_name,
 {
        char *b, *p, *s, *r, *a_string;
        fstring pidstr, vnnstr;
-       struct passwd *pass;
        char addr[INET6_ADDRSTRLEN];
        const char *local_machine_name = get_local_machine_name();
 
@@ -571,15 +575,21 @@ char *alloc_sub_basic(const char *smb_name, const char *domain_name,
                        }
                        a_string = realloc_string_sub(a_string, "%U", r);
                        break;
-               case 'G' :
+               case 'G' : {
+                       struct passwd *pass;
                        r = SMB_STRDUP(smb_name);
                        if (r == NULL) {
                                goto error;
                        }
-                       if ((pass = Get_Pwnam(r))!=NULL) {
-                               a_string = realloc_string_sub(a_string, "%G", gidtoname(pass->pw_gid));
-                       } 
+                       pass = Get_Pwnam_alloc(talloc_tos(), r);
+                       if (pass != NULL) {
+                               a_string = realloc_string_sub(
+                                       a_string, "%G",
+                                       gidtoname(pass->pw_gid));
+                       }
+                       TALLOC_FREE(pass);
                        break;
+               }
                case 'D' :
                        r = strdup_upper(domain_name);
                        if (r == NULL) {
@@ -766,7 +776,7 @@ static char *alloc_sub_advanced(const char *servicename, const char *user,
                         const char *str)
 {
        char *a_string, *ret_string;
-       char *b, *p, *s, *h;
+       char *b, *p, *s;
 
        a_string = SMB_STRDUP(str);
        if (a_string == NULL) {
@@ -782,10 +792,13 @@ static char *alloc_sub_advanced(const char *servicename, const char *user,
                case 'N' :
                        a_string = realloc_string_sub(a_string, "%N", automount_server(user));
                        break;
-               case 'H':
-                       if ((h = get_user_home_dir(user)))
+               case 'H': {
+                       char *h;
+                       if ((h = get_user_home_dir(talloc_tos(), user)))
                                a_string = realloc_string_sub(a_string, "%H", h);
+                       TALLOC_FREE(h);
                        break;
+               }
                case 'P': 
                        a_string = realloc_string_sub(a_string, "%P", connectpath); 
                        break;
index 3e61f42aa52ac889da8fa451887a2f137ce692e5..9c1256ed650039d8a4c895f9aa9b4f5a9a6dab60 100644 (file)
@@ -3,7 +3,7 @@
    Samba system utilities for ACL support.
    Copyright (C) Jeremy Allison 2000.
    Copyright (C) Volker Lendecke 2006
-   Copyright (C) Michael Adam 2006
+   Copyright (C) Michael Adam 2006,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
@@ -364,9 +364,9 @@ SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
        return posixacl_sys_acl_get_file(handle, path_p, type);
 }
  
-SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp, int fd)
+SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp)
 {
-       return posixacl_sys_acl_get_fd(handle, fsp, fd);
+       return posixacl_sys_acl_get_fd(handle, fsp);
 }
  
 int sys_acl_set_file(vfs_handle_struct *handle,
@@ -376,9 +376,9 @@ int sys_acl_set_file(vfs_handle_struct *handle,
 }
  
 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
-                  int fd, SMB_ACL_T acl_d)
+                  SMB_ACL_T acl_d)
 {
-       return posixacl_sys_acl_set_fd(handle, fsp, fd, acl_d);
+       return posixacl_sys_acl_set_fd(handle, fsp, acl_d);
 }
 
 int sys_acl_delete_def_file(vfs_handle_struct *handle,
@@ -395,9 +395,9 @@ SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
        return aixacl_sys_acl_get_file(handle, path_p, type);
 }
 
-SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp, int fd)
+SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp)
 {
-       return aixacl_sys_acl_get_fd(handle, fsp, fd);
+       return aixacl_sys_acl_get_fd(handle, fsp);
 }
 
 int sys_acl_set_file(vfs_handle_struct *handle,
@@ -407,9 +407,9 @@ int sys_acl_set_file(vfs_handle_struct *handle,
 }
 
 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
-                  int fd, SMB_ACL_T acl_d)
+                  SMB_ACL_T acl_d)
 {
-       return aixacl_sys_acl_set_fd(handle, fsp, fd, acl_d);
+       return aixacl_sys_acl_set_fd(handle, fsp, acl_d);
 }
 
 int sys_acl_delete_def_file(vfs_handle_struct *handle,
@@ -426,9 +426,9 @@ SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
        return tru64acl_sys_acl_get_file(handle, path_p, type);
 }
 
-SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp, int fd)
+SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp)
 {
-       return tru64acl_sys_acl_get_fd(handle, fsp, fd);
+       return tru64acl_sys_acl_get_fd(handle, fsp);
 }
 
 int sys_acl_set_file(vfs_handle_struct *handle,
@@ -438,9 +438,9 @@ int sys_acl_set_file(vfs_handle_struct *handle,
 }
 
 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
-                  int fd, SMB_ACL_T acl_d)
+                  SMB_ACL_T acl_d)
 {
-       return tru64acl_sys_acl_set_fd(handle, fsp, fd, acl_d);
+       return tru64acl_sys_acl_set_fd(handle, fsp, acl_d);
 }
 
 int sys_acl_delete_def_file(vfs_handle_struct *handle,
@@ -457,9 +457,9 @@ SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
        return solarisacl_sys_acl_get_file(handle, path_p, type);
 }
 
-SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp, int fd)
+SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp)
 {
-       return solarisacl_sys_acl_get_fd(handle, fsp, fd);
+       return solarisacl_sys_acl_get_fd(handle, fsp);
 }
 
 int sys_acl_set_file(vfs_handle_struct *handle,
@@ -469,9 +469,9 @@ int sys_acl_set_file(vfs_handle_struct *handle,
 }
 
 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
-                  int fd, SMB_ACL_T acl_d)
+                  SMB_ACL_T acl_d)
 {
-       return solarisacl_sys_acl_set_fd(handle, fsp, fd, acl_d);
+       return solarisacl_sys_acl_set_fd(handle, fsp, acl_d);
 }
 
 int sys_acl_delete_def_file(vfs_handle_struct *handle,
@@ -488,9 +488,9 @@ SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
        return hpuxacl_sys_acl_get_file(handle, path_p, type);
 }
 
-SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp, int fd)
+SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp)
 {
-       return hpuxacl_sys_acl_get_fd(handle, fsp, fd);
+       return hpuxacl_sys_acl_get_fd(handle, fsp);
 }
 
 int sys_acl_set_file(vfs_handle_struct *handle,
@@ -500,9 +500,9 @@ int sys_acl_set_file(vfs_handle_struct *handle,
 }
 
 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
-                  int fd, SMB_ACL_T acl_d)
+                  SMB_ACL_T acl_d)
 {
-       return hpuxacl_sys_acl_set_fd(handle, fsp, fd, acl_d);
+       return hpuxacl_sys_acl_set_fd(handle, fsp, acl_d);
 }
 
 int sys_acl_delete_def_file(vfs_handle_struct *handle,
@@ -519,9 +519,9 @@ SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
        return irixacl_sys_acl_get_file(handle, path_p, type);
 }
 
-SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp, int fd)
+SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp)
 {
-       return irixacl_sys_acl_get_fd(handle, fsp, fd);
+       return irixacl_sys_acl_get_fd(handle, fsp);
 }
 
 int sys_acl_set_file(vfs_handle_struct *handle,
@@ -531,9 +531,9 @@ int sys_acl_set_file(vfs_handle_struct *handle,
 }
 
 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
-                  int fd, SMB_ACL_T acl_d)
+                  SMB_ACL_T acl_d)
 {
-       return irixacl_sys_acl_set_fd(handle, fsp, fd, acl_d);
+       return irixacl_sys_acl_set_fd(handle, fsp, acl_d);
 }
 
 int sys_acl_delete_def_file(vfs_handle_struct *handle,
@@ -555,7 +555,7 @@ SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
        return NULL;
 }
 
-SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp, int fd)
+SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp)
 {
 #ifdef ENOTSUP
        errno = ENOTSUP;
@@ -577,7 +577,7 @@ int sys_acl_set_file(vfs_handle_struct *handle,
 }
 
 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
-                  int fd, SMB_ACL_T acl_d)
+                  SMB_ACL_T acl_d)
 {
 #ifdef ENOTSUP
        errno = ENOTSUP;
index eb6dcae6fb1f0c57357a54cfe67acbfe7a901da4..fa50955ef64cedee89a0d247fd78d74736617e74 100644 (file)
@@ -1917,11 +1917,6 @@ int sys_fremovexattr (int filedes, const char *name)
 #endif
 }
 
-#if !defined(HAVE_SETXATTR)
-#define XATTR_CREATE  0x1       /* set value, fail if attr already exists */
-#define XATTR_REPLACE 0x2       /* set value, fail if attr does not exist */
-#endif
-
 int sys_setxattr (const char *path, const char *name, const void *value, size_t size, int flags)
 {
 #if defined(HAVE_SETXATTR)
index 4d72c0e871a2d190d37a5021aaa40e3e629250bd..9dcd8a2a83cf4e9254b79c8e9f264efdbc8587a4 100644 (file)
@@ -60,6 +60,8 @@
 #define TALLOC_MAGIC 0xe814ec70
 #define TALLOC_FLAG_FREE 0x01
 #define TALLOC_FLAG_LOOP 0x02
+#define TALLOC_FLAG_POOL 0x04          /* This is a talloc pool */
+#define TALLOC_FLAG_POOLMEM 0x08       /* This is allocated in a pool */
 #define TALLOC_MAGIC_REFERENCE ((const char *)1)
 
 /* by default we abort when given a bad pointer (such as when talloc_free() is called 
@@ -109,6 +111,19 @@ struct talloc_chunk {
        const char *name;
        size_t size;
        unsigned flags;
+
+       /*
+        * "pool" has dual use:
+        *
+        * For the talloc pool itself (i.e. TALLOC_FLAG_POOL is set), "pool"
+        * marks the end of the currently allocated area.
+        *
+        * For members of the pool (i.e. TALLOC_FLAG_POOLMEM is set), "pool"
+        * is a pointer to the struct talloc_chunk of the pool that it was
+        * allocated from. This way children can quickly find the pool to chew
+        * from.
+        */
+       void *pool;
 };
 
 /* 16 byte alignment seems to keep everyone happy */
@@ -200,12 +215,87 @@ const char *talloc_parent_name(const void *ptr)
        return tc? tc->name : NULL;
 }
 
+/*
+  A pool carries an in-pool object count count in the first 16 bytes.
+  bytes. This is done to support talloc_steal() to a parent outside of the
+  pool. The count includes the pool itself, so a talloc_free() on a pool will
+  only destroy the pool if the count has dropped to zero. A talloc_free() of a
+  pool member will reduce the count, and eventually also call free(3) on the
+  pool memory.
+
+  The object count is not put into "struct talloc_chunk" because it is only
+  relevant for talloc pools and the alignment to 16 bytes would increase the
+  memory footprint of each talloc chunk by those 16 bytes.
+*/
+
+#define TALLOC_POOL_HDR_SIZE 16
+
+static unsigned int *talloc_pool_objectcount(struct talloc_chunk *tc)
+{
+       return (unsigned int *)((char *)tc + sizeof(struct talloc_chunk));
+}
+
+/*
+  Allocate from a pool
+*/
+
+static struct talloc_chunk *talloc_alloc_pool(struct talloc_chunk *parent,
+                                             size_t size)
+{
+       struct talloc_chunk *pool_ctx = NULL;
+       size_t space_left;
+       struct talloc_chunk *result;
+       size_t chunk_size;
+
+       if (parent == NULL) {
+               return NULL;
+       }
+
+       if (parent->flags & TALLOC_FLAG_POOL) {
+               pool_ctx = parent;
+       }
+       else if (parent->flags & TALLOC_FLAG_POOLMEM) {
+               pool_ctx = (struct talloc_chunk *)parent->pool;
+       }
+
+       if (pool_ctx == NULL) {
+               return NULL;
+       }
+
+       space_left = ((char *)pool_ctx + TC_HDR_SIZE + pool_ctx->size)
+               - ((char *)pool_ctx->pool);
+
+       /*
+        * Align size to 16 bytes
+        */
+       chunk_size = ((size + 15) & ~15);
+
+       if (space_left < chunk_size) {
+               return NULL;
+       }
+
+       result = (struct talloc_chunk *)pool_ctx->pool;
+
+#if defined(DEVELOPER) && defined(VALGRIND_MAKE_MEM_UNDEFINED)
+       VALGRIND_MAKE_MEM_UNDEFINED(result, size);
+#endif
+
+       pool_ctx->pool = (void *)((char *)result + chunk_size);
+
+       result->flags = TALLOC_MAGIC | TALLOC_FLAG_POOLMEM;
+       result->pool = pool_ctx;
+
+       *talloc_pool_objectcount(pool_ctx) += 1;
+
+       return result;
+}
+
 /* 
    Allocate a bit of memory as a child of an existing pointer
 */
 static inline void *__talloc(const void *context, size_t size)
 {
-       struct talloc_chunk *tc;
+       struct talloc_chunk *tc = NULL;
 
        if (unlikely(context == NULL)) {
                context = null_context;
@@ -215,11 +305,19 @@ static inline void *__talloc(const void *context, size_t size)
                return NULL;
        }
 
-       tc = (struct talloc_chunk *)malloc(TC_HDR_SIZE+size);
-       if (unlikely(tc == NULL)) return NULL;
+       if (context != NULL) {
+               tc = talloc_alloc_pool(talloc_chunk_from_ptr(context),
+                                      TC_HDR_SIZE+size);
+       }
+
+       if (tc == NULL) {
+               tc = (struct talloc_chunk *)malloc(TC_HDR_SIZE+size);
+               if (unlikely(tc == NULL)) return NULL;
+               tc->flags = TALLOC_MAGIC;
+               tc->pool  = NULL;
+       }
 
        tc->size = size;
-       tc->flags = TALLOC_MAGIC;
        tc->destructor = NULL;
        tc->child = NULL;
        tc->name = NULL;
@@ -245,6 +343,33 @@ static inline void *__talloc(const void *context, size_t size)
        return TC_PTR_FROM_CHUNK(tc);
 }
 
+/*
+ * Create a talloc pool
+ */
+
+void *talloc_pool(const void *context, size_t size)
+{
+       void *result = __talloc(context, size + TALLOC_POOL_HDR_SIZE);
+       struct talloc_chunk *tc;
+
+       if (unlikely(result == NULL)) {
+               return NULL;
+       }
+
+       tc = talloc_chunk_from_ptr(result);
+
+       tc->flags |= TALLOC_FLAG_POOL;
+       tc->pool = (char *)result + TALLOC_POOL_HDR_SIZE;
+
+       *talloc_pool_objectcount(tc) = 1;
+
+#if defined(DEVELOPER) && defined(VALGRIND_MAKE_MEM_NOACCESS)
+       VALGRIND_MAKE_MEM_NOACCESS(tc->pool, size);
+#endif
+
+       return result;
+}
+
 /*
   setup a destructor to be called on free of a pointer
   the destructor should return 0 on success, or -1 on failure.
@@ -420,7 +545,29 @@ static inline int _talloc_free(void *ptr)
        }
 
        tc->flags |= TALLOC_FLAG_FREE;
-       free(tc);
+
+       if (tc->flags & (TALLOC_FLAG_POOL|TALLOC_FLAG_POOLMEM)) {
+               struct talloc_chunk *pool;
+               unsigned int *pool_object_count;
+
+               pool = (tc->flags & TALLOC_FLAG_POOL)
+                       ? tc : (struct talloc_chunk *)tc->pool;
+
+               pool_object_count = talloc_pool_objectcount(pool);
+
+               if (*pool_object_count == 0) {
+                       TALLOC_ABORT("Pool object count zero!");
+               }
+
+               *pool_object_count -= 1;
+
+               if (*pool_object_count == 0) {
+                       free(pool);
+               }
+       }
+       else {
+               free(tc);
+       }
        return 0;
 }
 
@@ -718,6 +865,15 @@ void talloc_free_children(void *ptr)
                        talloc_steal(new_parent, child);
                }
        }
+
+       if ((tc->flags & TALLOC_FLAG_POOL)
+           && (*talloc_pool_objectcount(tc) == 1)) {
+               tc->pool = ((char *)tc + TC_HDR_SIZE + TALLOC_POOL_HDR_SIZE);
+#if defined(DEVELOPER) && defined(VALGRIND_MAKE_MEM_NOACCESS)
+               VALGRIND_MAKE_MEM_NOACCESS(
+                       tc->pool, tc->size - TALLOC_POOL_HDR_SIZE);
+#endif
+       }
 }
 
 /* 
@@ -769,6 +925,7 @@ void *_talloc_realloc(const void *context, void *ptr, size_t size, const char *n
 {
        struct talloc_chunk *tc;
        void *new_ptr;
+       bool malloced = false;
 
        /* size zero is equivalent to free() */
        if (unlikely(size == 0)) {
@@ -792,6 +949,12 @@ void *_talloc_realloc(const void *context, void *ptr, size_t size, const char *n
                return NULL;
        }
 
+       /* don't shrink if we have less than 1k to gain */
+       if ((size < tc->size) && ((tc->size - size) < 1024)) {
+               tc->size = size;
+               return ptr;
+       }
+
        /* by resetting magic we catch users of the old memory */
        tc->flags |= TALLOC_FLAG_FREE;
 
@@ -802,7 +965,24 @@ void *_talloc_realloc(const void *context, void *ptr, size_t size, const char *n
                free(tc);
        }
 #else
-       new_ptr = realloc(tc, size + TC_HDR_SIZE);
+       if (tc->flags & TALLOC_FLAG_POOLMEM) {
+
+               new_ptr = talloc_alloc_pool(tc, size + TC_HDR_SIZE);
+               *talloc_pool_objectcount((struct talloc_chunk *)
+                                        (tc->pool)) -= 1;
+
+               if (new_ptr == NULL) {
+                       new_ptr = malloc(TC_HDR_SIZE+size);
+                       malloced = true;
+               }
+
+               if (new_ptr) {
+                       memcpy(new_ptr, tc, MIN(tc->size,size) + TC_HDR_SIZE);
+               }
+       }
+       else {
+               new_ptr = realloc(tc, size + TC_HDR_SIZE);
+       }
 #endif
        if (unlikely(!new_ptr)) {       
                tc->flags &= ~TALLOC_FLAG_FREE; 
@@ -810,7 +990,10 @@ void *_talloc_realloc(const void *context, void *ptr, size_t size, const char *n
        }
 
        tc = (struct talloc_chunk *)new_ptr;
-       tc->flags &= ~TALLOC_FLAG_FREE; 
+       tc->flags &= ~TALLOC_FLAG_FREE;
+       if (malloced) {
+               tc->flags &= ~TALLOC_FLAG_POOLMEM;
+       }
        if (tc->parent) {
                tc->parent->child = tc;
        }
index e1033916817d86b913393824a8a711e30acc6968..5431971655ed7093a2e9d2db3c3239da69c18177 100644 (file)
@@ -116,6 +116,7 @@ typedef void TALLOC_CTX;
 
 /* The following definitions come from talloc.c  */
 void *_talloc(const void *context, size_t size);
+void *talloc_pool(const void *context, size_t size);
 void _talloc_set_destructor(const void *ptr, int (*destructor)(void *));
 int talloc_increase_ref_count(const void *ptr);
 size_t talloc_reference_count(const void *ptr);
index e16c91f8b9c27cb0b3f308ff42a2d13ae5413eb4..fedbda95aac23dbb86d2701a43385df04dbb023e 100644 (file)
@@ -813,6 +813,25 @@ static bool test_speed(void)
 
        talloc_free(ctx);
 
+       ctx = talloc_pool(NULL, 1024);
+
+       tv = timeval_current();
+       count = 0;
+       do {
+               void *p1, *p2, *p3;
+               for (i=0;i<loop;i++) {
+                       p1 = talloc_size(ctx, loop % 100);
+                       p2 = talloc_strdup(p1, "foo bar");
+                       p3 = talloc_size(p1, 300);
+                       talloc_free_children(ctx);
+               }
+               count += 3 * loop;
+       } while (timeval_elapsed(&tv) < 5.0);
+
+       talloc_free(ctx);
+
+       fprintf(stderr, "talloc_pool: %.0f ops/sec\n", count/timeval_elapsed(&tv));
+
        tv = timeval_current();
        count = 0;
        do {
@@ -1066,6 +1085,23 @@ static bool test_autofree(void)
        return true;
 }
 
+static bool test_pool(void)
+{
+       void *pool;
+       void *p1, *p2, *p3, *p4;
+
+       pool = talloc_pool(NULL, 1024);
+
+       p1 = talloc_size(pool, 80);
+       p2 = talloc_size(pool, 20);
+       p3 = talloc_size(p1, 50);
+       p4 = talloc_size(p3, 1000);
+
+       talloc_free(pool);
+
+       return true;
+}
+
 struct torture_context;
 bool torture_local_talloc(struct torture_context *tctx)
 {
@@ -1094,6 +1130,7 @@ bool torture_local_talloc(struct torture_context *tctx)
        ret &= test_free_parent_deny_child(); 
        ret &= test_talloc_ptrtype();
        ret &= test_talloc_free_in_destructor();
+       ret &= test_pool();
 
        if (ret) {
                ret &= test_speed();
index e6e4ed321a52a08956e652f943f5452b81f4bbac..2722fb96768636ccd64fac6e896d25c1c74c2422 100644 (file)
 #include "includes.h"
 
 static int talloc_stacksize;
+static int talloc_stack_arraysize;
 static TALLOC_CTX **talloc_stack;
 
-static int talloc_pop(int *ptr)
+static int talloc_pop(TALLOC_CTX *frame)
 {
-       int tos = *ptr;
        int i;
 
-       for (i=talloc_stacksize-1; i>=tos; i--) {
+       for (i=talloc_stacksize-1; i>0; i--) {
+               if (frame == talloc_stack[i]) {
+                       break;
+               }
                talloc_free(talloc_stack[i]);
        }
 
-       talloc_stacksize = tos;
+       talloc_stacksize = i;
        return 0;
 }
 
@@ -61,31 +64,40 @@ static int talloc_pop(int *ptr)
  * not explicitly freed.
  */
 
-TALLOC_CTX *talloc_stackframe(void)
+static TALLOC_CTX *talloc_stackframe_internal(size_t poolsize)
 {
-       TALLOC_CTX **tmp, *top;
-       int *cleanup;
+       TALLOC_CTX **tmp, *top, *parent;
+
+       if (talloc_stack_arraysize < talloc_stacksize + 1) {
+               tmp = TALLOC_REALLOC_ARRAY(NULL, talloc_stack, TALLOC_CTX *,
+                                          talloc_stacksize + 1);
+               if (tmp == NULL) {
+                       goto fail;
+               }
+               talloc_stack = tmp;
+               talloc_stack_arraysize = talloc_stacksize + 1;
+        }
 
-       if (!(tmp = TALLOC_REALLOC_ARRAY(NULL, talloc_stack, TALLOC_CTX *,
-                                        talloc_stacksize + 1))) {
-               goto fail;
+       if (talloc_stacksize == 0) {
+               parent = talloc_stack;
+       }
+       else {
+               parent = talloc_stack[talloc_stacksize-1];
        }
 
-       talloc_stack = tmp;
-
-       if (!(top = talloc_new(talloc_stack))) {
-               goto fail;
+       if (poolsize) {
+               top = talloc_pool(parent, poolsize);
+       } else {
+               top = talloc_new(parent);
        }
 
-       if (!(cleanup = talloc(top, int))) {
+       if (top == NULL) {
                goto fail;
        }
 
-       *cleanup = talloc_stacksize;
-       talloc_set_destructor(cleanup, talloc_pop);
+       talloc_set_destructor(top, talloc_pop);
 
        talloc_stack[talloc_stacksize++] = top;
-
        return top;
 
  fail:
@@ -93,6 +105,16 @@ TALLOC_CTX *talloc_stackframe(void)
        return NULL;
 }
 
+TALLOC_CTX *talloc_stackframe(void)
+{
+       return talloc_stackframe_internal(0);
+}
+
+TALLOC_CTX *talloc_stackframe_pool(size_t poolsize)
+{
+       return talloc_stackframe_internal(poolsize);
+}
+
 /*
  * Get us the current top of the talloc stack.
  */
index b109643f23561790f7616a963551c7bf64c13385..2f2a4c379b0690399a9f4065b15960e667300bf0 100644 (file)
 
 #include "tdb_private.h"
 
+/* 'right' merges can involve O(n^2) cost when combined with a
+   traverse, so they are disabled until we find a way to do them in 
+   O(1) time
+*/
+#define USE_RIGHT_MERGES 0
+
 /* read a freelist record and check for simple errors */
 int tdb_rec_free_read(struct tdb_context *tdb, tdb_off_t off, struct list_struct *rec)
 {
@@ -56,7 +62,7 @@ int tdb_rec_free_read(struct tdb_context *tdb, tdb_off_t off, struct list_struct
 }
 
 
-
+#if USE_RIGHT_MERGES
 /* Remove an element from the freelist.  Must have alloc lock. */
 static int remove_from_freelist(struct tdb_context *tdb, tdb_off_t off, tdb_off_t next)
 {
@@ -75,6 +81,7 @@ static int remove_from_freelist(struct tdb_context *tdb, tdb_off_t off, tdb_off_
        TDB_LOG((tdb, TDB_DEBUG_FATAL,"remove_from_freelist: not on list at off=%d\n", off));
        return TDB_ERRCODE(TDB_ERR_CORRUPT, -1);
 }
+#endif
 
 
 /* update a record tailer (must hold allocation lock) */
@@ -93,8 +100,6 @@ static int update_tailer(struct tdb_context *tdb, tdb_off_t offset,
    neccessary. */
 int tdb_free(struct tdb_context *tdb, tdb_off_t offset, struct list_struct *rec)
 {
-       tdb_off_t right, left;
-
        /* Allocation and tailer lock */
        if (tdb_lock(tdb, -1, F_WRLCK) != 0)
                return -1;
@@ -105,9 +110,10 @@ int tdb_free(struct tdb_context *tdb, tdb_off_t offset, struct list_struct *rec)
                goto fail;
        }
 
+#if USE_RIGHT_MERGES
        /* Look right first (I'm an Australian, dammit) */
-       right = offset + sizeof(*rec) + rec->rec_len;
-       if (right + sizeof(*rec) <= tdb->map_size) {
+       if (offset + sizeof(*rec) + rec->rec_len + sizeof(*rec) <= tdb->map_size) {
+               tdb_off_t right = offset + sizeof(*rec) + rec->rec_len;
                struct list_struct r;
 
                if (tdb->methods->tdb_read(tdb, right, &r, sizeof(r), DOCONV()) == -1) {
@@ -122,13 +128,18 @@ int tdb_free(struct tdb_context *tdb, tdb_off_t offset, struct list_struct *rec)
                                goto left;
                        }
                        rec->rec_len += sizeof(r) + r.rec_len;
+                       if (update_tailer(tdb, offset, rec) == -1) {
+                               TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_free: update_tailer failed at %u\n", offset));
+                               goto fail;
+                       }
                }
        }
-
 left:
+#endif
+
        /* Look left */
-       left = offset - sizeof(tdb_off_t);
-       if (left > TDB_DATA_START(tdb->header.hash_size)) {
+       if (offset - sizeof(tdb_off_t) > TDB_DATA_START(tdb->header.hash_size)) {
+               tdb_off_t left = offset - sizeof(tdb_off_t);
                struct list_struct l;
                tdb_off_t leftsize;
                
@@ -145,7 +156,12 @@ left:
 
                left = offset - leftsize;
 
-               /* Now read in record */
+               if (leftsize > offset ||
+                   left < TDB_DATA_START(tdb->header.hash_size)) {
+                       goto update;
+               }
+
+               /* Now read in the left record */
                if (tdb->methods->tdb_read(tdb, left, &l, sizeof(l), DOCONV()) == -1) {
                        TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_free: left read failed at %u (%u)\n", left, leftsize));
                        goto update;
@@ -153,21 +169,24 @@ left:
 
                /* If it's free, expand to include it. */
                if (l.magic == TDB_FREE_MAGIC) {
-                       if (remove_from_freelist(tdb, left, l.next) == -1) {
-                               TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_free: left free failed at %u\n", left));
-                               goto update;
-                       } else {
-                               offset = left;
-                               rec->rec_len += leftsize;
+                       /* we now merge the new record into the left record, rather than the other 
+                          way around. This makes the operation O(1) instead of O(n). This change
+                          prevents traverse from being O(n^2) after a lot of deletes */
+                       l.rec_len += sizeof(*rec) + rec->rec_len;
+                       if (tdb_rec_write(tdb, left, &l) == -1) {
+                               TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_free: update_left failed at %u\n", left));
+                               goto fail;
+                       }
+                       if (update_tailer(tdb, left, &l) == -1) {
+                               TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_free: update_tailer failed at %u\n", offset));
+                               goto fail;
                        }
+                       tdb_unlock(tdb, -1, F_WRLCK);
+                       return 0;
                }
        }
 
 update:
-       if (update_tailer(tdb, offset, rec) == -1) {
-               TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_free: update_tailer failed at %u\n", offset));
-               goto fail;
-       }
 
        /* Now, prepend to free list */
        rec->magic = TDB_FREE_MAGIC;
@@ -189,62 +208,61 @@ update:
 }
 
 
+
 /* 
    the core of tdb_allocate - called when we have decided which
    free list entry to use
+
+   Note that we try to allocate by grabbing data from the end of an existing record,
+   not the beginning. This is so the left merge in a free is more likely to be
+   able to free up the record without fragmentation
  */
-static tdb_off_t tdb_allocate_ofs(struct tdb_context *tdb, tdb_len_t length, tdb_off_t rec_ptr,
-                               struct list_struct *rec, tdb_off_t last_ptr)
+static tdb_off_t tdb_allocate_ofs(struct tdb_context *tdb, 
+                                 tdb_len_t length, tdb_off_t rec_ptr,
+                                 struct list_struct *rec, tdb_off_t last_ptr)
 {
-       struct list_struct newrec;
-       tdb_off_t newrec_ptr;
+#define MIN_REC_SIZE (sizeof(struct list_struct) + sizeof(tdb_off_t) + 8)
 
-       memset(&newrec, '\0', sizeof(newrec));
+       if (rec->rec_len < length + MIN_REC_SIZE) {
+               /* we have to grab the whole record */
 
-       /* found it - now possibly split it up  */
-       if (rec->rec_len > length + MIN_REC_SIZE) {
-               /* Length of left piece */
-               length = TDB_ALIGN(length, TDB_ALIGNMENT);
-               
-               /* Right piece to go on free list */
-               newrec.rec_len = rec->rec_len - (sizeof(*rec) + length);
-               newrec_ptr = rec_ptr + sizeof(*rec) + length;
-               
-               /* And left record is shortened */
-               rec->rec_len = length;
-       } else {
-               newrec_ptr = 0;
+               /* unlink it from the previous record */
+               if (tdb_ofs_write(tdb, last_ptr, &rec->next) == -1) {
+                       return 0;
+               }
+
+               /* mark it not free */
+               rec->magic = TDB_MAGIC;
+               if (tdb_rec_write(tdb, rec_ptr, rec) == -1) {
+                       return 0;
+               }
+               return rec_ptr;
+       }
+
+       /* we're going to just shorten the existing record */
+       rec->rec_len -= (length + sizeof(*rec));
+       if (tdb_rec_write(tdb, rec_ptr, rec) == -1) {
+               return 0;
        }
-       
-       /* Remove allocated record from the free list */
-       if (tdb_ofs_write(tdb, last_ptr, &rec->next) == -1) {
+       if (update_tailer(tdb, rec_ptr, rec) == -1) {
                return 0;
        }
-       
-       /* Update header: do this before we drop alloc
-          lock, otherwise tdb_free() might try to
-          merge with us, thinking we're free.
-          (Thanks Jeremy Allison). */
+
+       /* and setup the new record */
+       rec_ptr += sizeof(*rec) + rec->rec_len; 
+
+       memset(rec, '\0', sizeof(*rec));
+       rec->rec_len = length;
        rec->magic = TDB_MAGIC;
+
        if (tdb_rec_write(tdb, rec_ptr, rec) == -1) {
                return 0;
        }
-       
-       /* Did we create new block? */
-       if (newrec_ptr) {
-               /* Update allocated record tailer (we
-                  shortened it). */
-               if (update_tailer(tdb, rec_ptr, rec) == -1) {
-                       return 0;
-               }
-               
-               /* Free new record */
-               if (tdb_free(tdb, newrec_ptr, &newrec) == -1) {
-                       return 0;
-               }
+
+       if (update_tailer(tdb, rec_ptr, rec) == -1) {
+               return 0;
        }
-       
-       /* all done - return the new record offset */
+
        return rec_ptr;
 }
 
@@ -261,12 +279,14 @@ tdb_off_t tdb_allocate(struct tdb_context *tdb, tdb_len_t length, struct list_st
                tdb_off_t rec_ptr, last_ptr;
                tdb_len_t rec_len;
        } bestfit;
+       float multiplier = 1.0;
 
        if (tdb_lock(tdb, -1, F_WRLCK) == -1)
                return 0;
 
        /* Extra bytes required for tailer */
        length += sizeof(tdb_off_t);
+       length = TDB_ALIGN(length, TDB_ALIGNMENT);
 
  again:
        last_ptr = FREELIST_TOP;
@@ -295,18 +315,27 @@ tdb_off_t tdb_allocate(struct tdb_context *tdb, tdb_len_t length, struct list_st
                                bestfit.rec_len = rec->rec_len;
                                bestfit.rec_ptr = rec_ptr;
                                bestfit.last_ptr = last_ptr;
-                               /* consider a fit to be good enough if
-                                  we aren't wasting more than half
-                                  the space */
-                               if (bestfit.rec_len < 2*length) {
-                                       break;
-                               }
                        }
                }
 
                /* move to the next record */
                last_ptr = rec_ptr;
                rec_ptr = rec->next;
+
+               /* if we've found a record that is big enough, then
+                  stop searching if its also not too big. The
+                  definition of 'too big' changes as we scan
+                  through */
+               if (bestfit.rec_len > 0 &&
+                   bestfit.rec_len < length * multiplier) {
+                       break;
+               }
+               
+               /* this multiplier means we only extremely rarely
+                  search more than 50 or so records. At 50 records we
+                  accept records up to 11 times larger than what we
+                  want */
+               multiplier *= 1.05;
        }
 
        if (bestfit.rec_ptr != 0) {
@@ -314,7 +343,8 @@ tdb_off_t tdb_allocate(struct tdb_context *tdb, tdb_len_t length, struct list_st
                        goto fail;
                }
 
-               newrec_ptr = tdb_allocate_ofs(tdb, length, bestfit.rec_ptr, rec, bestfit.last_ptr);
+               newrec_ptr = tdb_allocate_ofs(tdb, length, bestfit.rec_ptr, 
+                                             rec, bestfit.last_ptr);
                tdb_unlock(tdb, -1, F_WRLCK);
                return newrec_ptr;
        }
@@ -328,3 +358,25 @@ tdb_off_t tdb_allocate(struct tdb_context *tdb, tdb_len_t length, struct list_st
        return 0;
 }
 
+
+
+/* 
+   return the size of the freelist - used to decide if we should repack 
+*/
+int tdb_freelist_size(struct tdb_context *tdb)
+{
+       tdb_off_t ptr;
+       int count=0;
+
+       if (tdb_lock(tdb, -1, F_RDLCK) == -1) {
+               return -1;
+       }
+
+       ptr = FREELIST_TOP;
+       while (tdb_ofs_read(tdb, ptr, &ptr) == 0 && ptr != 0) {
+               count++;
+       }
+
+       tdb_unlock(tdb, -1, F_RDLCK);
+       return count;
+}
index 8ab0768883709467876939127a3dc6dddfeb4822..172ab69d8c9e69ae7f160071567c4d885ac7848c 100644 (file)
@@ -101,8 +101,8 @@ static int tdb_write(struct tdb_context *tdb, tdb_off_t off,
                                         off+written);
                }
                if (written == -1) {
-                       /* Ensure ecode is set for log fn. */
-                       tdb->ecode = TDB_ERR_IO;
+               /* Ensure ecode is set for log fn. */
+               tdb->ecode = TDB_ERR_IO;
                        TDB_LOG((tdb, TDB_DEBUG_FATAL,"tdb_write failed at %d "
                                 "len=%d (%s)\n", off, len, strerror(errno)));
                        return TDB_ERRCODE(TDB_ERR_IO, -1);
@@ -111,8 +111,8 @@ static int tdb_write(struct tdb_context *tdb, tdb_off_t off,
                                 "write %d bytes at %d in two attempts\n",
                                 len, off));
                        errno = ENOSPC;
-                       return TDB_ERRCODE(TDB_ERR_IO, -1);
-               }
+               return TDB_ERRCODE(TDB_ERR_IO, -1);
+       }
        }
        return 0;
 }
@@ -230,7 +230,7 @@ void tdb_mmap(struct tdb_context *tdb)
   says to use for mmap expansion */
 static int tdb_expand_file(struct tdb_context *tdb, tdb_off_t size, tdb_off_t addition)
 {
-       char buf[1024];
+       char buf[8192];
 
        if (tdb->read_only || tdb->traverse_read) {
                tdb->ecode = TDB_ERR_RDONLY;
@@ -294,7 +294,7 @@ static int tdb_expand_file(struct tdb_context *tdb, tdb_off_t size, tdb_off_t ad
 int tdb_expand(struct tdb_context *tdb, tdb_off_t size)
 {
        struct list_struct rec;
-       tdb_off_t offset;
+       tdb_off_t offset, new_size;     
 
        if (tdb_lock(tdb, -1, F_WRLCK) == -1) {
                TDB_LOG((tdb, TDB_DEBUG_ERROR, "lock failed in tdb_expand\n"));
@@ -304,9 +304,11 @@ int tdb_expand(struct tdb_context *tdb, tdb_off_t size)
        /* must know about any previous expansions by another process */
        tdb->methods->tdb_oob(tdb, tdb->map_size + 1, 1);
 
-       /* always make room for at least 10 more records, and round
-           the database up to a multiple of the page size */
-       size = TDB_ALIGN(tdb->map_size + size*10, tdb->page_size) - tdb->map_size;
+       /* always make room for at least 100 more records, and at
+           least 25% more space. Round the database up to a multiple
+           of the page size */
+       new_size = MAX(tdb->map_size + size*100, tdb->map_size * 1.25);
+       size = TDB_ALIGN(new_size, tdb->page_size) - tdb->map_size;
 
        if (!(tdb->flags & TDB_INTERNAL))
                tdb_munmap(tdb);
index e3fe888c465f357adb436b7230d8e3070f073a63..f156c0fa7b2e548640d47db23df71c9427ec73ce 100644 (file)
@@ -505,6 +505,9 @@ int tdb_chainunlock_read(struct tdb_context *tdb, TDB_DATA key)
 /* record lock stops delete underneath */
 int tdb_lock_record(struct tdb_context *tdb, tdb_off_t off)
 {
+       if (tdb->global_lock.count) {
+               return 0;
+       }
        return off ? tdb->methods->tdb_brlock(tdb, off, F_RDLCK, F_SETLKW, 0, 1) : 0;
 }
 
@@ -537,6 +540,10 @@ int tdb_unlock_record(struct tdb_context *tdb, tdb_off_t off)
        struct tdb_traverse_lock *i;
        uint32_t count = 0;
 
+       if (tdb->global_lock.count) {
+               return 0;
+       }
+
        if (off == 0)
                return 0;
        for (i = &tdb->travlocks; i; i = i->next)
index 0bd1c91a5eec1333af91d949b17cf202a29540ef..b19e4cea293df769a588db89c71df25529d677ec 100644 (file)
@@ -35,7 +35,7 @@ static struct tdb_context *tdbs = NULL;
 static unsigned int default_tdb_hash(TDB_DATA *key)
 {
        uint32_t value; /* Used to compute the hash value.  */
-       uint32_t i;     /* Used to cycle through random values. */
+       uint32_t   i;   /* Used to cycle through random values. */
 
        /* Set the initial value from the key size. */
        for (value = 0x238F13AF * key->dsize, i=0; i < key->dsize; i++)
@@ -90,7 +90,7 @@ static int tdb_new_database(struct tdb_context *tdb, int hash_size)
                size -= written;
                written = write(tdb->fd, newdb+written, size);
                if (written == size) {
-                       ret = 0;
+               ret = 0;
                } else if (written >= 0) {
                        /* a second incomplete write - we give up.
                         * guessing the errno... */
@@ -152,6 +152,7 @@ struct tdb_context *tdb_open_ex(const char *name, int hash_size, int tdb_flags,
        int rev = 0, locked = 0;
        unsigned char *vp;
        uint32_t vertest;
+       unsigned v;
 
        if (!(tdb = (struct tdb_context *)calloc(1, sizeof *tdb))) {
                /* Can't log this */
@@ -178,9 +179,7 @@ struct tdb_context *tdb_open_ex(const char *name, int hash_size, int tdb_flags,
                tdb->page_size = 0x2000;
        }
 
-       if (open_flags & TDB_VOLATILE) {
-               tdb->max_dead_records = 5;
-       }
+       tdb->max_dead_records = (tdb_flags & TDB_VOLATILE) ? 5 : 0;
 
        if ((open_flags & O_ACCMODE) == O_WRONLY) {
                TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_open_ex: can't open tdb %s write-only\n",
@@ -215,6 +214,10 @@ struct tdb_context *tdb_open_ex(const char *name, int hash_size, int tdb_flags,
                goto fail;      /* errno set by open(2) */
        }
 
+       /* on exec, don't inherit the fd */
+       v = fcntl(tdb->fd, F_GETFD, 0);
+        fcntl(tdb->fd, F_SETFD, v | FD_CLOEXEC);
+
        /* ensure there is only one process initialising at once */
        if (tdb->methods->tdb_brlock(tdb, GLOBAL_LOCK, F_WRLCK, F_SETLKW, 0, 1) == -1) {
                TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_open_ex: failed to get global lock on %s: %s\n",
@@ -224,6 +227,7 @@ struct tdb_context *tdb_open_ex(const char *name, int hash_size, int tdb_flags,
 
        /* we need to zero database if we are the only one with it open */
        if ((tdb_flags & TDB_CLEAR_IF_FIRST) &&
+           (!tdb->read_only) &&
            (locked = (tdb->methods->tdb_brlock(tdb, ACTIVE_LOCK, F_WRLCK, F_SETLK, 0, 1) == 0))) {
                open_flags |= O_CREAT;
                if (ftruncate(tdb->fd, 0) == -1) {
@@ -242,7 +246,7 @@ struct tdb_context *tdb_open_ex(const char *name, int hash_size, int tdb_flags,
                /* its not a valid database - possibly initialise it */
                if (!(open_flags & O_CREAT) || tdb_new_database(tdb, hash_size) == -1) {
                        if (errno == 0) {
-                               errno = EIO; /* ie bad format or something */
+                       errno = EIO; /* ie bad format or something */
                        }
                        goto fail;
                }
@@ -283,7 +287,6 @@ struct tdb_context *tdb_open_ex(const char *name, int hash_size, int tdb_flags,
        tdb->map_size = st.st_size;
        tdb->device = st.st_dev;
        tdb->inode = st.st_ino;
-       tdb->max_dead_records = 0;
        tdb_mmap(tdb);
        if (locked) {
                if (tdb->methods->tdb_brlock(tdb, ACTIVE_LOCK, F_UNLCK, F_SETLK, 0, 1) == -1) {
index 0e9d1dbd7412942634d982c92fe3bef57d7bf572..ea5d9ccc6014ff9cd205e42579b48ed1c3390093 100644 (file)
@@ -102,8 +102,7 @@ static tdb_off_t tdb_find(struct tdb_context *tdb, TDB_DATA key, uint32_t hash,
 }
 
 /* As tdb_find, but if you succeed, keep the lock */
-tdb_off_t tdb_find_lock_hash(struct tdb_context *tdb, TDB_DATA key, 
-                                                        uint32_t hash, int locktype,
+tdb_off_t tdb_find_lock_hash(struct tdb_context *tdb, TDB_DATA key, uint32_t hash, int locktype,
                           struct list_struct *rec)
 {
        uint32_t rec_ptr;
@@ -237,14 +236,15 @@ int tdb_exists(struct tdb_context *tdb, TDB_DATA key)
 }
 
 /* actually delete an entry in the database given the offset */
-int tdb_do_delete(struct tdb_context *tdb, tdb_off_t rec_ptr, struct list_struct*rec)
+int tdb_do_delete(struct tdb_context *tdb, tdb_off_t rec_ptr, struct list_struct *rec)
 {
        tdb_off_t last_ptr, i;
        struct list_struct lastrec;
 
        if (tdb->read_only || tdb->traverse_read) return -1;
 
-       if (tdb_write_lock_record(tdb, rec_ptr) == -1) {
+       if (tdb->traverse_write != 0 || 
+           tdb_write_lock_record(tdb, rec_ptr) == -1) {
                /* Someone traversing here: mark it as dead */
                rec->magic = TDB_DEAD_MAGIC;
                return tdb_rec_write(tdb, rec_ptr, rec);
@@ -666,6 +666,16 @@ int tdb_get_flags(struct tdb_context *tdb)
        return tdb->flags;
 }
 
+void tdb_add_flags(struct tdb_context *tdb, unsigned flags)
+{
+       tdb->flags |= flags;
+}
+
+void tdb_remove_flags(struct tdb_context *tdb, unsigned flags)
+{
+       tdb->flags &= ~flags;
+}
+
 
 /*
   enable sequence number handling on an open tdb
@@ -674,3 +684,62 @@ void tdb_enable_seqnum(struct tdb_context *tdb)
 {
        tdb->flags |= TDB_SEQNUM;
 }
+
+
+/*
+  wipe the entire database, deleting all records. This can be done
+  very fast by using a global lock. The entire data portion of the
+  file becomes a single entry in the freelist.
+ */
+int tdb_wipe_all(struct tdb_context *tdb)
+{
+       int i;
+       tdb_off_t offset = 0;
+       ssize_t data_len;
+
+       if (tdb_lockall(tdb) != 0) {
+               return -1;
+       }
+
+       /* wipe the hashes */
+       for (i=0;i<tdb->header.hash_size;i++) {
+               if (tdb_ofs_write(tdb, TDB_HASH_TOP(i), &offset) == -1) {
+                       TDB_LOG((tdb, TDB_DEBUG_FATAL,"tdb_wipe_all: failed to write hash %d\n", i));
+                       goto failed;
+               }
+       }
+
+       /* wipe the freelist */
+       if (tdb_ofs_write(tdb, FREELIST_TOP, &offset) == -1) {
+               TDB_LOG((tdb, TDB_DEBUG_FATAL,"tdb_wipe_all: failed to write freelist\n"));
+               goto failed;
+       }
+
+       if (tdb_ofs_write(tdb, TDB_RECOVERY_HEAD, &offset) == -1) {
+               TDB_LOG((tdb, TDB_DEBUG_FATAL,"tdb_wipe_all: failed to write recovery head\n"));
+               goto failed;            
+       }
+
+       /* add all the rest of the file to the freelist */
+       data_len = (tdb->map_size - TDB_DATA_START(tdb->header.hash_size)) - sizeof(struct list_struct);
+       if (data_len > 0) {
+               struct list_struct rec;
+               memset(&rec,'\0',sizeof(rec));
+               rec.rec_len = data_len;
+               if (tdb_free(tdb, TDB_DATA_START(tdb->header.hash_size), &rec) == -1) {
+                       TDB_LOG((tdb, TDB_DEBUG_FATAL,"tdb_wipe_all: failed to add free record\n"));
+                       goto failed;
+               }
+       }
+
+       if (tdb_unlockall(tdb) != 0) {
+               TDB_LOG((tdb, TDB_DEBUG_FATAL,"tdb_wipe_all: failed to unlock\n"));
+               goto failed;
+       }
+
+       return 0;
+
+failed:
+       tdb_unlockall(tdb);
+       return -1;
+}
index 58c30c1706cf0bf244bf8f467a6c1e5acba277fc..ffac89ff0e315195b3defdebc35184ef7ab6a038 100644 (file)
 typedef uint32_t tdb_len_t;
 typedef uint32_t tdb_off_t;
 
+#ifndef offsetof
+#define offsetof(t,f) ((unsigned int)&((t *)0)->f)
+#endif
+
 #define TDB_MAGIC_FOOD "TDB file\n"
 #define TDB_VERSION (0x26011967 + 6)
 #define TDB_MAGIC (0x26011999U)
@@ -45,7 +49,6 @@ typedef uint32_t tdb_off_t;
 #define TDB_DEAD_MAGIC (0xFEE1DEAD)
 #define TDB_RECOVERY_MAGIC (0xf53bc0e7U)
 #define TDB_ALIGNMENT 4
-#define MIN_REC_SIZE (2*sizeof(struct list_struct) + TDB_ALIGNMENT)
 #define DEFAULT_HASH_SIZE 131
 #define FREELIST_TOP (sizeof(struct tdb_header))
 #define TDB_ALIGN(x,a) (((x) + (a)-1) & ~((a)-1))
@@ -54,7 +57,7 @@ typedef uint32_t tdb_off_t;
 #define TDB_BAD_MAGIC(r) ((r)->magic != TDB_MAGIC && !TDB_DEAD(r))
 #define TDB_HASH_TOP(hash) (FREELIST_TOP + (BUCKET(hash)+1)*sizeof(tdb_off_t))
 #define TDB_HASHTABLE_SIZE(tdb) ((tdb->header.hash_size+1)*sizeof(tdb_off_t))
-#define TDB_DATA_START(hash_size) TDB_HASH_TOP(hash_size-1)
+#define TDB_DATA_START(hash_size) (TDB_HASH_TOP(hash_size-1) + sizeof(tdb_off_t))
 #define TDB_RECOVERY_HEAD offsetof(struct tdb_header, recovery_start)
 #define TDB_SEQNUM_OFS    offsetof(struct tdb_header, sequence_number)
 #define TDB_PAD_BYTE 0x42
@@ -144,6 +147,7 @@ struct tdb_context {
        tdb_len_t map_size; /* how much space has been mapped */
        int read_only; /* opened read-only */
        int traverse_read; /* read-only traversal */
+       int traverse_write; /* read-write traversal */
        struct tdb_lock_type global_lock;
        int num_lockrecs;
        struct tdb_lock_type *lockrecs; /* only real locks, all with count>0 */
index 7eaacf7a164fbad3052c8b211ca8f547af3ba3be..4e2127be64484cbcb5faee1a6e5682c08425f26a 100644 (file)
 
 */
 
-struct tdb_transaction_el {
-       struct tdb_transaction_el *next, *prev;
-       tdb_off_t offset;
-       tdb_len_t length;
-       unsigned char *data;
-};
 
 /*
   hold the context of any current transaction
@@ -105,12 +99,12 @@ struct tdb_transaction {
        /* the original io methods - used to do IOs to the real db */
        const struct tdb_methods *io_methods;
 
-       /* the list of transaction elements. We use a doubly linked
-          list with a last pointer to allow us to keep the list
-          ordered, with first element at the front of the list. It
-          needs to be doubly linked as the read/write traversals need
-          to be backwards, while the commit needs to be forwards */
-       struct tdb_transaction_el *elements, *elements_last;
+       /* the list of transaction blocks. When a block is first
+          written to, it gets created in this list */
+       uint8_t **blocks;
+       uint32_t num_blocks;
+       uint32_t block_size;      /* bytes in each block */
+       uint32_t last_block_size; /* number of valid bytes in the last block */
 
        /* non-zero when an internal transaction error has
           occurred. All write operations will then fail until the
@@ -134,52 +128,48 @@ struct tdb_transaction {
 static int transaction_read(struct tdb_context *tdb, tdb_off_t off, void *buf, 
                            tdb_len_t len, int cv)
 {
-       struct tdb_transaction_el *el;
-
-       /* we need to walk the list backwards to get the most recent data */
-       for (el=tdb->transaction->elements_last;el;el=el->prev) {
-               tdb_len_t partial;
+       uint32_t blk;
 
-               if (off+len <= el->offset) {
-                       continue;
-               }
-               if (off >= el->offset + el->length) {
-                       continue;
+       /* break it down into block sized ops */
+       while (len + (off % tdb->transaction->block_size) > tdb->transaction->block_size) {
+               tdb_len_t len2 = tdb->transaction->block_size - (off % tdb->transaction->block_size);
+               if (transaction_read(tdb, off, buf, len2, cv) != 0) {
+                       return -1;
                }
+               len -= len2;
+               off += len2;
+               buf = (void *)(len2 + (char *)buf);
+       }
 
-               /* an overlapping read - needs to be split into up to
-                  2 reads and a memcpy */
-               if (off < el->offset) {
-                       partial = el->offset - off;
-                       if (transaction_read(tdb, off, buf, partial, cv) != 0) {
-                               goto fail;
-                       }
-                       len -= partial;
-                       off += partial;
-                       buf = (void *)(partial + (char *)buf);
-               }
-               if (off + len <= el->offset + el->length) {
-                       partial = len;
-               } else {
-                       partial = el->offset + el->length - off;
-               }
-               memcpy(buf, el->data + (off - el->offset), partial);
-               if (cv) {
-                       tdb_convert(buf, len);
-               }
-               len -= partial;
-               off += partial;
-               buf = (void *)(partial + (char *)buf);
-               
-               if (len != 0 && transaction_read(tdb, off, buf, len, cv) != 0) {
+       if (len == 0) {
+               return 0;
+       }
+
+       blk = off / tdb->transaction->block_size;
+
+       /* see if we have it in the block list */
+       if (tdb->transaction->num_blocks <= blk ||
+           tdb->transaction->blocks[blk] == NULL) {
+               /* nope, do a real read */
+               if (tdb->transaction->io_methods->tdb_read(tdb, off, buf, len, cv) != 0) {
                        goto fail;
                }
-
                return 0;
        }
 
-       /* its not in the transaction elements - do a real read */
-       return tdb->transaction->io_methods->tdb_read(tdb, off, buf, len, cv);
+       /* it is in the block list. Now check for the last block */
+       if (blk == tdb->transaction->num_blocks-1) {
+               if (len > tdb->transaction->last_block_size) {
+                       goto fail;
+               }
+       }
+       
+       /* now copy it out of this block */
+       memcpy(buf, tdb->transaction->blocks[blk] + (off % tdb->transaction->block_size), len);
+       if (cv) {
+               tdb_convert(buf, len);
+       }
+       return 0;
 
 fail:
        TDB_LOG((tdb, TDB_DEBUG_FATAL, "transaction_read: failed at off=%d len=%d\n", off, len));
@@ -195,12 +185,8 @@ fail:
 static int transaction_write(struct tdb_context *tdb, tdb_off_t off, 
                             const void *buf, tdb_len_t len)
 {
-       struct tdb_transaction_el *el, *best_el=NULL;
+       uint32_t blk;
 
-       if (len == 0) {
-               return 0;
-       }
-       
        /* if the write is to a hash head, then update the transaction
           hash heads */
        if (len == sizeof(tdb_off_t) && off >= FREELIST_TOP &&
@@ -209,110 +195,145 @@ static int transaction_write(struct tdb_context *tdb, tdb_off_t off,
                memcpy(&tdb->transaction->hash_heads[chain], buf, len);
        }
 
-       /* first see if we can replace an existing entry */
-       for (el=tdb->transaction->elements_last;el;el=el->prev) {
-               tdb_len_t partial;
-
-               if (best_el == NULL && off == el->offset+el->length) {
-                       best_el = el;
-               }
-
-               if (off+len <= el->offset) {
-                       continue;
+       /* break it up into block sized chunks */
+       while (len + (off % tdb->transaction->block_size) > tdb->transaction->block_size) {
+               tdb_len_t len2 = tdb->transaction->block_size - (off % tdb->transaction->block_size);
+               if (transaction_write(tdb, off, buf, len2) != 0) {
+                       return -1;
                }
-               if (off >= el->offset + el->length) {
-                       continue;
+               len -= len2;
+               off += len2;
+               if (buf != NULL) {
+                       buf = (const void *)(len2 + (const char *)buf);
                }
+       }
 
-               /* an overlapping write - needs to be split into up to
-                  2 writes and a memcpy */
-               if (off < el->offset) {
-                       partial = el->offset - off;
-                       if (transaction_write(tdb, off, buf, partial) != 0) {
-                               goto fail;
-                       }
-                       len -= partial;
-                       off += partial;
-                       buf = (const void *)(partial + (const char *)buf);
-               }
-               if (off + len <= el->offset + el->length) {
-                       partial = len;
+       if (len == 0) {
+               return 0;
+       }
+
+       blk = off / tdb->transaction->block_size;
+       off = off % tdb->transaction->block_size;
+
+       if (tdb->transaction->num_blocks <= blk) {
+               uint8_t **new_blocks;
+               /* expand the blocks array */
+               if (tdb->transaction->blocks == NULL) {
+                       new_blocks = (uint8_t **)malloc(
+                               (blk+1)*sizeof(uint8_t *));
                } else {
-                       partial = el->offset + el->length - off;
+                       new_blocks = (uint8_t **)realloc(
+                               tdb->transaction->blocks,
+                               (blk+1)*sizeof(uint8_t *));
                }
-               memcpy(el->data + (off - el->offset), buf, partial);
-               len -= partial;
-               off += partial;
-               buf = (const void *)(partial + (const char *)buf);
-               
-               if (len != 0 && transaction_write(tdb, off, buf, len) != 0) {
+               if (new_blocks == NULL) {
+                       tdb->ecode = TDB_ERR_OOM;
                        goto fail;
                }
-
-               return 0;
+               memset(&new_blocks[tdb->transaction->num_blocks], 0, 
+                      (1+(blk - tdb->transaction->num_blocks))*sizeof(uint8_t *));
+               tdb->transaction->blocks = new_blocks;
+               tdb->transaction->num_blocks = blk+1;
+               tdb->transaction->last_block_size = 0;
        }
 
-       /* see if we can append the new entry to an existing entry */
-       if (best_el && best_el->offset + best_el->length == off && 
-           (off+len < tdb->transaction->old_map_size ||
-            off > tdb->transaction->old_map_size)) {
-               unsigned char *data = best_el->data;
-               el = best_el;
-               el->data = (unsigned char *)realloc(el->data,
-                                                   el->length + len);
-               if (el->data == NULL) {
+       /* allocate and fill a block? */
+       if (tdb->transaction->blocks[blk] == NULL) {
+               tdb->transaction->blocks[blk] = (uint8_t *)calloc(tdb->transaction->block_size, 1);
+               if (tdb->transaction->blocks[blk] == NULL) {
                        tdb->ecode = TDB_ERR_OOM;
                        tdb->transaction->transaction_error = 1;
-                       el->data = data;
-                       return -1;
+                       return -1;                      
                }
-               if (buf) {
-                       memcpy(el->data + el->length, buf, len);
-               } else {
-                       memset(el->data + el->length, TDB_PAD_BYTE, len);
+               if (tdb->transaction->old_map_size > blk * tdb->transaction->block_size) {
+                       tdb_len_t len2 = tdb->transaction->block_size;
+                       if (len2 + (blk * tdb->transaction->block_size) > tdb->transaction->old_map_size) {
+                               len2 = tdb->transaction->old_map_size - (blk * tdb->transaction->block_size);
+                       }
+                       if (tdb->transaction->io_methods->tdb_read(tdb, blk * tdb->transaction->block_size, 
+                                                                  tdb->transaction->blocks[blk], 
+                                                                  len2, 0) != 0) {
+                               SAFE_FREE(tdb->transaction->blocks[blk]);                               
+                               tdb->ecode = TDB_ERR_IO;
+                               goto fail;
+                       }
+                       if (blk == tdb->transaction->num_blocks-1) {
+                               tdb->transaction->last_block_size = len2;
+                       }                       
                }
-               el->length += len;
-               return 0;
-       }
-
-       /* add a new entry at the end of the list */
-       el = (struct tdb_transaction_el *)malloc(sizeof(*el));
-       if (el == NULL) {
-               tdb->ecode = TDB_ERR_OOM;
-               tdb->transaction->transaction_error = 1;                
-               return -1;
-       }
-       el->next = NULL;
-       el->prev = tdb->transaction->elements_last;
-       el->offset = off;
-       el->length = len;
-       el->data = (unsigned char *)malloc(len);
-       if (el->data == NULL) {
-               free(el);
-               tdb->ecode = TDB_ERR_OOM;
-               tdb->transaction->transaction_error = 1;                
-               return -1;
        }
-       if (buf) {
-               memcpy(el->data, buf, len);
+       
+       /* overwrite part of an existing block */
+       if (buf == NULL) {
+               memset(tdb->transaction->blocks[blk] + off, 0, len);
        } else {
-               memset(el->data, TDB_PAD_BYTE, len);
+               memcpy(tdb->transaction->blocks[blk] + off, buf, len);
        }
-       if (el->prev) {
-               el->prev->next = el;
-       } else {
-               tdb->transaction->elements = el;
+       if (blk == tdb->transaction->num_blocks-1) {
+               if (len + off > tdb->transaction->last_block_size) {
+                       tdb->transaction->last_block_size = len + off;
+               }
        }
-       tdb->transaction->elements_last = el;
+
        return 0;
 
 fail:
-       TDB_LOG((tdb, TDB_DEBUG_FATAL, "transaction_write: failed at off=%d len=%d\n", off, len));
-       tdb->ecode = TDB_ERR_IO;
+       TDB_LOG((tdb, TDB_DEBUG_FATAL, "transaction_write: failed at off=%d len=%d\n", 
+                (blk*tdb->transaction->block_size) + off, len));
        tdb->transaction->transaction_error = 1;
        return -1;
 }
 
+
+/*
+  write while in a transaction - this varient never expands the transaction blocks, it only
+  updates existing blocks. This means it cannot change the recovery size
+*/
+static int transaction_write_existing(struct tdb_context *tdb, tdb_off_t off, 
+                                     const void *buf, tdb_len_t len)
+{
+       uint32_t blk;
+
+       /* break it up into block sized chunks */
+       while (len + (off % tdb->transaction->block_size) > tdb->transaction->block_size) {
+               tdb_len_t len2 = tdb->transaction->block_size - (off % tdb->transaction->block_size);
+               if (transaction_write_existing(tdb, off, buf, len2) != 0) {
+                       return -1;
+               }
+               len -= len2;
+               off += len2;
+               if (buf != NULL) {
+                       buf = (const void *)(len2 + (const char *)buf);
+               }
+       }
+
+       if (len == 0) {
+               return 0;
+       }
+
+       blk = off / tdb->transaction->block_size;
+       off = off % tdb->transaction->block_size;
+
+       if (tdb->transaction->num_blocks <= blk ||
+           tdb->transaction->blocks[blk] == NULL) {
+               return 0;
+       }
+
+       if (blk == tdb->transaction->num_blocks-1 &&
+           off + len > tdb->transaction->last_block_size) {
+               if (off >= tdb->transaction->last_block_size) {
+                       return 0;
+               }
+               len = tdb->transaction->last_block_size - off;
+       }
+
+       /* overwrite part of an existing block */
+       memcpy(tdb->transaction->blocks[blk] + off, buf, len);
+
+       return 0;
+}
+
+
 /*
   accelerated hash chain head search, using the cached hash heads
 */
@@ -419,10 +440,14 @@ int tdb_transaction_start(struct tdb_context *tdb)
                return -1;
        }
 
+       /* a page at a time seems like a reasonable compromise between compactness and efficiency */
+       tdb->transaction->block_size = tdb->page_size;
+
        /* get the transaction write lock. This is a blocking lock. As
           discussed with Volker, there are a number of ways we could
           make this async, which we will probably do in the future */
        if (tdb_transaction_lock(tdb, F_WRLCK) == -1) {
+               SAFE_FREE(tdb->transaction->blocks);
                SAFE_FREE(tdb->transaction);
                return -1;
        }
@@ -460,21 +485,12 @@ int tdb_transaction_start(struct tdb_context *tdb)
        tdb->transaction->io_methods = tdb->methods;
        tdb->methods = &transaction_methods;
 
-       /* by calling this transaction write here, we ensure that we don't grow the
-          transaction linked list due to hash table updates */
-       if (transaction_write(tdb, FREELIST_TOP, tdb->transaction->hash_heads, 
-                             TDB_HASHTABLE_SIZE(tdb)) != 0) {
-               TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_transaction_start: failed to prime hash table\n"));
-               tdb->ecode = TDB_ERR_IO;
-               tdb->methods = tdb->transaction->io_methods;
-               goto fail;
-       }
-
        return 0;
        
 fail:
        tdb_brlock(tdb, FREELIST_TOP, F_UNLCK, F_SETLKW, 0, 0);
        tdb_transaction_unlock(tdb);
+       SAFE_FREE(tdb->transaction->blocks);
        SAFE_FREE(tdb->transaction->hash_heads);
        SAFE_FREE(tdb->transaction);
        return -1;
@@ -486,6 +502,8 @@ fail:
 */
 int tdb_transaction_cancel(struct tdb_context *tdb)
 {      
+       int i;
+
        if (tdb->transaction == NULL) {
                TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_transaction_cancel: no transaction\n"));
                return -1;
@@ -499,13 +517,13 @@ int tdb_transaction_cancel(struct tdb_context *tdb)
 
        tdb->map_size = tdb->transaction->old_map_size;
 
-       /* free all the transaction elements */
-       while (tdb->transaction->elements) {
-               struct tdb_transaction_el *el = tdb->transaction->elements;
-               tdb->transaction->elements = el->next;
-               free(el->data);
-               free(el);
+       /* free all the transaction blocks */
+       for (i=0;i<tdb->transaction->num_blocks;i++) {
+               if (tdb->transaction->blocks[i] != NULL) {
+                       free(tdb->transaction->blocks[i]);
+               }
        }
+       SAFE_FREE(tdb->transaction->blocks);
 
        /* remove any global lock created during the transaction */
        if (tdb->global_lock.count != 0) {
@@ -515,7 +533,6 @@ int tdb_transaction_cancel(struct tdb_context *tdb)
 
        /* remove any locks created during the transaction */
        if (tdb->num_locks != 0) {
-               int i;
                for (i=0;i<tdb->num_lockrecs;i++) {
                        tdb_brlock(tdb,FREELIST_TOP+4*tdb->lockrecs[i].list,
                                   F_UNLCK,F_SETLKW, 0, 1);
@@ -567,16 +584,24 @@ static int transaction_sync(struct tdb_context *tdb, tdb_off_t offset, tdb_len_t
 */
 static tdb_len_t tdb_recovery_size(struct tdb_context *tdb)
 {
-       struct tdb_transaction_el *el;
        tdb_len_t recovery_size = 0;
+       int i;
 
        recovery_size = sizeof(uint32_t);
-       for (el=tdb->transaction->elements;el;el=el->next) {
-               if (el->offset >= tdb->transaction->old_map_size) {
+       for (i=0;i<tdb->transaction->num_blocks;i++) {
+               if (i * tdb->transaction->block_size >= tdb->transaction->old_map_size) {
+                       break;
+               }
+               if (tdb->transaction->blocks[i] == NULL) {
                        continue;
                }
-               recovery_size += 2*sizeof(tdb_off_t) + el->length;
-       }
+               recovery_size += 2*sizeof(tdb_off_t);
+               if (i == tdb->transaction->num_blocks-1) {
+                       recovery_size += tdb->transaction->last_block_size;
+               } else {
+                       recovery_size += tdb->transaction->block_size;
+               }
+       }       
 
        return recovery_size;
 }
@@ -658,6 +683,10 @@ static int tdb_recovery_allocate(struct tdb_context *tdb,
                TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_recovery_allocate: failed to write recovery head\n"));
                return -1;
        }
+       if (transaction_write_existing(tdb, TDB_RECOVERY_HEAD, &recovery_head, sizeof(tdb_off_t)) == -1) {
+               TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_recovery_allocate: failed to write recovery head\n"));
+               return -1;
+       }
 
        return 0;
 }
@@ -669,7 +698,6 @@ static int tdb_recovery_allocate(struct tdb_context *tdb,
 static int transaction_setup_recovery(struct tdb_context *tdb, 
                                      tdb_off_t *magic_offset)
 {
-       struct tdb_transaction_el *el;
        tdb_len_t recovery_size;
        unsigned char *data, *p;
        const struct tdb_methods *methods = tdb->transaction->io_methods;
@@ -677,6 +705,7 @@ static int transaction_setup_recovery(struct tdb_context *tdb,
        tdb_off_t recovery_offset, recovery_max_size;
        tdb_off_t old_map_size = tdb->transaction->old_map_size;
        uint32_t magic, tailer;
+       int i;
 
        /*
          check that the recovery area has enough space
@@ -704,30 +733,43 @@ static int transaction_setup_recovery(struct tdb_context *tdb,
        /* build the recovery data into a single blob to allow us to do a single
           large write, which should be more efficient */
        p = data + sizeof(*rec);
-       for (el=tdb->transaction->elements;el;el=el->next) {
-               if (el->offset >= old_map_size) {
+       for (i=0;i<tdb->transaction->num_blocks;i++) {
+               tdb_off_t offset;
+               tdb_len_t length;
+
+               if (tdb->transaction->blocks[i] == NULL) {
+                       continue;
+               }
+
+               offset = i * tdb->transaction->block_size;
+               length = tdb->transaction->block_size;
+               if (i == tdb->transaction->num_blocks-1) {
+                       length = tdb->transaction->last_block_size;
+               }
+               
+               if (offset >= old_map_size) {
                        continue;
                }
-               if (el->offset + el->length > tdb->transaction->old_map_size) {
+               if (offset + length > tdb->transaction->old_map_size) {
                        TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_transaction_setup_recovery: transaction data over new region boundary\n"));
                        free(data);
                        tdb->ecode = TDB_ERR_CORRUPT;
                        return -1;
                }
-               memcpy(p, &el->offset, 4);
-               memcpy(p+4, &el->length, 4);
+               memcpy(p, &offset, 4);
+               memcpy(p+4, &length, 4);
                if (DOCONV()) {
                        tdb_convert(p, 8);
                }
                /* the recovery area contains the old data, not the
                   new data, so we have to call the original tdb_read
                   method to get it */
-               if (methods->tdb_read(tdb, el->offset, p + 8, el->length, 0) != 0) {
+               if (methods->tdb_read(tdb, offset, p + 8, length, 0) != 0) {
                        free(data);
                        tdb->ecode = TDB_ERR_IO;
                        return -1;
                }
-               p += 8 + el->length;
+               p += 8 + length;
        }
 
        /* and the tailer */
@@ -742,6 +784,12 @@ static int transaction_setup_recovery(struct tdb_context *tdb,
                tdb->ecode = TDB_ERR_IO;
                return -1;
        }
+       if (transaction_write_existing(tdb, recovery_offset, data, sizeof(*rec) + recovery_size) == -1) {
+               TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_transaction_setup_recovery: failed to write secondary recovery data\n"));
+               free(data);
+               tdb->ecode = TDB_ERR_IO;
+               return -1;
+       }
 
        /* as we don't have ordered writes, we have to sync the recovery
           data before we update the magic to indicate that the recovery
@@ -763,6 +811,11 @@ static int transaction_setup_recovery(struct tdb_context *tdb,
                tdb->ecode = TDB_ERR_IO;
                return -1;
        }
+       if (transaction_write_existing(tdb, *magic_offset, &magic, sizeof(magic)) == -1) {
+               TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_transaction_setup_recovery: failed to write secondary recovery magic\n"));
+               tdb->ecode = TDB_ERR_IO;
+               return -1;
+       }
 
        /* ensure the recovery magic marker is on disk */
        if (transaction_sync(tdb, *magic_offset, sizeof(magic)) == -1) {
@@ -780,6 +833,7 @@ int tdb_transaction_commit(struct tdb_context *tdb)
        const struct tdb_methods *methods;
        tdb_off_t magic_offset = 0;
        uint32_t zero = 0;
+       int i;
 
        if (tdb->transaction == NULL) {
                TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_transaction_commit: no transaction\n"));
@@ -793,13 +847,14 @@ int tdb_transaction_commit(struct tdb_context *tdb)
                return -1;
        }
 
+
        if (tdb->transaction->nesting != 0) {
                tdb->transaction->nesting--;
                return 0;
        }               
 
        /* check for a null transaction */
-       if (tdb->transaction->elements == NULL) {
+       if (tdb->transaction->blocks == NULL) {
                tdb_transaction_cancel(tdb);
                return 0;
        }
@@ -858,10 +913,21 @@ int tdb_transaction_commit(struct tdb_context *tdb)
        }
 
        /* perform all the writes */
-       while (tdb->transaction->elements) {
-               struct tdb_transaction_el *el = tdb->transaction->elements;
+       for (i=0;i<tdb->transaction->num_blocks;i++) {
+               tdb_off_t offset;
+               tdb_len_t length;
+
+               if (tdb->transaction->blocks[i] == NULL) {
+                       continue;
+               }
 
-               if (methods->tdb_write(tdb, el->offset, el->data, el->length) == -1) {
+               offset = i * tdb->transaction->block_size;
+               length = tdb->transaction->block_size;
+               if (i == tdb->transaction->num_blocks-1) {
+                       length = tdb->transaction->last_block_size;
+               }
+
+               if (methods->tdb_write(tdb, offset, tdb->transaction->blocks[i], length) == -1) {
                        TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_transaction_commit: write failed during commit\n"));
                        
                        /* we've overwritten part of the data and
@@ -876,11 +942,12 @@ int tdb_transaction_commit(struct tdb_context *tdb)
                        TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_transaction_commit: write failed\n"));
                        return -1;
                }
-               tdb->transaction->elements = el->next;
-               free(el->data); 
-               free(el);
+               SAFE_FREE(tdb->transaction->blocks[i]);
        } 
 
+       SAFE_FREE(tdb->transaction->blocks);
+       tdb->transaction->num_blocks = 0;
+
        if (!(tdb->flags & TDB_NOSYNC)) {
                /* ensure the new data is on disk */
                if (transaction_sync(tdb, 0, tdb->map_size) == -1) {
@@ -919,6 +986,7 @@ int tdb_transaction_commit(struct tdb_context *tdb)
        /* use a transaction cancel to free memory and remove the
           transaction locks */
        tdb_transaction_cancel(tdb);
+
        return 0;
 }
 
index 27b2cfc54a4b92acd0466940a0943daa7e05e4ea..07b0c238587eb85fe3945b61b71dbd9dd0729d58 100644 (file)
@@ -241,7 +241,9 @@ int tdb_traverse(struct tdb_context *tdb,
                return -1;
        }
 
+       tdb->traverse_write++;
        ret = tdb_traverse_internal(tdb, fn, private_data, &tl);
+       tdb->traverse_write--;
 
        tdb_transaction_unlock(tdb);
 
@@ -333,3 +335,4 @@ TDB_DATA tdb_nextkey(struct tdb_context *tdb, TDB_DATA oldkey)
                TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_nextkey: WARNING tdb_unlock failed!\n"));
        return key;
 }
+
index de8fc9c2b593b336111a37f0977c997b58379714..1085055bc91e703ffcc3963a525998abe40f6c78 100644 (file)
@@ -2,7 +2,7 @@ AC_PREREQ(2.50)
 AC_DEFUN([SMB_MODULE_DEFAULT], [echo -n ""])
 AC_DEFUN([SMB_LIBRARY_ENABLE], [echo -n ""])
 AC_DEFUN([SMB_ENABLE], [echo -n ""])
-AC_INIT(tdb, 1.1.0)
+AC_INIT(tdb, 1.1.1)
 AC_CONFIG_SRCDIR([common/tdb.c])
 AC_CONFIG_HEADER(include/config.h)
 AC_LIBREPLACE_ALL_CHECKS
index fce6628b846877a93a1d7def0b327c5c6b74dfa7..0008085de540b525bb02fc1ff178d06bc898a02d 100644 (file)
@@ -135,6 +135,8 @@ int tdb_get_seqnum(struct tdb_context *tdb);
 int tdb_hash_size(struct tdb_context *tdb);
 size_t tdb_map_size(struct tdb_context *tdb);
 int tdb_get_flags(struct tdb_context *tdb);
+void tdb_add_flags(struct tdb_context *tdb, unsigned flag);
+void tdb_remove_flags(struct tdb_context *tdb, unsigned flag);
 void tdb_enable_seqnum(struct tdb_context *tdb);
 void tdb_increment_seqnum_nonblock(struct tdb_context *tdb);
 
@@ -153,6 +155,8 @@ void tdb_setalarm_sigptr(struct tdb_context *tdb, volatile sig_atomic_t *sigptr)
 void tdb_dump_all(struct tdb_context *tdb);
 int tdb_printfreelist(struct tdb_context *tdb);
 int tdb_validate_freelist(struct tdb_context *tdb, int *pnum_entries);
+int tdb_wipe_all(struct tdb_context *tdb);
+int tdb_freelist_size(struct tdb_context *tdb);
 
 extern TDB_DATA tdb_null;
 
index 79435a3571cf61f02233d088e7ce3f01354b19af..d104ccd7c44994e9d0f8ba138cbf4584343983dc 100644 (file)
@@ -135,7 +135,7 @@ static void print_data(const char *buf,int len)
        if (len<=0) return;
        printf("[%03X] ",i);
        for (i=0;i<len;) {
-               printf("%02X ",(int)buf[i]);
+               printf("%02X ",(int)((unsigned char)buf[i]));
                i++;
                if (i%8 == 0) printf(" ");
                if (i%16 == 0) {      
index 5301e3a55a4049bd6908ecc90cb13e76eb08e9c0..f98e03197f210315d52b2045e6985a58af4915f5 100644 (file)
@@ -1382,7 +1382,7 @@ void unix_to_nt_time_abs(NTTIME *nt, time_t t)
        d = (double)(t);
        d *= 1.0e7;
 
-       *nt = d;
+       *nt = (NTTIME)d;
 
        /* convert to a negative value */
        *nt=~*nt;
@@ -1443,7 +1443,7 @@ const char *display_time(NTTIME nttime)
        low = ~(nttime & 0xFFFFFFFF);
        low = low/(1000*1000*10);
 
-       sec=high+low;
+       sec=(int)(high+low);
 
        days=sec/(60*60*24);
        hours=(sec - (days*60*60*24)) / (60*60);
index 21eed9f5fc3cd2c5e7be5fe0e0846e155d34eb46..3087bac0f4b1ec50d188a3bc6467959e69d0da01 100644 (file)
@@ -32,19 +32,24 @@ static struct passwd *uname_string_combinations2(char *s, TALLOC_CTX *mem_ctx, i
  Get a users home directory.
 ****************************************************************************/
 
-char *get_user_home_dir(const char *user)
+char *get_user_home_dir(TALLOC_CTX *mem_ctx, const char *user)
 {
-       static struct passwd *pass;
+       struct passwd *pass;
+       char *result;
 
        /* Ensure the user exists. */
 
-       pass = Get_Pwnam(user);
+       pass = Get_Pwnam_alloc(mem_ctx, user);
 
        if (!pass)
                return(NULL);
+
        /* Return home directory from struct passwd. */
 
-       return(pass->pw_dir);      
+       result = talloc_move(mem_ctx, &pass->pw_dir);
+
+       TALLOC_FREE(pass);
+       return result;
 }
 
 /****************************************************************************
@@ -55,8 +60,6 @@ char *get_user_home_dir(const char *user)
  *   - using lp_usernamelevel() for permutations.
 ****************************************************************************/
 
-static struct passwd *Get_Pwnam_ret = NULL;
-
 static struct passwd *Get_Pwnam_internals(TALLOC_CTX *mem_ctx,
                                          const char *user, char *user2)
 {
@@ -134,40 +137,6 @@ struct passwd *Get_Pwnam_alloc(TALLOC_CTX *mem_ctx, const char *user)
        return ret;  
 }
 
-/****************************************************************************
- Get_Pwnam wrapper without modification.
-  NOTE: This with NOT modify 'user'! 
-****************************************************************************/
-
-struct passwd *Get_Pwnam(const char *user)
-{
-       struct passwd *ret;
-
-       ret = Get_Pwnam_alloc(NULL, user);
-       
-       /* This call used to just return the 'passwd' static buffer.
-          This could then have accidental reuse implications, so 
-          we now malloc a copy, and free it in the next use.
-
-          This should cause the (ab)user to segfault if it 
-          uses an old struct. 
-          
-          This is better than useing the wrong data in security
-          critical operations.
-
-          The real fix is to make the callers free the returned 
-          malloc'ed data.
-       */
-
-       if (Get_Pwnam_ret) {
-               TALLOC_FREE(Get_Pwnam_ret);
-       }
-       
-       Get_Pwnam_ret = ret;
-
-       return ret;  
-}
-
 /* The functions below have been taken from password.c and slightly modified */
 /****************************************************************************
  Apply a function to upper/lower case combinations
index 73b035b22bc94f532db49133b7c2d113a1e5fb80..dba7142bad35011c57029169252f5e75630b0411 100644 (file)
@@ -183,6 +183,7 @@ void gfree_names(void)
        SAFE_FREE( smb_myworkgroup );
        SAFE_FREE( smb_scope );
        free_netbios_names_array();
+       free_local_machine_name();
 }
 
 void gfree_all( void )
@@ -289,7 +290,8 @@ static struct user_auth_info cmdline_auth_info = {
        NULL,   /* password */
        false,  /* got_pass */
        false,  /* use_kerberos */
-       Undefined /* signing state */
+       Undefined, /* signing state */
+       false   /* smb_encrypt */
 };
 
 const char *get_cmdline_auth_info_username(void)
@@ -362,11 +364,22 @@ void set_cmdline_auth_info_use_krb5_ticket(void)
        cmdline_auth_info.got_pass = true;
 }
 
+/* This should only be used by lib/popt_common.c JRA */
+void set_cmdline_auth_info_smb_encrypt(void)
+{
+       cmdline_auth_info.smb_encrypt = true;
+}
+
 bool get_cmdline_auth_info_got_pass(void)
 {
        return cmdline_auth_info.got_pass;
 }
 
+bool get_cmdline_auth_info_smb_encrypt(void)
+{
+       return cmdline_auth_info.smb_encrypt;
+}
+
 bool get_cmdline_auth_info_copy(struct user_auth_info *info)
 {
        *info = cmdline_auth_info;
@@ -492,6 +505,19 @@ bool file_exist(const char *fname,SMB_STRUCT_STAT *sbuf)
        return((S_ISREG(sbuf->st_mode)) || (S_ISFIFO(sbuf->st_mode)));
 }
 
+/*******************************************************************
+ Check if a unix domain socket exists - call vfs_file_exist for samba files.
+********************************************************************/
+
+bool socket_exist(const char *fname)
+{
+       SMB_STRUCT_STAT st;
+       if (sys_stat(fname,&st) != 0) 
+               return(False);
+
+       return S_ISSOCK(st.st_mode);
+}
+
 /*******************************************************************
  Check a files mod time.
 ********************************************************************/
@@ -605,32 +631,30 @@ void show_msg(char *buf)
 }
 
 /*******************************************************************
- Set the length and marker of an smb packet.
+ Set the length and marker of an encrypted smb packet.
 ********************************************************************/
 
-void smb_setlen(char *buf,int len)
+void smb_set_enclen(char *buf,int len,uint16 enc_ctx_num)
 {
        _smb_setlen(buf,len);
 
        SCVAL(buf,4,0xFF);
-       SCVAL(buf,5,'S');
-       SCVAL(buf,6,'M');
-       SCVAL(buf,7,'B');
+       SCVAL(buf,5,'E');
+       SSVAL(buf,6,enc_ctx_num);
 }
 
 /*******************************************************************
- Setup the word count and byte count for a smb message.
+ Set the length and marker of an smb packet.
 ********************************************************************/
 
-int set_message(char *buf,int num_words,int num_bytes,bool zero)
+void smb_setlen(char *buf,int len)
 {
-       if (zero && (num_words || num_bytes)) {
-               memset(buf + smb_size,'\0',num_words*2 + num_bytes);
-       }
-       SCVAL(buf,smb_wct,num_words);
-       SSVAL(buf,smb_vwv + num_words*SIZEOFWORD,num_bytes);  
-       smb_setlen(buf,smb_size + num_words*2 + num_bytes - 4);
-       return (smb_size + num_words*2 + num_bytes);
+       _smb_setlen(buf,len);
+
+       SCVAL(buf,4,0xFF);
+       SCVAL(buf,5,'S');
+       SCVAL(buf,6,'M');
+       SCVAL(buf,7,'B');
 }
 
 /*******************************************************************
@@ -641,20 +665,10 @@ int set_message_bcc(char *buf,int num_bytes)
 {
        int num_words = CVAL(buf,smb_wct);
        SSVAL(buf,smb_vwv + num_words*SIZEOFWORD,num_bytes);
-       smb_setlen(buf,smb_size + num_words*2 + num_bytes - 4);
+       _smb_setlen(buf,smb_size + num_words*2 + num_bytes - 4);
        return (smb_size + num_words*2 + num_bytes);
 }
 
-/*******************************************************************
- Setup only the byte count for a smb message, using the end of the
- message as a marker.
-********************************************************************/
-
-int set_message_end(void *outbuf,void *end_ptr)
-{
-       return set_message_bcc((char *)outbuf,PTR_DIFF(end_ptr,smb_buf((char *)outbuf)));
-}
-
 /*******************************************************************
  Add a data blob to the end of a smb_buf, adjusting bcc and smb_len.
  Return the bytes added
@@ -896,67 +910,6 @@ int set_blocking(int fd, bool set)
 #undef FLAG_TO_SET
 }
 
-/****************************************************************************
- Transfer some data between two fd's.
-****************************************************************************/
-
-#ifndef TRANSFER_BUF_SIZE
-#define TRANSFER_BUF_SIZE 65536
-#endif
-
-ssize_t transfer_file_internal(int infd, int outfd, size_t n, ssize_t (*read_fn)(int, void *, size_t),
-                                               ssize_t (*write_fn)(int, const void *, size_t))
-{
-       char *buf;
-       size_t total = 0;
-       ssize_t read_ret;
-       ssize_t write_ret;
-       size_t num_to_read_thistime;
-       size_t num_written = 0;
-
-       if ((buf = SMB_MALLOC_ARRAY(char, TRANSFER_BUF_SIZE)) == NULL)
-               return -1;
-
-       while (total < n) {
-               num_to_read_thistime = MIN((n - total), TRANSFER_BUF_SIZE);
-
-               read_ret = (*read_fn)(infd, buf, num_to_read_thistime);
-               if (read_ret == -1) {
-                       DEBUG(0,("transfer_file_internal: read failure. Error = %s\n", strerror(errno) ));
-                       SAFE_FREE(buf);
-                       return -1;
-               }
-               if (read_ret == 0)
-                       break;
-
-               num_written = 0;
-               while (num_written < read_ret) {
-                       write_ret = (*write_fn)(outfd,buf + num_written, read_ret - num_written);
-                       if (write_ret == -1) {
-                               DEBUG(0,("transfer_file_internal: write failure. Error = %s\n", strerror(errno) ));
-                               SAFE_FREE(buf);
-                               return -1;
-                       }
-                       if (write_ret == 0)
-                               return (ssize_t)total;
-                       num_written += (size_t)write_ret;
-               }
-
-               total += (size_t)read_ret;
-       }
-
-       SAFE_FREE(buf);
-       return (ssize_t)total;          
-}
-
-SMB_OFF_T transfer_file(int infd,int outfd,SMB_OFF_T n)
-{
-       return (SMB_OFF_T)transfer_file_internal(infd, outfd, (size_t)n, sys_read, sys_write);
-}
-
 /*******************************************************************
  Sleep for a specified number of milliseconds.
 ********************************************************************/
@@ -2227,17 +2180,12 @@ void dump_data_pw(const char *msg, const uchar * data, size_t len)
 #endif
 }
 
-char *tab_depth(int depth)
+const char *tab_depth(int level, int depth)
 {
-       static fstring spaces;
-       size_t len = depth * 4;
-       if (len > sizeof(fstring)-1) {
-               len = sizeof(fstring)-1;
+       if( CHECK_DEBUGLVL(level) ) {
+               dbgtext("%*s", depth*4, "");
        }
-
-       memset(spaces, ' ', len);
-       spaces[len] = 0;
-       return spaces;
+       return "";
 }
 
 /*****************************************************************************
@@ -2483,6 +2431,7 @@ char *smb_xstrndup(const char *s, size_t n)
        if (n == -1 || ! *ptr) {
                smb_panic("smb_xvasprintf: out of memory");
        }
+       va_end(ap2);
        return n;
 }
 
@@ -3325,3 +3274,93 @@ void *talloc_zeronull(const void *context, size_t size, const char *name)
        return talloc_named_const(context, size, name);
 }
 #endif
+
+/* Split a path name into filename and stream name components. Canonicalise
+ * such that an implicit $DATA token is always explicit.
+ *
+ * The "specification" of this function can be found in the
+ * run_local_stream_name() function in torture.c, I've tried those
+ * combinations against a W2k3 server.
+ */
+
+NTSTATUS split_ntfs_stream_name(TALLOC_CTX *mem_ctx, const char *fname,
+                               char **pbase, char **pstream)
+{
+       char *base = NULL;
+       char *stream = NULL;
+       char *sname; /* stream name */
+       const char *stype; /* stream type */
+
+       DEBUG(10, ("split_ntfs_stream_name called for [%s]\n", fname));
+
+       sname = strchr_m(fname, ':');
+
+       if (lp_posix_pathnames() || (sname == NULL)) {
+               if (pbase != NULL) {
+                       base = talloc_strdup(mem_ctx, fname);
+                       NT_STATUS_HAVE_NO_MEMORY(base);
+               }
+               goto done;
+       }
+
+       if (pbase != NULL) {
+               base = talloc_strndup(mem_ctx, fname, PTR_DIFF(sname, fname));
+               NT_STATUS_HAVE_NO_MEMORY(base);
+       }
+
+       sname += 1;
+
+       stype = strchr_m(sname, ':');
+
+       if (stype == NULL) {
+               sname = talloc_strdup(mem_ctx, sname);
+               stype = "$DATA";
+       }
+       else {
+               if (StrCaseCmp(stype, ":$DATA") != 0) {
+                       /*
+                        * If there is an explicit stream type, so far we only
+                        * allow $DATA. Is there anything else allowed? -- vl
+                        */
+                       DEBUG(10, ("[%s] is an invalid stream type\n", stype));
+                       TALLOC_FREE(base);
+                       return NT_STATUS_OBJECT_NAME_INVALID;
+               }
+               sname = talloc_strndup(mem_ctx, sname, PTR_DIFF(stype, sname));
+               stype += 1;
+       }
+
+       if (sname == NULL) {
+               TALLOC_FREE(base);
+               return NT_STATUS_NO_MEMORY;
+       }
+
+       if (sname[0] == '\0') {
+               /*
+                * no stream name, so no stream
+                */
+               goto done;
+       }
+
+       if (pstream != NULL) {
+               stream = talloc_asprintf(mem_ctx, "%s:%s", sname, stype);
+               if (stream == NULL) {
+                       TALLOC_FREE(sname);
+                       TALLOC_FREE(base);
+                       return NT_STATUS_NO_MEMORY;
+               }
+               /*
+                * upper-case the type field
+                */
+               strupper_m(strchr_m(stream, ':')+1);
+       }
+
+ done:
+       if (pbase != NULL) {
+               *pbase = base;
+       }
+       if (pstream != NULL) {
+               *pstream = stream;
+       }
+       return NT_STATUS_OK;
+}
index 1973626d84cbc8ecdc919b3946ef02a303d7752b..428378505f7a1a1230e7499bb2d6bd0b7ee534b3 100644 (file)
@@ -37,74 +37,36 @@ struct passwd *tcopy_passwd(TALLOC_CTX *mem_ctx, const struct passwd *from)
        return ret;
 }
 
-#define PWNAMCACHE_SIZE 4
-static struct passwd **pwnam_cache = NULL;
-
-static void init_pwnam_cache(void)
-{
-       if (pwnam_cache != NULL)
-               return;
-
-       pwnam_cache = TALLOC_ZERO_ARRAY(NULL, struct passwd *,
-                                       PWNAMCACHE_SIZE);
-       if (pwnam_cache == NULL) {
-               smb_panic("Could not init pwnam_cache");
-       }
-
-       return;
-}
-
 void flush_pwnam_cache(void)
 {
-       TALLOC_FREE(pwnam_cache);
-       pwnam_cache = NULL;
-       init_pwnam_cache();
+       memcache_flush(NULL, GETPWNAM_CACHE);
 }
 
 struct passwd *getpwnam_alloc(TALLOC_CTX *mem_ctx, const char *name)
 {
-       int i;
-
-       struct passwd *temp;
+       struct passwd *temp, *cached;
 
-       init_pwnam_cache();
-
-       for (i=0; i<PWNAMCACHE_SIZE; i++) {
-               if ((pwnam_cache[i] != NULL) && 
-                   (strcmp(name, pwnam_cache[i]->pw_name) == 0)) {
-                       DEBUG(10, ("Got %s from pwnam_cache\n", name));
-                       return tcopy_passwd(mem_ctx, pwnam_cache[i]);
-               }
+       temp = (struct passwd *)memcache_lookup_talloc(
+               NULL, GETPWNAM_CACHE, data_blob_string_const(name));
+       if (temp != NULL) {
+               return tcopy_passwd(mem_ctx, temp);
        }
 
        temp = sys_getpwnam(name);
-       
-       if (!temp) {
-#if 0
-               if (errno == ENOMEM) {
-                       /* what now? */
-               }
-#endif
+       if (temp == NULL) {
                return NULL;
        }
 
-       for (i=0; i<PWNAMCACHE_SIZE; i++) {
-               if (pwnam_cache[i] == NULL)
-                       break;
+       cached = tcopy_passwd(NULL, temp);
+       if (cached == NULL) {
+               /*
+                * Just don't add this into the cache, ignore the failure
+                */
+               return temp;
        }
 
-       if (i == PWNAMCACHE_SIZE)
-               i = rand() % PWNAMCACHE_SIZE;
-
-       if (pwnam_cache[i] != NULL) {
-               /* Remove this old cache entry, from the cache.  We
-                * use talloc_unlink here because we want to be very
-                * clear which referece we are removing */
-               talloc_unlink(pwnam_cache, pwnam_cache[i]);
-       }
-
-       pwnam_cache[i] = tcopy_passwd(pwnam_cache, temp);
-
+       memcache_add_talloc(NULL, GETPWNAM_CACHE, data_blob_string_const(name),
+                           cached);
        return tcopy_passwd(mem_ctx, temp);
 }
 
index 956f0475a576ddbc4812d151a10d69d2769a10ac..2d7d70c63f30e2b3747267aa770bf1563acfbb24 100644 (file)
@@ -130,6 +130,7 @@ bool registry_smbconf_valname_forbidden(const char *valname)
                "include",
                "lock directory",
                "lock dir",
+               "config backend",
                NULL
        };
        const char **forbidden = NULL;
index 0481eea5f0bfdc6d8647f45cf3e87390178de28c..87e70bb95bf1b2eb6475c39c5148ec61b4693255 100644 (file)
@@ -350,7 +350,9 @@ NTSTATUS samr_make_sam_obj_sd(TALLOC_CTX *ctx, SEC_DESC **psd, size_t *sd_size)
        if ((psa = make_sec_acl(ctx, NT4_ACL_REVISION, 3, ace)) == NULL)
                return NT_STATUS_NO_MEMORY;
 
-       if ((*psd = make_sec_desc(ctx, SEC_DESC_REVISION, SEC_DESC_SELF_RELATIVE, NULL, NULL, NULL, psa, sd_size)) == NULL)
+       if ((*psd = make_sec_desc(ctx, SECURITY_DESCRIPTOR_REVISION_1,
+                                 SEC_DESC_SELF_RELATIVE, NULL, NULL, NULL,
+                                 psa, sd_size)) == NULL)
                return NT_STATUS_NO_MEMORY;
 
        return NT_STATUS_OK;
index 52f65aa77dcab81e697d42a537b905cd86c754fb..37865238a5276aa167ea41c4b9507e403de8447f 100644 (file)
@@ -382,7 +382,7 @@ bool sid_linearize(char *outbuf, size_t len, const DOM_SID *sid)
 {
        size_t i;
 
-       if (len < sid_size(sid))
+       if (len < ndr_size_dom_sid(sid, 0))
                return False;
 
        SCVAL(outbuf,0,sid->sid_rev_num);
@@ -494,18 +494,6 @@ bool sid_equal(const DOM_SID *sid1, const DOM_SID *sid2)
        return sid_compare(sid1, sid2) == 0;
 }
 
-/*****************************************************************
- Calculates size of a sid.
-*****************************************************************/  
-
-size_t sid_size(const DOM_SID *sid)
-{
-       if (sid == NULL)
-               return 0;
-
-       return sid->num_auths * sizeof(uint32) + 8;
-}
-
 /*****************************************************************
  Returns true if SID is internal (and non-mappable).
 *****************************************************************/
@@ -535,7 +523,7 @@ bool non_mappable_sid(DOM_SID *sid)
 char *sid_binstring(const DOM_SID *sid)
 {
        char *buf, *s;
-       int len = sid_size(sid);
+       int len = ndr_size_dom_sid(sid, 0);
        buf = (char *)SMB_MALLOC(len);
        if (!buf)
                return NULL;
@@ -553,7 +541,7 @@ char *sid_binstring(const DOM_SID *sid)
 char *sid_binstring_hex(const DOM_SID *sid)
 {
        char *buf, *s;
-       int len = sid_size(sid);
+       int len = ndr_size_dom_sid(sid, 0);
        buf = (char *)SMB_MALLOC(len);
        if (!buf)
                return NULL;
@@ -585,20 +573,20 @@ DOM_SID *sid_dup_talloc(TALLOC_CTX *ctx, const DOM_SID *src)
  Add SID to an array SIDs
 ********************************************************************/
 
-bool add_sid_to_array(TALLOC_CTX *mem_ctx, const DOM_SID *sid, 
-                     DOM_SID **sids, size_t *num)
+NTSTATUS add_sid_to_array(TALLOC_CTX *mem_ctx, const DOM_SID *sid,
+                         DOM_SID **sids, size_t *num)
 {
        *sids = TALLOC_REALLOC_ARRAY(mem_ctx, *sids, DOM_SID,
                                             (*num)+1);
        if (*sids == NULL) {
                *num = 0;
-               return False;
+               return NT_STATUS_NO_MEMORY;
        }
 
        sid_copy(&((*sids)[*num]), sid);
        *num += 1;
 
-       return True;
+       return NT_STATUS_OK;
 }
 
 
@@ -606,14 +594,14 @@ bool add_sid_to_array(TALLOC_CTX *mem_ctx, const DOM_SID *sid,
  Add SID to an array SIDs ensuring that it is not already there
 ********************************************************************/
 
-bool add_sid_to_array_unique(TALLOC_CTX *mem_ctx, const DOM_SID *sid,
-                            DOM_SID **sids, size_t *num_sids)
+NTSTATUS add_sid_to_array_unique(TALLOC_CTX *mem_ctx, const DOM_SID *sid,
+                                DOM_SID **sids, size_t *num_sids)
 {
        size_t i;
 
        for (i=0; i<(*num_sids); i++) {
                if (sid_compare(sid, &(*sids)[i]) == 0)
-                       return True;
+                       return NT_STATUS_OK;
        }
 
        return add_sid_to_array(mem_ctx, sid, sids, num_sids);
@@ -682,6 +670,7 @@ NTSTATUS sid_array_from_info3(TALLOC_CTX *mem_ctx,
                              size_t *num_user_sids,
                              bool include_user_group_rid)
 {
+       NTSTATUS status;
        DOM_SID sid;
        DOM_SID *sid_array = NULL;
        size_t num_sids = 0;
@@ -689,35 +678,47 @@ NTSTATUS sid_array_from_info3(TALLOC_CTX *mem_ctx,
 
        if (include_user_group_rid) {
 
-               if (!sid_compose(&sid, &(info3->dom_sid.sid),
-                                info3->user_rid)
-                   || !add_sid_to_array(mem_ctx, &sid,
-                                        &sid_array, &num_sids)) {
-                       DEBUG(3,("could not add user SID from rid 0x%x\n",
-                                info3->user_rid));                     
+               if (!sid_compose(&sid, &(info3->dom_sid.sid), info3->user_rid))
+               {
+                       DEBUG(3, ("could not compose user SID from rid 0x%x\n",
+                                 info3->user_rid));
                        return NT_STATUS_INVALID_PARAMETER;
                }
+               status = add_sid_to_array(mem_ctx, &sid, &sid_array, &num_sids);
+               if (!NT_STATUS_IS_OK(status)) {
+                       DEBUG(3, ("could not append user SID from rid 0x%x\n",
+                                 info3->user_rid));
+                       return status;
+               }
 
-               if (!sid_compose(&sid, &(info3->dom_sid.sid),
-                                info3->group_rid)
-                   || !add_sid_to_array(mem_ctx, &sid, 
-                                        &sid_array, &num_sids)) {
-                       DEBUG(3,("could not append additional group rid 0x%x\n",
-                                info3->group_rid));                    
-                       
+               if (!sid_compose(&sid, &(info3->dom_sid.sid), info3->group_rid))
+               {
+                       DEBUG(3, ("could not compose group SID from rid 0x%x\n",
+                                 info3->group_rid));
                        return NT_STATUS_INVALID_PARAMETER;
                }
+               status = add_sid_to_array(mem_ctx, &sid, &sid_array, &num_sids);
+               if (!NT_STATUS_IS_OK(status)) {
+                       DEBUG(3, ("could not append group SID from rid 0x%x\n",
+                                 info3->group_rid));
+                       return status;
+               }
        }
 
        for (i = 0; i < info3->num_groups2; i++) {
                if (!sid_compose(&sid, &(info3->dom_sid.sid),
-                                info3->gids[i].g_rid)
-                   || !add_sid_to_array(mem_ctx, &sid,
-                                        &sid_array, &num_sids)) {
-                       DEBUG(3,("could not append additional group rid 0x%x\n",
-                                info3->gids[i].g_rid));        
+                                info3->gids[i].g_rid))
+               {
+                       DEBUG(3, ("could not compose SID from additional group "
+                                 "rid 0x%x\n", info3->gids[i].g_rid));
                        return NT_STATUS_INVALID_PARAMETER;
                }
+               status = add_sid_to_array(mem_ctx, &sid, &sid_array, &num_sids);
+               if (!NT_STATUS_IS_OK(status)) {
+                       DEBUG(3, ("could not append SID from additional group "
+                                 "rid 0x%x\n", info3->gids[i].g_rid));
+                       return status;
+               }
        }
 
        /* Copy 'other' sids.  We need to do sid filtering here to
@@ -727,11 +728,12 @@ NTSTATUS sid_array_from_info3(TALLOC_CTX *mem_ctx,
          */
 
        for (i = 0; i < info3->num_other_sids; i++) {
-               if (!add_sid_to_array(mem_ctx, &info3->other_sids[i].sid,
-                                     &sid_array, &num_sids)) {
+               status = add_sid_to_array(mem_ctx, &info3->other_sids[i].sid,
+                                     &sid_array, &num_sids);
+               if (!NT_STATUS_IS_OK(status)) {
                        DEBUG(3, ("could not add SID to array: %s\n",
                                  sid_string_dbg(&info3->other_sids[i].sid)));
-                       return NT_STATUS_NO_MEMORY;
+                       return status;
                }
        }
 
index 8f1bd9e686e4056e44754acd0303e2b1c45c9a3c..ced113053610b06bf8b96827e875deb93975d924 100644 (file)
@@ -475,6 +475,29 @@ bool is_address_any(const struct sockaddr_storage *psa)
        return false;
 }
 
+/****************************************************************************
+ Get a port number in host byte order from a sockaddr_storage.
+****************************************************************************/
+
+uint16_t get_sockaddr_port(const struct sockaddr_storage *pss)
+{
+       uint16_t port = 0;
+
+       if (pss->ss_family != AF_INET) {
+#if defined(HAVE_IPV6)
+               /* IPv6 */
+               const struct sockaddr_in6 *sa6 =
+                       (const struct sockaddr_in6 *)pss;
+               port = ntohs(sa6->sin6_port);
+#endif
+       } else {
+               const struct sockaddr_in *sa =
+                       (const struct sockaddr_in *)pss;
+               port = ntohs(sa->sin_port);
+       }
+       return port;
+}
+
 /****************************************************************************
  Print out an IPv4 or IPv6 address from a struct sockaddr_storage.
 ****************************************************************************/
@@ -518,7 +541,7 @@ char *print_canonical_sockaddr(TALLOC_CTX *ctx,
        char *dest = NULL;
        int ret;
 
-       ret = getnameinfo((const struct sockaddr *)pss,
+       ret = sys_getnameinfo((const struct sockaddr *)pss,
                        sizeof(struct sockaddr_storage),
                        addr, sizeof(addr),
                        NULL, 0,
@@ -1031,44 +1054,7 @@ ssize_t read_socket_with_timeout(int fd,
 
 ssize_t read_data(int fd,char *buffer,size_t N, enum smb_read_errors *pre)
 {
-       ssize_t ret;
-       size_t total=0;
-       char addr[INET6_ADDRSTRLEN];
-
-       set_smb_read_error(pre,SMB_READ_OK);
-
-       while (total < N) {
-               ret = sys_read(fd,buffer + total,N - total);
-
-               if (ret == 0) {
-                       DEBUG(10,("read_data: read of %d returned 0. "
-                               "Error = %s\n",
-                               (int)(N - total), strerror(errno) ));
-                       set_smb_read_error(pre,SMB_READ_EOF);
-                       return 0;
-               }
-
-               if (ret == -1) {
-                       if (fd == get_client_fd()) {
-                               /* Try and give an error message saying
-                                * what client failed. */
-                               DEBUG(0,("read_data: read failure for %d "
-                                       "bytes to client %s. Error = %s\n",
-                                       (int)(N - total),
-                                       get_peer_addr(fd,addr,sizeof(addr)),
-                                       strerror(errno) ));
-                       } else {
-                               DEBUG(0,("read_data: read failure for %d. "
-                                       "Error = %s\n",
-                                       (int)(N - total),
-                                       strerror(errno) ));
-                       }
-                       set_smb_read_error(pre,SMB_READ_ERROR);
-                       return -1;
-               }
-               total += ret;
-       }
-       return (ssize_t)total;
+       return read_socket_with_timeout(fd, buffer, N, N, 0, pre);
 }
 
 /****************************************************************************
@@ -1137,25 +1123,16 @@ ssize_t read_smb_length_return_keepalive(int fd,
 {
        ssize_t len=0;
        int msg_type;
-       bool ok = false;
 
-       while (!ok) {
-               if (timeout > 0) {
-                       ok = (read_socket_with_timeout(fd,inbuf,4,4,
-                                               timeout,pre) == 4);
-               } else {
-                       ok = (read_data(fd,inbuf,4,pre) == 4);
-               }
-               if (!ok) {
-                       return -1;
-               }
+       if (read_socket_with_timeout(fd, inbuf, 4, 4, timeout, pre) != 4) {
+               return -1;
+       }
 
-               len = smb_len(inbuf);
-               msg_type = CVAL(inbuf,0);
+       len = smb_len(inbuf);
+       msg_type = CVAL(inbuf,0);
 
-               if (msg_type == SMBkeepalive) {
-                       DEBUG(5,("Got keepalive packet\n"));
-               }
+       if (msg_type == SMBkeepalive) {
+               DEBUG(5,("Got keepalive packet\n"));
        }
 
        DEBUG(10,("got smb length of %lu\n",(unsigned long)len));
@@ -1173,16 +1150,15 @@ ssize_t read_smb_length_return_keepalive(int fd,
 ssize_t read_smb_length(int fd, char *inbuf, unsigned int timeout, enum smb_read_errors *pre)
 {
        ssize_t len;
+       uint8_t msgtype = SMBkeepalive;
 
-       for(;;) {
-               len = read_smb_length_return_keepalive(fd, inbuf, timeout, pre);
-
-               if(len < 0)
+       while (msgtype == SMBkeepalive) {
+               len = read_smb_length_return_keepalive(fd, inbuf, timeout,
+                                                      pre);
+               if (len < 0) {
                        return len;
-
-               /* Ignore session keepalives. */
-               if(CVAL(inbuf,0) != SMBkeepalive)
-                       break;
+               }
+               msgtype = CVAL(inbuf, 0);
        }
 
        DEBUG(10,("read_smb_length: got smb length of %lu\n",
@@ -1251,16 +1227,8 @@ ssize_t receive_smb_raw(int fd,
                        len = MIN(len,maxlen);
                }
 
-               if (timeout > 0) {
-                       ret = read_socket_with_timeout(fd,
-                                       buffer+4,
-                                       len,
-                                       len,
-                                       timeout,
-                                       pre);
-               } else {
-                       ret = read_data(fd,buffer+4,len,pre);
-               }
+               ret = read_socket_with_timeout(fd, buffer+4, len, len, timeout,
+                                              pre);
 
                if (ret != len) {
                        cond_set_smb_read_error(pre,SMB_READ_ERROR);
@@ -1276,56 +1244,6 @@ ssize_t receive_smb_raw(int fd,
        return len;
 }
 
-/****************************************************************************
- Wrapper for receive_smb_raw().
- Checks the MAC on signed packets.
-****************************************************************************/
-
-bool receive_smb(int fd, char *buffer, unsigned int timeout, enum smb_read_errors *pre)
-{
-       if (receive_smb_raw(fd, buffer, timeout, 0, pre) < 0) {
-               return false;
-       }
-
-       /* Check the incoming SMB signature. */
-       if (!srv_check_sign_mac(buffer, true)) {
-               DEBUG(0, ("receive_smb: SMB Signature verification "
-                       "failed on incoming packet!\n"));
-               cond_set_smb_read_error(pre,SMB_READ_BAD_SIG);
-               return false;
-       }
-
-       return true;
-}
-
-/****************************************************************************
- Send an smb to a fd.
-****************************************************************************/
-
-bool send_smb(int fd, char *buffer)
-{
-       size_t len;
-       size_t nwritten=0;
-       ssize_t ret;
-
-       /* Sign the outgoing packet if required. */
-       srv_calculate_sign_mac(buffer);
-
-       len = smb_len(buffer) + 4;
-
-       while (nwritten < len) {
-               ret = write_data(fd,buffer+nwritten,len - nwritten);
-               if (ret <= 0) {
-                       DEBUG(0,("Error writing %d bytes to client. %d. (%s)\n",
-                               (int)len,(int)ret, strerror(errno) ));
-                       return false;
-               }
-               nwritten += ret;
-       }
-
-       return true;
-}
-
 /****************************************************************************
  Open a socket of the specified type, port, and address for incoming data.
 ****************************************************************************/
@@ -1800,18 +1718,66 @@ static bool matchname(const char *remotehost,
        return false;
 }
 
-static struct {
-        struct sockaddr_storage ss;
-        char *name;
-} nc;
+/*******************************************************************
+ Deal with the singleton cache.
+******************************************************************/
+
+struct name_addr_pair {
+       struct sockaddr_storage ss;
+       const char *name;
+};
+
+/*******************************************************************
+ Lookup a name/addr pair. Returns memory allocated from memcache.
+******************************************************************/
+
+static bool lookup_nc(struct name_addr_pair *nc)
+{
+       DATA_BLOB tmp;
+
+       ZERO_STRUCTP(nc);
+
+       if (!memcache_lookup(
+                       NULL, SINGLETON_CACHE,
+                       data_blob_string_const("get_peer_name"),
+                       &tmp)) {
+               return false;
+       }
+
+       memcpy(&nc->ss, tmp.data, sizeof(nc->ss));
+       nc->name = (const char *)tmp.data + sizeof(nc->ss);
+       return true;
+}
+
+/*******************************************************************
+ Save a name/addr pair.
+******************************************************************/
+
+static void store_nc(const struct name_addr_pair *nc)
+{
+       DATA_BLOB tmp;
+       size_t namelen = strlen(nc->name);
+
+       tmp = data_blob(NULL, sizeof(nc->ss) + namelen + 1);
+       if (!tmp.data) {
+               return;
+       }
+       memcpy(tmp.data, &nc->ss, sizeof(nc->ss));
+       memcpy(tmp.data+sizeof(nc->ss), nc->name, namelen+1);
+
+       memcache_add(NULL, SINGLETON_CACHE,
+                       data_blob_string_const("get_peer_name"),
+                       tmp);
+       data_blob_free(&tmp);
+}
 
 /*******************************************************************
  Return the DNS name of the remote end of a socket.
 ******************************************************************/
 
-const char *get_peer_name(int fd,
-                               bool force_lookup)
+const char *get_peer_name(int fd, bool force_lookup)
 {
+       struct name_addr_pair nc;
        char addr_buf[INET6_ADDRSTRLEN];
        struct sockaddr_storage ss;
        socklen_t length = sizeof(ss);
@@ -1826,13 +1792,15 @@ const char *get_peer_name(int fd,
           possible */
        if (!lp_hostname_lookups() && (force_lookup == false)) {
                length = sizeof(nc.ss);
-               p = get_peer_addr_internal(fd, addr_buf, sizeof(addr_buf),
+               nc.name = get_peer_addr_internal(fd, addr_buf, sizeof(addr_buf),
                        &nc.ss, &length);
-               SAFE_FREE(nc.name);
-               nc.name = SMB_STRDUP(p);
+               store_nc(&nc);
+               lookup_nc(&nc);
                return nc.name ? nc.name : "UNKNOWN";
        }
 
+       lookup_nc(&nc);
+
        memset(&ss, '\0', sizeof(ss));
        p = get_peer_addr_internal(fd, addr_buf, sizeof(addr_buf), &ss, &length);
 
@@ -1841,15 +1809,13 @@ const char *get_peer_name(int fd,
                return nc.name ? nc.name : "UNKNOWN";
        }
 
-       /* Not the same. Reset the cache. */
-       zero_addr(&nc.ss);
-       SAFE_FREE(nc.name);
+       /* Not the same. We need to lookup. */
        if (fd == -1) {
                return "UNKNOWN";
        }
 
        /* Look up the remote host name. */
-       ret = getnameinfo((struct sockaddr *)&ss,
+       ret = sys_getnameinfo((struct sockaddr *)&ss,
                        length,
                        name_buf,
                        sizeof(name_buf),
@@ -1880,7 +1846,11 @@ const char *get_peer_name(int fd,
                strlcpy(name_buf, "UNKNOWN", sizeof(name_buf));
        }
 
-       nc.name = SMB_STRDUP(name_buf);
+       nc.name = name_buf;
+       nc.ss = ss;
+
+       store_nc(&nc);
+       lookup_nc(&nc);
        return nc.name ? nc.name : "UNKNOWN";
 }
 
@@ -2002,50 +1972,69 @@ out_umask:
 
 const char *get_mydnsfullname(void)
 {
-       static char *dnshostname_cache;
-
-       if (dnshostname_cache == NULL || !*dnshostname_cache) {
-               struct addrinfo *res = NULL;
-               char my_hostname[HOST_NAME_MAX];
-               bool ret;
+       struct addrinfo *res = NULL;
+       char my_hostname[HOST_NAME_MAX];
+       bool ret;
+       DATA_BLOB tmp;
 
-               /* get my host name */
-               if (gethostname(my_hostname, sizeof(my_hostname)) == -1) {
-                       DEBUG(0,("get_mydnsfullname: gethostname failed\n"));
-                       return NULL;
-               }
+       if (memcache_lookup(NULL, SINGLETON_CACHE,
+                       data_blob_string_const("get_mydnsfullname"),
+                       &tmp)) {
+               SMB_ASSERT(tmp.length > 0);
+               return (const char *)tmp.data;
+       }
 
-               /* Ensure null termination. */
-               my_hostname[sizeof(my_hostname)-1] = '\0';
+       /* get my host name */
+       if (gethostname(my_hostname, sizeof(my_hostname)) == -1) {
+               DEBUG(0,("get_mydnsfullname: gethostname failed\n"));
+               return NULL;
+       }
 
-               ret = interpret_string_addr_internal(&res,
-                                       my_hostname,
-                                       AI_ADDRCONFIG|AI_CANONNAME);
+       /* Ensure null termination. */
+       my_hostname[sizeof(my_hostname)-1] = '\0';
 
-               if (!ret || res == NULL) {
-                       DEBUG(3,("get_mydnsfullname: getaddrinfo failed for "
-                               "name %s [%s]\n",
+       ret = interpret_string_addr_internal(&res,
                                my_hostname,
-                               gai_strerror(ret) ));
-                       return NULL;
-               }
+                               AI_ADDRCONFIG|AI_CANONNAME);
 
-               /*
-                * Make sure that getaddrinfo() returns the "correct" host name.
-                */
+       if (!ret || res == NULL) {
+               DEBUG(3,("get_mydnsfullname: getaddrinfo failed for "
+                       "name %s [%s]\n",
+                       my_hostname,
+                       gai_strerror(ret) ));
+               return NULL;
+       }
 
-               if (res->ai_canonname == NULL) {
-                       DEBUG(3,("get_mydnsfullname: failed to get "
-                               "canonical name for %s\n",
-                               my_hostname));
-                       freeaddrinfo(res);
-                       return NULL;
-               }
+       /*
+        * Make sure that getaddrinfo() returns the "correct" host name.
+        */
 
-               dnshostname_cache = SMB_STRDUP(res->ai_canonname);
+       if (res->ai_canonname == NULL) {
+               DEBUG(3,("get_mydnsfullname: failed to get "
+                       "canonical name for %s\n",
+                       my_hostname));
                freeaddrinfo(res);
+               return NULL;
        }
-       return dnshostname_cache;
+
+       /* This copies the data, so we must do a lookup
+        * afterwards to find the value to return.
+        */
+
+       memcache_add(NULL, SINGLETON_CACHE,
+                       data_blob_string_const("get_mydnsfullname"),
+                       data_blob_string_const(res->ai_canonname));
+
+       if (!memcache_lookup(NULL, SINGLETON_CACHE,
+                       data_blob_string_const("get_mydnsfullname"),
+                       &tmp)) {
+               tmp = data_blob_talloc(talloc_tos(), res->ai_canonname,
+                               strlen(res->ai_canonname) + 1);
+       }
+
+       freeaddrinfo(res);
+
+       return (const char *)tmp.data;
 }
 
 /************************************************************
index ee76e33de8830672b0ef85dd44a1ea8596358b77..bcb9197141c71ea0bbf5ba9e374f722873c1c7d7 100644 (file)
 
 #include "includes.h"
 
+char toupper_ascii_fast_table[128] = {
+       0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf,
+       0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
+       0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
+       0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
+       0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
+       0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
+       0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
+       0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f
+};
+
 /**
  * @file
  * @brief String utilities.
@@ -136,83 +147,6 @@ bool next_token_no_ltrim_talloc(TALLOC_CTX *ctx,
        return next_token_internal_talloc(ctx, ptr, pp_buff, sep, false);
 }
 
-/**
-This is like next_token but is not re-entrant and "remembers" the first
-parameter so you can pass NULL. This is useful for user interface code
-but beware the fact that it is not re-entrant!
-**/
-
-static const char *last_ptr=NULL;
-
-bool next_token_nr_talloc(TALLOC_CTX *ctx,
-                               const char **ptr,
-                               char **pp_buff,
-                               const char *sep)
-{
-       bool ret;
-       if (!ptr) {
-               ptr = &last_ptr;
-       }
-
-       ret = next_token_talloc(ctx, ptr, pp_buff, sep);
-       last_ptr = *ptr;
-       return ret;
-}
-
-void set_first_token(char *ptr)
-{
-       last_ptr = ptr;
-}
-
-/**
- Convert list of tokens to array; dependent on above routine.
- Uses last_ptr from above - bit of a hack.
-**/
-
-char **toktocliplist(int *ctok, const char *sep)
-{
-       char *s=(char *)last_ptr;
-       int ictok=0;
-       char **ret, **iret;
-
-       if (!sep)
-               sep = " \t\n\r";
-
-       while(*s && strchr_m(sep,*s))
-               s++;
-
-       /* nothing left? */
-       if (!*s)
-               return(NULL);
-
-       do {
-               ictok++;
-               while(*s && (!strchr_m(sep,*s)))
-                       s++;
-               while(*s && strchr_m(sep,*s))
-                       *s++=0;
-       } while(*s);
-
-       *ctok=ictok;
-       s=(char *)last_ptr;
-
-       if (!(ret=iret=SMB_MALLOC_ARRAY(char *,ictok+1)))
-               return NULL;
-
-       while(ictok--) {
-               *iret++=s;
-               if (ictok > 0) {
-                       while(*s++)
-                               ;
-                       while(!*s)
-                               s++;
-               }
-       }
-
-       ret[*ctok] = NULL;
-       return ret;
-}
-
 /**
  * Case insensitive string compararison.
  *
@@ -264,8 +198,8 @@ int StrCaseCmp(const char *s, const char *t)
                         * from here on in */
                        break;
 
-               us = toupper_ascii(*ps);
-               ut = toupper_ascii(*pt);
+               us = toupper_ascii_fast(*ps);
+               ut = toupper_ascii_fast(*pt);
                if (us == ut)
                        continue;
                else if (us < ut)
@@ -323,8 +257,8 @@ int StrnCaseCmp(const char *s, const char *t, size_t len)
                         * hard way from here on in */
                        break;
 
-               us = toupper_ascii(*ps);
-               ut = toupper_ascii(*pt);
+               us = toupper_ascii_fast(*ps);
+               ut = toupper_ascii_fast(*pt);
                if (us == ut)
                        continue;
                else if (us < ut)
@@ -1756,7 +1690,7 @@ void strupper_m(char *s)
           (ie. they match for the first 128 chars) */
 
        while (*s && !(((unsigned char)s[0]) & 0x80)) {
-               *s = toupper_ascii((unsigned char)*s);
+               *s = toupper_ascii_fast((unsigned char)*s);
                s++;
        }
 
@@ -2481,13 +2415,13 @@ void base64_decode_inplace(char *s)
 }
 
 /**
- * Encode a base64 string into a malloc()ed string caller to free.
+ * Encode a base64 string into a talloc()ed string caller to free.
  *
  * From SQUID: adopted from http://ftp.sunet.se/pub2/gnu/vm/base64-encode.c
  * with adjustments
  **/
 
-char *base64_encode_data_blob(DATA_BLOB data)
+char *base64_encode_data_blob(TALLOC_CTX *mem_ctx, DATA_BLOB data)
 {
        int bits = 0;
        int char_count = 0;
@@ -2500,7 +2434,7 @@ char *base64_encode_data_blob(DATA_BLOB data)
        out_cnt = 0;
        len = data.length;
        output_len = data.length * 2;
-       result = TALLOC_ARRAY(talloc_tos(), char, output_len); /* get us plenty of space */
+       result = TALLOC_ARRAY(mem_ctx, char, output_len); /* get us plenty of space */
        SMB_ASSERT(result != NULL);
 
        while (len-- && out_cnt < (data.length * 2) - 5) {
index ce2cb427d118f8b8fa36dd56f35c8d663f00411b..dd5ebcd7ab5e1a3aa38a9d97fa4ef6193c50bb42 100644 (file)
@@ -656,6 +656,7 @@ int tdb_unpack(const uint8 *buf, int bufsize, const char *fmt, ...)
        return PTR_DIFF(buf, buf0);
 
  no_space:
+       va_end(ap);
        return -1;
 }
 
diff --git a/source/lib/util_transfer_file.c b/source/lib/util_transfer_file.c
new file mode 100644 (file)
index 0000000..1e3b76f
--- /dev/null
@@ -0,0 +1,110 @@
+/*
+ * Unix SMB/CIFS implementation.
+ * Utility functions to transfer files.
+ *
+ * Copyright (C) Jeremy Allison 2001-2002
+ * Copyright (C) Michael Adam 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/>.
+ */
+
+
+#include <includes.h>
+
+/****************************************************************************
+ Transfer some data between two fd's.
+****************************************************************************/
+
+#ifndef TRANSFER_BUF_SIZE
+#define TRANSFER_BUF_SIZE 65536
+#endif
+
+
+ssize_t transfer_file_internal(void *in_file,
+                              void *out_file,
+                              size_t n,
+                              ssize_t (*read_fn)(void *, void *, size_t),
+                              ssize_t (*write_fn)(void *, const void *, size_t))
+{
+       char *buf;
+       size_t total = 0;
+       ssize_t read_ret;
+       ssize_t write_ret;
+       size_t num_to_read_thistime;
+       size_t num_written = 0;
+
+       if ((buf = SMB_MALLOC_ARRAY(char, TRANSFER_BUF_SIZE)) == NULL) {
+               return -1;
+       }
+
+       while (total < n) {
+               num_to_read_thistime = MIN((n - total), TRANSFER_BUF_SIZE);
+
+               read_ret = (*read_fn)(in_file, buf, num_to_read_thistime);
+               if (read_ret == -1) {
+                       DEBUG(0,("transfer_file_internal: read failure. "
+                                "Error = %s\n", strerror(errno) ));
+                       SAFE_FREE(buf);
+                       return -1;
+               }
+               if (read_ret == 0) {
+                       break;
+               }
+
+               num_written = 0;
+
+               while (num_written < read_ret) {
+                       write_ret = (*write_fn)(out_file, buf + num_written,
+                                               read_ret - num_written);
+
+                       if (write_ret == -1) {
+                               DEBUG(0,("transfer_file_internal: "
+                                        "write failure. Error = %s\n",
+                                        strerror(errno) ));
+                               SAFE_FREE(buf);
+                               return -1;
+                       }
+                       if (write_ret == 0) {
+                               return (ssize_t)total;
+                       }
+
+                       num_written += (size_t)write_ret;
+               }
+
+               total += (size_t)read_ret;
+       }
+
+       SAFE_FREE(buf);
+       return (ssize_t)total;
+}
+
+static ssize_t sys_read_fn(void *file, void *buf, size_t len)
+{
+       int *fd = (int *)file;
+
+       return sys_read(*fd, buf, len);
+}
+
+static ssize_t sys_write_fn(void *file, const void *buf, size_t len)
+{
+       int *fd = (int *)file;
+
+       return sys_write(*fd, buf, len);
+}
+
+SMB_OFF_T transfer_file(int infd, int outfd, SMB_OFF_T n)
+{
+       return (SMB_OFF_T)transfer_file_internal(&infd, &outfd, (size_t)n,
+                                                sys_read_fn, sys_write_fn);
+}
index 204c2044a8d2576f988d9d49011a93b34f7c972b..3cae02ad2ee096c2cae125c1b707f1fdcc891e03 100644 (file)
@@ -51,6 +51,8 @@ const char *samba_version_string(void)
         */
        assert(res != -1);
 
+       SAFE_FREE(samba_version);
+
        samba_version = tmp_version;
 #endif
 
diff --git a/source/lib/winbind_util.c b/source/lib/winbind_util.c
new file mode 100644 (file)
index 0000000..14356b0
--- /dev/null
@@ -0,0 +1,321 @@
+/* 
+   Unix SMB/CIFS implementation.
+   Winbind Utility functions
+
+   Copyright (C) Gerald (Jerry) Carter   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"
+
+#if defined(WITH_WINBIND)
+
+#include "nsswitch/libwbclient/wbclient.h"
+
+/* Call winbindd to convert a name to a sid */
+
+bool winbind_lookup_name(const char *dom_name, const char *name, DOM_SID *sid, 
+                         enum lsa_SidType *name_type)
+{
+       struct wbcDomainSid dom_sid;
+       wbcErr result;
+       enum wbcSidType type;   
+
+       result = wbcLookupName(dom_name, name, &dom_sid, &type);
+       if (result != WBC_ERR_SUCCESS)
+               return false;
+
+       memcpy(sid, &dom_sid, sizeof(DOM_SID)); 
+       *name_type = (enum lsa_SidType)type;    
+
+       return true;    
+}
+
+/* Call winbindd to convert sid to name */
+
+bool winbind_lookup_sid(TALLOC_CTX *mem_ctx, const DOM_SID *sid, 
+                       const char **domain, const char **name,
+                        enum lsa_SidType *name_type)
+{
+       struct wbcDomainSid dom_sid;
+       wbcErr result;
+       enum wbcSidType type;
+       char *domain_name = NULL;
+       char *account_name = NULL;
+
+       memcpy(&dom_sid, sid, sizeof(dom_sid)); 
+
+       result = wbcLookupSid(&dom_sid, &domain_name, &account_name, &type);
+       if (result != WBC_ERR_SUCCESS)
+               return false;
+
+       /* Copy out result */
+
+       if (domain) {           
+               *domain = talloc_strdup(mem_ctx, domain_name);
+       }
+       if (name) {
+               *name = talloc_strdup(mem_ctx, account_name);
+       }
+       *name_type = (enum lsa_SidType)type;
+
+       DEBUG(10, ("winbind_lookup_sid: SUCCESS: SID %s -> %s %s\n", 
+                  sid_string_dbg(sid), domain_name, account_name));
+
+       wbcFreeMemory(domain_name);
+       wbcFreeMemory(account_name);
+       
+       if ((domain && !*domain) || (name && !*name)) {         
+               DEBUG(0,("winbind_lookup_sid: talloc() failed!\n"));
+               return false;
+       }       
+
+
+       return true;
+}
+
+/* Ping winbindd to see it is alive */
+
+bool winbind_ping(void)
+{
+       wbcErr result = wbcPing();
+
+       return (result == WBC_ERR_SUCCESS);
+}
+
+/* Call winbindd to convert SID to uid */
+
+bool winbind_sid_to_uid(uid_t *puid, const DOM_SID *sid)
+{
+       struct wbcDomainSid dom_sid;
+       wbcErr result;
+
+       memcpy(&dom_sid, sid, sizeof(dom_sid)); 
+
+       result = wbcSidToUid(&dom_sid, puid);   
+
+       return (result == WBC_ERR_SUCCESS);     
+}
+
+/* Call winbindd to convert uid to sid */
+
+bool winbind_uid_to_sid(DOM_SID *sid, uid_t uid)
+{
+       struct wbcDomainSid dom_sid;
+       wbcErr result;
+
+       result = wbcUidToSid(uid, &dom_sid);
+       if (result == WBC_ERR_SUCCESS) {
+               memcpy(sid, &dom_sid, sizeof(DOM_SID));
+       } else {
+               sid_copy(sid, &global_sid_NULL);
+       }
+
+       return (result == WBC_ERR_SUCCESS);
+}
+
+/* Call winbindd to convert SID to gid */
+
+bool winbind_sid_to_gid(gid_t *pgid, const DOM_SID *sid)
+{
+       struct wbcDomainSid dom_sid;
+       wbcErr result;
+
+       memcpy(&dom_sid, sid, sizeof(dom_sid)); 
+
+       result = wbcSidToGid(&dom_sid, pgid);   
+
+       return (result == WBC_ERR_SUCCESS);     
+}
+
+/* Call winbindd to convert gid to sid */
+
+bool winbind_gid_to_sid(DOM_SID *sid, gid_t gid)
+{
+       struct wbcDomainSid dom_sid;
+       wbcErr result;
+
+       result = wbcGidToSid(gid, &dom_sid);
+       if (result == WBC_ERR_SUCCESS) {
+               memcpy(sid, &dom_sid, sizeof(DOM_SID));
+       } else {
+               sid_copy(sid, &global_sid_NULL);
+       }
+
+       return (result == WBC_ERR_SUCCESS);
+}
+
+/* Check for a trusted domain */
+
+wbcErr wb_is_trusted_domain(const char *domain)
+{
+       wbcErr result;
+       struct wbcDomainInfo *info = NULL;
+       
+       result = wbcDomainInfo(domain, &info);
+
+       if (WBC_ERROR_IS_OK(result)) {
+               wbcFreeMemory(info);
+       }
+
+       return result;  
+}
+
+/* Lookup a set of rids in a given domain */
+
+bool winbind_lookup_rids(TALLOC_CTX *mem_ctx,
+                        const DOM_SID *domain_sid,
+                        int num_rids, uint32 *rids,
+                        const char **domain_name,
+                        const char ***names, enum lsa_SidType **types)
+{
+       const char *dom_name = NULL;
+       const char **namelist = NULL;
+       enum wbcSidType *name_types = NULL;
+       struct wbcDomainSid dom_sid;
+       wbcErr ret;
+       int i;  
+       
+       memcpy(&dom_sid, domain_sid, sizeof(struct wbcDomainSid));
+       
+       ret = wbcLookupRids(&dom_sid, num_rids, rids,
+                           &dom_name, &namelist, &name_types);
+       if (ret != WBC_ERR_SUCCESS) {           
+               return false;
+       }       
+       
+       *domain_name = talloc_strdup(mem_ctx, dom_name);
+       *names       = TALLOC_ARRAY(mem_ctx, const char*, num_rids);
+       *types       = TALLOC_ARRAY(mem_ctx, enum lsa_SidType, num_rids);
+
+       for(i=0; i<num_rids; i++) {
+               (*names)[i] = talloc_strdup(*names, namelist[i]);
+               (*types)[i] = (enum lsa_SidType)name_types[i];
+       }
+
+       wbcFreeMemory(CONST_DISCARD(char*, dom_name));
+       wbcFreeMemory(namelist);
+       wbcFreeMemory(name_types);
+       
+       return true;    
+}
+
+/* Ask Winbind to allocate a new uid for us */
+
+bool winbind_allocate_uid(uid_t *uid)
+{
+       wbcErr ret;
+       
+       ret = wbcAllocateUid(uid);
+       
+       return (ret == WBC_ERR_SUCCESS);
+}
+
+/* Ask Winbind to allocate a new gid for us */
+
+bool winbind_allocate_gid(gid_t *gid)
+{
+       wbcErr ret;
+       
+       ret = wbcAllocateGid(gid);
+       
+       return (ret == WBC_ERR_SUCCESS);
+}
+
+#else      /* WITH_WINBIND */
+
+bool winbind_lookup_name(const char *dom_name, const char *name, DOM_SID *sid, 
+                         enum lsa_SidType *name_type)
+{
+       return false;
+}
+
+/* Call winbindd to convert sid to name */
+
+bool winbind_lookup_sid(TALLOC_CTX *mem_ctx, const DOM_SID *sid, 
+                       const char **domain, const char **name,
+                        enum lsa_SidType *name_type)
+{
+       return false;
+}
+
+/* Ping winbindd to see it is alive */
+
+bool winbind_ping(void)
+{
+       return false;
+}
+
+/* Call winbindd to convert SID to uid */
+
+bool winbind_sid_to_uid(uid_t *puid, const DOM_SID *sid)
+{
+       return false;
+}
+
+/* Call winbindd to convert uid to sid */
+
+bool winbind_uid_to_sid(DOM_SID *sid, uid_t uid)
+{
+       return false;
+}
+
+/* Call winbindd to convert SID to gid */
+
+bool winbind_sid_to_gid(gid_t *pgid, const DOM_SID *sid)
+{
+       return false;   
+}
+
+/* Call winbindd to convert gid to sid */
+
+bool winbind_gid_to_sid(DOM_SID *sid, gid_t gid)
+{
+       return false;
+}
+
+/* Check for a trusted domain */
+
+wbcErr wb_is_trusted_domain(const char *domain)
+{
+       return WBC_ERR_UNKNOWN_FAILURE;
+}
+
+/* Lookup a set of rids in a given domain */
+
+bool winbind_lookup_rids(TALLOC_CTX *mem_ctx,
+                        const DOM_SID *domain_sid,
+                        int num_rids, uint32 *rids,
+                        const char **domain_name,
+                        const char ***names, enum lsa_SidType **types)
+{
+       return false;
+}
+
+/* Ask Winbind to allocate a new uid for us */
+
+bool winbind_allocate_uid(uid_t *uid)
+{
+       return false;
+}
+
+/* Ask Winbind to allocate a new gid for us */
+
+bool winbind_allocate_gid(gid_t *gid)
+{
+       return false;
+}
+
+#endif     /* WITH_WINBIND */
index c98522200b82a8401d62070e21ddadc77a32bf4d..ee6e5813329bb5e53221ec7101a70eafa66f48d7 100644 (file)
@@ -223,9 +223,15 @@ size_t x_fwrite(const void *p, size_t size, size_t nmemb, XFILE *f)
        VA_COPY(ap2, ap);
 
        len = vasprintf(&p, format, ap2);
-       if (len <= 0) return len;
+       if (len <= 0) {
+               va_end(ap2);
+               return len;
+       }
        ret = x_fwrite(p, 1, len, f);
        SAFE_FREE(p);
+
+       va_end(ap2);
+
        return ret;
 }
 
index b901acf4cc047f3ad53609e55a10a423899e0fa3..cf842f4d109711bafc55d0093d7cb4ecdbf08c42 100644 (file)
 #ifndef _DNS_H
 #define _DNS_H
 
-#include "config.h"
+#include "lib/replace/replace.h"
+#include "system/network.h"
+
+/* make sure we have included the correct config.h */
+#ifndef NO_CONFIG_H /* for some tests */
+#ifndef CONFIG_H_IS_FROM_SAMBA
+#error "make sure you have removed all config.h files from standalone builds!"
+#error "the included config.h isn't from samba!"
+#endif
+#endif /* NO_CONFIG_H */
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -411,7 +420,7 @@ DNS_ERROR dns_create_update( TALLOC_CTX *mem_ctx, const char *name,
                             struct dns_update_request **preq );
 DNS_ERROR dns_create_probe(TALLOC_CTX *mem_ctx, const char *zone,
                           const char *host, int num_ips,
-                          const struct in_addr *iplist,
+                          const struct sockaddr_storage *sslist,
                           struct dns_update_request **preq);
 DNS_ERROR dns_create_rrec(TALLOC_CTX *mem_ctx, const char *name,
                          uint16 type, uint16 r_class, uint32 ttl,
@@ -426,7 +435,7 @@ DNS_ERROR dns_create_tkey_record(TALLOC_CTX *mem_ctx, const char *keyname,
                                 struct dns_rrec **prec);
 DNS_ERROR dns_create_name_in_use_record(TALLOC_CTX *mem_ctx,
                                        const char *name,
-                                       const struct in_addr *ip,
+                                       const struct sockaddr_storage *ip,
                                        struct dns_rrec **prec);
 DNS_ERROR dns_create_delete_record(TALLOC_CTX *mem_ctx, const char *name,
                                   uint16 type, uint16 r_class,
@@ -435,7 +444,7 @@ DNS_ERROR dns_create_name_not_in_use_record(TALLOC_CTX *mem_ctx,
                                            const char *name, uint32 type,
                                            struct dns_rrec **prec);
 DNS_ERROR dns_create_a_record(TALLOC_CTX *mem_ctx, const char *host,
-                             uint32 ttl, struct in_addr ip,
+                             uint32 ttl, const struct sockaddr_storage *pss,
                              struct dns_rrec **prec);
 DNS_ERROR dns_unmarshall_tkey_record(TALLOC_CTX *mem_ctx, struct dns_rrec *rec,
                                     struct dns_tkey_record **ptkey);
@@ -517,7 +526,7 @@ DNS_ERROR dns_sign_update(struct dns_update_request *req,
 DNS_ERROR dns_create_update_request(TALLOC_CTX *mem_ctx,
                                    const char *domainname,
                                    const char *hostname,
-                                   const struct in_addr *ip_addr,
+                                   const struct sockaddr_storage *ip_addr,
                                    size_t num_adds,
                                    struct dns_update_request **preq);
 
index cb8a7c1a950fd354160337addfa7d367c795c31d..500cbd6681a41ad2c1cd4211daabe6c3d744acef 100644 (file)
@@ -119,12 +119,19 @@ DNS_ERROR dns_create_rrec(TALLOC_CTX *mem_ctx, const char *name,
 }
 
 DNS_ERROR dns_create_a_record(TALLOC_CTX *mem_ctx, const char *host,
-                             uint32 ttl, struct in_addr ip,
+                             uint32 ttl, const struct sockaddr_storage *pss,
                              struct dns_rrec **prec)
 {
        uint8 *data;
        DNS_ERROR err;
+       struct in_addr ip;
 
+       if (pss->ss_family != AF_INET) {
+               /* Silently ignore this. */
+               return ERROR_DNS_SUCCESS;
+       }
+
+       ip = ((struct sockaddr_in *)pss)->sin_addr;
        if (!(data = (uint8 *)TALLOC_MEMDUP(mem_ctx, (const void *)&ip.s_addr,
                                            sizeof(ip.s_addr)))) {
                return ERROR_DNS_NO_MEMORY;
@@ -142,11 +149,11 @@ DNS_ERROR dns_create_a_record(TALLOC_CTX *mem_ctx, const char *host,
 
 DNS_ERROR dns_create_name_in_use_record(TALLOC_CTX *mem_ctx,
                                        const char *name,
-                                       const struct in_addr *ip,
+                                       const struct sockaddr_storage *ss,
                                        struct dns_rrec **prec)
 {
-       if (ip != NULL) {
-               return dns_create_a_record(mem_ctx, name, 0, *ip, prec);
+       if (ss != NULL) {
+               return dns_create_a_record(mem_ctx, name, 0, ss, prec);
        }
 
        return dns_create_rrec(mem_ctx, name, QTYPE_ANY, DNS_CLASS_IN, 0, 0,
@@ -321,7 +328,7 @@ DNS_ERROR dns_add_rrec(TALLOC_CTX *mem_ctx, struct dns_rrec *rec,
 
 DNS_ERROR dns_create_probe(TALLOC_CTX *mem_ctx, const char *zone,
                           const char *host, int num_ips,
-                          const struct in_addr *iplist,
+                          const struct sockaddr_storage *sslist,
                           struct dns_update_request **preq)
 {
        struct dns_update_request *req;
@@ -340,7 +347,7 @@ DNS_ERROR dns_create_probe(TALLOC_CTX *mem_ctx, const char *zone,
 
        for (i=0; i<num_ips; i++) {
                err = dns_create_name_in_use_record(req, host,
-                                                   &iplist[i], &rec);
+                                                   &sslist[i], &rec);
                if (!ERR_DNS_IS_OK(err)) goto error;
 
                err = dns_add_rrec(req, rec, &req->num_preqs, &req->preqs);
@@ -358,14 +365,14 @@ DNS_ERROR dns_create_probe(TALLOC_CTX *mem_ctx, const char *zone,
 DNS_ERROR dns_create_update_request(TALLOC_CTX *mem_ctx,
                                    const char *domainname,
                                    const char *hostname,
-                                   const struct in_addr *ip_addrs,
+                                   const struct sockaddr_storage *ss_addrs,
                                    size_t num_addrs,
                                    struct dns_update_request **preq)
 {
        struct dns_update_request *req;
        struct dns_rrec *rec;
        DNS_ERROR err;
-       size_t i;       
+       size_t i;
 
        err = dns_create_update(mem_ctx, domainname, &req);
        if (!ERR_DNS_IS_OK(err)) return err;
@@ -388,7 +395,7 @@ DNS_ERROR dns_create_update_request(TALLOC_CTX *mem_ctx,
        err = dns_create_delete_record(req, hostname, QTYPE_A, DNS_CLASS_ANY,
                                       &rec);
        if (!ERR_DNS_IS_OK(err)) goto error;
-       
+
        err = dns_add_rrec(req, rec, &req->num_updates, &req->updates);
        if (!ERR_DNS_IS_OK(err)) goto error;
 
@@ -396,15 +403,15 @@ DNS_ERROR dns_create_update_request(TALLOC_CTX *mem_ctx,
         * .. and add our IPs
         */
 
-       for ( i=0; i<num_addrs; i++ ) {         
-               err = dns_create_a_record(req, hostname, 3600, ip_addrs[i], &rec);
-               if (!ERR_DNS_IS_OK(err)) 
+       for ( i=0; i<num_addrs; i++ ) {
+               err = dns_create_a_record(req, hostname, 3600, &ss_addrs[i], &rec);
+               if (!ERR_DNS_IS_OK(err))
                        goto error;
 
                err = dns_add_rrec(req, rec, &req->num_updates, &req->updates);
-               if (!ERR_DNS_IS_OK(err)) 
+               if (!ERR_DNS_IS_OK(err))
                        goto error;
-       }       
+       }
 
        *preq = req;
        return ERROR_DNS_SUCCESS;
index ecef9d224b3ecb11e5ae0112c514b49fe618f5a1..29148e85439d0f264d3874d9c3ddc30a53b998c9 100644 (file)
@@ -141,3 +141,12 @@ const char *ads_errstr(ADS_STATUS status)
        }
 }
 
+#ifdef HAVE_GSSAPI
+NTSTATUS gss_err_to_ntstatus(uint32 maj, uint32 min)
+{
+        ADS_STATUS adss = ADS_ERROR_GSS(maj, min);
+        DEBUG(10,("gss_err_to_ntstatus: Error %s\n",
+                ads_errstr(adss) ));
+        return ads_ntstatus(adss);
+}
+#endif
index 041878916ec742103dcf2f8f3995f6c2b3cf57d8..8cc2f1215e24fe8a616b92b8addc8b6bff64518b 100644 (file)
@@ -29,35 +29,42 @@ char *ads_build_path(const char *realm, const char *sep, const char *field, int
        int numbits = 0;
        char *ret;
        int len;
-       
+       char *saveptr;
+
        r = SMB_STRDUP(realm);
 
-       if (!r || !*r)
+       if (!r || !*r) {
                return r;
+       }
 
-       for (p=r; *p; p++)
-               if (strchr(sep, *p))
+       for (p=r; *p; p++) {
+               if (strchr(sep, *p)) {
                        numbits++;
+               }
+       }
 
        len = (numbits+1)*(strlen(field)+1) + strlen(r) + 1;
 
        ret = (char *)SMB_MALLOC(len);
-       if (!ret)
+       if (!ret) {
+               free(r);
                return NULL;
+       }
 
        strlcpy(ret,field, len);
-       p=strtok(r,sep); 
+       p=strtok_r(r, sep, &saveptr);
        if (p) {
                strlcat(ret, p, len);
        
-               while ((p=strtok(NULL,sep))) {
+               while ((p=strtok_r(NULL, sep, &saveptr)) != NULL) {
                        char *s;
                        if (reverse)
                                asprintf(&s, "%s%s,%s", field, p, ret);
                        else
                                asprintf(&s, "%s,%s%s", ret, field, p);
                        free(ret);
-                       ret = s;
+                       ret = SMB_STRDUP(s);
+                       free(s);
                }
        }
 
index 500f2d455e12825f12dbf3256de4c5c41235e21f..644f8515bc3c2f4c5bdcbd89469cf83dd5932266 100644 (file)
@@ -214,7 +214,7 @@ static bool pac_io_group_membership_array(const char *desc,
 static bool pac_io_pac_logon_info(const char *desc, PAC_LOGON_INFO *info, 
                                  prs_struct *ps, int depth)
 {
-       uint32 garbage, i;
+       uint32 garbage = 0, i;
 
        if (NULL == info)
                return False;
@@ -398,7 +398,7 @@ static bool pac_io_pac_logon_info(const char *desc, PAC_LOGON_INFO *info,
 static bool pac_io_pac_logon_info(const char *desc, PAC_LOGON_INFO *info, 
                                  prs_struct *ps, int depth)
 {
-       uint32 garbage;
+       uint32 garbage = 0;
        bool kerb_validation_info = True;
 
        if (NULL == info)
@@ -429,8 +429,8 @@ static bool pac_io_pac_logon_info(const char *desc, PAC_LOGON_INFO *info,
 
        if (info->info3.ptr_res_groups) {
 
-               if (!(info->info3.user_flgs & LOGON_RESOURCE_GROUPS)) {
-                       DEBUG(0,("user_flgs attribute does not have LOGON_RESOURCE_GROUPS\n"));
+               if (!(info->info3.user_flgs & NETLOGON_RESOURCE_GROUPS)) {
+                       DEBUG(0,("user_flgs attribute does not have NETLOGON_RESOURCE_GROUPS\n"));
                        /* return False; */
                }
 
@@ -738,10 +738,10 @@ void dump_pac_logon_info(int lvl, PAC_LOGON_INFO *logon_info)
        DEBUG(lvl,("The PAC:\n"));
 
        DEBUGADD(lvl,("\tUser Flags: 0x%x (%d)\n", user_flgs, user_flgs));
-       if (user_flgs & LOGON_EXTRA_SIDS)
-               DEBUGADD(lvl,("\tUser Flags: LOGON_EXTRA_SIDS 0x%x (%d)\n", LOGON_EXTRA_SIDS, LOGON_EXTRA_SIDS));
-       if (user_flgs & LOGON_RESOURCE_GROUPS)
-               DEBUGADD(lvl,("\tUser Flags: LOGON_RESOURCE_GROUPS 0x%x (%d)\n", LOGON_RESOURCE_GROUPS, LOGON_RESOURCE_GROUPS));
+       if (user_flgs & NETLOGON_EXTRA_SIDS)
+               DEBUGADD(lvl,("\tUser Flags: NETLOGON_EXTRA_SIDS 0x%x (%d)\n", NETLOGON_EXTRA_SIDS, NETLOGON_EXTRA_SIDS));
+       if (user_flgs & NETLOGON_RESOURCE_GROUPS)
+               DEBUGADD(lvl,("\tUser Flags: NETLOGON_RESOURCE_GROUPS 0x%x (%d)\n", NETLOGON_RESOURCE_GROUPS, NETLOGON_RESOURCE_GROUPS));
        DEBUGADD(lvl,("\tUser SID: %s-%d\n", sid_string_dbg(&dom_sid),
                      logon_info->info3.user_rid));
        DEBUGADD(lvl,("\tGroup SID: %s-%d\n", sid_string_dbg(&dom_sid),
index 227f95d15e4b964ce704aeef896274df87a2b5e2..d47e8a3ff1ce577764beca5404e61dfa1f69d36b 100644 (file)
@@ -25,6 +25,8 @@
 
 #ifdef HAVE_KRB5
 
+#define DEFAULT_KRB5_PORT 88
+
 #define LIBADS_CCACHE_NAME "MEMORY:libads"
 
 /*
@@ -209,7 +211,8 @@ int kerberos_kinit_password_ext(const char *principal,
                krb5_set_real_time(ctx, time(NULL) + time_offset, 0);
        }
 
-       DEBUG(10,("kerberos_kinit_password: using [%s] as ccache and config [%s]\n",
+       DEBUG(10,("kerberos_kinit_password: as %s using [%s] as ccache and config [%s]\n",
+                       principal,
                        cache_name ? cache_name: krb5_cc_default_name(ctx),
                        getenv("KRB5_CONFIG")));
 
@@ -521,7 +524,10 @@ char *kerberos_get_default_realm_from_ccache( void )
 #if defined(HAVE_KRB5_PRINCIPAL_GET_REALM)
        realm = SMB_STRDUP(krb5_principal_get_realm(ctx, princ));
 #elif defined(HAVE_KRB5_PRINC_REALM)
-       realm = SMB_STRDUP(krb5_princ_realm(ctx, princ)->data);
+       {
+               krb5_data *realm_data = krb5_princ_realm(ctx, princ);
+               realm = SMB_STRNDUP(realm_data->data, realm_data->length);
+       }
 #endif
 
   out:
@@ -661,6 +667,57 @@ int kerberos_kinit_password(const char *principal,
                                           NULL);
 }
 
+/************************************************************************
+************************************************************************/
+
+static char *print_kdc_line(char *mem_ctx,
+                       const char *prev_line,
+                       const struct sockaddr_storage *pss)
+{
+       char *kdc_str = NULL;
+
+       if (pss->ss_family == AF_INET) {
+               kdc_str = talloc_asprintf(mem_ctx, "%s\tkdc = %s\n",
+                                       prev_line,
+                                        print_canonical_sockaddr(mem_ctx, pss));
+       } else {
+               char addr[INET6_ADDRSTRLEN];
+               uint16_t port = get_sockaddr_port(pss);
+
+               if (port != 0 && port != DEFAULT_KRB5_PORT) {
+                       /* Currently for IPv6 we can't specify a non-default
+                          krb5 port with an address, as this requires a ':'.
+                          Resolve to a name. */
+                       char hostname[MAX_DNS_NAME_LENGTH];
+                       int ret = sys_getnameinfo((const struct sockaddr *)pss,
+                                       sizeof(*pss),
+                                       hostname, sizeof(hostname),
+                                       NULL, 0,
+                                       NI_NAMEREQD);
+                       if (ret) {
+                               DEBUG(0,("print_kdc_line: can't resolve name "
+                                       "for kdc with non-default port %s. "
+                                       "Error %s\n.",
+                                       print_canonical_sockaddr(mem_ctx, pss),
+                                       gai_strerror(ret)));
+                       }
+                       /* Success, use host:port */
+                       kdc_str = talloc_asprintf(mem_ctx,
+                                       "%s\tkdc = %s:%u\n",
+                                       prev_line,
+                                       hostname,
+                                       (unsigned int)port);
+               } else {
+                       kdc_str = talloc_asprintf(mem_ctx, "%s\tkdc = %s\n",
+                                       prev_line,
+                                       print_sockaddr(addr,
+                                               sizeof(addr),
+                                               pss));
+               }
+       }
+       return kdc_str;
+}
+
 /************************************************************************
  Create a string list of available kdc's, possibly searching by sitename.
  Does DNS queries.
@@ -673,12 +730,10 @@ static char *get_kdc_ip_string(char *mem_ctx,
 {
        int i;
        struct ip_service *ip_srv_site = NULL;
-       struct ip_service *ip_srv_nonsite;
+       struct ip_service *ip_srv_nonsite = NULL;
        int count_site = 0;
        int count_nonsite;
-       char *kdc_str = talloc_asprintf(mem_ctx, "\tkdc = %s\n",
-                                       print_canonical_sockaddr(mem_ctx,
-                                                       pss));
+       char *kdc_str = print_kdc_line(mem_ctx, "", pss);
 
        if (kdc_str == NULL) {
                return NULL;
@@ -696,10 +751,9 @@ static char *get_kdc_ip_string(char *mem_ctx,
                        }
                        /* Append to the string - inefficient
                         * but not done often. */
-                       kdc_str = talloc_asprintf(mem_ctx, "%s\tkdc = %s\n",
-                               kdc_str,
-                               print_canonical_sockaddr(mem_ctx,
-                                                       &ip_srv_site[i].ss));
+                       kdc_str = print_kdc_line(mem_ctx,
+                                               kdc_str,
+                                               &ip_srv_site[i].ss);
                        if (!kdc_str) {
                                SAFE_FREE(ip_srv_site);
                                return NULL;
@@ -734,10 +788,9 @@ static char *get_kdc_ip_string(char *mem_ctx,
                }
 
                /* Append to the string - inefficient but not done often. */
-               kdc_str = talloc_asprintf(mem_ctx, "%s\tkdc = %s\n",
+               kdc_str = print_kdc_line(mem_ctx,
                                kdc_str,
-                               print_canonical_sockaddr(mem_ctx,
-                                               &ip_srv_nonsite[i].ss));
+                               &ip_srv_nonsite[i].ss);
                if (!kdc_str) {
                        SAFE_FREE(ip_srv_site);
                        SAFE_FREE(ip_srv_nonsite);
@@ -812,10 +865,14 @@ bool create_local_private_krb5_conf_for_domain(const char *realm,
                return False;
        }
 
-       file_contents = talloc_asprintf(fname, "[libdefaults]\n\tdefault_realm = %s\n\n"
-                               "[realms]\n\t%s = {\n"
-                               "\t%s\t}\n",
-                               realm_upper, realm_upper, kdc_ip_string);
+       file_contents = talloc_asprintf(fname,
+                                       "[libdefaults]\n\tdefault_realm = %s\n"
+                                       "default_tgs_enctypes = RC4-HMAC DES-CBC-CRC DES-CBC-MD5\n"
+                                       "default_tkt_enctypes = RC4-HMAC DES-CBC-CRC DES-CBC-MD5\n"
+                                       "preferred_enctypes = RC4-HMAC DES-CBC-CRC DES-CBC-MD5\n\n"
+                                       "[realms]\n\t%s = {\n"
+                                       "\t%s\t}\n",
+                                       realm_upper, realm_upper, kdc_ip_string);
 
        if (!file_contents) {
                TALLOC_FREE(dname);
@@ -869,8 +926,8 @@ bool create_local_private_krb5_conf_for_domain(const char *realm,
        }
 
        DEBUG(5,("create_local_private_krb5_conf_for_domain: wrote "
-               "file %s with realm %s KDC = %s\n",
-               fname, realm_upper, print_canonical_sockaddr(dname, pss) ));
+               "file %s with realm %s KDC list = %s\n",
+               fname, realm_upper, kdc_ip_string));
 
        /* Set the environment variable to this file. */
        setenv("KRB5_CONFIG", fname, 1);
index 7040093e901ab22ac6eae6d7ac04b353086d5ff8..5ce7aa6b4577ac336665012515c479e8d03642f7 100644 (file)
@@ -501,8 +501,7 @@ NTSTATUS ads_verify_ticket(TALLOC_CTX *mem_ctx,
                DEBUG(3,("ads_verify_ticket: did not retrieve auth data. continuing without PAC\n"));
        }
 
-       if (got_auth_data && pac_data != NULL) {
-
+       if (got_auth_data) {
                pac_ret = decode_pac_data(mem_ctx, &auth_data, context, keyblock, client_principal, authtime, pac_data);
                if (!NT_STATUS_IS_OK(pac_ret)) {
                        DEBUG(3,("ads_verify_ticket: failed to decode PAC_DATA: %s\n", nt_errstr(pac_ret)));
index 348ccacaee0d8359a57d041946f0574e9a7549eb..7b0adc2fc33ca18aa1a39b9369d8c29c8a2cef22 100644 (file)
@@ -56,6 +56,10 @@ static void gotalarm_sig(void)
 {
        LDAP *ldp = NULL;
 
+
+       DEBUG(10, ("Opening connection to LDAP server '%s:%d', timeout "
+                  "%u seconds\n", server, port, to));
+
        /* Setup timeout */
        gotalarm = 0;
        CatchSignal(SIGALRM, SIGNAL_CAST gotalarm_sig);
@@ -65,8 +69,10 @@ static void gotalarm_sig(void)
        ldp = ldap_open(server, port);
 
        if (ldp == NULL) {
-               DEBUG(2,("Could not open LDAP connection to %s:%d: %s\n",
+               DEBUG(2,("Could not open connection to LDAP server %s:%d: %s\n",
                         server, port, strerror(errno)));
+       } else {
+               DEBUG(10, ("Connected to LDAP server '%s:%d'\n", server, port));
        }
 
        /* Teardown timeout. */
@@ -385,6 +391,13 @@ ADS_STATUS ads_connect(ADS_STRUCT *ads)
 
        /* try with a user specified server */
 
+       if (DEBUGLEVEL >= 11) {
+               char *s = NDR_PRINT_STRUCT_STRING(talloc_tos(), ads_struct, ads);
+               DEBUG(11,("ads_connect: entering\n"));
+               DEBUGADD(11,("%s\n", s));
+               TALLOC_FREE(s);
+       }
+
        if (ads->server.ldap_server &&
            ads_try_connect(ads, ads->server.ldap_server)) {
                goto got_connection;
@@ -395,12 +408,13 @@ ADS_STATUS ads_connect(ADS_STRUCT *ads)
                goto got_connection;
        }
 
-       return ADS_ERROR_NT(ntstatus);
+       status = ADS_ERROR_NT(ntstatus);
+       goto out;
 
 got_connection:
 
        print_sockaddr(addr, sizeof(addr), &ads->ldap.ss);
-       DEBUG(3,("Connected to LDAP server %s\n", addr));
+       DEBUG(3,("Successfully contacted LDAP server %s\n", addr));
 
        if (!ads->auth.user_name) {
                /* Must use the userPrincipalName value here or sAMAccountName
@@ -432,21 +446,25 @@ got_connection:
        /* If the caller() requested no LDAP bind, then we are done */
        
        if (ads->auth.flags & ADS_AUTH_NO_BIND) {
-               return ADS_SUCCESS;
+               status = ADS_SUCCESS;
+               goto out;
        }
 
        ads->ldap.mem_ctx = talloc_init("ads LDAP connection memory");
        if (!ads->ldap.mem_ctx) {
-               return ADS_ERROR_NT(NT_STATUS_NO_MEMORY);
+               status = ADS_ERROR_NT(NT_STATUS_NO_MEMORY);
+               goto out;
        }
        
        /* Otherwise setup the TCP LDAP session */
 
-       if ( (ads->ldap.ld = ldap_open_with_timeout(ads->config.ldap_server_name, 
-               LDAP_PORT, lp_ldap_timeout())) == NULL )
-       {
-               return ADS_ERROR(LDAP_OPERATIONS_ERROR);
+       ads->ldap.ld = ldap_open_with_timeout(ads->config.ldap_server_name,
+                                             LDAP_PORT, lp_ldap_timeout());
+       if (ads->ldap.ld == NULL) {
+               status = ADS_ERROR(LDAP_OPERATIONS_ERROR);
+               goto out;
        }
+       DEBUG(3,("Connected to LDAP server %s\n", ads->config.ldap_server_name));
 
        /* cache the successful connection for workgroup and realm */
        if (ads_closest_dc(ads)) {
@@ -459,27 +477,40 @@ got_connection:
 
        status = ADS_ERROR(smb_ldap_start_tls(ads->ldap.ld, version));
        if (!ADS_ERR_OK(status)) {
-               return status;
+               goto out;
        }
 
        /* fill in the current time and offsets */
        
        status = ads_current_time( ads );
        if ( !ADS_ERR_OK(status) ) {
-               return status;
+               goto out;
        }
 
        /* Now do the bind */
        
        if (ads->auth.flags & ADS_AUTH_ANON_BIND) {
-               return ADS_ERROR(ldap_simple_bind_s( ads->ldap.ld, NULL, NULL));
+               status = ADS_ERROR(ldap_simple_bind_s(ads->ldap.ld, NULL, NULL));
+               goto out;
        }
 
        if (ads->auth.flags & ADS_AUTH_SIMPLE_BIND) {
-               return ADS_ERROR(ldap_simple_bind_s( ads->ldap.ld, ads->auth.user_name, ads->auth.password));
+               status = ADS_ERROR(ldap_simple_bind_s(ads->ldap.ld, ads->auth.user_name, ads->auth.password));
+               goto out;
        }
 
-       return ads_sasl_bind(ads);
+       status = ads_sasl_bind(ads);
+
+ out:
+       if (DEBUGLEVEL >= 11) {
+               char *s = NDR_PRINT_STRUCT_STRING(talloc_tos(), ads_struct, ads);
+               DEBUG(11,("ads_connect: leaving with: %s\n",
+                       ads_errstr(status)));
+               DEBUGADD(11,("%s\n", s));
+               TALLOC_FREE(s);
+       }
+
+       return status;
 }
 
 /**
@@ -2384,20 +2415,22 @@ int ads_count_replies(ADS_STRUCT *ads, void *res)
                  LDAPMessage *msg, const char *field, SEC_DESC **sd)
 {
        struct berval **values;
-       bool ret = False;
+       bool ret = true;
 
        values = ldap_get_values_len(ads->ldap.ld, msg, field);
 
-       if (!values) return False;
+       if (!values) return false;
 
        if (values[0]) {
-               prs_struct ps;
-               prs_init(&ps, values[0]->bv_len, mem_ctx, UNMARSHALL);
-               prs_copy_data_in(&ps, values[0]->bv_val, values[0]->bv_len);
-               prs_set_offset(&ps,0);
-
-               ret = sec_io_desc("sd", sd, &ps, 1);
-               prs_mem_free(&ps);
+               NTSTATUS status;
+               status = unmarshall_sec_desc(mem_ctx,
+                                            (uint8 *)values[0]->bv_val,
+                                            values[0]->bv_len, sd);
+               if (!NT_STATUS_IS_OK(status)) {
+                       DEBUG(0, ("unmarshall_sec_desc failed: %s\n",
+                                 nt_errstr(status)));
+                       ret = false;
+               }
        }
        
        ldap_value_free_len(values);
@@ -2788,6 +2821,66 @@ ADS_STATUS ads_upn_suffixes(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, char ***suffix
        return status;
 }
 
+/**
+ * get the joinable ous for a domain
+ * @param ads connection to ads server
+ * @param mem_ctx Pointer to talloc context
+ * @param ous Pointer to an array of ous
+ * @param num_ous Pointer to the number of ous
+ * @return status of search
+ **/
+ADS_STATUS ads_get_joinable_ous(ADS_STRUCT *ads,
+                               TALLOC_CTX *mem_ctx,
+                               char ***ous,
+                               size_t *num_ous)
+{
+       ADS_STATUS status;
+       LDAPMessage *res = NULL;
+       LDAPMessage *msg = NULL;
+       const char *attrs[] = { "dn", NULL };
+       int count = 0;
+
+       status = ads_search(ads, &res,
+                           "(|(objectClass=domain)(objectclass=organizationalUnit))",
+                           attrs);
+       if (!ADS_ERR_OK(status)) {
+               return status;
+       }
+
+       count = ads_count_replies(ads, res);
+       if (count < 1) {
+               ads_msgfree(ads, res);
+               return ADS_ERROR(LDAP_NO_RESULTS_RETURNED);
+       }
+
+       for (msg = ads_first_entry(ads, res); msg;
+            msg = ads_next_entry(ads, msg)) {
+
+               char *dn = NULL;
+
+               dn = ads_get_dn(ads, msg);
+               if (!dn) {
+                       ads_msgfree(ads, res);
+                       return ADS_ERROR(LDAP_NO_MEMORY);
+               }
+
+               if (!add_string_to_array(mem_ctx, dn,
+                                        (const char ***)ous,
+                                        (int *)num_ous)) {
+                       ads_memfree(ads, dn);
+                       ads_msgfree(ads, res);
+                       return ADS_ERROR(LDAP_NO_MEMORY);
+               }
+
+               ads_memfree(ads, dn);
+       }
+
+       ads_msgfree(ads, res);
+
+       return status;
+}
+
+
 /**
  * pull a DOM_SID from an extended dn string
  * @param mem_ctx TALLOC_CTX 
@@ -2957,26 +3050,26 @@ char* ads_get_upn( ADS_STRUCT *ads, TALLOC_CTX *ctx, const char *machine_name )
        ADS_STATUS status;
        int count = 0;
        char *name = NULL;
-       
-       status = ads_find_machine_acct(ads, &res, global_myname());
+
+       status = ads_find_machine_acct(ads, &res, machine_name);
        if (!ADS_ERR_OK(status)) {
                DEBUG(0,("ads_get_upn: Failed to find account for %s\n",
                        global_myname()));
                goto out;
        }
-               
+
        if ( (count = ads_count_replies(ads, res)) != 1 ) {
                DEBUG(1,("ads_get_upn: %d entries returned!\n", count));
                goto out;
        }
-               
+
        if ( (name = ads_pull_string(ads, ctx, res, "userPrincipalName")) == NULL ) {
                DEBUG(2,("ads_get_upn: No userPrincipalName attribute!\n"));
        }
 
 out:
        ads_msgfree(ads, res);
-       
+
        return name;
 }
 
diff --git a/source/libads/ndr.c b/source/libads/ndr.c
new file mode 100644 (file)
index 0000000..6324a22
--- /dev/null
@@ -0,0 +1,118 @@
+/*
+   Unix SMB/CIFS implementation.
+
+   debug print helpers
+
+   Copyright (C) Guenther Deschner 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/>.
+*/
+
+#include "includes.h"
+
+void ndr_print_ads_auth_flags(struct ndr_print *ndr, const char *name, uint32_t r)
+{
+       ndr_print_uint32(ndr, name, r);
+       ndr->depth++;
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ADS_AUTH_DISABLE_KERBEROS", ADS_AUTH_DISABLE_KERBEROS, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ADS_AUTH_NO_BIND", ADS_AUTH_NO_BIND, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ADS_AUTH_ANON_BIND", ADS_AUTH_ANON_BIND, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ADS_AUTH_SIMPLE_BIND", ADS_AUTH_SIMPLE_BIND, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ADS_AUTH_ALLOW_NTLMSSP", ADS_AUTH_ALLOW_NTLMSSP, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ADS_AUTH_SASL_SIGN", ADS_AUTH_SASL_SIGN, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ADS_AUTH_SASL_SEAL", ADS_AUTH_SASL_SEAL, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ADS_AUTH_SASL_FORCE", ADS_AUTH_SASL_FORCE, r);
+       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_ads_auth_flags(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_netr_DsR_DcFlags(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 9f6557ef32e6cbbdf9eec8773b0fd427d28f512d..03d5286fae4c779937a8c792292c10cd15b43f01 100644 (file)
@@ -166,7 +166,7 @@ static void gpo_sync_func(const char *mnt,
                }
 
                old_nt_dir = ctx->remote_path;
-               ctx->remote_path = nt_dir;
+               ctx->remote_path = talloc_strdup(ctx->mem_ctx, nt_dir);
 
                old_unix_dir = ctx->local_path;
                ctx->local_path = talloc_strdup(ctx->mem_ctx, unix_dir);
@@ -174,7 +174,7 @@ static void gpo_sync_func(const char *mnt,
                ctx->mask = talloc_asprintf(ctx->mem_ctx,
                                        "%s\\*",
                                        nt_dir);
-               if (!ctx->local_path || !ctx->mask) {
+               if (!ctx->local_path || !ctx->mask || !ctx->remote_path) {
                        DEBUG(0,("gpo_sync_func: ENOMEM\n"));
                        return;
                }
index 7c59e8e5dc55de916e1101242ca6b1d68567afce..4e63b92e4efb56cca17c438bfe47fcf95a6b2a36 100644 (file)
@@ -643,9 +643,12 @@ ADS_STATUS ads_get_sid_token(ADS_STRUCT *ads,
        token_sids = TALLOC_ARRAY(mem_ctx, DOM_SID, 1);
        ADS_ERROR_HAVE_NO_MEMORY(token_sids);
 
-       if (!add_sid_to_array_unique(mem_ctx, &primary_group_sid, &token_sids,
-                                    &num_token_sids)) {
-               return ADS_ERROR(LDAP_NO_MEMORY);
+       status = ADS_ERROR_NT(add_sid_to_array_unique(mem_ctx,
+                                                     &primary_group_sid,
+                                                     &token_sids,
+                                                     &num_token_sids));
+       if (!ADS_ERR_OK(status)) {
+               return status;
        }
 
        for (i = 0; i < num_ad_token_sids; i++) {
@@ -654,9 +657,12 @@ ADS_STATUS ads_get_sid_token(ADS_STRUCT *ads,
                        continue;
                }
 
-               if (!add_sid_to_array_unique(mem_ctx, &ad_token_sids[i],
-                                            &token_sids, &num_token_sids)) {
-                       return ADS_ERROR(LDAP_NO_MEMORY);
+               status = ADS_ERROR_NT(add_sid_to_array_unique(mem_ctx,
+                                                             &ad_token_sids[i],
+                                                             &token_sids,
+                                                             &num_token_sids));
+               if (!ADS_ERR_OK(status)) {
+                       return status;
                }
        }
 
similarity index 68%
rename from source/lib/netapi/joindomain.h
rename to source/libnet/libnet.h
index 2c71702db7cbc81069897b8aa5355b5ada0ee132..97e720f61769efdd76ed8396382f84f06e255b4d 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Unix SMB/CIFS implementation.
- *  NetApi Support
+ *  libnet Support
  *  Copyright (C) Guenther Deschner 2007
  *
  *  This program is free software; you can redistribute it and/or modify
  *  along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
-WERROR NetJoinDomain(const char *server,
-                    const char *domain,
-                    const char *account_ou,
-                    const char *account,
-                    const char *password,
-                    uint32_t join_options);
-WERROR NetUnjoinDomain(const char *server_name,
-                      const char *account,
-                      const char *password,
-                      uint32_t unjoin_flags);
+#ifndef __LIBNET_H__
+#define __LIBNET_H__
+
+#include "librpc/gen_ndr/libnet_join.h"
+#include "libnet/libnet_conf.h"
+#include "libnet/libnet_proto.h"
+
+#endif
diff --git a/source/libnet/libnet_conf.c b/source/libnet/libnet_conf.c
new file mode 100644 (file)
index 0000000..4d998ac
--- /dev/null
@@ -0,0 +1,960 @@
+/*
+ *  Unix SMB/CIFS implementation.
+ *  libnet smbconf registry Support
+ *  Copyright (C) Michael Adam 2007-2008
+ *  Copyright (C) Guenther Deschner 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 "libnet/libnet.h"
+
+/**********************************************************************
+ *
+ * Helper functions (mostly registry related)
+ * TODO: These should be eventually static.
+
+ **********************************************************************/
+
+/**
+ * add a string to a talloced array of strings.
+ */
+static WERROR libnet_conf_add_string_to_array(TALLOC_CTX *mem_ctx,
+                                             char ***array,
+                                             uint32_t count,
+                                             const char *string)
+{
+       char **new_array = NULL;
+
+       if ((array == NULL) || (string == NULL)) {
+               return WERR_INVALID_PARAM;
+       }
+
+       new_array = TALLOC_REALLOC_ARRAY(mem_ctx, *array, char *, count + 1);
+       if (new_array == NULL) {
+               return WERR_NOMEM;
+       }
+
+       new_array[count] = talloc_strdup(new_array, string);
+       if (new_array[count] == NULL) {
+               TALLOC_FREE(new_array);
+               return WERR_NOMEM;
+       }
+
+       *array = new_array;
+
+       return WERR_OK;
+}
+
+static WERROR libnet_conf_reg_initialize(struct libnet_conf_ctx *ctx)
+{
+       WERROR werr = WERR_OK;
+
+       if (!registry_init_regdb()) {
+               werr = WERR_REG_IO_FAILURE;
+               goto done;
+       }
+
+       werr = ntstatus_to_werror(registry_create_admin_token(ctx,
+                                                             &(ctx->token)));
+       if (!W_ERROR_IS_OK(werr)) {
+               DEBUG(1, ("Error creating admin token\n"));
+               goto done;
+       }
+
+done:
+       return werr;
+}
+
+/**
+ * Open a registry key specified by "path"
+ */
+static WERROR libnet_conf_reg_open_path(TALLOC_CTX *mem_ctx,
+                                       struct libnet_conf_ctx *ctx,
+                                       const char *path,
+                                       uint32 desired_access,
+                                       struct registry_key **key)
+{
+       WERROR werr = WERR_OK;
+
+       if (ctx == NULL) {
+               DEBUG(1, ("Error: configuration is not open!\n"));
+               werr = WERR_INVALID_PARAM;
+               goto done;
+       }
+
+       if (ctx->token == NULL) {
+               DEBUG(1, ("Error: token missing from libnet_conf_ctx. "
+                         "was libnet_conf_open() called?\n"));
+               werr = WERR_INVALID_PARAM;
+               goto done;
+       }
+
+       if (path == NULL) {
+               DEBUG(1, ("Error: NULL path string given\n"));
+               werr = WERR_INVALID_PARAM;
+               goto done;
+       }
+
+       werr = reg_open_path(mem_ctx, path, desired_access, ctx->token, key);
+
+       if (!W_ERROR_IS_OK(werr)) {
+               DEBUG(1, ("Error opening registry path '%s': %s\n",
+                         path, dos_errstr(werr)));
+       }
+
+done:
+       return werr;
+}
+
+/**
+ * Open a subkey of KEY_SMBCONF (i.e a service)
+ */
+static WERROR libnet_conf_reg_open_service_key(TALLOC_CTX *mem_ctx,
+                                              struct libnet_conf_ctx *ctx,
+                                              const char *servicename,
+                                              uint32 desired_access,
+                                              struct registry_key **key)
+{
+       WERROR werr = WERR_OK;
+       char *path = NULL;
+
+       if (servicename == NULL) {
+               DEBUG(3, ("Error: NULL servicename given.\n"));
+               werr = WERR_INVALID_PARAM;
+               goto done;
+       }
+
+       path = talloc_asprintf(mem_ctx, "%s\\%s", KEY_SMBCONF, servicename);
+       if (path == NULL) {
+               werr = WERR_NOMEM;
+               goto done;
+       }
+
+       werr = libnet_conf_reg_open_path(mem_ctx, ctx, path, desired_access,
+                                        key);
+
+done:
+       TALLOC_FREE(path);
+       return werr;
+}
+
+/**
+ * open the base key KEY_SMBCONF
+ */
+static WERROR libnet_conf_reg_open_base_key(TALLOC_CTX *mem_ctx,
+                                           struct libnet_conf_ctx *ctx,
+                                           uint32 desired_access,
+                                           struct registry_key **key)
+{
+       return libnet_conf_reg_open_path(mem_ctx, ctx, KEY_SMBCONF,
+                                        desired_access, key);
+}
+
+/**
+ * check if a value exists in a given registry key
+ */
+static bool libnet_conf_value_exists(struct registry_key *key,
+                                    const char *param)
+{
+       bool ret = false;
+       WERROR werr = WERR_OK;
+       TALLOC_CTX *ctx = talloc_stackframe();
+       struct registry_value *value = NULL;
+
+       werr = reg_queryvalue(ctx, key, param, &value);
+       if (W_ERROR_IS_OK(werr)) {
+               ret = true;
+       }
+
+       TALLOC_FREE(ctx);
+       return ret;
+}
+
+/**
+ * create a subkey of KEY_SMBCONF
+ */
+static WERROR libnet_conf_reg_create_service_key(TALLOC_CTX *mem_ctx,
+                                                struct libnet_conf_ctx *ctx,
+                                                const char * subkeyname,
+                                                struct registry_key **newkey)
+{
+       WERROR werr = WERR_OK;
+       struct registry_key *create_parent = NULL;
+       TALLOC_CTX *create_ctx;
+       enum winreg_CreateAction action = REG_ACTION_NONE;
+
+       /* create a new talloc ctx for creation. it will hold
+        * the intermediate parent key (SMBCONF) for creation
+        * and will be destroyed when leaving this function... */
+       if (!(create_ctx = talloc_stackframe())) {
+               werr = WERR_NOMEM;
+               goto done;
+       }
+
+       werr = libnet_conf_reg_open_base_key(create_ctx, ctx, REG_KEY_WRITE,
+                                            &create_parent);
+       if (!W_ERROR_IS_OK(werr)) {
+               goto done;
+       }
+
+       werr = reg_createkey(mem_ctx, create_parent, subkeyname,
+                            REG_KEY_WRITE, newkey, &action);
+       if (W_ERROR_IS_OK(werr) && (action != REG_CREATED_NEW_KEY)) {
+               DEBUG(10, ("Key '%s' already exists.\n", subkeyname));
+               werr = WERR_ALREADY_EXISTS;
+       }
+       if (!W_ERROR_IS_OK(werr)) {
+               DEBUG(5, ("Error creating key %s: %s\n",
+                        subkeyname, dos_errstr(werr)));
+       }
+
+done:
+       TALLOC_FREE(create_ctx);
+       return werr;
+}
+
+/**
+ * add a value to a key.
+ */
+static WERROR libnet_conf_reg_set_value(struct registry_key *key,
+                                       const char *valname,
+                                       const char *valstr)
+{
+       struct registry_value val;
+       WERROR werr = WERR_OK;
+       char *subkeyname;
+       const char *canon_valname;
+       const char *canon_valstr;
+
+       if (!lp_canonicalize_parameter_with_value(valname, valstr,
+                                                 &canon_valname,
+                                                 &canon_valstr))
+       {
+               if (canon_valname == NULL) {
+                       DEBUG(5, ("invalid parameter '%s' given\n",
+                                 valname));
+               } else {
+                       DEBUG(5, ("invalid value '%s' given for "
+                                 "parameter '%s'\n", valstr, valname));
+               }
+               werr = WERR_INVALID_PARAM;
+               goto done;
+       }
+
+       ZERO_STRUCT(val);
+
+       val.type = REG_SZ;
+       val.v.sz.str = CONST_DISCARD(char *, canon_valstr);
+       val.v.sz.len = strlen(canon_valstr) + 1;
+
+       if (registry_smbconf_valname_forbidden(canon_valname)) {
+               DEBUG(5, ("Parameter '%s' not allowed in registry.\n",
+                         canon_valname));
+               werr = WERR_INVALID_PARAM;
+               goto done;
+       }
+
+       subkeyname = strrchr_m(key->key->name, '\\');
+       if ((subkeyname == NULL) || (*(subkeyname +1) == '\0')) {
+               DEBUG(5, ("Invalid registry key '%s' given as "
+                         "smbconf section.\n", key->key->name));
+               werr = WERR_INVALID_PARAM;
+               goto done;
+       }
+       subkeyname++;
+       if (!strequal(subkeyname, GLOBAL_NAME) &&
+           lp_parameter_is_global(valname))
+       {
+               DEBUG(5, ("Global paramter '%s' not allowed in "
+                         "service definition ('%s').\n", canon_valname,
+                         subkeyname));
+               werr = WERR_INVALID_PARAM;
+               goto done;
+       }
+
+       werr = reg_setvalue(key, canon_valname, &val);
+       if (!W_ERROR_IS_OK(werr)) {
+               DEBUG(5, ("Error adding value '%s' to "
+                         "key '%s': %s\n",
+                         canon_valname, key->key->name, dos_errstr(werr)));
+       }
+
+done:
+       return werr;
+}
+
+/**
+ * format a registry_value into a string.
+ *
+ * This is intended to be used for smbconf registry values,
+ * which are ar stored as REG_SZ values, so the incomplete
+ * handling should be ok.
+ */
+static char *libnet_conf_format_registry_value(TALLOC_CTX *mem_ctx,
+                                              struct registry_value *value)
+{
+       char *result = NULL;
+
+       /* alternatively, create a new talloc context? */
+       if (mem_ctx == NULL) {
+               return result;
+       }
+
+       switch (value->type) {
+       case REG_DWORD:
+               result = talloc_asprintf(mem_ctx, "%d", value->v.dword);
+               break;
+       case REG_SZ:
+       case REG_EXPAND_SZ:
+               result = talloc_asprintf(mem_ctx, "%s", value->v.sz.str);
+               break;
+       case REG_MULTI_SZ: {
+                uint32 j;
+                for (j = 0; j < value->v.multi_sz.num_strings; j++) {
+                        result = talloc_asprintf(mem_ctx, "%s \"%s\" ",
+                                                result,
+                                                value->v.multi_sz.strings[j]);
+                       if (result == NULL) {
+                               break;
+                       }
+                }
+                break;
+        }
+       case REG_BINARY:
+                result = talloc_asprintf(mem_ctx, "binary (%d bytes)",
+                                        (int)value->v.binary.length);
+                break;
+        default:
+                result = talloc_asprintf(mem_ctx, "<unprintable>");
+                break;
+        }
+       return result;
+}
+
+/**
+ * Get the values of a key as a list of value names
+ * and a list of value strings (ordered)
+ */
+static WERROR libnet_conf_reg_get_values(TALLOC_CTX *mem_ctx,
+                                        struct registry_key *key,
+                                        uint32_t *num_values,
+                                        char ***value_names,
+                                        char ***value_strings)
+{
+       TALLOC_CTX *tmp_ctx = NULL;
+       WERROR werr = WERR_OK;
+       uint32_t count;
+       struct registry_value *valvalue = NULL;
+       char *valname = NULL;
+       char **tmp_valnames = NULL;
+       char **tmp_valstrings = NULL;
+
+       if ((num_values == NULL) || (value_names == NULL) ||
+           (value_strings == NULL))
+       {
+               werr = WERR_INVALID_PARAM;
+               goto done;
+       }
+
+       tmp_ctx = talloc_stackframe();
+       if (tmp_ctx == NULL) {
+               werr = WERR_NOMEM;
+               goto done;
+       }
+
+       for (count = 0;
+            W_ERROR_IS_OK(werr = reg_enumvalue(tmp_ctx, key, count, &valname,
+                                               &valvalue));
+            count++)
+       {
+               char *valstring;
+
+               werr = libnet_conf_add_string_to_array(tmp_ctx,
+                                                      &tmp_valnames,
+                                                      count, valname);
+               if (!W_ERROR_IS_OK(werr)) {
+                       goto done;
+               }
+
+               valstring = libnet_conf_format_registry_value(tmp_ctx,
+                                                             valvalue);
+               werr = libnet_conf_add_string_to_array(tmp_ctx,
+                                                      &tmp_valstrings,
+                                                      count,
+                                                      valstring);
+               if (!W_ERROR_IS_OK(werr)) {
+                       goto done;
+               }
+       }
+       if (!W_ERROR_EQUAL(WERR_NO_MORE_ITEMS, werr)) {
+               goto done;
+       }
+
+       werr = WERR_OK;
+
+       *num_values = count;
+       if (count > 0) {
+               *value_names = talloc_move(mem_ctx, &tmp_valnames);
+               *value_strings = talloc_move(mem_ctx, &tmp_valstrings);
+       } else {
+               *value_names = NULL;
+               *value_strings = NULL;
+       }
+
+done:
+       TALLOC_FREE(tmp_ctx);
+       return werr;
+}
+
+static int libnet_conf_destroy_ctx(struct libnet_conf_ctx *ctx)
+{
+       return regdb_close();
+}
+
+/**********************************************************************
+ *
+ * The actual net conf api functions, that are exported.
+ *
+ **********************************************************************/
+
+/**
+ * Open the configuration.
+ *
+ * This should be the first function in a sequence of calls to libnet_conf
+ * functions:
+ *
+ * Upon success, this creates and returns the conf context
+ * that should be passed around in subsequent calls to the other
+ * libnet_conf functions.
+ *
+ * After the work with the configuration is completed, libnet_conf_close()
+ * should be called.
+ */
+WERROR libnet_conf_open(TALLOC_CTX *mem_ctx, struct libnet_conf_ctx **conf_ctx)
+{
+       WERROR werr = WERR_OK;
+       struct libnet_conf_ctx *ctx;
+
+       if (conf_ctx == NULL) {
+               return WERR_INVALID_PARAM;
+       }
+
+       ctx = TALLOC_ZERO_P(mem_ctx, struct libnet_conf_ctx);
+       if (ctx == NULL) {
+               return WERR_NOMEM;
+       }
+
+       werr = libnet_conf_reg_initialize(ctx);
+       if (!W_ERROR_IS_OK(werr)) {
+               goto fail;
+       }
+
+       talloc_set_destructor(ctx, libnet_conf_destroy_ctx);
+
+       *conf_ctx = ctx;
+       return werr;
+
+fail:
+       TALLOC_FREE(ctx);
+       return werr;
+}
+
+/**
+ * Close the configuration.
+ */
+void libnet_conf_close(struct libnet_conf_ctx *ctx)
+{
+       /* this also closes the registry (by destructor): */
+       TALLOC_FREE(ctx);
+}
+
+/**
+ * Drop the whole configuration (restarting empty).
+ */
+WERROR libnet_conf_drop(struct libnet_conf_ctx *ctx)
+{
+       char *path, *p;
+       WERROR werr = WERR_OK;
+       struct registry_key *parent_key = NULL;
+       struct registry_key *new_key = NULL;
+       TALLOC_CTX* mem_ctx = talloc_stackframe();
+       enum winreg_CreateAction action;
+
+       path = talloc_strdup(mem_ctx, KEY_SMBCONF);
+       if (path == NULL) {
+               werr = WERR_NOMEM;
+               goto done;
+       }
+       p = strrchr(path, '\\');
+       *p = '\0';
+       werr = libnet_conf_reg_open_path(mem_ctx, ctx, path, REG_KEY_WRITE,
+                                        &parent_key);
+
+       if (!W_ERROR_IS_OK(werr)) {
+               goto done;
+       }
+
+       werr = reg_deletekey_recursive(mem_ctx, parent_key, p+1);
+
+       if (!W_ERROR_IS_OK(werr)) {
+               goto done;
+       }
+
+       werr = reg_createkey(mem_ctx, parent_key, p+1, REG_KEY_WRITE,
+                            &new_key, &action);
+
+done:
+       TALLOC_FREE(mem_ctx);
+       return werr;
+}
+
+/**
+ * Get the whole configuration as lists of strings with counts:
+ *
+ *  num_shares   : number of shares
+ *  share_names  : list of length num_shares of share names
+ *  num_params   : list of length num_shares of parameter counts for each share
+ *  param_names  : list of lists of parameter names for each share
+ *  param_values : list of lists of parameter values for each share
+ */
+WERROR libnet_conf_get_config(TALLOC_CTX *mem_ctx,
+                             struct libnet_conf_ctx *ctx, uint32_t *num_shares,
+                             char ***share_names, uint32_t **num_params,
+                             char ****param_names, char ****param_values)
+{
+       WERROR werr = WERR_OK;
+       TALLOC_CTX *tmp_ctx = NULL;
+       uint32_t tmp_num_shares;
+       char **tmp_share_names;
+       uint32_t *tmp_num_params;
+       char ***tmp_param_names;
+       char ***tmp_param_values;
+       uint32_t count;
+
+       if ((num_shares == NULL) || (share_names == NULL) ||
+           (num_params == NULL) || (param_names == NULL) ||
+           (param_values == NULL))
+       {
+               werr = WERR_INVALID_PARAM;
+               goto done;
+       }
+
+       tmp_ctx = talloc_stackframe();
+       if (tmp_ctx == NULL) {
+               werr = WERR_NOMEM;
+               goto done;
+       }
+
+       werr = libnet_conf_get_share_names(tmp_ctx, ctx, &tmp_num_shares,
+                                          &tmp_share_names);
+       if (!W_ERROR_IS_OK(werr)) {
+               goto done;
+       }
+
+       tmp_num_params   = TALLOC_ARRAY(tmp_ctx, uint32_t, tmp_num_shares);
+       tmp_param_names  = TALLOC_ARRAY(tmp_ctx, char **, tmp_num_shares);
+       tmp_param_values = TALLOC_ARRAY(tmp_ctx, char **, tmp_num_shares);
+
+       if ((tmp_num_params == NULL) || (tmp_param_names == NULL) ||
+           (tmp_param_values == NULL))
+       {
+               werr = WERR_NOMEM;
+               goto done;
+       }
+
+       for (count = 0; count < tmp_num_shares; count++) {
+               werr = libnet_conf_get_share(mem_ctx, ctx,
+                                            tmp_share_names[count],
+                                            &tmp_num_params[count],
+                                            &tmp_param_names[count],
+                                            &tmp_param_values[count]);
+               if (!W_ERROR_IS_OK(werr)) {
+                       goto done;
+               }
+       }
+
+       werr = WERR_OK;
+
+       *num_shares = tmp_num_shares;
+       if (tmp_num_shares > 0) {
+               *share_names = talloc_move(mem_ctx, &tmp_share_names);
+               *num_params = talloc_move(mem_ctx, &tmp_num_params);
+               *param_names = talloc_move(mem_ctx, &tmp_param_names);
+               *param_values = talloc_move(mem_ctx, &tmp_param_values);
+       } else {
+               *share_names = NULL;
+               *num_params = NULL;
+               *param_names = NULL;
+               *param_values = NULL;
+       }
+
+done:
+       TALLOC_FREE(tmp_ctx);
+       return werr;
+}
+
+/**
+ * get the list of share names defined in the configuration.
+ */
+WERROR libnet_conf_get_share_names(TALLOC_CTX *mem_ctx,
+                                  struct libnet_conf_ctx *ctx,
+                                  uint32_t *num_shares,
+                                  char ***share_names)
+{
+       uint32_t count;
+       uint32_t added_count = 0;
+       TALLOC_CTX *tmp_ctx = NULL;
+       WERROR werr = WERR_OK;
+       struct registry_key *key = NULL;
+       char *subkey_name = NULL;
+       char **tmp_share_names = NULL;
+
+       if ((num_shares == NULL) || (share_names == NULL)) {
+               werr = WERR_INVALID_PARAM;
+               goto done;
+       }
+
+       tmp_ctx = talloc_stackframe();
+       if (tmp_ctx == NULL) {
+               werr = WERR_NOMEM;
+               goto done;
+       }
+
+       /* make sure "global" is always listed first */
+       if (libnet_conf_share_exists(ctx, GLOBAL_NAME)) {
+               werr = libnet_conf_add_string_to_array(tmp_ctx,
+                                                      &tmp_share_names,
+                                                      0, GLOBAL_NAME);
+               if (!W_ERROR_IS_OK(werr)) {
+                       goto done;
+               }
+               added_count++;
+       }
+
+       werr = libnet_conf_reg_open_base_key(tmp_ctx, ctx,
+                                            SEC_RIGHTS_ENUM_SUBKEYS, &key);
+       if (!W_ERROR_IS_OK(werr)) {
+               goto done;
+       }
+
+       for (count = 0;
+            W_ERROR_IS_OK(werr = reg_enumkey(tmp_ctx, key, count,
+                                             &subkey_name, NULL));
+            count++)
+       {
+               if (strequal(subkey_name, GLOBAL_NAME)) {
+                       continue;
+               }
+
+               werr = libnet_conf_add_string_to_array(tmp_ctx,
+                                                      &tmp_share_names,
+                                                      added_count,
+                                                      subkey_name);
+               if (!W_ERROR_IS_OK(werr)) {
+                       goto done;
+               }
+               added_count++;
+       }
+       if (!W_ERROR_EQUAL(WERR_NO_MORE_ITEMS, werr)) {
+               goto done;
+       }
+       werr = WERR_OK;
+
+       *num_shares = added_count;
+       if (added_count > 0) {
+               *share_names = talloc_move(mem_ctx, &tmp_share_names);
+       } else {
+               *share_names = NULL;
+       }
+
+done:
+       TALLOC_FREE(tmp_ctx);
+       return werr;
+}
+
+/**
+ * check if a share/service of a given name exists
+ */
+bool libnet_conf_share_exists(struct libnet_conf_ctx *ctx,
+                             const char *servicename)
+{
+       bool ret = false;
+       WERROR werr = WERR_OK;
+       TALLOC_CTX *mem_ctx = talloc_stackframe();
+       struct registry_key *key = NULL;
+
+       werr = libnet_conf_reg_open_service_key(mem_ctx, ctx, servicename,
+                                               REG_KEY_READ, &key);
+       if (W_ERROR_IS_OK(werr)) {
+               ret = true;
+       }
+
+       TALLOC_FREE(mem_ctx);
+       return ret;
+}
+
+/**
+ * Add a service if it does not already exist.
+ */
+WERROR libnet_conf_create_share(struct libnet_conf_ctx *ctx,
+                               const char *servicename)
+{
+       WERROR werr;
+       TALLOC_CTX *mem_ctx = talloc_stackframe();
+       struct registry_key *key = NULL;
+
+       if (libnet_conf_share_exists(ctx, servicename)) {
+               werr = WERR_ALREADY_EXISTS;
+               goto done;
+       }
+
+       werr = libnet_conf_reg_create_service_key(mem_ctx, ctx, servicename,
+                                                 &key);
+
+done:
+       TALLOC_FREE(mem_ctx);
+       return werr;
+}
+
+/**
+ * get a definition of a share (service) from configuration.
+ */
+WERROR libnet_conf_get_share(TALLOC_CTX *mem_ctx, struct libnet_conf_ctx *ctx,
+                            const char *servicename, uint32_t *num_params,
+                            char ***param_names, char ***param_values)
+{
+       WERROR werr = WERR_OK;
+       struct registry_key *key = NULL;
+
+       werr = libnet_conf_reg_open_service_key(mem_ctx, ctx, servicename,
+                                               REG_KEY_READ, &key);
+       if (!W_ERROR_IS_OK(werr)) {
+               goto done;
+       }
+
+       werr = libnet_conf_reg_get_values(mem_ctx, key, num_params,
+                                         param_names, param_values);
+
+done:
+       TALLOC_FREE(key);
+       return werr;
+}
+
+/**
+ * delete a service from configuration
+ */
+WERROR libnet_conf_delete_share(struct libnet_conf_ctx *ctx,
+                               const char *servicename)
+{
+       WERROR werr = WERR_OK;
+       struct registry_key *key = NULL;
+       TALLOC_CTX *mem_ctx = talloc_stackframe();
+
+       werr = libnet_conf_reg_open_base_key(mem_ctx, ctx, REG_KEY_WRITE, &key);
+       if (!W_ERROR_IS_OK(werr)) {
+               goto done;
+       }
+
+       werr = reg_deletekey_recursive(key, key, servicename);
+
+done:
+       TALLOC_FREE(mem_ctx);
+       return werr;
+}
+
+/**
+ * set a configuration parameter to the value provided.
+ */
+WERROR libnet_conf_set_parameter(struct libnet_conf_ctx *ctx,
+                                const char *service,
+                                const char *param,
+                                const char *valstr)
+{
+       WERROR werr;
+       struct registry_key *key = NULL;
+       TALLOC_CTX *mem_ctx = talloc_stackframe();
+
+       if (!libnet_conf_share_exists(ctx, service)) {
+               werr = WERR_NO_SUCH_SERVICE;
+               goto done;
+       }
+
+       werr = libnet_conf_reg_open_service_key(mem_ctx, ctx, service,
+                                               REG_KEY_WRITE, &key);
+       if (!W_ERROR_IS_OK(werr)) {
+               goto done;
+       }
+
+       werr = libnet_conf_reg_set_value(key, param, valstr);
+
+done:
+       TALLOC_FREE(mem_ctx);
+       return werr;
+}
+
+/**
+ * Set a global parameter
+ * (i.e. a parameter in the [global] service).
+ *
+ * This also creates [global] when it does not exist.
+ */
+WERROR libnet_conf_set_global_parameter(struct libnet_conf_ctx *ctx,
+                                       const char *param, const char *val)
+{
+       WERROR werr;
+
+       if (!libnet_conf_share_exists(ctx, GLOBAL_NAME)) {
+               werr = libnet_conf_create_share(ctx, GLOBAL_NAME);
+               if (!W_ERROR_IS_OK(werr)) {
+                       goto done;
+               }
+       }
+       werr = libnet_conf_set_parameter(ctx, GLOBAL_NAME, param, val);
+
+done:
+       return werr;
+}
+
+/**
+ * get the value of a configuration parameter as a string
+ */
+WERROR libnet_conf_get_parameter(TALLOC_CTX *mem_ctx,
+                                struct libnet_conf_ctx *ctx,
+                                const char *service,
+                                const char *param,
+                                char **valstr)
+{
+       WERROR werr = WERR_OK;
+       struct registry_key *key = NULL;
+       struct registry_value *value = NULL;
+
+       if (valstr == NULL) {
+               werr = WERR_INVALID_PARAM;
+               goto done;
+       }
+
+       if (!libnet_conf_share_exists(ctx, service)) {
+               werr = WERR_NO_SUCH_SERVICE;
+               goto done;
+       }
+
+       werr = libnet_conf_reg_open_service_key(mem_ctx, ctx, service,
+                                               REG_KEY_READ, &key);
+       if (!W_ERROR_IS_OK(werr)) {
+               goto done;
+       }
+
+       if (!libnet_conf_value_exists(key, param)) {
+               werr = WERR_INVALID_PARAM;
+               goto done;
+       }
+
+       werr = reg_queryvalue(mem_ctx, key, param, &value);
+       if (!W_ERROR_IS_OK(werr)) {
+               goto done;
+       }
+
+       *valstr = libnet_conf_format_registry_value(mem_ctx, value);
+
+       if (*valstr == NULL) {
+               werr = WERR_NOMEM;
+       }
+
+done:
+       TALLOC_FREE(key);
+       TALLOC_FREE(value);
+       return werr;
+}
+
+/**
+ * Get the value of a global parameter.
+ *
+ * Create [global] if it does not exist.
+ */
+WERROR libnet_conf_get_global_parameter(TALLOC_CTX *mem_ctx,
+                                       struct libnet_conf_ctx *ctx,
+                                       const char *param,
+                                       char **valstr)
+{
+       WERROR werr;
+
+       if (!libnet_conf_share_exists(ctx, GLOBAL_NAME)) {
+               werr = libnet_conf_create_share(ctx, GLOBAL_NAME);
+               if (!W_ERROR_IS_OK(werr)) {
+                       goto done;
+               }
+       }
+       werr = libnet_conf_get_parameter(mem_ctx, ctx, GLOBAL_NAME, param,
+                                        valstr);
+
+done:
+       return werr;
+}
+
+/**
+ * delete a parameter from configuration
+ */
+WERROR libnet_conf_delete_parameter(struct libnet_conf_ctx *ctx,
+                                   const char *service, const char *param)
+{
+       struct registry_key *key = NULL;
+       WERROR werr = WERR_OK;
+       TALLOC_CTX *mem_ctx = talloc_stackframe();
+
+       if (!libnet_conf_share_exists(ctx, service)) {
+               return WERR_NO_SUCH_SERVICE;
+       }
+
+       werr = libnet_conf_reg_open_service_key(mem_ctx, ctx, service,
+                                               REG_KEY_ALL,
+                                               &key);
+       if (!W_ERROR_IS_OK(werr)) {
+               goto done;
+       }
+
+       if (!libnet_conf_value_exists(key, param)) {
+               werr = WERR_INVALID_PARAM;
+               goto done;
+       }
+
+       werr = reg_deletevalue(key, param);
+
+done:
+       TALLOC_FREE(mem_ctx);
+       return werr;
+}
+
+/**
+ * Delete a global parameter.
+ *
+ * Create [global] if it does not exist.
+ */
+WERROR libnet_conf_delete_global_parameter(struct libnet_conf_ctx *ctx,
+                                          const char *param)
+{
+       WERROR werr;
+
+       if (!libnet_conf_share_exists(ctx, GLOBAL_NAME)) {
+               werr = libnet_conf_create_share(ctx, GLOBAL_NAME);
+               if (!W_ERROR_IS_OK(werr)) {
+                       goto done;
+               }
+       }
+       werr = libnet_conf_delete_parameter(ctx, GLOBAL_NAME, param);
+
+done:
+       return werr;
+}
diff --git a/source/libnet/libnet_conf.h b/source/libnet/libnet_conf.h
new file mode 100644 (file)
index 0000000..b518c0e
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ *  Unix SMB/CIFS implementation.
+ *  libnet smbconf registry support
+ *  Copyright (C) Michael Adam 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_CONF_H__
+#define __LIBNET_CONF_H__
+
+struct libnet_conf_ctx {
+       NT_USER_TOKEN *token;
+};
+
+#endif
diff --git a/source/libnet/libnet_join.c b/source/libnet/libnet_join.c
new file mode 100644 (file)
index 0000000..737474d
--- /dev/null
@@ -0,0 +1,1427 @@
+/*
+ *  Unix SMB/CIFS implementation.
+ *  libnet Join Support
+ *  Copyright (C) Gerald (Jerry) Carter 2006
+ *  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/>.
+ */
+
+#include "includes.h"
+#include "libnet/libnet.h"
+
+/****************************************************************
+****************************************************************/
+
+#define LIBNET_JOIN_DUMP_CTX(ctx, r, f) \
+       do { \
+               char *str = NULL; \
+               str = NDR_PRINT_FUNCTION_STRING(ctx, libnet_JoinCtx, f, r); \
+               DEBUG(1,("libnet_Join:\n%s", str)); \
+               talloc_free(str); \
+       } while (0)
+
+#define LIBNET_JOIN_IN_DUMP_CTX(ctx, r) \
+       LIBNET_JOIN_DUMP_CTX(ctx, r, NDR_IN | NDR_SET_VALUES)
+#define LIBNET_JOIN_OUT_DUMP_CTX(ctx, r) \
+       LIBNET_JOIN_DUMP_CTX(ctx, r, NDR_OUT)
+
+#define LIBNET_UNJOIN_DUMP_CTX(ctx, r, f) \
+       do { \
+               char *str = NULL; \
+               str = NDR_PRINT_FUNCTION_STRING(ctx, libnet_UnjoinCtx, f, r); \
+               DEBUG(1,("libnet_Unjoin:\n%s", str)); \
+               talloc_free(str); \
+       } while (0)
+
+#define LIBNET_UNJOIN_IN_DUMP_CTX(ctx, r) \
+       LIBNET_UNJOIN_DUMP_CTX(ctx, r, NDR_IN | NDR_SET_VALUES)
+#define LIBNET_UNJOIN_OUT_DUMP_CTX(ctx, r) \
+       LIBNET_UNJOIN_DUMP_CTX(ctx, r, NDR_OUT)
+
+static void init_lsa_String(struct lsa_String *name, const char *s)
+{
+       name->string = s;
+}
+
+/****************************************************************
+****************************************************************/
+
+static void libnet_join_set_error_string(TALLOC_CTX *mem_ctx,
+                                        struct libnet_JoinCtx *r,
+                                        const char *format, ...)
+{
+       va_list args;
+
+       if (r->out.error_string) {
+               return;
+       }
+
+       va_start(args, format);
+       r->out.error_string = talloc_vasprintf(mem_ctx, format, args);
+       va_end(args);
+}
+
+/****************************************************************
+****************************************************************/
+
+static void libnet_unjoin_set_error_string(TALLOC_CTX *mem_ctx,
+                                          struct libnet_UnjoinCtx *r,
+                                          const char *format, ...)
+{
+       va_list args;
+
+       if (r->out.error_string) {
+               return;
+       }
+
+       va_start(args, format);
+       r->out.error_string = talloc_vasprintf(mem_ctx, format, args);
+       va_end(args);
+}
+
+#ifdef WITH_ADS
+
+/****************************************************************
+****************************************************************/
+
+static ADS_STATUS libnet_connect_ads(const char *dns_domain_name,
+                                    const char *netbios_domain_name,
+                                    const char *dc_name,
+                                    const char *user_name,
+                                    const char *password,
+                                    ADS_STRUCT **ads)
+{
+       ADS_STATUS status;
+       ADS_STRUCT *my_ads = NULL;
+
+       my_ads = ads_init(dns_domain_name,
+                         netbios_domain_name,
+                         dc_name);
+       if (!my_ads) {
+               return ADS_ERROR_LDAP(LDAP_NO_MEMORY);
+       }
+
+       if (user_name) {
+               SAFE_FREE(my_ads->auth.user_name);
+               my_ads->auth.user_name = SMB_STRDUP(user_name);
+       }
+
+       if (password) {
+               SAFE_FREE(my_ads->auth.password);
+               my_ads->auth.password = SMB_STRDUP(password);
+       }
+
+       status = ads_connect(my_ads);
+       if (!ADS_ERR_OK(status)) {
+               ads_destroy(&my_ads);
+               return status;
+       }
+
+       *ads = my_ads;
+       return ADS_SUCCESS;
+}
+
+/****************************************************************
+****************************************************************/
+
+static ADS_STATUS libnet_join_connect_ads(TALLOC_CTX *mem_ctx,
+                                         struct libnet_JoinCtx *r)
+{
+       ADS_STATUS status;
+
+       status = libnet_connect_ads(r->in.domain_name,
+                                   r->in.domain_name,
+                                   r->in.dc_name,
+                                   r->in.admin_account,
+                                   r->in.admin_password,
+                                   &r->in.ads);
+       if (!ADS_ERR_OK(status)) {
+               libnet_join_set_error_string(mem_ctx, r,
+                       "failed to connect to AD: %s",
+                       ads_errstr(status));
+       }
+
+       return status;
+}
+
+/****************************************************************
+****************************************************************/
+
+static ADS_STATUS libnet_unjoin_connect_ads(TALLOC_CTX *mem_ctx,
+                                           struct libnet_UnjoinCtx *r)
+{
+       ADS_STATUS status;
+
+       status = libnet_connect_ads(r->in.domain_name,
+                                   r->in.domain_name,
+                                   r->in.dc_name,
+                                   r->in.admin_account,
+                                   r->in.admin_password,
+                                   &r->in.ads);
+       if (!ADS_ERR_OK(status)) {
+               libnet_unjoin_set_error_string(mem_ctx, r,
+                       "failed to connect to AD: %s",
+                       ads_errstr(status));
+       }
+
+       return status;
+}
+
+/****************************************************************
+****************************************************************/
+
+static ADS_STATUS libnet_join_precreate_machine_acct(TALLOC_CTX *mem_ctx,
+                                                    struct libnet_JoinCtx *r)
+{
+       ADS_STATUS status;
+       LDAPMessage *res = NULL;
+       const char *attrs[] = { "dn", NULL };
+
+       status = ads_search_dn(r->in.ads, &res, r->in.account_ou, attrs);
+       if (!ADS_ERR_OK(status)) {
+               return status;
+       }
+
+       if (ads_count_replies(r->in.ads, res) != 1) {
+               ads_msgfree(r->in.ads, res);
+               return ADS_ERROR_LDAP(LDAP_NO_SUCH_OBJECT);
+       }
+
+       status = ads_create_machine_acct(r->in.ads,
+                                        r->in.machine_name,
+                                        r->in.account_ou);
+       ads_msgfree(r->in.ads, res);
+
+       if ((status.error_type == ENUM_ADS_ERROR_LDAP) &&
+           (status.err.rc == LDAP_ALREADY_EXISTS)) {
+               status = ADS_SUCCESS;
+       }
+
+       return status;
+}
+
+/****************************************************************
+****************************************************************/
+
+static ADS_STATUS libnet_unjoin_remove_machine_acct(TALLOC_CTX *mem_ctx,
+                                                   struct libnet_UnjoinCtx *r)
+{
+       ADS_STATUS status;
+
+       if (!r->in.ads) {
+               status = libnet_unjoin_connect_ads(mem_ctx, r);
+               if (!ADS_ERR_OK(status)) {
+                       return status;
+               }
+       }
+
+       status = ads_leave_realm(r->in.ads, r->in.machine_name);
+       if (!ADS_ERR_OK(status)) {
+               libnet_unjoin_set_error_string(mem_ctx, r,
+                       "failed to leave realm: %s",
+                       ads_errstr(status));
+               return status;
+       }
+
+       return ADS_SUCCESS;
+}
+
+/****************************************************************
+****************************************************************/
+
+static ADS_STATUS libnet_join_find_machine_acct(TALLOC_CTX *mem_ctx,
+                                               struct libnet_JoinCtx *r)
+{
+       ADS_STATUS status;
+       LDAPMessage *res = NULL;
+       char *dn = NULL;
+
+       if (!r->in.machine_name) {
+               return ADS_ERROR(LDAP_NO_MEMORY);
+       }
+
+       status = ads_find_machine_acct(r->in.ads,
+                                      &res,
+                                      r->in.machine_name);
+       if (!ADS_ERR_OK(status)) {
+               return status;
+       }
+
+       if (ads_count_replies(r->in.ads, res) != 1) {
+               status = ADS_ERROR_LDAP(LDAP_NO_MEMORY);
+               goto done;
+       }
+
+       dn = ads_get_dn(r->in.ads, res);
+       if (!dn) {
+               status = ADS_ERROR_LDAP(LDAP_NO_MEMORY);
+               goto done;
+       }
+
+       r->out.dn = talloc_strdup(mem_ctx, dn);
+       if (!r->out.dn) {
+               status = ADS_ERROR_LDAP(LDAP_NO_MEMORY);
+               goto done;
+       }
+
+ done:
+       ads_msgfree(r->in.ads, res);
+       ads_memfree(r->in.ads, dn);
+
+       return status;
+}
+
+/****************************************************************
+****************************************************************/
+
+static ADS_STATUS libnet_join_set_machine_spn(TALLOC_CTX *mem_ctx,
+                                             struct libnet_JoinCtx *r)
+{
+       ADS_STATUS status;
+       ADS_MODLIST mods;
+       fstring my_fqdn;
+       const char *spn_array[3] = {NULL, NULL, NULL};
+       char *spn = NULL;
+
+       if (!r->in.ads) {
+               status = libnet_join_connect_ads(mem_ctx, r);
+               if (!ADS_ERR_OK(status)) {
+                       return status;
+               }
+       }
+
+       status = libnet_join_find_machine_acct(mem_ctx, r);
+       if (!ADS_ERR_OK(status)) {
+               return status;
+       }
+
+       spn = talloc_asprintf(mem_ctx, "HOST/%s", r->in.machine_name);
+       if (!spn) {
+               return ADS_ERROR_LDAP(LDAP_NO_MEMORY);
+       }
+       strupper_m(spn);
+       spn_array[0] = spn;
+
+       if (name_to_fqdn(my_fqdn, r->in.machine_name) &&
+           !strequal(my_fqdn, r->in.machine_name)) {
+
+               strlower_m(my_fqdn);
+               spn = talloc_asprintf(mem_ctx, "HOST/%s", my_fqdn);
+               if (!spn) {
+                       return ADS_ERROR_LDAP(LDAP_NO_MEMORY);
+               }
+               spn_array[1] = spn;
+       }
+
+       mods = ads_init_mods(mem_ctx);
+       if (!mods) {
+               return ADS_ERROR_LDAP(LDAP_NO_MEMORY);
+       }
+
+       status = ads_mod_str(mem_ctx, &mods, "dNSHostName", my_fqdn);
+       if (!ADS_ERR_OK(status)) {
+               return ADS_ERROR_LDAP(LDAP_NO_MEMORY);
+       }
+
+       status = ads_mod_strlist(mem_ctx, &mods, "servicePrincipalName",
+                                spn_array);
+       if (!ADS_ERR_OK(status)) {
+               return ADS_ERROR_LDAP(LDAP_NO_MEMORY);
+       }
+
+       return ads_gen_mod(r->in.ads, r->out.dn, mods);
+}
+
+/****************************************************************
+****************************************************************/
+
+static ADS_STATUS libnet_join_set_machine_upn(TALLOC_CTX *mem_ctx,
+                                             struct libnet_JoinCtx *r)
+{
+       ADS_STATUS status;
+       ADS_MODLIST mods;
+
+       if (!r->in.create_upn) {
+               return ADS_SUCCESS;
+       }
+
+       if (!r->in.ads) {
+               status = libnet_join_connect_ads(mem_ctx, r);
+               if (!ADS_ERR_OK(status)) {
+                       return status;
+               }
+       }
+
+       status = libnet_join_find_machine_acct(mem_ctx, r);
+       if (!ADS_ERR_OK(status)) {
+               return status;
+       }
+
+       if (!r->in.upn) {
+               r->in.upn = talloc_asprintf(mem_ctx,
+                                           "host/%s@%s",
+                                           r->in.machine_name,
+                                           r->out.dns_domain_name);
+               if (!r->in.upn) {
+                       return ADS_ERROR(LDAP_NO_MEMORY);
+               }
+       }
+
+       mods = ads_init_mods(mem_ctx);
+       if (!mods) {
+               return ADS_ERROR_LDAP(LDAP_NO_MEMORY);
+       }
+
+       status = ads_mod_str(mem_ctx, &mods, "userPrincipalName", r->in.upn);
+       if (!ADS_ERR_OK(status)) {
+               return ADS_ERROR_LDAP(LDAP_NO_MEMORY);
+       }
+
+       return ads_gen_mod(r->in.ads, r->out.dn, mods);
+}
+
+
+/****************************************************************
+****************************************************************/
+
+static ADS_STATUS libnet_join_set_os_attributes(TALLOC_CTX *mem_ctx,
+                                               struct libnet_JoinCtx *r)
+{
+       ADS_STATUS status;
+       ADS_MODLIST mods;
+       char *os_sp = NULL;
+
+       if (!r->in.os_name || !r->in.os_version ) {
+               return ADS_SUCCESS;
+       }
+
+       if (!r->in.ads) {
+               status = libnet_join_connect_ads(mem_ctx, r);
+               if (!ADS_ERR_OK(status)) {
+                       return status;
+               }
+       }
+
+       status = libnet_join_find_machine_acct(mem_ctx, r);
+       if (!ADS_ERR_OK(status)) {
+               return status;
+       }
+
+       mods = ads_init_mods(mem_ctx);
+       if (!mods) {
+               return ADS_ERROR(LDAP_NO_MEMORY);
+       }
+
+       os_sp = talloc_asprintf(mem_ctx, "Samba %s", SAMBA_VERSION_STRING);
+       if (!os_sp) {
+               return ADS_ERROR(LDAP_NO_MEMORY);
+       }
+
+       status = ads_mod_str(mem_ctx, &mods, "operatingSystem",
+                            r->in.os_name);
+       if (!ADS_ERR_OK(status)) {
+               return status;
+       }
+
+       status = ads_mod_str(mem_ctx, &mods, "operatingSystemVersion",
+                            r->in.os_version);
+       if (!ADS_ERR_OK(status)) {
+               return status;
+       }
+
+       status = ads_mod_str(mem_ctx, &mods, "operatingSystemServicePack",
+                            os_sp);
+       if (!ADS_ERR_OK(status)) {
+               return status;
+       }
+
+       return ads_gen_mod(r->in.ads, r->out.dn, mods);
+}
+
+/****************************************************************
+****************************************************************/
+
+static bool libnet_join_create_keytab(TALLOC_CTX *mem_ctx,
+                                     struct libnet_JoinCtx *r)
+{
+       if (!lp_use_kerberos_keytab()) {
+               return true;
+       }
+
+       if (!ads_keytab_create_default(r->in.ads)) {
+               return false;
+       }
+
+       return true;
+}
+
+/****************************************************************
+****************************************************************/
+
+static bool libnet_join_derive_salting_principal(TALLOC_CTX *mem_ctx,
+                                                struct libnet_JoinCtx *r)
+{
+       uint32_t domain_func;
+       ADS_STATUS status;
+       const char *salt = NULL;
+       char *std_salt = NULL;
+
+       status = ads_domain_func_level(r->in.ads, &domain_func);
+       if (!ADS_ERR_OK(status)) {
+               libnet_join_set_error_string(mem_ctx, r,
+                       "failed to determine domain functional level: %s",
+                       ads_errstr(status));
+               return false;
+       }
+
+       std_salt = kerberos_standard_des_salt();
+       if (!std_salt) {
+               libnet_join_set_error_string(mem_ctx, r,
+                       "failed to obtain standard DES salt");
+               return false;
+       }
+
+       salt = talloc_strdup(mem_ctx, std_salt);
+       if (!salt) {
+               return false;
+       }
+
+       SAFE_FREE(std_salt);
+
+       if (domain_func == DS_DOMAIN_FUNCTION_2000) {
+               char *upn;
+
+               upn = ads_get_upn(r->in.ads, mem_ctx,
+                                 r->in.machine_name);
+               if (upn) {
+                       salt = talloc_strdup(mem_ctx, upn);
+                       if (!salt) {
+                               return false;
+                       }
+               }
+       }
+
+       return kerberos_secrets_store_des_salt(salt);
+}
+
+/****************************************************************
+****************************************************************/
+
+static ADS_STATUS libnet_join_post_processing_ads(TALLOC_CTX *mem_ctx,
+                                                 struct libnet_JoinCtx *r)
+{
+       ADS_STATUS status;
+
+       status = libnet_join_set_machine_spn(mem_ctx, r);
+       if (!ADS_ERR_OK(status)) {
+               libnet_join_set_error_string(mem_ctx, r,
+                       "failed to set machine spn: %s",
+                       ads_errstr(status));
+               return status;
+       }
+
+       status = libnet_join_set_os_attributes(mem_ctx, r);
+       if (!ADS_ERR_OK(status)) {
+               libnet_join_set_error_string(mem_ctx, r,
+                       "failed to set machine os attributes: %s",
+                       ads_errstr(status));
+               return status;
+       }
+
+       status = libnet_join_set_machine_upn(mem_ctx, r);
+       if (!ADS_ERR_OK(status)) {
+               libnet_join_set_error_string(mem_ctx, r,
+                       "failed to set machine upn: %s",
+                       ads_errstr(status));
+               return status;
+       }
+
+       if (!libnet_join_derive_salting_principal(mem_ctx, r)) {
+               return ADS_ERROR_NT(NT_STATUS_UNSUCCESSFUL);
+       }
+
+       if (!libnet_join_create_keytab(mem_ctx, r)) {
+               libnet_join_set_error_string(mem_ctx, r,
+                       "failed to create kerberos keytab");
+               return ADS_ERROR_NT(NT_STATUS_UNSUCCESSFUL);
+       }
+
+       return ADS_SUCCESS;
+}
+#endif /* WITH_ADS */
+
+/****************************************************************
+****************************************************************/
+
+static bool libnet_join_joindomain_store_secrets(TALLOC_CTX *mem_ctx,
+                                                struct libnet_JoinCtx *r)
+{
+       if (!secrets_store_domain_sid(r->out.netbios_domain_name,
+                                     r->out.domain_sid))
+       {
+               return false;
+       }
+
+       if (!secrets_store_machine_password(r->in.machine_password,
+                                           r->out.netbios_domain_name,
+                                           SEC_CHAN_WKSTA))
+       {
+               return false;
+       }
+
+       return true;
+}
+
+/****************************************************************
+****************************************************************/
+
+static NTSTATUS libnet_join_joindomain_rpc(TALLOC_CTX *mem_ctx,
+                                          struct libnet_JoinCtx *r)
+{
+       struct cli_state *cli = NULL;
+       struct rpc_pipe_client *pipe_hnd = NULL;
+       POLICY_HND sam_pol, domain_pol, user_pol, lsa_pol;
+       NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
+       char *acct_name;
+       const char *const_acct_name;
+       struct lsa_String lsa_acct_name;
+       uint32 user_rid;
+       uint32 num_rids, *name_types, *user_rids;
+       uint32 flags = 0x3e8;
+       uint32 acb_info = ACB_WSTRUST;
+       uint32 fields_present;
+       uchar pwbuf[532];
+       SAM_USERINFO_CTR ctr;
+       SAM_USER_INFO_25 p25;
+       const int infolevel = 25;
+       struct MD5Context md5ctx;
+       uchar md5buffer[16];
+       DATA_BLOB digested_session_key;
+       uchar md4_trust_password[16];
+
+       if (!r->in.machine_password) {
+               r->in.machine_password = talloc_strdup(mem_ctx, generate_random_str(DEFAULT_TRUST_ACCOUNT_PASSWORD_LENGTH));
+               NT_STATUS_HAVE_NO_MEMORY(r->in.machine_password);
+       }
+
+       status = cli_full_connection(&cli, NULL,
+                                    r->in.dc_name,
+                                    NULL, 0,
+                                    "IPC$", "IPC",
+                                    r->in.admin_account,
+                                    NULL,
+                                    r->in.admin_password,
+                                    0,
+                                    Undefined, NULL);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               goto done;
+       }
+
+       pipe_hnd = cli_rpc_pipe_open_noauth(cli, PI_LSARPC, &status);
+       if (!pipe_hnd) {
+               goto done;
+       }
+
+       status = rpccli_lsa_open_policy(pipe_hnd, mem_ctx, True,
+                                       SEC_RIGHTS_MAXIMUM_ALLOWED, &lsa_pol);
+       if (!NT_STATUS_IS_OK(status)) {
+               goto done;
+       }
+
+       status = rpccli_lsa_query_info_policy2(pipe_hnd, mem_ctx, &lsa_pol,
+                                              12,
+                                              &r->out.netbios_domain_name,
+                                              &r->out.dns_domain_name,
+                                              NULL,
+                                              NULL,
+                                              &r->out.domain_sid);
+
+       if (NT_STATUS_IS_OK(status)) {
+               r->out.domain_is_ad = true;
+       }
+
+       if (!NT_STATUS_IS_OK(status)) {
+               status = rpccli_lsa_query_info_policy(pipe_hnd, mem_ctx, &lsa_pol,
+                                                     5,
+                                                     &r->out.netbios_domain_name,
+                                                     &r->out.domain_sid);
+               if (!NT_STATUS_IS_OK(status)) {
+                       goto done;
+               }
+       }
+
+       rpccli_lsa_Close(pipe_hnd, mem_ctx, &lsa_pol);
+       cli_rpc_pipe_close(pipe_hnd);
+
+       pipe_hnd = cli_rpc_pipe_open_noauth(cli, PI_SAMR, &status);
+       if (!pipe_hnd) {
+               goto done;
+       }
+
+       status = rpccli_samr_connect(pipe_hnd, mem_ctx,
+                                    SEC_RIGHTS_MAXIMUM_ALLOWED, &sam_pol);
+       if (!NT_STATUS_IS_OK(status)) {
+               goto done;
+       }
+
+       status = rpccli_samr_OpenDomain(pipe_hnd, mem_ctx,
+                                       &sam_pol,
+                                       SEC_RIGHTS_MAXIMUM_ALLOWED,
+                                       r->out.domain_sid,
+                                       &domain_pol);
+       if (!NT_STATUS_IS_OK(status)) {
+               goto done;
+       }
+
+       acct_name = talloc_asprintf(mem_ctx, "%s$", r->in.machine_name);
+       strlower_m(acct_name);
+       const_acct_name = acct_name;
+
+       init_lsa_String(&lsa_acct_name, acct_name);
+
+       if (r->in.join_flags & WKSSVC_JOIN_FLAGS_ACCOUNT_CREATE) {
+               uint32_t acct_flags =
+                       SEC_GENERIC_READ | SEC_GENERIC_WRITE | SEC_GENERIC_EXECUTE |
+                       SEC_STD_WRITE_DAC | SEC_STD_DELETE |
+                       SAMR_USER_ACCESS_SET_PASSWORD |
+                       SAMR_USER_ACCESS_GET_ATTRIBUTES |
+                       SAMR_USER_ACCESS_SET_ATTRIBUTES;
+               uint32_t access_granted = 0;
+
+               status = rpccli_samr_CreateUser2(pipe_hnd, mem_ctx,
+                                                &domain_pol,
+                                                &lsa_acct_name,
+                                                ACB_WSTRUST,
+                                                acct_flags,
+                                                &user_pol,
+                                                &access_granted,
+                                                &user_rid);
+               if (NT_STATUS_EQUAL(status, NT_STATUS_USER_EXISTS)) {
+                       if (!(r->in.join_flags &
+                             WKSSVC_JOIN_FLAGS_DOMAIN_JOIN_IF_JOINED)) {
+                               goto done;
+                       }
+               }
+
+               if (NT_STATUS_IS_OK(status)) {
+                       rpccli_samr_Close(pipe_hnd, mem_ctx, &user_pol);
+               }
+       }
+
+       status = rpccli_samr_lookup_names(pipe_hnd, mem_ctx,
+                                         &domain_pol, flags, 1,
+                                         &const_acct_name,
+                                         &num_rids, &user_rids, &name_types);
+       if (!NT_STATUS_IS_OK(status)) {
+               goto done;
+       }
+
+       if (name_types[0] != SID_NAME_USER) {
+               status = NT_STATUS_INVALID_WORKSTATION;
+               goto done;
+       }
+
+       user_rid = user_rids[0];
+
+       status = rpccli_samr_OpenUser(pipe_hnd, mem_ctx,
+                                     &domain_pol,
+                                     SEC_RIGHTS_MAXIMUM_ALLOWED,
+                                     user_rid,
+                                     &user_pol);
+       if (!NT_STATUS_IS_OK(status)) {
+               goto done;
+       }
+
+       E_md4hash(r->in.machine_password, md4_trust_password);
+       encode_pw_buffer(pwbuf, r->in.machine_password, STR_UNICODE);
+
+       generate_random_buffer((uint8*)md5buffer, sizeof(md5buffer));
+       digested_session_key = data_blob_talloc(mem_ctx, 0, 16);
+
+       MD5Init(&md5ctx);
+       MD5Update(&md5ctx, md5buffer, sizeof(md5buffer));
+       MD5Update(&md5ctx, cli->user_session_key.data,
+                 cli->user_session_key.length);
+       MD5Final(digested_session_key.data, &md5ctx);
+
+       SamOEMhashBlob(pwbuf, sizeof(pwbuf), &digested_session_key);
+       memcpy(&pwbuf[516], md5buffer, sizeof(md5buffer));
+
+       acb_info |= ACB_PWNOEXP;
+       if (r->out.domain_is_ad) {
+#if !defined(ENCTYPE_ARCFOUR_HMAC)
+               acb_info |= ACB_USE_DES_KEY_ONLY;
+#endif
+               ;;
+       }
+
+       ZERO_STRUCT(ctr);
+       ZERO_STRUCT(p25);
+
+       fields_present = ACCT_NT_PWD_SET | ACCT_LM_PWD_SET | ACCT_FLAGS;
+       init_sam_user_info25P(&p25, fields_present, acb_info, (char *)pwbuf);
+
+       ctr.switch_value = infolevel;
+       ctr.info.id25    = &p25;
+
+       status = rpccli_samr_set_userinfo2(pipe_hnd, mem_ctx, &user_pol,
+                                          infolevel, &cli->user_session_key,
+                                          &ctr);
+       if (!NT_STATUS_IS_OK(status)) {
+               goto done;
+       }
+
+       rpccli_samr_Close(pipe_hnd, mem_ctx, &user_pol);
+       cli_rpc_pipe_close(pipe_hnd);
+
+       status = NT_STATUS_OK;
+ done:
+       if (cli) {
+               cli_shutdown(cli);
+       }
+
+       return status;
+}
+
+/****************************************************************
+****************************************************************/
+
+static bool libnet_join_unjoindomain_remove_secrets(TALLOC_CTX *mem_ctx,
+                                                   struct libnet_UnjoinCtx *r)
+{
+       if (!secrets_delete_machine_password_ex(lp_workgroup())) {
+               return false;
+       }
+
+       if (!secrets_delete_domain_sid(lp_workgroup())) {
+               return false;
+       }
+
+       return true;
+}
+
+/****************************************************************
+****************************************************************/
+
+static NTSTATUS libnet_join_unjoindomain_rpc(TALLOC_CTX *mem_ctx,
+                                            struct libnet_UnjoinCtx *r)
+{
+       struct cli_state *cli = NULL;
+       struct rpc_pipe_client *pipe_hnd = NULL;
+       POLICY_HND sam_pol, domain_pol, user_pol;
+       NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
+       char *acct_name;
+       uint32 flags = 0x3e8;
+       const char *const_acct_name;
+       uint32 user_rid;
+       uint32 num_rids, *name_types, *user_rids;
+       SAM_USERINFO_CTR ctr, *qctr = NULL;
+       SAM_USER_INFO_16 p16;
+
+       status = cli_full_connection(&cli, NULL,
+                                    r->in.dc_name,
+                                    NULL, 0,
+                                    "IPC$", "IPC",
+                                    r->in.admin_account,
+                                    NULL,
+                                    r->in.admin_password,
+                                    0, Undefined, NULL);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               goto done;
+       }
+
+       pipe_hnd = cli_rpc_pipe_open_noauth(cli, PI_SAMR, &status);
+       if (!pipe_hnd) {
+               goto done;
+       }
+
+       status = rpccli_samr_connect(pipe_hnd, mem_ctx,
+                                    SEC_RIGHTS_MAXIMUM_ALLOWED, &sam_pol);
+       if (!NT_STATUS_IS_OK(status)) {
+               goto done;
+       }
+
+       status = rpccli_samr_OpenDomain(pipe_hnd, mem_ctx,
+                                       &sam_pol,
+                                       SEC_RIGHTS_MAXIMUM_ALLOWED,
+                                       r->in.domain_sid,
+                                       &domain_pol);
+       if (!NT_STATUS_IS_OK(status)) {
+               goto done;
+       }
+
+       acct_name = talloc_asprintf(mem_ctx, "%s$", r->in.machine_name);
+       strlower_m(acct_name);
+       const_acct_name = acct_name;
+
+       status = rpccli_samr_lookup_names(pipe_hnd, mem_ctx,
+                                         &domain_pol, flags, 1,
+                                         &const_acct_name,
+                                         &num_rids, &user_rids, &name_types);
+       if (!NT_STATUS_IS_OK(status)) {
+               goto done;
+       }
+
+       if (name_types[0] != SID_NAME_USER) {
+               status = NT_STATUS_INVALID_WORKSTATION;
+               goto done;
+       }
+
+       user_rid = user_rids[0];
+
+       status = rpccli_samr_OpenUser(pipe_hnd, mem_ctx,
+                                     &domain_pol,
+                                     SEC_RIGHTS_MAXIMUM_ALLOWED,
+                                     user_rid,
+                                     &user_pol);
+       if (!NT_STATUS_IS_OK(status)) {
+               goto done;
+       }
+
+       status = rpccli_samr_query_userinfo(pipe_hnd, mem_ctx,
+                                           &user_pol, 16, &qctr);
+       if (!NT_STATUS_IS_OK(status)) {
+               rpccli_samr_Close(pipe_hnd, mem_ctx, &user_pol);
+               goto done;
+       }
+
+       ZERO_STRUCT(ctr);
+       ctr.switch_value = 16;
+       ctr.info.id16 = &p16;
+
+       p16.acb_info = qctr->info.id16->acb_info | ACB_DISABLED;
+
+       status = rpccli_samr_set_userinfo2(pipe_hnd, mem_ctx, &user_pol, 16,
+                                          &cli->user_session_key, &ctr);
+
+       rpccli_samr_Close(pipe_hnd, mem_ctx, &user_pol);
+
+done:
+       if (pipe_hnd) {
+               rpccli_samr_Close(pipe_hnd, mem_ctx, &domain_pol);
+               rpccli_samr_Close(pipe_hnd, mem_ctx, &sam_pol);
+               cli_rpc_pipe_close(pipe_hnd);
+       }
+
+       if (cli) {
+               cli_shutdown(cli);
+       }
+
+       return status;
+}
+
+/****************************************************************
+****************************************************************/
+
+static WERROR do_join_modify_vals_config(struct libnet_JoinCtx *r)
+{
+       WERROR werr;
+       struct libnet_conf_ctx *ctx;
+
+       werr = libnet_conf_open(r, &ctx);
+       if (!W_ERROR_IS_OK(werr)) {
+               goto done;
+       }
+
+       if (!(r->in.join_flags & WKSSVC_JOIN_FLAGS_JOIN_TYPE)) {
+
+               werr = libnet_conf_set_global_parameter(ctx, "security", "user");
+               if (!W_ERROR_IS_OK(werr)) {
+                       goto done;
+               }
+
+               werr = libnet_conf_set_global_parameter(ctx, "workgroup",
+                                                       r->in.domain_name);
+               goto done;
+       }
+
+       werr = libnet_conf_set_global_parameter(ctx, "security", "domain");
+       if (!W_ERROR_IS_OK(werr)) {
+               goto done;
+       }
+
+       werr = libnet_conf_set_global_parameter(ctx, "workgroup",
+                                               r->out.netbios_domain_name);
+       if (!W_ERROR_IS_OK(werr)) {
+               goto done;
+       }
+
+       if (r->out.domain_is_ad) {
+               werr = libnet_conf_set_global_parameter(ctx, "security", "ads");
+               if (!W_ERROR_IS_OK(werr)) {
+                       goto done;
+               }
+
+               werr = libnet_conf_set_global_parameter(ctx, "realm",
+                                                       r->out.dns_domain_name);
+       }
+
+done:
+       libnet_conf_close(ctx);
+       return werr;
+}
+
+/****************************************************************
+****************************************************************/
+
+static WERROR do_unjoin_modify_vals_config(struct libnet_UnjoinCtx *r)
+{
+       WERROR werr = WERR_OK;
+       struct libnet_conf_ctx *ctx;
+
+       werr = libnet_conf_open(r, &ctx);
+       if (!W_ERROR_IS_OK(werr)) {
+               goto done;
+       }
+
+       if (r->in.unjoin_flags & WKSSVC_JOIN_FLAGS_JOIN_TYPE) {
+
+               werr = libnet_conf_set_global_parameter(ctx, "security", "user");
+               if (!W_ERROR_IS_OK(werr)) {
+                       goto done;
+               }
+       }
+
+       libnet_conf_delete_global_parameter(ctx, "realm");
+
+done:
+       libnet_conf_close(ctx);
+       return werr;
+}
+
+/****************************************************************
+****************************************************************/
+
+static WERROR do_JoinConfig(struct libnet_JoinCtx *r)
+{
+       WERROR werr;
+
+       if (!W_ERROR_IS_OK(r->out.result)) {
+               return r->out.result;
+       }
+
+       if (!r->in.modify_config) {
+               return WERR_OK;
+       }
+
+       werr = do_join_modify_vals_config(r);
+       if (!W_ERROR_IS_OK(werr)) {
+               return werr;
+       }
+
+       r->out.modified_config = true;
+       r->out.result = werr;
+
+       return werr;
+}
+
+/****************************************************************
+****************************************************************/
+
+static WERROR do_UnjoinConfig(struct libnet_UnjoinCtx *r)
+{
+       WERROR werr;
+
+       if (!W_ERROR_IS_OK(r->out.result)) {
+               return r->out.result;
+       }
+
+       if (!r->in.modify_config) {
+               return WERR_OK;
+       }
+
+       werr = do_unjoin_modify_vals_config(r);
+       if (!W_ERROR_IS_OK(werr)) {
+               return werr;
+       }
+
+       r->out.modified_config = true;
+       r->out.result = werr;
+
+       return werr;
+}
+
+/****************************************************************
+****************************************************************/
+
+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_config_backend_is_registry()) {
+               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) {
+               ads_destroy(&r->in.ads);
+       }
+
+       return 0;
+}
+
+/****************************************************************
+****************************************************************/
+
+static int libnet_destroy_UnjoinCtx(struct libnet_UnjoinCtx *r)
+{
+       if (r->in.ads) {
+               ads_destroy(&r->in.ads);
+       }
+
+       return 0;
+}
+
+/****************************************************************
+****************************************************************/
+
+WERROR libnet_init_JoinCtx(TALLOC_CTX *mem_ctx,
+                          struct libnet_JoinCtx **r)
+{
+       struct libnet_JoinCtx *ctx;
+
+       ctx = talloc_zero(mem_ctx, struct libnet_JoinCtx);
+       if (!ctx) {
+               return WERR_NOMEM;
+       }
+
+       talloc_set_destructor(ctx, libnet_destroy_JoinCtx);
+
+       ctx->in.machine_name = talloc_strdup(mem_ctx, global_myname());
+       W_ERROR_HAVE_NO_MEMORY(ctx->in.machine_name);
+
+       *r = ctx;
+
+       return WERR_OK;
+}
+
+/****************************************************************
+****************************************************************/
+
+WERROR libnet_init_UnjoinCtx(TALLOC_CTX *mem_ctx,
+                            struct libnet_UnjoinCtx **r)
+{
+       struct libnet_UnjoinCtx *ctx;
+
+       ctx = talloc_zero(mem_ctx, struct libnet_UnjoinCtx);
+       if (!ctx) {
+               return WERR_NOMEM;
+       }
+
+       talloc_set_destructor(ctx, libnet_destroy_UnjoinCtx);
+
+       ctx->in.machine_name = talloc_strdup(mem_ctx, global_myname());
+       W_ERROR_HAVE_NO_MEMORY(ctx->in.machine_name);
+
+       *r = ctx;
+
+       return WERR_OK;
+}
+
+/****************************************************************
+****************************************************************/
+
+static WERROR libnet_DomainJoin(TALLOC_CTX *mem_ctx,
+                               struct libnet_JoinCtx *r)
+{
+       NTSTATUS status;
+#ifdef WITH_ADS
+       ADS_STATUS ads_status;
+#endif /* WITH_ADS */
+
+       if (!r->in.dc_name) {
+               struct DS_DOMAIN_CONTROLLER_INFO *info;
+               status = dsgetdcname(mem_ctx,
+                                    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_join_set_error_string(mem_ctx, r,
+                               "failed to find DC for domain %s",
+                               r->in.domain_name,
+                               get_friendly_nt_error_msg(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);
+       }
+
+#ifdef WITH_ADS
+       if (r->in.account_ou) {
+
+               ads_status = libnet_join_connect_ads(mem_ctx, r);
+               if (!ADS_ERR_OK(ads_status)) {
+                       return WERR_DEFAULT_JOIN_REQUIRED;
+               }
+
+               ads_status = libnet_join_precreate_machine_acct(mem_ctx, r);
+               if (!ADS_ERR_OK(ads_status)) {
+                       libnet_join_set_error_string(mem_ctx, r,
+                               "failed to precreate account in ou %s: %s",
+                               r->in.account_ou,
+                               ads_errstr(ads_status));
+                       return WERR_DEFAULT_JOIN_REQUIRED;
+               }
+
+               r->in.join_flags &= ~WKSSVC_JOIN_FLAGS_ACCOUNT_CREATE;
+       }
+#endif /* WITH_ADS */
+
+       status = libnet_join_joindomain_rpc(mem_ctx, r);
+       if (!NT_STATUS_IS_OK(status)) {
+               libnet_join_set_error_string(mem_ctx, r,
+                       "failed to join domain over rpc: %s",
+                       get_friendly_nt_error_msg(status));
+               if (NT_STATUS_EQUAL(status, NT_STATUS_USER_EXISTS)) {
+                       return WERR_SETUP_ALREADY_JOINED;
+               }
+               return ntstatus_to_werror(status);
+       }
+
+       if (!libnet_join_joindomain_store_secrets(mem_ctx, r)) {
+               return WERR_SETUP_NOT_JOINED;
+       }
+
+#ifdef WITH_ADS
+       if (r->out.domain_is_ad) {
+               ads_status  = libnet_join_post_processing_ads(mem_ctx, r);
+               if (!ADS_ERR_OK(ads_status)) {
+                       return WERR_GENERAL_FAILURE;
+               }
+       }
+#endif /* WITH_ADS */
+
+       return WERR_OK;
+}
+
+/****************************************************************
+****************************************************************/
+
+WERROR libnet_Join(TALLOC_CTX *mem_ctx,
+                  struct libnet_JoinCtx *r)
+{
+       WERROR werr;
+
+       if (r->in.debug) {
+               LIBNET_JOIN_IN_DUMP_CTX(mem_ctx, r);
+       }
+
+       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)) {
+                       goto done;
+               }
+       }
+
+       werr = libnet_join_post_processing(mem_ctx, r);
+       if (!W_ERROR_IS_OK(werr)) {
+               goto done;
+       }
+ done:
+       r->out.result = werr;
+
+       if (r->in.debug) {
+               LIBNET_JOIN_OUT_DUMP_CTX(mem_ctx, r);
+       }
+       return werr;
+}
+
+/****************************************************************
+****************************************************************/
+
+static WERROR libnet_DomainUnjoin(TALLOC_CTX *mem_ctx,
+                                 struct libnet_UnjoinCtx *r)
+{
+       NTSTATUS status;
+
+       if (!r->in.domain_sid) {
+               struct dom_sid sid;
+               if (!secrets_fetch_domain_sid(lp_workgroup(), &sid)) {
+                       libnet_unjoin_set_error_string(mem_ctx, r,
+                               "Unable to fetch domain sid: are we joined?");
+                       return WERR_SETUP_NOT_JOINED;
+               }
+               r->in.domain_sid = sid_dup_talloc(mem_ctx, &sid);
+               W_ERROR_HAVE_NO_MEMORY(r->in.domain_sid);
+       }
+
+       if (!r->in.dc_name) {
+               struct DS_DOMAIN_CONTROLLER_INFO *info;
+               status = dsgetdcname(mem_ctx,
+                                    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 for domain %s",
+                               r->in.domain_name,
+                               get_friendly_nt_error_msg(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,
+                       "failed to disable machine account via rpc: %s",
+                       get_friendly_nt_error_msg(status));
+               if (NT_STATUS_EQUAL(status, NT_STATUS_NO_SUCH_USER)) {
+                       return WERR_SETUP_NOT_JOINED;
+               }
+               return ntstatus_to_werror(status);
+       }
+
+#ifdef WITH_ADS
+       if (r->in.unjoin_flags & WKSSVC_JOIN_FLAGS_ACCOUNT_DELETE) {
+               ADS_STATUS ads_status;
+               libnet_unjoin_connect_ads(mem_ctx, r);
+               ads_status = libnet_unjoin_remove_machine_acct(mem_ctx, r);
+               if (!ADS_ERR_OK(ads_status)) {
+                       libnet_unjoin_set_error_string(mem_ctx, r,
+                               "failed to remove machine account from AD: %s",
+                               ads_errstr(ads_status));
+               }
+       }
+#endif /* WITH_ADS */
+
+       libnet_join_unjoindomain_remove_secrets(mem_ctx, r);
+
+       return WERR_OK;
+}
+
+/****************************************************************
+****************************************************************/
+
+static WERROR libnet_unjoin_pre_processing(TALLOC_CTX *mem_ctx,
+                                          struct libnet_UnjoinCtx *r)
+{
+       if (r->in.modify_config && !lp_config_backend_is_registry()) {
+               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.debug) {
+               LIBNET_UNJOIN_IN_DUMP_CTX(mem_ctx, 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)) {
+                       goto done;
+               }
+       }
+
+       werr = do_UnjoinConfig(r);
+       if (!W_ERROR_IS_OK(werr)) {
+               goto done;
+       }
+
+ done:
+       r->out.result = werr;
+
+       if (r->in.debug) {
+               LIBNET_UNJOIN_OUT_DUMP_CTX(mem_ctx, r);
+       }
+
+       return werr;
+}
index cd4d621dd511f7d06de7b6d15b3541eb6780e03d..cdd1807e232de851c2dda442799a8dbc0a253ebc 100644 (file)
@@ -5,5 +5,5 @@
 bin/libsmbclient.@SHLIBEXT@:0:1
 bin/libsmbsharemodes.@SHLIBEXT@:0:2
 bin/libaddns.@SHLIBEXT@:0:1
-bin/libmsrpc.@SHLIBEXT@:0:1
-
+bin/libwbclient.@SHLIBEXT@:0:1
+bin/libnetapi.@SHLIBEXT@:0:1
index fda04608d327dab3564906785f82369271191dea..fc00128f3f9001a5bf6897397343030f3b806115 100644 (file)
 #include "includes.h"
 #include "librpc/gen_ndr/cli_dfs.h"
 
-NTSTATUS rpccli_dfs_GetManagerVersion(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, enum dfs_ManagerVersion *version)
+NTSTATUS rpccli_dfs_GetManagerVersion(struct rpc_pipe_client *cli,
+                                     TALLOC_CTX *mem_ctx,
+                                     enum dfs_ManagerVersion *version)
 {
        struct dfs_GetManagerVersion r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(dfs_GetManagerVersion, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, &ndr_table_netdfs, NDR_DFS_GETMANAGERVERSION, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETDFS,
+                               &ndr_table_netdfs,
+                               NDR_DFS_GETMANAGERVERSION,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(dfs_GetManagerVersion, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *version = *r.out.version;
-       
+
        /* Return result */
        return NT_STATUS_OK;
 }
 
-NTSTATUS rpccli_dfs_Add(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *path, const char *server, const char *share, const char *comment, uint32_t flags, WERROR *werror)
+NTSTATUS rpccli_dfs_Add(struct rpc_pipe_client *cli,
+                       TALLOC_CTX *mem_ctx,
+                       const char *path,
+                       const char *server,
+                       const char *share,
+                       const char *comment,
+                       uint32_t flags,
+                       WERROR *werror)
 {
        struct dfs_Add r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.path = path;
        r.in.server = server;
        r.in.share = share;
        r.in.comment = comment;
        r.in.flags = flags;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(dfs_Add, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, &ndr_table_netdfs, NDR_DFS_ADD, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETDFS,
+                               &ndr_table_netdfs,
+                               NDR_DFS_ADD,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(dfs_Add, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_dfs_Remove(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *dfs_entry_path, const char *servername, const char *sharename, WERROR *werror)
+NTSTATUS rpccli_dfs_Remove(struct rpc_pipe_client *cli,
+                          TALLOC_CTX *mem_ctx,
+                          const char *dfs_entry_path,
+                          const char *servername,
+                          const char *sharename,
+                          WERROR *werror)
 {
        struct dfs_Remove r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.dfs_entry_path = dfs_entry_path;
        r.in.servername = servername;
        r.in.sharename = sharename;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(dfs_Remove, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, &ndr_table_netdfs, NDR_DFS_REMOVE, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETDFS,
+                               &ndr_table_netdfs,
+                               NDR_DFS_REMOVE,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(dfs_Remove, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_dfs_SetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *dfs_entry_path, const char *servername, const char *sharename, uint32_t level, union dfs_Info *info, WERROR *werror)
+NTSTATUS rpccli_dfs_SetInfo(struct rpc_pipe_client *cli,
+                           TALLOC_CTX *mem_ctx,
+                           const char *dfs_entry_path,
+                           const char *servername,
+                           const char *sharename,
+                           uint32_t level,
+                           union dfs_Info *info,
+                           WERROR *werror)
 {
        struct dfs_SetInfo r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.dfs_entry_path = dfs_entry_path;
        r.in.servername = servername;
        r.in.sharename = sharename;
        r.in.level = level;
        r.in.info = info;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(dfs_SetInfo, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, &ndr_table_netdfs, NDR_DFS_SETINFO, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETDFS,
+                               &ndr_table_netdfs,
+                               NDR_DFS_SETINFO,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(dfs_SetInfo, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_dfs_GetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *dfs_entry_path, const char *servername, const char *sharename, uint32_t level, union dfs_Info *info, WERROR *werror)
+NTSTATUS rpccli_dfs_GetInfo(struct rpc_pipe_client *cli,
+                           TALLOC_CTX *mem_ctx,
+                           const char *dfs_entry_path,
+                           const char *servername,
+                           const char *sharename,
+                           uint32_t level,
+                           union dfs_Info *info,
+                           WERROR *werror)
 {
        struct dfs_GetInfo r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.dfs_entry_path = dfs_entry_path;
        r.in.servername = servername;
        r.in.sharename = sharename;
        r.in.level = level;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(dfs_GetInfo, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, &ndr_table_netdfs, NDR_DFS_GETINFO, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETDFS,
+                               &ndr_table_netdfs,
+                               NDR_DFS_GETINFO,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(dfs_GetInfo, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *info = *r.out.info;
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_dfs_Enum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t level, uint32_t bufsize, struct dfs_EnumStruct *info, uint32_t *total, WERROR *werror)
+NTSTATUS rpccli_dfs_Enum(struct rpc_pipe_client *cli,
+                        TALLOC_CTX *mem_ctx,
+                        uint32_t level,
+                        uint32_t bufsize,
+                        struct dfs_EnumStruct *info,
+                        uint32_t *total,
+                        WERROR *werror)
 {
        struct dfs_Enum r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.level = level;
        r.in.bufsize = bufsize;
        r.in.info = info;
        r.in.total = total;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(dfs_Enum, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, &ndr_table_netdfs, NDR_DFS_ENUM, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETDFS,
+                               &ndr_table_netdfs,
+                               NDR_DFS_ENUM,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(dfs_Enum, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        if (info && r.out.info) {
                *info = *r.out.info;
@@ -220,152 +296,199 @@ NTSTATUS rpccli_dfs_Enum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint3
        if (total && r.out.total) {
                *total = *r.out.total;
        }
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_dfs_Rename(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror)
+NTSTATUS rpccli_dfs_Rename(struct rpc_pipe_client *cli,
+                          TALLOC_CTX *mem_ctx,
+                          WERROR *werror)
 {
        struct dfs_Rename r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(dfs_Rename, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, &ndr_table_netdfs, NDR_DFS_RENAME, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETDFS,
+                               &ndr_table_netdfs,
+                               NDR_DFS_RENAME,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(dfs_Rename, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_dfs_Move(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror)
+NTSTATUS rpccli_dfs_Move(struct rpc_pipe_client *cli,
+                        TALLOC_CTX *mem_ctx,
+                        WERROR *werror)
 {
        struct dfs_Move r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(dfs_Move, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, &ndr_table_netdfs, NDR_DFS_MOVE, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETDFS,
+                               &ndr_table_netdfs,
+                               NDR_DFS_MOVE,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(dfs_Move, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_dfs_ManagerGetConfigInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror)
+NTSTATUS rpccli_dfs_ManagerGetConfigInfo(struct rpc_pipe_client *cli,
+                                        TALLOC_CTX *mem_ctx,
+                                        WERROR *werror)
 {
        struct dfs_ManagerGetConfigInfo r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(dfs_ManagerGetConfigInfo, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, &ndr_table_netdfs, NDR_DFS_MANAGERGETCONFIGINFO, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETDFS,
+                               &ndr_table_netdfs,
+                               NDR_DFS_MANAGERGETCONFIGINFO,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(dfs_ManagerGetConfigInfo, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_dfs_ManagerSendSiteInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror)
+NTSTATUS rpccli_dfs_ManagerSendSiteInfo(struct rpc_pipe_client *cli,
+                                       TALLOC_CTX *mem_ctx,
+                                       WERROR *werror)
 {
        struct dfs_ManagerSendSiteInfo r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(dfs_ManagerSendSiteInfo, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, &ndr_table_netdfs, NDR_DFS_MANAGERSENDSITEINFO, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETDFS,
+                               &ndr_table_netdfs,
+                               NDR_DFS_MANAGERSENDSITEINFO,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(dfs_ManagerSendSiteInfo, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_dfs_AddFtRoot(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *servername, const char *dns_servername, const char *dfsname, const char *rootshare, const char *comment, const char *dfs_config_dn, uint8_t unknown1, uint32_t flags, struct dfs_UnknownStruct **unknown2, WERROR *werror)
+NTSTATUS rpccli_dfs_AddFtRoot(struct rpc_pipe_client *cli,
+                             TALLOC_CTX *mem_ctx,
+                             const char *servername,
+                             const char *dns_servername,
+                             const char *dfsname,
+                             const char *rootshare,
+                             const char *comment,
+                             const char *dfs_config_dn,
+                             uint8_t unknown1,
+                             uint32_t flags,
+                             struct dfs_UnknownStruct **unknown2,
+                             WERROR *werror)
 {
        struct dfs_AddFtRoot r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.servername = servername;
        r.in.dns_servername = dns_servername;
@@ -376,41 +499,56 @@ NTSTATUS rpccli_dfs_AddFtRoot(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
        r.in.unknown1 = unknown1;
        r.in.flags = flags;
        r.in.unknown2 = unknown2;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(dfs_AddFtRoot, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, &ndr_table_netdfs, NDR_DFS_ADDFTROOT, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETDFS,
+                               &ndr_table_netdfs,
+                               NDR_DFS_ADDFTROOT,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(dfs_AddFtRoot, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        if (unknown2 && r.out.unknown2) {
                *unknown2 = *r.out.unknown2;
        }
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_dfs_RemoveFtRoot(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *servername, const char *dns_servername, const char *dfsname, const char *rootshare, uint32_t flags, struct dfs_UnknownStruct **unknown, WERROR *werror)
+NTSTATUS rpccli_dfs_RemoveFtRoot(struct rpc_pipe_client *cli,
+                                TALLOC_CTX *mem_ctx,
+                                const char *servername,
+                                const char *dns_servername,
+                                const char *dfsname,
+                                const char *rootshare,
+                                uint32_t flags,
+                                struct dfs_UnknownStruct **unknown,
+                                WERROR *werror)
 {
        struct dfs_RemoveFtRoot r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.servername = servername;
        r.in.dns_servername = dns_servername;
@@ -418,376 +556,512 @@ NTSTATUS rpccli_dfs_RemoveFtRoot(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct
        r.in.rootshare = rootshare;
        r.in.flags = flags;
        r.in.unknown = unknown;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(dfs_RemoveFtRoot, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, &ndr_table_netdfs, NDR_DFS_REMOVEFTROOT, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETDFS,
+                               &ndr_table_netdfs,
+                               NDR_DFS_REMOVEFTROOT,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(dfs_RemoveFtRoot, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        if (unknown && r.out.unknown) {
                *unknown = *r.out.unknown;
        }
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_dfs_AddStdRoot(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *servername, const char *rootshare, const char *comment, uint32_t flags, WERROR *werror)
+NTSTATUS rpccli_dfs_AddStdRoot(struct rpc_pipe_client *cli,
+                              TALLOC_CTX *mem_ctx,
+                              const char *servername,
+                              const char *rootshare,
+                              const char *comment,
+                              uint32_t flags,
+                              WERROR *werror)
 {
        struct dfs_AddStdRoot r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.servername = servername;
        r.in.rootshare = rootshare;
        r.in.comment = comment;
        r.in.flags = flags;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(dfs_AddStdRoot, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, &ndr_table_netdfs, NDR_DFS_ADDSTDROOT, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETDFS,
+                               &ndr_table_netdfs,
+                               NDR_DFS_ADDSTDROOT,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(dfs_AddStdRoot, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_dfs_RemoveStdRoot(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *servername, const char *rootshare, uint32_t flags, WERROR *werror)
+NTSTATUS rpccli_dfs_RemoveStdRoot(struct rpc_pipe_client *cli,
+                                 TALLOC_CTX *mem_ctx,
+                                 const char *servername,
+                                 const char *rootshare,
+                                 uint32_t flags,
+                                 WERROR *werror)
 {
        struct dfs_RemoveStdRoot r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.servername = servername;
        r.in.rootshare = rootshare;
        r.in.flags = flags;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(dfs_RemoveStdRoot, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, &ndr_table_netdfs, NDR_DFS_REMOVESTDROOT, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETDFS,
+                               &ndr_table_netdfs,
+                               NDR_DFS_REMOVESTDROOT,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(dfs_RemoveStdRoot, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_dfs_ManagerInitialize(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *servername, uint32_t flags, WERROR *werror)
+NTSTATUS rpccli_dfs_ManagerInitialize(struct rpc_pipe_client *cli,
+                                     TALLOC_CTX *mem_ctx,
+                                     const char *servername,
+                                     uint32_t flags,
+                                     WERROR *werror)
 {
        struct dfs_ManagerInitialize r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.servername = servername;
        r.in.flags = flags;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(dfs_ManagerInitialize, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, &ndr_table_netdfs, NDR_DFS_MANAGERINITIALIZE, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETDFS,
+                               &ndr_table_netdfs,
+                               NDR_DFS_MANAGERINITIALIZE,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(dfs_ManagerInitialize, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_dfs_AddStdRootForced(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *servername, const char *rootshare, const char *comment, const char *store, WERROR *werror)
+NTSTATUS rpccli_dfs_AddStdRootForced(struct rpc_pipe_client *cli,
+                                    TALLOC_CTX *mem_ctx,
+                                    const char *servername,
+                                    const char *rootshare,
+                                    const char *comment,
+                                    const char *store,
+                                    WERROR *werror)
 {
        struct dfs_AddStdRootForced r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.servername = servername;
        r.in.rootshare = rootshare;
        r.in.comment = comment;
        r.in.store = store;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(dfs_AddStdRootForced, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, &ndr_table_netdfs, NDR_DFS_ADDSTDROOTFORCED, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETDFS,
+                               &ndr_table_netdfs,
+                               NDR_DFS_ADDSTDROOTFORCED,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(dfs_AddStdRootForced, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_dfs_GetDcAddress(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror)
+NTSTATUS rpccli_dfs_GetDcAddress(struct rpc_pipe_client *cli,
+                                TALLOC_CTX *mem_ctx,
+                                const char *servername,
+                                const char **server_fullname,
+                                uint8_t *is_root,
+                                uint32_t *ttl,
+                                WERROR *werror)
 {
        struct dfs_GetDcAddress r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+       r.in.servername = servername;
+       r.in.server_fullname = server_fullname;
+       r.in.is_root = is_root;
+       r.in.ttl = ttl;
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(dfs_GetDcAddress, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, &ndr_table_netdfs, NDR_DFS_GETDCADDRESS, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETDFS,
+                               &ndr_table_netdfs,
+                               NDR_DFS_GETDCADDRESS,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(dfs_GetDcAddress, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+       *server_fullname = *r.out.server_fullname;
+       *is_root = *r.out.is_root;
+       *ttl = *r.out.ttl;
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_dfs_SetDcAddress(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror)
+NTSTATUS rpccli_dfs_SetDcAddress(struct rpc_pipe_client *cli,
+                                TALLOC_CTX *mem_ctx,
+                                const char *servername,
+                                const char *server_fullname,
+                                uint32_t flags,
+                                uint32_t ttl,
+                                WERROR *werror)
 {
        struct dfs_SetDcAddress r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+       r.in.servername = servername;
+       r.in.server_fullname = server_fullname;
+       r.in.flags = flags;
+       r.in.ttl = ttl;
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(dfs_SetDcAddress, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, &ndr_table_netdfs, NDR_DFS_SETDCADDRESS, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETDFS,
+                               &ndr_table_netdfs,
+                               NDR_DFS_SETDCADDRESS,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(dfs_SetDcAddress, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_dfs_FlushFtTable(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *servername, const char *rootshare, WERROR *werror)
+NTSTATUS rpccli_dfs_FlushFtTable(struct rpc_pipe_client *cli,
+                                TALLOC_CTX *mem_ctx,
+                                const char *servername,
+                                const char *rootshare,
+                                WERROR *werror)
 {
        struct dfs_FlushFtTable r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.servername = servername;
        r.in.rootshare = rootshare;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(dfs_FlushFtTable, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, &ndr_table_netdfs, NDR_DFS_FLUSHFTTABLE, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETDFS,
+                               &ndr_table_netdfs,
+                               NDR_DFS_FLUSHFTTABLE,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(dfs_FlushFtTable, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_dfs_Add2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror)
+NTSTATUS rpccli_dfs_Add2(struct rpc_pipe_client *cli,
+                        TALLOC_CTX *mem_ctx,
+                        WERROR *werror)
 {
        struct dfs_Add2 r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(dfs_Add2, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, &ndr_table_netdfs, NDR_DFS_ADD2, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETDFS,
+                               &ndr_table_netdfs,
+                               NDR_DFS_ADD2,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(dfs_Add2, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_dfs_Remove2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror)
+NTSTATUS rpccli_dfs_Remove2(struct rpc_pipe_client *cli,
+                           TALLOC_CTX *mem_ctx,
+                           WERROR *werror)
 {
        struct dfs_Remove2 r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(dfs_Remove2, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, &ndr_table_netdfs, NDR_DFS_REMOVE2, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETDFS,
+                               &ndr_table_netdfs,
+                               NDR_DFS_REMOVE2,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(dfs_Remove2, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_dfs_EnumEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *dfs_name, uint32_t level, uint32_t bufsize, struct dfs_EnumStruct *info, uint32_t *total, WERROR *werror)
+NTSTATUS rpccli_dfs_EnumEx(struct rpc_pipe_client *cli,
+                          TALLOC_CTX *mem_ctx,
+                          const char *dfs_name,
+                          uint32_t level,
+                          uint32_t bufsize,
+                          struct dfs_EnumStruct *info,
+                          uint32_t *total,
+                          WERROR *werror)
 {
        struct dfs_EnumEx r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.dfs_name = dfs_name;
        r.in.level = level;
        r.in.bufsize = bufsize;
        r.in.info = info;
        r.in.total = total;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(dfs_EnumEx, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, &ndr_table_netdfs, NDR_DFS_ENUMEX, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETDFS,
+                               &ndr_table_netdfs,
+                               NDR_DFS_ENUMEX,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(dfs_EnumEx, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        if (info && r.out.info) {
                *info = *r.out.info;
@@ -795,45 +1069,54 @@ NTSTATUS rpccli_dfs_EnumEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, con
        if (total && r.out.total) {
                *total = *r.out.total;
        }
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_dfs_SetInfo2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror)
+NTSTATUS rpccli_dfs_SetInfo2(struct rpc_pipe_client *cli,
+                            TALLOC_CTX *mem_ctx,
+                            WERROR *werror)
 {
        struct dfs_SetInfo2 r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(dfs_SetInfo2, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, &ndr_table_netdfs, NDR_DFS_SETINFO2, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETDFS,
+                               &ndr_table_netdfs,
+                               NDR_DFS_SETINFO2,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(dfs_SetInfo2, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
index 1b03fbf070bbe7a86cf89b444f1146f55f64b50f..d23bb9047083c468650cd56bd6b1de60be9d2c83 100644 (file)
 #include "librpc/gen_ndr/ndr_dfs.h"
 #ifndef __CLI_NETDFS__
 #define __CLI_NETDFS__
-NTSTATUS rpccli_dfs_GetManagerVersion(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, enum dfs_ManagerVersion *version);
-NTSTATUS rpccli_dfs_Add(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *path, const char *server, const char *share, const char *comment, uint32_t flags, WERROR *werror);
-NTSTATUS rpccli_dfs_Remove(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *dfs_entry_path, const char *servername, const char *sharename, WERROR *werror);
-NTSTATUS rpccli_dfs_SetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *dfs_entry_path, const char *servername, const char *sharename, uint32_t level, union dfs_Info *info, WERROR *werror);
-NTSTATUS rpccli_dfs_GetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *dfs_entry_path, const char *servername, const char *sharename, uint32_t level, union dfs_Info *info, WERROR *werror);
-NTSTATUS rpccli_dfs_Enum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t level, uint32_t bufsize, struct dfs_EnumStruct *info, uint32_t *total, WERROR *werror);
-NTSTATUS rpccli_dfs_Rename(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror);
-NTSTATUS rpccli_dfs_Move(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror);
-NTSTATUS rpccli_dfs_ManagerGetConfigInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror);
-NTSTATUS rpccli_dfs_ManagerSendSiteInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror);
-NTSTATUS rpccli_dfs_AddFtRoot(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *servername, const char *dns_servername, const char *dfsname, const char *rootshare, const char *comment, const char *dfs_config_dn, uint8_t unknown1, uint32_t flags, struct dfs_UnknownStruct **unknown2, WERROR *werror);
-NTSTATUS rpccli_dfs_RemoveFtRoot(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *servername, const char *dns_servername, const char *dfsname, const char *rootshare, uint32_t flags, struct dfs_UnknownStruct **unknown, WERROR *werror);
-NTSTATUS rpccli_dfs_AddStdRoot(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *servername, const char *rootshare, const char *comment, uint32_t flags, WERROR *werror);
-NTSTATUS rpccli_dfs_RemoveStdRoot(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *servername, const char *rootshare, uint32_t flags, WERROR *werror);
-NTSTATUS rpccli_dfs_ManagerInitialize(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *servername, uint32_t flags, WERROR *werror);
-NTSTATUS rpccli_dfs_AddStdRootForced(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *servername, const char *rootshare, const char *comment, const char *store, WERROR *werror);
-NTSTATUS rpccli_dfs_GetDcAddress(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror);
-NTSTATUS rpccli_dfs_SetDcAddress(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror);
-NTSTATUS rpccli_dfs_FlushFtTable(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *servername, const char *rootshare, WERROR *werror);
-NTSTATUS rpccli_dfs_Add2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror);
-NTSTATUS rpccli_dfs_Remove2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror);
-NTSTATUS rpccli_dfs_EnumEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *dfs_name, uint32_t level, uint32_t bufsize, struct dfs_EnumStruct *info, uint32_t *total, WERROR *werror);
-NTSTATUS rpccli_dfs_SetInfo2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror);
+NTSTATUS rpccli_dfs_GetManagerVersion(struct rpc_pipe_client *cli,
+                                     TALLOC_CTX *mem_ctx,
+                                     enum dfs_ManagerVersion *version);
+NTSTATUS rpccli_dfs_Add(struct rpc_pipe_client *cli,
+                       TALLOC_CTX *mem_ctx,
+                       const char *path,
+                       const char *server,
+                       const char *share,
+                       const char *comment,
+                       uint32_t flags,
+                       WERROR *werror);
+NTSTATUS rpccli_dfs_Remove(struct rpc_pipe_client *cli,
+                          TALLOC_CTX *mem_ctx,
+                          const char *dfs_entry_path,
+                          const char *servername,
+                          const char *sharename,
+                          WERROR *werror);
+NTSTATUS rpccli_dfs_SetInfo(struct rpc_pipe_client *cli,
+                           TALLOC_CTX *mem_ctx,
+                           const char *dfs_entry_path,
+                           const char *servername,
+                           const char *sharename,
+                           uint32_t level,
+                           union dfs_Info *info,
+                           WERROR *werror);
+NTSTATUS rpccli_dfs_GetInfo(struct rpc_pipe_client *cli,
+                           TALLOC_CTX *mem_ctx,
+                           const char *dfs_entry_path,
+                           const char *servername,
+                           const char *sharename,
+                           uint32_t level,
+                           union dfs_Info *info,
+                           WERROR *werror);
+NTSTATUS rpccli_dfs_Enum(struct rpc_pipe_client *cli,
+                        TALLOC_CTX *mem_ctx,
+                        uint32_t level,
+                        uint32_t bufsize,
+                        struct dfs_EnumStruct *info,
+                        uint32_t *total,
+                        WERROR *werror);
+NTSTATUS rpccli_dfs_Rename(struct rpc_pipe_client *cli,
+                          TALLOC_CTX *mem_ctx,
+                          WERROR *werror);
+NTSTATUS rpccli_dfs_Move(struct rpc_pipe_client *cli,
+                        TALLOC_CTX *mem_ctx,
+                        WERROR *werror);
+NTSTATUS rpccli_dfs_ManagerGetConfigInfo(struct rpc_pipe_client *cli,
+                                        TALLOC_CTX *mem_ctx,
+                                        WERROR *werror);
+NTSTATUS rpccli_dfs_ManagerSendSiteInfo(struct rpc_pipe_client *cli,
+                                       TALLOC_CTX *mem_ctx,
+                                       WERROR *werror);
+NTSTATUS rpccli_dfs_AddFtRoot(struct rpc_pipe_client *cli,
+                             TALLOC_CTX *mem_ctx,
+                             const char *servername,
+                             const char *dns_servername,
+                             const char *dfsname,
+                             const char *rootshare,
+                             const char *comment,
+                             const char *dfs_config_dn,
+                             uint8_t unknown1,
+                             uint32_t flags,
+                             struct dfs_UnknownStruct **unknown2,
+                             WERROR *werror);
+NTSTATUS rpccli_dfs_RemoveFtRoot(struct rpc_pipe_client *cli,
+                                TALLOC_CTX *mem_ctx,
+                                const char *servername,
+                                const char *dns_servername,
+                                const char *dfsname,
+                                const char *rootshare,
+                                uint32_t flags,
+                                struct dfs_UnknownStruct **unknown,
+                                WERROR *werror);
+NTSTATUS rpccli_dfs_AddStdRoot(struct rpc_pipe_client *cli,
+                              TALLOC_CTX *mem_ctx,
+                              const char *servername,
+                              const char *rootshare,
+                              const char *comment,
+                              uint32_t flags,
+                              WERROR *werror);
+NTSTATUS rpccli_dfs_RemoveStdRoot(struct rpc_pipe_client *cli,
+                                 TALLOC_CTX *mem_ctx,
+                                 const char *servername,
+                                 const char *rootshare,
+                                 uint32_t flags,
+                                 WERROR *werror);
+NTSTATUS rpccli_dfs_ManagerInitialize(struct rpc_pipe_client *cli,
+                                     TALLOC_CTX *mem_ctx,
+                                     const char *servername,
+                                     uint32_t flags,
+                                     WERROR *werror);
+NTSTATUS rpccli_dfs_AddStdRootForced(struct rpc_pipe_client *cli,
+                                    TALLOC_CTX *mem_ctx,
+                                    const char *servername,
+                                    const char *rootshare,
+                                    const char *comment,
+                                    const char *store,
+                                    WERROR *werror);
+NTSTATUS rpccli_dfs_GetDcAddress(struct rpc_pipe_client *cli,
+                                TALLOC_CTX *mem_ctx,
+                                const char *servername,
+                                const char **server_fullname,
+                                uint8_t *is_root,
+                                uint32_t *ttl,
+                                WERROR *werror);
+NTSTATUS rpccli_dfs_SetDcAddress(struct rpc_pipe_client *cli,
+                                TALLOC_CTX *mem_ctx,
+                                const char *servername,
+                                const char *server_fullname,
+                                uint32_t flags,
+                                uint32_t ttl,
+                                WERROR *werror);
+NTSTATUS rpccli_dfs_FlushFtTable(struct rpc_pipe_client *cli,
+                                TALLOC_CTX *mem_ctx,
+                                const char *servername,
+                                const char *rootshare,
+                                WERROR *werror);
+NTSTATUS rpccli_dfs_Add2(struct rpc_pipe_client *cli,
+                        TALLOC_CTX *mem_ctx,
+                        WERROR *werror);
+NTSTATUS rpccli_dfs_Remove2(struct rpc_pipe_client *cli,
+                           TALLOC_CTX *mem_ctx,
+                           WERROR *werror);
+NTSTATUS rpccli_dfs_EnumEx(struct rpc_pipe_client *cli,
+                          TALLOC_CTX *mem_ctx,
+                          const char *dfs_name,
+                          uint32_t level,
+                          uint32_t bufsize,
+                          struct dfs_EnumStruct *info,
+                          uint32_t *total,
+                          WERROR *werror);
+NTSTATUS rpccli_dfs_SetInfo2(struct rpc_pipe_client *cli,
+                            TALLOC_CTX *mem_ctx,
+                            WERROR *werror);
 #endif /* __CLI_NETDFS__ */
diff --git a/source/librpc/gen_ndr/cli_dssetup.c b/source/librpc/gen_ndr/cli_dssetup.c
new file mode 100644 (file)
index 0000000..8947d99
--- /dev/null
@@ -0,0 +1,476 @@
+/*
+ * Unix SMB/CIFS implementation.
+ * client auto-generated by pidl. DO NOT MODIFY!
+ */
+
+#include "includes.h"
+#include "librpc/gen_ndr/cli_dssetup.h"
+
+NTSTATUS rpccli_dssetup_DsRoleGetPrimaryDomainInformation(struct rpc_pipe_client *cli,
+                                                         TALLOC_CTX *mem_ctx,
+                                                         enum dssetup_DsRoleInfoLevel level,
+                                                         union dssetup_DsRoleInfo *info,
+                                                         WERROR *werror)
+{
+       struct dssetup_DsRoleGetPrimaryDomainInformation r;
+       NTSTATUS status;
+
+       /* In parameters */
+       r.in.level = level;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(dssetup_DsRoleGetPrimaryDomainInformation, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_DSSETUP,
+                               &ndr_table_dssetup,
+                               NDR_DSSETUP_DSROLEGETPRIMARYDOMAININFORMATION,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(dssetup_DsRoleGetPrimaryDomainInformation, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+       if (info && r.out.info) {
+               *info = *r.out.info;
+       }
+
+       /* Return result */
+       if (werror) {
+               *werror = r.out.result;
+       }
+
+       return werror_to_ntstatus(r.out.result);
+}
+
+NTSTATUS rpccli_dssetup_DsRoleDnsNameToFlatName(struct rpc_pipe_client *cli,
+                                               TALLOC_CTX *mem_ctx,
+                                               WERROR *werror)
+{
+       struct dssetup_DsRoleDnsNameToFlatName r;
+       NTSTATUS status;
+
+       /* In parameters */
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(dssetup_DsRoleDnsNameToFlatName, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_DSSETUP,
+                               &ndr_table_dssetup,
+                               NDR_DSSETUP_DSROLEDNSNAMETOFLATNAME,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(dssetup_DsRoleDnsNameToFlatName, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+
+       /* Return result */
+       if (werror) {
+               *werror = r.out.result;
+       }
+
+       return werror_to_ntstatus(r.out.result);
+}
+
+NTSTATUS rpccli_dssetup_DsRoleDcAsDc(struct rpc_pipe_client *cli,
+                                    TALLOC_CTX *mem_ctx,
+                                    WERROR *werror)
+{
+       struct dssetup_DsRoleDcAsDc r;
+       NTSTATUS status;
+
+       /* In parameters */
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(dssetup_DsRoleDcAsDc, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_DSSETUP,
+                               &ndr_table_dssetup,
+                               NDR_DSSETUP_DSROLEDCASDC,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(dssetup_DsRoleDcAsDc, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+
+       /* Return result */
+       if (werror) {
+               *werror = r.out.result;
+       }
+
+       return werror_to_ntstatus(r.out.result);
+}
+
+NTSTATUS rpccli_dssetup_DsRoleDcAsReplica(struct rpc_pipe_client *cli,
+                                         TALLOC_CTX *mem_ctx,
+                                         WERROR *werror)
+{
+       struct dssetup_DsRoleDcAsReplica r;
+       NTSTATUS status;
+
+       /* In parameters */
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(dssetup_DsRoleDcAsReplica, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_DSSETUP,
+                               &ndr_table_dssetup,
+                               NDR_DSSETUP_DSROLEDCASREPLICA,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(dssetup_DsRoleDcAsReplica, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+
+       /* Return result */
+       if (werror) {
+               *werror = r.out.result;
+       }
+
+       return werror_to_ntstatus(r.out.result);
+}
+
+NTSTATUS rpccli_dssetup_DsRoleDemoteDc(struct rpc_pipe_client *cli,
+                                      TALLOC_CTX *mem_ctx,
+                                      WERROR *werror)
+{
+       struct dssetup_DsRoleDemoteDc r;
+       NTSTATUS status;
+
+       /* In parameters */
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(dssetup_DsRoleDemoteDc, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_DSSETUP,
+                               &ndr_table_dssetup,
+                               NDR_DSSETUP_DSROLEDEMOTEDC,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(dssetup_DsRoleDemoteDc, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+
+       /* Return result */
+       if (werror) {
+               *werror = r.out.result;
+       }
+
+       return werror_to_ntstatus(r.out.result);
+}
+
+NTSTATUS rpccli_dssetup_DsRoleGetDcOperationProgress(struct rpc_pipe_client *cli,
+                                                    TALLOC_CTX *mem_ctx,
+                                                    WERROR *werror)
+{
+       struct dssetup_DsRoleGetDcOperationProgress r;
+       NTSTATUS status;
+
+       /* In parameters */
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(dssetup_DsRoleGetDcOperationProgress, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_DSSETUP,
+                               &ndr_table_dssetup,
+                               NDR_DSSETUP_DSROLEGETDCOPERATIONPROGRESS,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(dssetup_DsRoleGetDcOperationProgress, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+
+       /* Return result */
+       if (werror) {
+               *werror = r.out.result;
+       }
+
+       return werror_to_ntstatus(r.out.result);
+}
+
+NTSTATUS rpccli_dssetup_DsRoleGetDcOperationResults(struct rpc_pipe_client *cli,
+                                                   TALLOC_CTX *mem_ctx,
+                                                   WERROR *werror)
+{
+       struct dssetup_DsRoleGetDcOperationResults r;
+       NTSTATUS status;
+
+       /* In parameters */
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(dssetup_DsRoleGetDcOperationResults, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_DSSETUP,
+                               &ndr_table_dssetup,
+                               NDR_DSSETUP_DSROLEGETDCOPERATIONRESULTS,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(dssetup_DsRoleGetDcOperationResults, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+
+       /* Return result */
+       if (werror) {
+               *werror = r.out.result;
+       }
+
+       return werror_to_ntstatus(r.out.result);
+}
+
+NTSTATUS rpccli_dssetup_DsRoleCancel(struct rpc_pipe_client *cli,
+                                    TALLOC_CTX *mem_ctx,
+                                    WERROR *werror)
+{
+       struct dssetup_DsRoleCancel r;
+       NTSTATUS status;
+
+       /* In parameters */
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(dssetup_DsRoleCancel, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_DSSETUP,
+                               &ndr_table_dssetup,
+                               NDR_DSSETUP_DSROLECANCEL,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(dssetup_DsRoleCancel, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+
+       /* Return result */
+       if (werror) {
+               *werror = r.out.result;
+       }
+
+       return werror_to_ntstatus(r.out.result);
+}
+
+NTSTATUS rpccli_dssetup_DsRoleServerSaveStateForUpgrade(struct rpc_pipe_client *cli,
+                                                       TALLOC_CTX *mem_ctx,
+                                                       WERROR *werror)
+{
+       struct dssetup_DsRoleServerSaveStateForUpgrade r;
+       NTSTATUS status;
+
+       /* In parameters */
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(dssetup_DsRoleServerSaveStateForUpgrade, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_DSSETUP,
+                               &ndr_table_dssetup,
+                               NDR_DSSETUP_DSROLESERVERSAVESTATEFORUPGRADE,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(dssetup_DsRoleServerSaveStateForUpgrade, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+
+       /* Return result */
+       if (werror) {
+               *werror = r.out.result;
+       }
+
+       return werror_to_ntstatus(r.out.result);
+}
+
+NTSTATUS rpccli_dssetup_DsRoleUpgradeDownlevelServer(struct rpc_pipe_client *cli,
+                                                    TALLOC_CTX *mem_ctx,
+                                                    WERROR *werror)
+{
+       struct dssetup_DsRoleUpgradeDownlevelServer r;
+       NTSTATUS status;
+
+       /* In parameters */
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(dssetup_DsRoleUpgradeDownlevelServer, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_DSSETUP,
+                               &ndr_table_dssetup,
+                               NDR_DSSETUP_DSROLEUPGRADEDOWNLEVELSERVER,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(dssetup_DsRoleUpgradeDownlevelServer, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+
+       /* Return result */
+       if (werror) {
+               *werror = r.out.result;
+       }
+
+       return werror_to_ntstatus(r.out.result);
+}
+
+NTSTATUS rpccli_dssetup_DsRoleAbortDownlevelServerUpgrade(struct rpc_pipe_client *cli,
+                                                         TALLOC_CTX *mem_ctx,
+                                                         WERROR *werror)
+{
+       struct dssetup_DsRoleAbortDownlevelServerUpgrade r;
+       NTSTATUS status;
+
+       /* In parameters */
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(dssetup_DsRoleAbortDownlevelServerUpgrade, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_DSSETUP,
+                               &ndr_table_dssetup,
+                               NDR_DSSETUP_DSROLEABORTDOWNLEVELSERVERUPGRADE,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(dssetup_DsRoleAbortDownlevelServerUpgrade, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+
+       /* Return result */
+       if (werror) {
+               *werror = r.out.result;
+       }
+
+       return werror_to_ntstatus(r.out.result);
+}
+
diff --git a/source/librpc/gen_ndr/cli_dssetup.h b/source/librpc/gen_ndr/cli_dssetup.h
new file mode 100644 (file)
index 0000000..b645c26
--- /dev/null
@@ -0,0 +1,39 @@
+#include "librpc/gen_ndr/ndr_dssetup.h"
+#ifndef __CLI_DSSETUP__
+#define __CLI_DSSETUP__
+NTSTATUS rpccli_dssetup_DsRoleGetPrimaryDomainInformation(struct rpc_pipe_client *cli,
+                                                         TALLOC_CTX *mem_ctx,
+                                                         enum dssetup_DsRoleInfoLevel level,
+                                                         union dssetup_DsRoleInfo *info,
+                                                         WERROR *werror);
+NTSTATUS rpccli_dssetup_DsRoleDnsNameToFlatName(struct rpc_pipe_client *cli,
+                                               TALLOC_CTX *mem_ctx,
+                                               WERROR *werror);
+NTSTATUS rpccli_dssetup_DsRoleDcAsDc(struct rpc_pipe_client *cli,
+                                    TALLOC_CTX *mem_ctx,
+                                    WERROR *werror);
+NTSTATUS rpccli_dssetup_DsRoleDcAsReplica(struct rpc_pipe_client *cli,
+                                         TALLOC_CTX *mem_ctx,
+                                         WERROR *werror);
+NTSTATUS rpccli_dssetup_DsRoleDemoteDc(struct rpc_pipe_client *cli,
+                                      TALLOC_CTX *mem_ctx,
+                                      WERROR *werror);
+NTSTATUS rpccli_dssetup_DsRoleGetDcOperationProgress(struct rpc_pipe_client *cli,
+                                                    TALLOC_CTX *mem_ctx,
+                                                    WERROR *werror);
+NTSTATUS rpccli_dssetup_DsRoleGetDcOperationResults(struct rpc_pipe_client *cli,
+                                                   TALLOC_CTX *mem_ctx,
+                                                   WERROR *werror);
+NTSTATUS rpccli_dssetup_DsRoleCancel(struct rpc_pipe_client *cli,
+                                    TALLOC_CTX *mem_ctx,
+                                    WERROR *werror);
+NTSTATUS rpccli_dssetup_DsRoleServerSaveStateForUpgrade(struct rpc_pipe_client *cli,
+                                                       TALLOC_CTX *mem_ctx,
+                                                       WERROR *werror);
+NTSTATUS rpccli_dssetup_DsRoleUpgradeDownlevelServer(struct rpc_pipe_client *cli,
+                                                    TALLOC_CTX *mem_ctx,
+                                                    WERROR *werror);
+NTSTATUS rpccli_dssetup_DsRoleAbortDownlevelServerUpgrade(struct rpc_pipe_client *cli,
+                                                         TALLOC_CTX *mem_ctx,
+                                                         WERROR *werror);
+#endif /* __CLI_DSSETUP__ */
index 4da2d7a209aeed421f4e8ceb7b3a3d84aa48d4dc..d2ef574821b8042e4ab5f150d876809133bf4656 100644 (file)
 #include "includes.h"
 #include "librpc/gen_ndr/cli_echo.h"
 
-NTSTATUS rpccli_echo_AddOne(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t in_data, uint32_t *out_data)
+NTSTATUS rpccli_echo_AddOne(struct rpc_pipe_client *cli,
+                           TALLOC_CTX *mem_ctx,
+                           uint32_t in_data,
+                           uint32_t *out_data)
 {
        struct echo_AddOne r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.in_data = in_data;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(echo_AddOne, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_RPCECHO, &ndr_table_rpcecho, NDR_ECHO_ADDONE, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_RPCECHO,
+                               &ndr_table_rpcecho,
+                               NDR_ECHO_ADDONE,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(echo_AddOne, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *out_data = *r.out.out_data;
-       
+
        /* Return result */
        return NT_STATUS_OK;
 }
 
-NTSTATUS rpccli_echo_EchoData(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t len, uint8_t *in_data, uint8_t *out_data)
+NTSTATUS rpccli_echo_EchoData(struct rpc_pipe_client *cli,
+                             TALLOC_CTX *mem_ctx,
+                             uint32_t len,
+                             uint8_t *in_data,
+                             uint8_t *out_data)
 {
        struct echo_EchoData r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.len = len;
        r.in.in_data = in_data;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(echo_EchoData, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_RPCECHO, &ndr_table_rpcecho, NDR_ECHO_ECHODATA, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_RPCECHO,
+                               &ndr_table_rpcecho,
+                               NDR_ECHO_ECHODATA,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(echo_EchoData, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        memcpy(out_data, r.out.out_data, r.in.len);
-       
+
        /* Return result */
        return NT_STATUS_OK;
 }
 
-NTSTATUS rpccli_echo_SinkData(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t len, uint8_t *data)
+NTSTATUS rpccli_echo_SinkData(struct rpc_pipe_client *cli,
+                             TALLOC_CTX *mem_ctx,
+                             uint32_t len,
+                             uint8_t *data)
 {
        struct echo_SinkData r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.len = len;
        r.in.data = data;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(echo_SinkData, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_RPCECHO, &ndr_table_rpcecho, NDR_ECHO_SINKDATA, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_RPCECHO,
+                               &ndr_table_rpcecho,
+                               NDR_ECHO_SINKDATA,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(echo_SinkData, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return NT_STATUS_OK;
 }
 
-NTSTATUS rpccli_echo_SourceData(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t len, uint8_t *data)
+NTSTATUS rpccli_echo_SourceData(struct rpc_pipe_client *cli,
+                               TALLOC_CTX *mem_ctx,
+                               uint32_t len,
+                               uint8_t *data)
 {
        struct echo_SourceData r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.len = len;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(echo_SourceData, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_RPCECHO, &ndr_table_rpcecho, NDR_ECHO_SOURCEDATA, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_RPCECHO,
+                               &ndr_table_rpcecho,
+                               NDR_ECHO_SOURCEDATA,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(echo_SourceData, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        memcpy(data, r.out.data, r.in.len);
-       
+
        /* Return result */
        return NT_STATUS_OK;
 }
 
-NTSTATUS rpccli_echo_TestCall(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *s1, const char **s2)
+NTSTATUS rpccli_echo_TestCall(struct rpc_pipe_client *cli,
+                             TALLOC_CTX *mem_ctx,
+                             const char *s1,
+                             const char **s2)
 {
        struct echo_TestCall r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.s1 = s1;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(echo_TestCall, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_RPCECHO, &ndr_table_rpcecho, NDR_ECHO_TESTCALL, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_RPCECHO,
+                               &ndr_table_rpcecho,
+                               NDR_ECHO_TESTCALL,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(echo_TestCall, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *s2 = *r.out.s2;
-       
+
        /* Return result */
        return NT_STATUS_OK;
 }
 
-NTSTATUS rpccli_echo_TestCall2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t level, union echo_Info *info)
+NTSTATUS rpccli_echo_TestCall2(struct rpc_pipe_client *cli,
+                              TALLOC_CTX *mem_ctx,
+                              uint16_t level,
+                              union echo_Info *info)
 {
        struct echo_TestCall2 r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.level = level;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(echo_TestCall2, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_RPCECHO, &ndr_table_rpcecho, NDR_ECHO_TESTCALL2, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_RPCECHO,
+                               &ndr_table_rpcecho,
+                               NDR_ECHO_TESTCALL2,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(echo_TestCall2, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *info = *r.out.info;
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_echo_TestSleep(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t seconds)
+NTSTATUS rpccli_echo_TestSleep(struct rpc_pipe_client *cli,
+                              TALLOC_CTX *mem_ctx,
+                              uint32_t seconds)
 {
        struct echo_TestSleep r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.seconds = seconds;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(echo_TestSleep, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_RPCECHO, &ndr_table_rpcecho, NDR_ECHO_TESTSLEEP, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_RPCECHO,
+                               &ndr_table_rpcecho,
+                               NDR_ECHO_TESTSLEEP,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(echo_TestSleep, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return NT_STATUS_OK;
 }
 
-NTSTATUS rpccli_echo_TestEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, enum echo_Enum1 *foo1, struct echo_Enum2 *foo2, union echo_Enum3 *foo3)
+NTSTATUS rpccli_echo_TestEnum(struct rpc_pipe_client *cli,
+                             TALLOC_CTX *mem_ctx,
+                             enum echo_Enum1 *foo1,
+                             struct echo_Enum2 *foo2,
+                             union echo_Enum3 *foo3)
 {
        struct echo_TestEnum r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.foo1 = foo1;
        r.in.foo2 = foo2;
        r.in.foo3 = foo3;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(echo_TestEnum, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_RPCECHO, &ndr_table_rpcecho, NDR_ECHO_TESTENUM, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_RPCECHO,
+                               &ndr_table_rpcecho,
+                               NDR_ECHO_TESTENUM,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(echo_TestEnum, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *foo1 = *r.out.foo1;
        *foo2 = *r.out.foo2;
        *foo3 = *r.out.foo3;
-       
+
        /* Return result */
        return NT_STATUS_OK;
 }
 
-NTSTATUS rpccli_echo_TestSurrounding(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct echo_Surrounding *data)
+NTSTATUS rpccli_echo_TestSurrounding(struct rpc_pipe_client *cli,
+                                    TALLOC_CTX *mem_ctx,
+                                    struct echo_Surrounding *data)
 {
        struct echo_TestSurrounding r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.data = data;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(echo_TestSurrounding, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_RPCECHO, &ndr_table_rpcecho, NDR_ECHO_TESTSURROUNDING, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_RPCECHO,
+                               &ndr_table_rpcecho,
+                               NDR_ECHO_TESTSURROUNDING,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(echo_TestSurrounding, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *data = *r.out.data;
-       
+
        /* Return result */
        return NT_STATUS_OK;
 }
 
-NTSTATUS rpccli_echo_TestDoublePointer(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t ***data)
+NTSTATUS rpccli_echo_TestDoublePointer(struct rpc_pipe_client *cli,
+                                      TALLOC_CTX *mem_ctx,
+                                      uint16_t ***data)
 {
        struct echo_TestDoublePointer r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.data = data;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(echo_TestDoublePointer, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_RPCECHO, &ndr_table_rpcecho, NDR_ECHO_TESTDOUBLEPOINTER, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_RPCECHO,
+                               &ndr_table_rpcecho,
+                               NDR_ECHO_TESTDOUBLEPOINTER,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(echo_TestDoublePointer, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return NT_STATUS_OK;
 }
index d7e7f31704871c418636b52dc6c6ee3459a0d05a..e682004c166ffda1ad213c4d270ca54f9fa1f200 100644 (file)
@@ -1,14 +1,43 @@
 #include "librpc/gen_ndr/ndr_echo.h"
 #ifndef __CLI_RPCECHO__
 #define __CLI_RPCECHO__
-NTSTATUS rpccli_echo_AddOne(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t in_data, uint32_t *out_data);
-NTSTATUS rpccli_echo_EchoData(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t len, uint8_t *in_data, uint8_t *out_data);
-NTSTATUS rpccli_echo_SinkData(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t len, uint8_t *data);
-NTSTATUS rpccli_echo_SourceData(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t len, uint8_t *data);
-NTSTATUS rpccli_echo_TestCall(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *s1, const char **s2);
-NTSTATUS rpccli_echo_TestCall2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t level, union echo_Info *info);
-NTSTATUS rpccli_echo_TestSleep(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t seconds);
-NTSTATUS rpccli_echo_TestEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, enum echo_Enum1 *foo1, struct echo_Enum2 *foo2, union echo_Enum3 *foo3);
-NTSTATUS rpccli_echo_TestSurrounding(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct echo_Surrounding *data);
-NTSTATUS rpccli_echo_TestDoublePointer(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t ***data);
+NTSTATUS rpccli_echo_AddOne(struct rpc_pipe_client *cli,
+                           TALLOC_CTX *mem_ctx,
+                           uint32_t in_data,
+                           uint32_t *out_data);
+NTSTATUS rpccli_echo_EchoData(struct rpc_pipe_client *cli,
+                             TALLOC_CTX *mem_ctx,
+                             uint32_t len,
+                             uint8_t *in_data,
+                             uint8_t *out_data);
+NTSTATUS rpccli_echo_SinkData(struct rpc_pipe_client *cli,
+                             TALLOC_CTX *mem_ctx,
+                             uint32_t len,
+                             uint8_t *data);
+NTSTATUS rpccli_echo_SourceData(struct rpc_pipe_client *cli,
+                               TALLOC_CTX *mem_ctx,
+                               uint32_t len,
+                               uint8_t *data);
+NTSTATUS rpccli_echo_TestCall(struct rpc_pipe_client *cli,
+                             TALLOC_CTX *mem_ctx,
+                             const char *s1,
+                             const char **s2);
+NTSTATUS rpccli_echo_TestCall2(struct rpc_pipe_client *cli,
+                              TALLOC_CTX *mem_ctx,
+                              uint16_t level,
+                              union echo_Info *info);
+NTSTATUS rpccli_echo_TestSleep(struct rpc_pipe_client *cli,
+                              TALLOC_CTX *mem_ctx,
+                              uint32_t seconds);
+NTSTATUS rpccli_echo_TestEnum(struct rpc_pipe_client *cli,
+                             TALLOC_CTX *mem_ctx,
+                             enum echo_Enum1 *foo1,
+                             struct echo_Enum2 *foo2,
+                             union echo_Enum3 *foo3);
+NTSTATUS rpccli_echo_TestSurrounding(struct rpc_pipe_client *cli,
+                                    TALLOC_CTX *mem_ctx,
+                                    struct echo_Surrounding *data);
+NTSTATUS rpccli_echo_TestDoublePointer(struct rpc_pipe_client *cli,
+                                      TALLOC_CTX *mem_ctx,
+                                      uint16_t ***data);
 #endif /* __CLI_RPCECHO__ */
index e00d9aa2a12606748fe7bc3d82a14248ca1f5f7a..775e349cd2de18d1909e5b2de4ec4ebd22f071a0 100644 (file)
 #include "includes.h"
 #include "librpc/gen_ndr/cli_epmapper.h"
 
-NTSTATUS rpccli_epm_Insert(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t num_ents, struct epm_entry_t *entries, uint32_t replace)
+NTSTATUS rpccli_epm_Insert(struct rpc_pipe_client *cli,
+                          TALLOC_CTX *mem_ctx,
+                          uint32_t num_ents,
+                          struct epm_entry_t *entries,
+                          uint32_t replace)
 {
        struct epm_Insert r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.num_ents = num_ents;
        r.in.entries = entries;
        r.in.replace = replace;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(epm_Insert, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_EPMAPPER, &ndr_table_epmapper, NDR_EPM_INSERT, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_EPMAPPER,
+                               &ndr_table_epmapper,
+                               NDR_EPM_INSERT,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(epm_Insert, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return NT_STATUS_OK;
 }
 
-NTSTATUS rpccli_epm_Delete(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t num_ents, struct epm_entry_t *entries)
+NTSTATUS rpccli_epm_Delete(struct rpc_pipe_client *cli,
+                          TALLOC_CTX *mem_ctx,
+                          uint32_t num_ents,
+                          struct epm_entry_t *entries)
 {
        struct epm_Delete r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.num_ents = num_ents;
        r.in.entries = entries;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(epm_Delete, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_EPMAPPER, &ndr_table_epmapper, NDR_EPM_DELETE, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_EPMAPPER,
+                               &ndr_table_epmapper,
+                               NDR_EPM_DELETE,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(epm_Delete, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return NT_STATUS_OK;
 }
 
-NTSTATUS rpccli_epm_Lookup(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t inquiry_type, struct GUID *object, struct rpc_if_id_t *interface_id, uint32_t vers_option, struct policy_handle *entry_handle, uint32_t max_ents, uint32_t *num_ents, struct epm_entry_t *entries)
+NTSTATUS rpccli_epm_Lookup(struct rpc_pipe_client *cli,
+                          TALLOC_CTX *mem_ctx,
+                          uint32_t inquiry_type,
+                          struct GUID *object,
+                          struct rpc_if_id_t *interface_id,
+                          uint32_t vers_option,
+                          struct policy_handle *entry_handle,
+                          uint32_t max_ents,
+                          uint32_t *num_ents,
+                          struct epm_entry_t *entries)
 {
        struct epm_Lookup r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.inquiry_type = inquiry_type;
        r.in.object = object;
@@ -81,186 +111,244 @@ NTSTATUS rpccli_epm_Lookup(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uin
        r.in.vers_option = vers_option;
        r.in.entry_handle = entry_handle;
        r.in.max_ents = max_ents;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(epm_Lookup, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_EPMAPPER, &ndr_table_epmapper, NDR_EPM_LOOKUP, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_EPMAPPER,
+                               &ndr_table_epmapper,
+                               NDR_EPM_LOOKUP,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(epm_Lookup, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *entry_handle = *r.out.entry_handle;
        *num_ents = *r.out.num_ents;
        memcpy(entries, r.out.entries, r.in.max_ents);
-       
+
        /* Return result */
        return NT_STATUS_OK;
 }
 
-NTSTATUS rpccli_epm_Map(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct GUID *object, struct epm_twr_t *map_tower, struct policy_handle *entry_handle, uint32_t max_towers, uint32_t *num_towers, struct epm_twr_p_t *towers)
+NTSTATUS rpccli_epm_Map(struct rpc_pipe_client *cli,
+                       TALLOC_CTX *mem_ctx,
+                       struct GUID *object,
+                       struct epm_twr_t *map_tower,
+                       struct policy_handle *entry_handle,
+                       uint32_t max_towers,
+                       uint32_t *num_towers,
+                       struct epm_twr_p_t *towers)
 {
        struct epm_Map r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.object = object;
        r.in.map_tower = map_tower;
        r.in.entry_handle = entry_handle;
        r.in.max_towers = max_towers;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(epm_Map, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_EPMAPPER, &ndr_table_epmapper, NDR_EPM_MAP, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_EPMAPPER,
+                               &ndr_table_epmapper,
+                               NDR_EPM_MAP,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(epm_Map, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *entry_handle = *r.out.entry_handle;
        *num_towers = *r.out.num_towers;
        memcpy(towers, r.out.towers, r.in.max_towers);
-       
+
        /* Return result */
        return NT_STATUS_OK;
 }
 
-NTSTATUS rpccli_epm_LookupHandleFree(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *entry_handle)
+NTSTATUS rpccli_epm_LookupHandleFree(struct rpc_pipe_client *cli,
+                                    TALLOC_CTX *mem_ctx,
+                                    struct policy_handle *entry_handle)
 {
        struct epm_LookupHandleFree r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.entry_handle = entry_handle;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(epm_LookupHandleFree, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_EPMAPPER, &ndr_table_epmapper, NDR_EPM_LOOKUPHANDLEFREE, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_EPMAPPER,
+                               &ndr_table_epmapper,
+                               NDR_EPM_LOOKUPHANDLEFREE,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(epm_LookupHandleFree, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *entry_handle = *r.out.entry_handle;
-       
+
        /* Return result */
        return NT_STATUS_OK;
 }
 
-NTSTATUS rpccli_epm_InqObject(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct GUID *epm_object)
+NTSTATUS rpccli_epm_InqObject(struct rpc_pipe_client *cli,
+                             TALLOC_CTX *mem_ctx,
+                             struct GUID *epm_object)
 {
        struct epm_InqObject r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.epm_object = epm_object;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(epm_InqObject, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_EPMAPPER, &ndr_table_epmapper, NDR_EPM_INQOBJECT, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_EPMAPPER,
+                               &ndr_table_epmapper,
+                               NDR_EPM_INQOBJECT,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(epm_InqObject, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return NT_STATUS_OK;
 }
 
-NTSTATUS rpccli_epm_MgmtDelete(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t object_speced, struct GUID *object, struct epm_twr_t *tower)
+NTSTATUS rpccli_epm_MgmtDelete(struct rpc_pipe_client *cli,
+                              TALLOC_CTX *mem_ctx,
+                              uint32_t object_speced,
+                              struct GUID *object,
+                              struct epm_twr_t *tower)
 {
        struct epm_MgmtDelete r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.object_speced = object_speced;
        r.in.object = object;
        r.in.tower = tower;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(epm_MgmtDelete, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_EPMAPPER, &ndr_table_epmapper, NDR_EPM_MGMTDELETE, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_EPMAPPER,
+                               &ndr_table_epmapper,
+                               NDR_EPM_MGMTDELETE,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(epm_MgmtDelete, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return NT_STATUS_OK;
 }
 
-NTSTATUS rpccli_epm_MapAuth(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx)
+NTSTATUS rpccli_epm_MapAuth(struct rpc_pipe_client *cli,
+                           TALLOC_CTX *mem_ctx)
 {
        struct epm_MapAuth r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(epm_MapAuth, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_EPMAPPER, &ndr_table_epmapper, NDR_EPM_MAPAUTH, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_EPMAPPER,
+                               &ndr_table_epmapper,
+                               NDR_EPM_MAPAUTH,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(epm_MapAuth, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return NT_STATUS_OK;
 }
index 88e05a4600a07d34dada4bc6d1cd6a2b17ad0384..fe99e6441c76d65aa7523075a1448d0a72f5554d 100644 (file)
@@ -1,12 +1,44 @@
 #include "librpc/gen_ndr/ndr_epmapper.h"
 #ifndef __CLI_EPMAPPER__
 #define __CLI_EPMAPPER__
-NTSTATUS rpccli_epm_Insert(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t num_ents, struct epm_entry_t *entries, uint32_t replace);
-NTSTATUS rpccli_epm_Delete(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t num_ents, struct epm_entry_t *entries);
-NTSTATUS rpccli_epm_Lookup(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t inquiry_type, struct GUID *object, struct rpc_if_id_t *interface_id, uint32_t vers_option, struct policy_handle *entry_handle, uint32_t max_ents, uint32_t *num_ents, struct epm_entry_t *entries);
-NTSTATUS rpccli_epm_Map(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct GUID *object, struct epm_twr_t *map_tower, struct policy_handle *entry_handle, uint32_t max_towers, uint32_t *num_towers, struct epm_twr_p_t *towers);
-NTSTATUS rpccli_epm_LookupHandleFree(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *entry_handle);
-NTSTATUS rpccli_epm_InqObject(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct GUID *epm_object);
-NTSTATUS rpccli_epm_MgmtDelete(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t object_speced, struct GUID *object, struct epm_twr_t *tower);
-NTSTATUS rpccli_epm_MapAuth(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx);
+NTSTATUS rpccli_epm_Insert(struct rpc_pipe_client *cli,
+                          TALLOC_CTX *mem_ctx,
+                          uint32_t num_ents,
+                          struct epm_entry_t *entries,
+                          uint32_t replace);
+NTSTATUS rpccli_epm_Delete(struct rpc_pipe_client *cli,
+                          TALLOC_CTX *mem_ctx,
+                          uint32_t num_ents,
+                          struct epm_entry_t *entries);
+NTSTATUS rpccli_epm_Lookup(struct rpc_pipe_client *cli,
+                          TALLOC_CTX *mem_ctx,
+                          uint32_t inquiry_type,
+                          struct GUID *object,
+                          struct rpc_if_id_t *interface_id,
+                          uint32_t vers_option,
+                          struct policy_handle *entry_handle,
+                          uint32_t max_ents,
+                          uint32_t *num_ents,
+                          struct epm_entry_t *entries);
+NTSTATUS rpccli_epm_Map(struct rpc_pipe_client *cli,
+                       TALLOC_CTX *mem_ctx,
+                       struct GUID *object,
+                       struct epm_twr_t *map_tower,
+                       struct policy_handle *entry_handle,
+                       uint32_t max_towers,
+                       uint32_t *num_towers,
+                       struct epm_twr_p_t *towers);
+NTSTATUS rpccli_epm_LookupHandleFree(struct rpc_pipe_client *cli,
+                                    TALLOC_CTX *mem_ctx,
+                                    struct policy_handle *entry_handle);
+NTSTATUS rpccli_epm_InqObject(struct rpc_pipe_client *cli,
+                             TALLOC_CTX *mem_ctx,
+                             struct GUID *epm_object);
+NTSTATUS rpccli_epm_MgmtDelete(struct rpc_pipe_client *cli,
+                              TALLOC_CTX *mem_ctx,
+                              uint32_t object_speced,
+                              struct GUID *object,
+                              struct epm_twr_t *tower);
+NTSTATUS rpccli_epm_MapAuth(struct rpc_pipe_client *cli,
+                           TALLOC_CTX *mem_ctx);
 #endif /* __CLI_EPMAPPER__ */
index 3fd61a7d4914091df7f3731390a9f70357f80e8d..72cd886cb4ccaf259a61c119765f0da597cc1561 100644 (file)
 #include "includes.h"
 #include "librpc/gen_ndr/cli_eventlog.h"
 
-NTSTATUS rpccli_eventlog_ClearEventLogW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_String *unknown)
+NTSTATUS rpccli_eventlog_ClearEventLogW(struct rpc_pipe_client *cli,
+                                       TALLOC_CTX *mem_ctx,
+                                       struct policy_handle *handle,
+                                       struct lsa_String *unknown)
 {
        struct eventlog_ClearEventLogW r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.unknown = unknown;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(eventlog_ClearEventLogW, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_CLEAREVENTLOGW, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_EVENTLOG,
+                               &ndr_table_eventlog,
+                               NDR_EVENTLOG_CLEAREVENTLOGW,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(eventlog_ClearEventLogW, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_eventlog_BackupEventLogW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx)
+NTSTATUS rpccli_eventlog_BackupEventLogW(struct rpc_pipe_client *cli,
+                                        TALLOC_CTX *mem_ctx)
 {
        struct eventlog_BackupEventLogW r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(eventlog_BackupEventLogW, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_BACKUPEVENTLOGW, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_EVENTLOG,
+                               &ndr_table_eventlog,
+                               NDR_EVENTLOG_BACKUPEVENTLOGW,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(eventlog_BackupEventLogW, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_eventlog_CloseEventLog(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle)
+NTSTATUS rpccli_eventlog_CloseEventLog(struct rpc_pipe_client *cli,
+                                      TALLOC_CTX *mem_ctx,
+                                      struct policy_handle *handle)
 {
        struct eventlog_CloseEventLog r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(eventlog_CloseEventLog, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_CLOSEEVENTLOG, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_EVENTLOG,
+                               &ndr_table_eventlog,
+                               NDR_EVENTLOG_CLOSEEVENTLOG,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(eventlog_CloseEventLog, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *handle = *r.out.handle;
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_eventlog_DeregisterEventSource(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx)
+NTSTATUS rpccli_eventlog_DeregisterEventSource(struct rpc_pipe_client *cli,
+                                              TALLOC_CTX *mem_ctx)
 {
        struct eventlog_DeregisterEventSource r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(eventlog_DeregisterEventSource, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_DEREGISTEREVENTSOURCE, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_EVENTLOG,
+                               &ndr_table_eventlog,
+                               NDR_EVENTLOG_DEREGISTEREVENTSOURCE,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(eventlog_DeregisterEventSource, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_eventlog_GetNumRecords(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t *number)
+NTSTATUS rpccli_eventlog_GetNumRecords(struct rpc_pipe_client *cli,
+                                      TALLOC_CTX *mem_ctx,
+                                      struct policy_handle *handle,
+                                      uint32_t *number)
 {
        struct eventlog_GetNumRecords r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(eventlog_GetNumRecords, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_GETNUMRECORDS, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_EVENTLOG,
+                               &ndr_table_eventlog,
+                               NDR_EVENTLOG_GETNUMRECORDS,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(eventlog_GetNumRecords, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *number = *r.out.number;
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_eventlog_GetOldestRecord(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx)
+NTSTATUS rpccli_eventlog_GetOldestRecord(struct rpc_pipe_client *cli,
+                                        TALLOC_CTX *mem_ctx)
 {
        struct eventlog_GetOldestRecord r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(eventlog_GetOldestRecord, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_GETOLDESTRECORD, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_EVENTLOG,
+                               &ndr_table_eventlog,
+                               NDR_EVENTLOG_GETOLDESTRECORD,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(eventlog_GetOldestRecord, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_eventlog_ChangeNotify(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx)
+NTSTATUS rpccli_eventlog_ChangeNotify(struct rpc_pipe_client *cli,
+                                     TALLOC_CTX *mem_ctx)
 {
        struct eventlog_ChangeNotify r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(eventlog_ChangeNotify, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_CHANGENOTIFY, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_EVENTLOG,
+                               &ndr_table_eventlog,
+                               NDR_EVENTLOG_CHANGENOTIFY,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(eventlog_ChangeNotify, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_eventlog_OpenEventLogW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct eventlog_OpenUnknown0 *unknown0, struct lsa_String logname, struct lsa_String servername, uint32_t unknown2, uint32_t unknown3, struct policy_handle *handle)
+NTSTATUS rpccli_eventlog_OpenEventLogW(struct rpc_pipe_client *cli,
+                                      TALLOC_CTX *mem_ctx,
+                                      struct eventlog_OpenUnknown0 *unknown0,
+                                      struct lsa_String logname,
+                                      struct lsa_String servername,
+                                      uint32_t unknown2,
+                                      uint32_t unknown3,
+                                      struct policy_handle *handle)
 {
        struct eventlog_OpenEventLogW r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.unknown0 = unknown0;
        r.in.logname = logname;
        r.in.servername = servername;
        r.in.unknown2 = unknown2;
        r.in.unknown3 = unknown3;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(eventlog_OpenEventLogW, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_OPENEVENTLOGW, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_EVENTLOG,
+                               &ndr_table_eventlog,
+                               NDR_EVENTLOG_OPENEVENTLOGW,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(eventlog_OpenEventLogW, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *handle = *r.out.handle;
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_eventlog_RegisterEventSourceW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx)
+NTSTATUS rpccli_eventlog_RegisterEventSourceW(struct rpc_pipe_client *cli,
+                                             TALLOC_CTX *mem_ctx)
 {
        struct eventlog_RegisterEventSourceW r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(eventlog_RegisterEventSourceW, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_REGISTEREVENTSOURCEW, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_EVENTLOG,
+                               &ndr_table_eventlog,
+                               NDR_EVENTLOG_REGISTEREVENTSOURCEW,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(eventlog_RegisterEventSourceW, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_eventlog_OpenBackupEventLogW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx)
+NTSTATUS rpccli_eventlog_OpenBackupEventLogW(struct rpc_pipe_client *cli,
+                                            TALLOC_CTX *mem_ctx)
 {
        struct eventlog_OpenBackupEventLogW r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(eventlog_OpenBackupEventLogW, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_OPENBACKUPEVENTLOGW, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_EVENTLOG,
+                               &ndr_table_eventlog,
+                               NDR_EVENTLOG_OPENBACKUPEVENTLOGW,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(eventlog_OpenBackupEventLogW, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_eventlog_ReadEventLogW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t flags, uint32_t offset, uint32_t number_of_bytes, uint8_t *data, uint32_t *sent_size, uint32_t *real_size)
+NTSTATUS rpccli_eventlog_ReadEventLogW(struct rpc_pipe_client *cli,
+                                      TALLOC_CTX *mem_ctx,
+                                      struct policy_handle *handle,
+                                      uint32_t flags,
+                                      uint32_t offset,
+                                      uint32_t number_of_bytes,
+                                      uint8_t *data,
+                                      uint32_t *sent_size,
+                                      uint32_t *real_size)
 {
        struct eventlog_ReadEventLogW r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.flags = flags;
        r.in.offset = offset;
        r.in.number_of_bytes = number_of_bytes;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(eventlog_ReadEventLogW, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_READEVENTLOGW, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_EVENTLOG,
+                               &ndr_table_eventlog,
+                               NDR_EVENTLOG_READEVENTLOGW,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(eventlog_ReadEventLogW, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        memcpy(data, r.out.data, r.in.number_of_bytes);
        *sent_size = *r.out.sent_size;
        *real_size = *r.out.real_size;
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_eventlog_ReportEventW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx)
+NTSTATUS rpccli_eventlog_ReportEventW(struct rpc_pipe_client *cli,
+                                     TALLOC_CTX *mem_ctx)
 {
        struct eventlog_ReportEventW r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(eventlog_ReportEventW, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_REPORTEVENTW, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_EVENTLOG,
+                               &ndr_table_eventlog,
+                               NDR_EVENTLOG_REPORTEVENTW,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(eventlog_ReportEventW, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_eventlog_ClearEventLogA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx)
+NTSTATUS rpccli_eventlog_ClearEventLogA(struct rpc_pipe_client *cli,
+                                       TALLOC_CTX *mem_ctx)
 {
        struct eventlog_ClearEventLogA r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(eventlog_ClearEventLogA, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_CLEAREVENTLOGA, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_EVENTLOG,
+                               &ndr_table_eventlog,
+                               NDR_EVENTLOG_CLEAREVENTLOGA,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(eventlog_ClearEventLogA, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_eventlog_BackupEventLogA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx)
+NTSTATUS rpccli_eventlog_BackupEventLogA(struct rpc_pipe_client *cli,
+                                        TALLOC_CTX *mem_ctx)
 {
        struct eventlog_BackupEventLogA r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(eventlog_BackupEventLogA, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_BACKUPEVENTLOGA, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_EVENTLOG,
+                               &ndr_table_eventlog,
+                               NDR_EVENTLOG_BACKUPEVENTLOGA,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(eventlog_BackupEventLogA, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_eventlog_OpenEventLogA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx)
+NTSTATUS rpccli_eventlog_OpenEventLogA(struct rpc_pipe_client *cli,
+                                      TALLOC_CTX *mem_ctx)
 {
        struct eventlog_OpenEventLogA r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(eventlog_OpenEventLogA, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_OPENEVENTLOGA, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_EVENTLOG,
+                               &ndr_table_eventlog,
+                               NDR_EVENTLOG_OPENEVENTLOGA,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(eventlog_OpenEventLogA, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_eventlog_RegisterEventSourceA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx)
+NTSTATUS rpccli_eventlog_RegisterEventSourceA(struct rpc_pipe_client *cli,
+                                             TALLOC_CTX *mem_ctx)
 {
        struct eventlog_RegisterEventSourceA r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(eventlog_RegisterEventSourceA, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_REGISTEREVENTSOURCEA, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_EVENTLOG,
+                               &ndr_table_eventlog,
+                               NDR_EVENTLOG_REGISTEREVENTSOURCEA,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(eventlog_RegisterEventSourceA, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_eventlog_OpenBackupEventLogA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx)
+NTSTATUS rpccli_eventlog_OpenBackupEventLogA(struct rpc_pipe_client *cli,
+                                            TALLOC_CTX *mem_ctx)
 {
        struct eventlog_OpenBackupEventLogA r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(eventlog_OpenBackupEventLogA, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_OPENBACKUPEVENTLOGA, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_EVENTLOG,
+                               &ndr_table_eventlog,
+                               NDR_EVENTLOG_OPENBACKUPEVENTLOGA,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(eventlog_OpenBackupEventLogA, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_eventlog_ReadEventLogA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx)
+NTSTATUS rpccli_eventlog_ReadEventLogA(struct rpc_pipe_client *cli,
+                                      TALLOC_CTX *mem_ctx)
 {
        struct eventlog_ReadEventLogA r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(eventlog_ReadEventLogA, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_READEVENTLOGA, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_EVENTLOG,
+                               &ndr_table_eventlog,
+                               NDR_EVENTLOG_READEVENTLOGA,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(eventlog_ReadEventLogA, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_eventlog_ReportEventA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx)
+NTSTATUS rpccli_eventlog_ReportEventA(struct rpc_pipe_client *cli,
+                                     TALLOC_CTX *mem_ctx)
 {
        struct eventlog_ReportEventA r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(eventlog_ReportEventA, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_REPORTEVENTA, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_EVENTLOG,
+                               &ndr_table_eventlog,
+                               NDR_EVENTLOG_REPORTEVENTA,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(eventlog_ReportEventA, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_eventlog_RegisterClusterSvc(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx)
+NTSTATUS rpccli_eventlog_RegisterClusterSvc(struct rpc_pipe_client *cli,
+                                           TALLOC_CTX *mem_ctx)
 {
        struct eventlog_RegisterClusterSvc r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(eventlog_RegisterClusterSvc, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_REGISTERCLUSTERSVC, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_EVENTLOG,
+                               &ndr_table_eventlog,
+                               NDR_EVENTLOG_REGISTERCLUSTERSVC,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(eventlog_RegisterClusterSvc, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_eventlog_DeregisterClusterSvc(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx)
+NTSTATUS rpccli_eventlog_DeregisterClusterSvc(struct rpc_pipe_client *cli,
+                                             TALLOC_CTX *mem_ctx)
 {
        struct eventlog_DeregisterClusterSvc r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(eventlog_DeregisterClusterSvc, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_DEREGISTERCLUSTERSVC, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_EVENTLOG,
+                               &ndr_table_eventlog,
+                               NDR_EVENTLOG_DEREGISTERCLUSTERSVC,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(eventlog_DeregisterClusterSvc, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_eventlog_WriteClusterEvents(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx)
+NTSTATUS rpccli_eventlog_WriteClusterEvents(struct rpc_pipe_client *cli,
+                                           TALLOC_CTX *mem_ctx)
 {
        struct eventlog_WriteClusterEvents r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(eventlog_WriteClusterEvents, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_WRITECLUSTEREVENTS, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_EVENTLOG,
+                               &ndr_table_eventlog,
+                               NDR_EVENTLOG_WRITECLUSTEREVENTS,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(eventlog_WriteClusterEvents, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_eventlog_GetLogIntormation(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx)
+NTSTATUS rpccli_eventlog_GetLogIntormation(struct rpc_pipe_client *cli,
+                                          TALLOC_CTX *mem_ctx)
 {
        struct eventlog_GetLogIntormation r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(eventlog_GetLogIntormation, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_GETLOGINTORMATION, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_EVENTLOG,
+                               &ndr_table_eventlog,
+                               NDR_EVENTLOG_GETLOGINTORMATION,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(eventlog_GetLogIntormation, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_eventlog_FlushEventLog(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle)
+NTSTATUS rpccli_eventlog_FlushEventLog(struct rpc_pipe_client *cli,
+                                      TALLOC_CTX *mem_ctx,
+                                      struct policy_handle *handle)
 {
        struct eventlog_FlushEventLog r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(eventlog_FlushEventLog, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_FLUSHEVENTLOG, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_EVENTLOG,
+                               &ndr_table_eventlog,
+                               NDR_EVENTLOG_FLUSHEVENTLOG,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(eventlog_FlushEventLog, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return r.out.result;
 }
index 9024641795618f04134b8db6c0cd91deaabd6302..f75355c390442ad7e78a242729d625d6ce3ac88a 100644 (file)
@@ -1,28 +1,71 @@
 #include "librpc/gen_ndr/ndr_eventlog.h"
 #ifndef __CLI_EVENTLOG__
 #define __CLI_EVENTLOG__
-NTSTATUS rpccli_eventlog_ClearEventLogW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_String *unknown);
-NTSTATUS rpccli_eventlog_BackupEventLogW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx);
-NTSTATUS rpccli_eventlog_CloseEventLog(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle);
-NTSTATUS rpccli_eventlog_DeregisterEventSource(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx);
-NTSTATUS rpccli_eventlog_GetNumRecords(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t *number);
-NTSTATUS rpccli_eventlog_GetOldestRecord(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx);
-NTSTATUS rpccli_eventlog_ChangeNotify(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx);
-NTSTATUS rpccli_eventlog_OpenEventLogW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct eventlog_OpenUnknown0 *unknown0, struct lsa_String logname, struct lsa_String servername, uint32_t unknown2, uint32_t unknown3, struct policy_handle *handle);
-NTSTATUS rpccli_eventlog_RegisterEventSourceW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx);
-NTSTATUS rpccli_eventlog_OpenBackupEventLogW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx);
-NTSTATUS rpccli_eventlog_ReadEventLogW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t flags, uint32_t offset, uint32_t number_of_bytes, uint8_t *data, uint32_t *sent_size, uint32_t *real_size);
-NTSTATUS rpccli_eventlog_ReportEventW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx);
-NTSTATUS rpccli_eventlog_ClearEventLogA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx);
-NTSTATUS rpccli_eventlog_BackupEventLogA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx);
-NTSTATUS rpccli_eventlog_OpenEventLogA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx);
-NTSTATUS rpccli_eventlog_RegisterEventSourceA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx);
-NTSTATUS rpccli_eventlog_OpenBackupEventLogA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx);
-NTSTATUS rpccli_eventlog_ReadEventLogA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx);
-NTSTATUS rpccli_eventlog_ReportEventA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx);
-NTSTATUS rpccli_eventlog_RegisterClusterSvc(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx);
-NTSTATUS rpccli_eventlog_DeregisterClusterSvc(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx);
-NTSTATUS rpccli_eventlog_WriteClusterEvents(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx);
-NTSTATUS rpccli_eventlog_GetLogIntormation(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx);
-NTSTATUS rpccli_eventlog_FlushEventLog(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle);
+NTSTATUS rpccli_eventlog_ClearEventLogW(struct rpc_pipe_client *cli,
+                                       TALLOC_CTX *mem_ctx,
+                                       struct policy_handle *handle,
+                                       struct lsa_String *unknown);
+NTSTATUS rpccli_eventlog_BackupEventLogW(struct rpc_pipe_client *cli,
+                                        TALLOC_CTX *mem_ctx);
+NTSTATUS rpccli_eventlog_CloseEventLog(struct rpc_pipe_client *cli,
+                                      TALLOC_CTX *mem_ctx,
+                                      struct policy_handle *handle);
+NTSTATUS rpccli_eventlog_DeregisterEventSource(struct rpc_pipe_client *cli,
+                                              TALLOC_CTX *mem_ctx);
+NTSTATUS rpccli_eventlog_GetNumRecords(struct rpc_pipe_client *cli,
+                                      TALLOC_CTX *mem_ctx,
+                                      struct policy_handle *handle,
+                                      uint32_t *number);
+NTSTATUS rpccli_eventlog_GetOldestRecord(struct rpc_pipe_client *cli,
+                                        TALLOC_CTX *mem_ctx);
+NTSTATUS rpccli_eventlog_ChangeNotify(struct rpc_pipe_client *cli,
+                                     TALLOC_CTX *mem_ctx);
+NTSTATUS rpccli_eventlog_OpenEventLogW(struct rpc_pipe_client *cli,
+                                      TALLOC_CTX *mem_ctx,
+                                      struct eventlog_OpenUnknown0 *unknown0,
+                                      struct lsa_String logname,
+                                      struct lsa_String servername,
+                                      uint32_t unknown2,
+                                      uint32_t unknown3,
+                                      struct policy_handle *handle);
+NTSTATUS rpccli_eventlog_RegisterEventSourceW(struct rpc_pipe_client *cli,
+                                             TALLOC_CTX *mem_ctx);
+NTSTATUS rpccli_eventlog_OpenBackupEventLogW(struct rpc_pipe_client *cli,
+                                            TALLOC_CTX *mem_ctx);
+NTSTATUS rpccli_eventlog_ReadEventLogW(struct rpc_pipe_client *cli,
+                                      TALLOC_CTX *mem_ctx,
+                                      struct policy_handle *handle,
+                                      uint32_t flags,
+                                      uint32_t offset,
+                                      uint32_t number_of_bytes,
+                                      uint8_t *data,
+                                      uint32_t *sent_size,
+                                      uint32_t *real_size);
+NTSTATUS rpccli_eventlog_ReportEventW(struct rpc_pipe_client *cli,
+                                     TALLOC_CTX *mem_ctx);
+NTSTATUS rpccli_eventlog_ClearEventLogA(struct rpc_pipe_client *cli,
+                                       TALLOC_CTX *mem_ctx);
+NTSTATUS rpccli_eventlog_BackupEventLogA(struct rpc_pipe_client *cli,
+                                        TALLOC_CTX *mem_ctx);
+NTSTATUS rpccli_eventlog_OpenEventLogA(struct rpc_pipe_client *cli,
+                                      TALLOC_CTX *mem_ctx);
+NTSTATUS rpccli_eventlog_RegisterEventSourceA(struct rpc_pipe_client *cli,
+                                             TALLOC_CTX *mem_ctx);
+NTSTATUS rpccli_eventlog_OpenBackupEventLogA(struct rpc_pipe_client *cli,
+                                            TALLOC_CTX *mem_ctx);
+NTSTATUS rpccli_eventlog_ReadEventLogA(struct rpc_pipe_client *cli,
+                                      TALLOC_CTX *mem_ctx);
+NTSTATUS rpccli_eventlog_ReportEventA(struct rpc_pipe_client *cli,
+                                     TALLOC_CTX *mem_ctx);
+NTSTATUS rpccli_eventlog_RegisterClusterSvc(struct rpc_pipe_client *cli,
+                                           TALLOC_CTX *mem_ctx);
+NTSTATUS rpccli_eventlog_DeregisterClusterSvc(struct rpc_pipe_client *cli,
+                                             TALLOC_CTX *mem_ctx);
+NTSTATUS rpccli_eventlog_WriteClusterEvents(struct rpc_pipe_client *cli,
+                                           TALLOC_CTX *mem_ctx);
+NTSTATUS rpccli_eventlog_GetLogIntormation(struct rpc_pipe_client *cli,
+                                          TALLOC_CTX *mem_ctx);
+NTSTATUS rpccli_eventlog_FlushEventLog(struct rpc_pipe_client *cli,
+                                      TALLOC_CTX *mem_ctx,
+                                      struct policy_handle *handle);
 #endif /* __CLI_EVENTLOG__ */
index 57c5e60226bd783f28e4acf88424269669109feb..10f5c308d58670a190a75af33a7bc61dcbd0b2e3 100644 (file)
 #include "includes.h"
 #include "librpc/gen_ndr/cli_initshutdown.h"
 
-NTSTATUS rpccli_initshutdown_Init(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *hostname, struct initshutdown_String *message, uint32_t timeout, uint8_t force_apps, uint8_t reboot, WERROR *werror)
+NTSTATUS rpccli_initshutdown_Init(struct rpc_pipe_client *cli,
+                                 TALLOC_CTX *mem_ctx,
+                                 uint16_t *hostname,
+                                 struct initshutdown_String *message,
+                                 uint32_t timeout,
+                                 uint8_t force_apps,
+                                 uint8_t reboot,
+                                 WERROR *werror)
 {
        struct initshutdown_Init r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.hostname = hostname;
        r.in.message = message;
        r.in.timeout = timeout;
        r.in.force_apps = force_apps;
        r.in.reboot = reboot;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(initshutdown_Init, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_INITSHUTDOWN, &ndr_table_initshutdown, NDR_INITSHUTDOWN_INIT, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_INITSHUTDOWN,
+                               &ndr_table_initshutdown,
+                               NDR_INITSHUTDOWN_INIT,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(initshutdown_Init, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_initshutdown_Abort(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *server, WERROR *werror)
+NTSTATUS rpccli_initshutdown_Abort(struct rpc_pipe_client *cli,
+                                  TALLOC_CTX *mem_ctx,
+                                  uint16_t *server,
+                                  WERROR *werror)
 {
        struct initshutdown_Abort r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server = server;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(initshutdown_Abort, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_INITSHUTDOWN, &ndr_table_initshutdown, NDR_INITSHUTDOWN_ABORT, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_INITSHUTDOWN,
+                               &ndr_table_initshutdown,
+                               NDR_INITSHUTDOWN_ABORT,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(initshutdown_Abort, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_initshutdown_InitEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *hostname, struct initshutdown_String *message, uint32_t timeout, uint8_t force_apps, uint8_t reboot, uint32_t reason, WERROR *werror)
+NTSTATUS rpccli_initshutdown_InitEx(struct rpc_pipe_client *cli,
+                                   TALLOC_CTX *mem_ctx,
+                                   uint16_t *hostname,
+                                   struct initshutdown_String *message,
+                                   uint32_t timeout,
+                                   uint8_t force_apps,
+                                   uint8_t reboot,
+                                   uint32_t reason,
+                                   WERROR *werror)
 {
        struct initshutdown_InitEx r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.hostname = hostname;
        r.in.message = message;
@@ -90,30 +122,37 @@ NTSTATUS rpccli_initshutdown_InitEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem
        r.in.force_apps = force_apps;
        r.in.reboot = reboot;
        r.in.reason = reason;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(initshutdown_InitEx, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_INITSHUTDOWN, &ndr_table_initshutdown, NDR_INITSHUTDOWN_INITEX, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_INITSHUTDOWN,
+                               &ndr_table_initshutdown,
+                               NDR_INITSHUTDOWN_INITEX,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(initshutdown_InitEx, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
index e2a35b6d50cb20db1c98803b3a6c439252e5885b..624b79f94ce7f651fcf9aa326b91f776fb7e7dcd 100644 (file)
@@ -1,7 +1,25 @@
 #include "librpc/gen_ndr/ndr_initshutdown.h"
 #ifndef __CLI_INITSHUTDOWN__
 #define __CLI_INITSHUTDOWN__
-NTSTATUS rpccli_initshutdown_Init(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *hostname, struct initshutdown_String *message, uint32_t timeout, uint8_t force_apps, uint8_t reboot, WERROR *werror);
-NTSTATUS rpccli_initshutdown_Abort(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *server, WERROR *werror);
-NTSTATUS rpccli_initshutdown_InitEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *hostname, struct initshutdown_String *message, uint32_t timeout, uint8_t force_apps, uint8_t reboot, uint32_t reason, WERROR *werror);
+NTSTATUS rpccli_initshutdown_Init(struct rpc_pipe_client *cli,
+                                 TALLOC_CTX *mem_ctx,
+                                 uint16_t *hostname,
+                                 struct initshutdown_String *message,
+                                 uint32_t timeout,
+                                 uint8_t force_apps,
+                                 uint8_t reboot,
+                                 WERROR *werror);
+NTSTATUS rpccli_initshutdown_Abort(struct rpc_pipe_client *cli,
+                                  TALLOC_CTX *mem_ctx,
+                                  uint16_t *server,
+                                  WERROR *werror);
+NTSTATUS rpccli_initshutdown_InitEx(struct rpc_pipe_client *cli,
+                                   TALLOC_CTX *mem_ctx,
+                                   uint16_t *hostname,
+                                   struct initshutdown_String *message,
+                                   uint32_t timeout,
+                                   uint8_t force_apps,
+                                   uint8_t reboot,
+                                   uint32_t reason,
+                                   WERROR *werror);
 #endif /* __CLI_INITSHUTDOWN__ */
index 50186360f67038b430ba525211bf14c92738f251..76370cabf1ae62d869b4fdc6a2288e02da22abac 100644 (file)
 #include "includes.h"
 #include "librpc/gen_ndr/cli_lsa.h"
 
-NTSTATUS rpccli_lsa_Close(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle)
+NTSTATUS rpccli_lsa_Close(struct rpc_pipe_client *cli,
+                         TALLOC_CTX *mem_ctx,
+                         struct policy_handle *handle)
 {
        struct lsa_Close r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_Close, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_CLOSE, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_CLOSE,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_Close, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *handle = *r.out.handle;
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_Delete(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle)
+NTSTATUS rpccli_lsa_Delete(struct rpc_pipe_client *cli,
+                          TALLOC_CTX *mem_ctx,
+                          struct policy_handle *handle)
 {
        struct lsa_Delete r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_Delete, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_DELETE, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_DELETE,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_Delete, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_EnumPrivs(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t *resume_handle, uint32_t max_count, struct lsa_PrivArray *privs)
+NTSTATUS rpccli_lsa_EnumPrivs(struct rpc_pipe_client *cli,
+                             TALLOC_CTX *mem_ctx,
+                             struct policy_handle *handle,
+                             uint32_t *resume_handle,
+                             uint32_t max_count,
+                             struct lsa_PrivArray *privs)
 {
        struct lsa_EnumPrivs r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.resume_handle = resume_handle;
        r.in.max_count = max_count;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_EnumPrivs, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_ENUMPRIVS, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_ENUMPRIVS,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_EnumPrivs, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *resume_handle = *r.out.resume_handle;
        *privs = *r.out.privs;
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_QuerySecurity(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t sec_info, struct sec_desc_buf *sdbuf)
+NTSTATUS rpccli_lsa_QuerySecurity(struct rpc_pipe_client *cli,
+                                 TALLOC_CTX *mem_ctx,
+                                 struct policy_handle *handle,
+                                 uint32_t sec_info,
+                                 struct sec_desc_buf *sdbuf)
 {
        struct lsa_QuerySecurity r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.sec_info = sec_info;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_QuerySecurity, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_QUERYSECURITY, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_QUERYSECURITY,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_QuerySecurity, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        if (sdbuf && r.out.sdbuf) {
                *sdbuf = *r.out.sdbuf;
        }
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_SetSecObj(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx)
+NTSTATUS rpccli_lsa_SetSecObj(struct rpc_pipe_client *cli,
+                             TALLOC_CTX *mem_ctx)
 {
        struct lsa_SetSecObj r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_SetSecObj, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_SETSECOBJ, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_SETSECOBJ,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_SetSecObj, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_ChangePassword(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx)
+NTSTATUS rpccli_lsa_ChangePassword(struct rpc_pipe_client *cli,
+                                  TALLOC_CTX *mem_ctx)
 {
        struct lsa_ChangePassword r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_ChangePassword, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_CHANGEPASSWORD, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_CHANGEPASSWORD,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_ChangePassword, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_OpenPolicy(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *system_name, struct lsa_ObjectAttribute *attr, uint32_t access_mask, struct policy_handle *handle)
+NTSTATUS rpccli_lsa_OpenPolicy(struct rpc_pipe_client *cli,
+                              TALLOC_CTX *mem_ctx,
+                              uint16_t *system_name,
+                              struct lsa_ObjectAttribute *attr,
+                              uint32_t access_mask,
+                              struct policy_handle *handle)
 {
        struct lsa_OpenPolicy r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.system_name = system_name;
        r.in.attr = attr;
        r.in.access_mask = access_mask;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_OpenPolicy, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_OPENPOLICY, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_OPENPOLICY,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_OpenPolicy, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *handle = *r.out.handle;
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_QueryInfoPolicy(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint16_t level, union lsa_PolicyInformation *info)
+NTSTATUS rpccli_lsa_QueryInfoPolicy(struct rpc_pipe_client *cli,
+                                   TALLOC_CTX *mem_ctx,
+                                   struct policy_handle *handle,
+                                   enum lsa_PolicyInfo level,
+                                   union lsa_PolicyInformation *info)
 {
        struct lsa_QueryInfoPolicy r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.level = level;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_QueryInfoPolicy, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_QUERYINFOPOLICY, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_QUERYINFOPOLICY,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_QueryInfoPolicy, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        if (info && r.out.info) {
                *info = *r.out.info;
        }
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_SetInfoPolicy(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx)
+NTSTATUS rpccli_lsa_SetInfoPolicy(struct rpc_pipe_client *cli,
+                                 TALLOC_CTX *mem_ctx,
+                                 struct policy_handle *handle,
+                                 enum lsa_PolicyInfo level,
+                                 union lsa_PolicyInformation *info)
 {
        struct lsa_SetInfoPolicy r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+       r.in.handle = handle;
+       r.in.level = level;
+       r.in.info = info;
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_SetInfoPolicy, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_SETINFOPOLICY, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_SETINFOPOLICY,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_SetInfoPolicy, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_ClearAuditLog(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx)
+NTSTATUS rpccli_lsa_ClearAuditLog(struct rpc_pipe_client *cli,
+                                 TALLOC_CTX *mem_ctx)
 {
        struct lsa_ClearAuditLog r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_ClearAuditLog, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_CLEARAUDITLOG, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_CLEARAUDITLOG,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_ClearAuditLog, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_CreateAccount(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct dom_sid2 *sid, uint32_t access_mask, struct policy_handle *acct_handle)
+NTSTATUS rpccli_lsa_CreateAccount(struct rpc_pipe_client *cli,
+                                 TALLOC_CTX *mem_ctx,
+                                 struct policy_handle *handle,
+                                 struct dom_sid2 *sid,
+                                 uint32_t access_mask,
+                                 struct policy_handle *acct_handle)
 {
        struct lsa_CreateAccount r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.sid = sid;
        r.in.access_mask = access_mask;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_CreateAccount, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_CREATEACCOUNT, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_CREATEACCOUNT,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_CreateAccount, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *acct_handle = *r.out.acct_handle;
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_EnumAccounts(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t *resume_handle, uint32_t num_entries, struct lsa_SidArray *sids)
+NTSTATUS rpccli_lsa_EnumAccounts(struct rpc_pipe_client *cli,
+                                TALLOC_CTX *mem_ctx,
+                                struct policy_handle *handle,
+                                uint32_t *resume_handle,
+                                uint32_t num_entries,
+                                struct lsa_SidArray *sids)
 {
        struct lsa_EnumAccounts r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.resume_handle = resume_handle;
        r.in.num_entries = num_entries;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_EnumAccounts, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_ENUMACCOUNTS, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_ENUMACCOUNTS,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_EnumAccounts, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *resume_handle = *r.out.resume_handle;
        *sids = *r.out.sids;
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_CreateTrustedDomain(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_DomainInfo *info, uint32_t access_mask, struct policy_handle *trustdom_handle)
+NTSTATUS rpccli_lsa_CreateTrustedDomain(struct rpc_pipe_client *cli,
+                                       TALLOC_CTX *mem_ctx,
+                                       struct policy_handle *handle,
+                                       struct lsa_DomainInfo *info,
+                                       uint32_t access_mask,
+                                       struct policy_handle *trustdom_handle)
 {
        struct lsa_CreateTrustedDomain r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.info = info;
        r.in.access_mask = access_mask;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_CreateTrustedDomain, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_CREATETRUSTEDDOMAIN, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_CREATETRUSTEDDOMAIN,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_CreateTrustedDomain, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *trustdom_handle = *r.out.trustdom_handle;
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_EnumTrustDom(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t *resume_handle, uint32_t max_size, struct lsa_DomainList *domains)
+NTSTATUS rpccli_lsa_EnumTrustDom(struct rpc_pipe_client *cli,
+                                TALLOC_CTX *mem_ctx,
+                                struct policy_handle *handle,
+                                uint32_t *resume_handle,
+                                uint32_t max_size,
+                                struct lsa_DomainList *domains)
 {
        struct lsa_EnumTrustDom r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.resume_handle = resume_handle;
        r.in.max_size = max_size;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_EnumTrustDom, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_ENUMTRUSTDOM, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_ENUMTRUSTDOM,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_EnumTrustDom, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *resume_handle = *r.out.resume_handle;
        *domains = *r.out.domains;
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_LookupNames(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t num_names, struct lsa_String *names, struct lsa_RefDomainList *domains, struct lsa_TransSidArray *sids, uint16_t level, uint32_t *count)
+NTSTATUS rpccli_lsa_LookupNames(struct rpc_pipe_client *cli,
+                               TALLOC_CTX *mem_ctx,
+                               struct policy_handle *handle,
+                               uint32_t num_names,
+                               struct lsa_String *names,
+                               struct lsa_RefDomainList *domains,
+                               struct lsa_TransSidArray *sids,
+                               enum lsa_LookupNamesLevel level,
+                               uint32_t *count)
 {
        struct lsa_LookupNames r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.num_names = num_names;
@@ -464,540 +622,715 @@ NTSTATUS rpccli_lsa_LookupNames(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx
        r.in.sids = sids;
        r.in.level = level;
        r.in.count = count;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_LookupNames, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_LOOKUPNAMES, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_LOOKUPNAMES,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_LookupNames, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        if (domains && r.out.domains) {
                *domains = *r.out.domains;
        }
        *sids = *r.out.sids;
        *count = *r.out.count;
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_LookupSids(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_SidArray *sids, struct lsa_RefDomainList *domains, struct lsa_TransNameArray *names, uint16_t level, uint32_t *count)
+NTSTATUS rpccli_lsa_LookupSids(struct rpc_pipe_client *cli,
+                              TALLOC_CTX *mem_ctx,
+                              struct policy_handle *handle,
+                              struct lsa_SidArray *sids,
+                              struct lsa_RefDomainList *domains,
+                              struct lsa_TransNameArray *names,
+                              uint16_t level,
+                              uint32_t *count)
 {
        struct lsa_LookupSids r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.sids = sids;
        r.in.names = names;
        r.in.level = level;
        r.in.count = count;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_LookupSids, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_LOOKUPSIDS, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_LOOKUPSIDS,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_LookupSids, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        if (domains && r.out.domains) {
                *domains = *r.out.domains;
        }
        *names = *r.out.names;
        *count = *r.out.count;
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_CreateSecret(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_String name, uint32_t access_mask, struct policy_handle *sec_handle)
+NTSTATUS rpccli_lsa_CreateSecret(struct rpc_pipe_client *cli,
+                                TALLOC_CTX *mem_ctx,
+                                struct policy_handle *handle,
+                                struct lsa_String name,
+                                uint32_t access_mask,
+                                struct policy_handle *sec_handle)
 {
        struct lsa_CreateSecret r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.name = name;
        r.in.access_mask = access_mask;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_CreateSecret, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_CREATESECRET, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_CREATESECRET,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_CreateSecret, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *sec_handle = *r.out.sec_handle;
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_OpenAccount(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct dom_sid2 *sid, uint32_t access_mask, struct policy_handle *acct_handle)
+NTSTATUS rpccli_lsa_OpenAccount(struct rpc_pipe_client *cli,
+                               TALLOC_CTX *mem_ctx,
+                               struct policy_handle *handle,
+                               struct dom_sid2 *sid,
+                               uint32_t access_mask,
+                               struct policy_handle *acct_handle)
 {
        struct lsa_OpenAccount r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.sid = sid;
        r.in.access_mask = access_mask;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_OpenAccount, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_OPENACCOUNT, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_OPENACCOUNT,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_OpenAccount, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *acct_handle = *r.out.acct_handle;
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_EnumPrivsAccount(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_PrivilegeSet *privs)
+NTSTATUS rpccli_lsa_EnumPrivsAccount(struct rpc_pipe_client *cli,
+                                    TALLOC_CTX *mem_ctx,
+                                    struct policy_handle *handle,
+                                    struct lsa_PrivilegeSet *privs)
 {
        struct lsa_EnumPrivsAccount r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_EnumPrivsAccount, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_ENUMPRIVSACCOUNT, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_ENUMPRIVSACCOUNT,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_EnumPrivsAccount, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        if (privs && r.out.privs) {
                *privs = *r.out.privs;
        }
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_AddPrivilegesToAccount(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_PrivilegeSet *privs)
+NTSTATUS rpccli_lsa_AddPrivilegesToAccount(struct rpc_pipe_client *cli,
+                                          TALLOC_CTX *mem_ctx,
+                                          struct policy_handle *handle,
+                                          struct lsa_PrivilegeSet *privs)
 {
        struct lsa_AddPrivilegesToAccount r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.privs = privs;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_AddPrivilegesToAccount, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_ADDPRIVILEGESTOACCOUNT, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_ADDPRIVILEGESTOACCOUNT,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_AddPrivilegesToAccount, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_RemovePrivilegesFromAccount(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint8_t remove_all, struct lsa_PrivilegeSet *privs)
+NTSTATUS rpccli_lsa_RemovePrivilegesFromAccount(struct rpc_pipe_client *cli,
+                                               TALLOC_CTX *mem_ctx,
+                                               struct policy_handle *handle,
+                                               uint8_t remove_all,
+                                               struct lsa_PrivilegeSet *privs)
 {
        struct lsa_RemovePrivilegesFromAccount r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.remove_all = remove_all;
        r.in.privs = privs;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_RemovePrivilegesFromAccount, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_REMOVEPRIVILEGESFROMACCOUNT, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_REMOVEPRIVILEGESFROMACCOUNT,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_RemovePrivilegesFromAccount, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_GetQuotasForAccount(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx)
+NTSTATUS rpccli_lsa_GetQuotasForAccount(struct rpc_pipe_client *cli,
+                                       TALLOC_CTX *mem_ctx)
 {
        struct lsa_GetQuotasForAccount r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_GetQuotasForAccount, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_GETQUOTASFORACCOUNT, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_GETQUOTASFORACCOUNT,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_GetQuotasForAccount, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_SetQuotasForAccount(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx)
+NTSTATUS rpccli_lsa_SetQuotasForAccount(struct rpc_pipe_client *cli,
+                                       TALLOC_CTX *mem_ctx)
 {
        struct lsa_SetQuotasForAccount r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_SetQuotasForAccount, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_SETQUOTASFORACCOUNT, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_SETQUOTASFORACCOUNT,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_SetQuotasForAccount, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_GetSystemAccessAccount(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx)
+NTSTATUS rpccli_lsa_GetSystemAccessAccount(struct rpc_pipe_client *cli,
+                                          TALLOC_CTX *mem_ctx)
 {
        struct lsa_GetSystemAccessAccount r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_GetSystemAccessAccount, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_GETSYSTEMACCESSACCOUNT, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_GETSYSTEMACCESSACCOUNT,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_GetSystemAccessAccount, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_SetSystemAccessAccount(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx)
+NTSTATUS rpccli_lsa_SetSystemAccessAccount(struct rpc_pipe_client *cli,
+                                          TALLOC_CTX *mem_ctx)
 {
        struct lsa_SetSystemAccessAccount r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_SetSystemAccessAccount, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_SETSYSTEMACCESSACCOUNT, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_SETSYSTEMACCESSACCOUNT,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_SetSystemAccessAccount, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_OpenTrustedDomain(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct dom_sid2 *sid, uint32_t access_mask, struct policy_handle *trustdom_handle)
+NTSTATUS rpccli_lsa_OpenTrustedDomain(struct rpc_pipe_client *cli,
+                                     TALLOC_CTX *mem_ctx,
+                                     struct policy_handle *handle,
+                                     struct dom_sid2 *sid,
+                                     uint32_t access_mask,
+                                     struct policy_handle *trustdom_handle)
 {
        struct lsa_OpenTrustedDomain r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.sid = sid;
        r.in.access_mask = access_mask;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_OpenTrustedDomain, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_OPENTRUSTEDDOMAIN, &r);
-       
-       if (!NT_STATUS_IS_OK(status)) {
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_OPENTRUSTEDDOMAIN,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_OpenTrustedDomain, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *trustdom_handle = *r.out.trustdom_handle;
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_QueryTrustedDomainInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *trustdom_handle, enum lsa_TrustDomInfoEnum level, union lsa_TrustedDomainInfo *info)
+NTSTATUS rpccli_lsa_QueryTrustedDomainInfo(struct rpc_pipe_client *cli,
+                                          TALLOC_CTX *mem_ctx,
+                                          struct policy_handle *trustdom_handle,
+                                          enum lsa_TrustDomInfoEnum level,
+                                          union lsa_TrustedDomainInfo *info)
 {
        struct lsa_QueryTrustedDomainInfo r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.trustdom_handle = trustdom_handle;
        r.in.level = level;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_QueryTrustedDomainInfo, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_QUERYTRUSTEDDOMAININFO, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_QUERYTRUSTEDDOMAININFO,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_QueryTrustedDomainInfo, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        if (info && r.out.info) {
                *info = *r.out.info;
        }
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_SetInformationTrustedDomain(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx)
+NTSTATUS rpccli_lsa_SetInformationTrustedDomain(struct rpc_pipe_client *cli,
+                                               TALLOC_CTX *mem_ctx)
 {
        struct lsa_SetInformationTrustedDomain r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_SetInformationTrustedDomain, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_SETINFORMATIONTRUSTEDDOMAIN, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_SETINFORMATIONTRUSTEDDOMAIN,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_SetInformationTrustedDomain, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_OpenSecret(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_String name, uint32_t access_mask, struct policy_handle *sec_handle)
+NTSTATUS rpccli_lsa_OpenSecret(struct rpc_pipe_client *cli,
+                              TALLOC_CTX *mem_ctx,
+                              struct policy_handle *handle,
+                              struct lsa_String name,
+                              uint32_t access_mask,
+                              struct policy_handle *sec_handle)
 {
        struct lsa_OpenSecret r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.name = name;
        r.in.access_mask = access_mask;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_OpenSecret, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_OPENSECRET, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_OPENSECRET,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_OpenSecret, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *sec_handle = *r.out.sec_handle;
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_SetSecret(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *sec_handle, struct lsa_DATA_BUF *new_val, struct lsa_DATA_BUF *old_val)
+NTSTATUS rpccli_lsa_SetSecret(struct rpc_pipe_client *cli,
+                             TALLOC_CTX *mem_ctx,
+                             struct policy_handle *sec_handle,
+                             struct lsa_DATA_BUF *new_val,
+                             struct lsa_DATA_BUF *old_val)
 {
        struct lsa_SetSecret r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.sec_handle = sec_handle;
        r.in.new_val = new_val;
        r.in.old_val = old_val;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_SetSecret, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_SETSECRET, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_SETSECRET,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_SetSecret, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_QuerySecret(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *sec_handle, struct lsa_DATA_BUF_PTR *new_val, NTTIME *new_mtime, struct lsa_DATA_BUF_PTR *old_val, NTTIME *old_mtime)
+NTSTATUS rpccli_lsa_QuerySecret(struct rpc_pipe_client *cli,
+                               TALLOC_CTX *mem_ctx,
+                               struct policy_handle *sec_handle,
+                               struct lsa_DATA_BUF_PTR *new_val,
+                               NTTIME *new_mtime,
+                               struct lsa_DATA_BUF_PTR *old_val,
+                               NTTIME *old_mtime)
 {
        struct lsa_QuerySecret r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.sec_handle = sec_handle;
        r.in.new_val = new_val;
        r.in.new_mtime = new_mtime;
        r.in.old_val = old_val;
        r.in.old_mtime = old_mtime;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_QuerySecret, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_QUERYSECRET, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_QUERYSECRET,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_QuerySecret, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        if (new_val && r.out.new_val) {
                *new_val = *r.out.new_val;
@@ -1011,484 +1344,641 @@ NTSTATUS rpccli_lsa_QuerySecret(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx
        if (old_mtime && r.out.old_mtime) {
                *old_mtime = *r.out.old_mtime;
        }
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_LookupPrivValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_String *name, struct lsa_LUID *luid)
+NTSTATUS rpccli_lsa_LookupPrivValue(struct rpc_pipe_client *cli,
+                                   TALLOC_CTX *mem_ctx,
+                                   struct policy_handle *handle,
+                                   struct lsa_String *name,
+                                   struct lsa_LUID *luid)
 {
        struct lsa_LookupPrivValue r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.name = name;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_LookupPrivValue, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_LOOKUPPRIVVALUE, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_LOOKUPPRIVVALUE,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_LookupPrivValue, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *luid = *r.out.luid;
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_LookupPrivName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_LUID *luid, struct lsa_StringLarge *name)
+NTSTATUS rpccli_lsa_LookupPrivName(struct rpc_pipe_client *cli,
+                                  TALLOC_CTX *mem_ctx,
+                                  struct policy_handle *handle,
+                                  struct lsa_LUID *luid,
+                                  struct lsa_StringLarge *name)
 {
        struct lsa_LookupPrivName r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.luid = luid;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_LookupPrivName, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_LOOKUPPRIVNAME, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_LOOKUPPRIVNAME,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_LookupPrivName, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        if (name && r.out.name) {
                *name = *r.out.name;
        }
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_LookupPrivDisplayName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_String *name, struct lsa_StringLarge *disp_name, uint16_t *language_id, uint16_t unknown)
+NTSTATUS rpccli_lsa_LookupPrivDisplayName(struct rpc_pipe_client *cli,
+                                         TALLOC_CTX *mem_ctx,
+                                         struct policy_handle *handle,
+                                         struct lsa_String *name,
+                                         struct lsa_StringLarge *disp_name,
+                                         uint16_t *language_id,
+                                         uint16_t unknown)
 {
        struct lsa_LookupPrivDisplayName r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.name = name;
        r.in.language_id = language_id;
        r.in.unknown = unknown;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_LookupPrivDisplayName, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_LOOKUPPRIVDISPLAYNAME, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_LOOKUPPRIVDISPLAYNAME,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_LookupPrivDisplayName, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        if (disp_name && r.out.disp_name) {
                *disp_name = *r.out.disp_name;
        }
        *language_id = *r.out.language_id;
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_DeleteObject(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx)
+NTSTATUS rpccli_lsa_DeleteObject(struct rpc_pipe_client *cli,
+                                TALLOC_CTX *mem_ctx)
 {
        struct lsa_DeleteObject r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_DeleteObject, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_DELETEOBJECT, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_DELETEOBJECT,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_DeleteObject, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_EnumAccountsWithUserRight(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_String *name, struct lsa_SidArray *sids)
+NTSTATUS rpccli_lsa_EnumAccountsWithUserRight(struct rpc_pipe_client *cli,
+                                             TALLOC_CTX *mem_ctx,
+                                             struct policy_handle *handle,
+                                             struct lsa_String *name,
+                                             struct lsa_SidArray *sids)
 {
        struct lsa_EnumAccountsWithUserRight r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.name = name;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_EnumAccountsWithUserRight, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_ENUMACCOUNTSWITHUSERRIGHT, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_ENUMACCOUNTSWITHUSERRIGHT,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_EnumAccountsWithUserRight, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *sids = *r.out.sids;
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_EnumAccountRights(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct dom_sid2 *sid, struct lsa_RightSet *rights)
+NTSTATUS rpccli_lsa_EnumAccountRights(struct rpc_pipe_client *cli,
+                                     TALLOC_CTX *mem_ctx,
+                                     struct policy_handle *handle,
+                                     struct dom_sid2 *sid,
+                                     struct lsa_RightSet *rights)
 {
        struct lsa_EnumAccountRights r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.sid = sid;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_EnumAccountRights, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_ENUMACCOUNTRIGHTS, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_ENUMACCOUNTRIGHTS,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_EnumAccountRights, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *rights = *r.out.rights;
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_AddAccountRights(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct dom_sid2 *sid, struct lsa_RightSet *rights)
+NTSTATUS rpccli_lsa_AddAccountRights(struct rpc_pipe_client *cli,
+                                    TALLOC_CTX *mem_ctx,
+                                    struct policy_handle *handle,
+                                    struct dom_sid2 *sid,
+                                    struct lsa_RightSet *rights)
 {
        struct lsa_AddAccountRights r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.sid = sid;
        r.in.rights = rights;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_AddAccountRights, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_ADDACCOUNTRIGHTS, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_ADDACCOUNTRIGHTS,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_AddAccountRights, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_RemoveAccountRights(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct dom_sid2 *sid, uint32_t unknown, struct lsa_RightSet *rights)
+NTSTATUS rpccli_lsa_RemoveAccountRights(struct rpc_pipe_client *cli,
+                                       TALLOC_CTX *mem_ctx,
+                                       struct policy_handle *handle,
+                                       struct dom_sid2 *sid,
+                                       uint32_t unknown,
+                                       struct lsa_RightSet *rights)
 {
        struct lsa_RemoveAccountRights r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.sid = sid;
        r.in.unknown = unknown;
        r.in.rights = rights;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_RemoveAccountRights, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_REMOVEACCOUNTRIGHTS, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_REMOVEACCOUNTRIGHTS,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_RemoveAccountRights, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_QueryTrustedDomainInfoBySid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct dom_sid2 *dom_sid, enum lsa_TrustDomInfoEnum level, union lsa_TrustedDomainInfo *info)
+NTSTATUS rpccli_lsa_QueryTrustedDomainInfoBySid(struct rpc_pipe_client *cli,
+                                               TALLOC_CTX *mem_ctx,
+                                               struct policy_handle *handle,
+                                               struct dom_sid2 *dom_sid,
+                                               enum lsa_TrustDomInfoEnum level,
+                                               union lsa_TrustedDomainInfo *info)
 {
        struct lsa_QueryTrustedDomainInfoBySid r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.dom_sid = dom_sid;
        r.in.level = level;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_QueryTrustedDomainInfoBySid, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_QUERYTRUSTEDDOMAININFOBYSID, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_QUERYTRUSTEDDOMAININFOBYSID,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_QueryTrustedDomainInfoBySid, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        if (info && r.out.info) {
                *info = *r.out.info;
        }
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_SetTrustedDomainInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx)
+NTSTATUS rpccli_lsa_SetTrustedDomainInfo(struct rpc_pipe_client *cli,
+                                        TALLOC_CTX *mem_ctx)
 {
        struct lsa_SetTrustedDomainInfo r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_SetTrustedDomainInfo, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_SETTRUSTEDDOMAININFO, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_SETTRUSTEDDOMAININFO,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_SetTrustedDomainInfo, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_DeleteTrustedDomain(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct dom_sid2 *dom_sid)
+NTSTATUS rpccli_lsa_DeleteTrustedDomain(struct rpc_pipe_client *cli,
+                                       TALLOC_CTX *mem_ctx,
+                                       struct policy_handle *handle,
+                                       struct dom_sid2 *dom_sid)
 {
        struct lsa_DeleteTrustedDomain r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.dom_sid = dom_sid;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_DeleteTrustedDomain, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_DELETETRUSTEDDOMAIN, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_DELETETRUSTEDDOMAIN,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_DeleteTrustedDomain, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_StorePrivateData(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx)
+NTSTATUS rpccli_lsa_StorePrivateData(struct rpc_pipe_client *cli,
+                                    TALLOC_CTX *mem_ctx)
 {
        struct lsa_StorePrivateData r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_StorePrivateData, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_STOREPRIVATEDATA, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_STOREPRIVATEDATA,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_StorePrivateData, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_RetrievePrivateData(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx)
+NTSTATUS rpccli_lsa_RetrievePrivateData(struct rpc_pipe_client *cli,
+                                       TALLOC_CTX *mem_ctx)
 {
        struct lsa_RetrievePrivateData r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_RetrievePrivateData, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_RETRIEVEPRIVATEDATA, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_RETRIEVEPRIVATEDATA,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_RetrievePrivateData, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_OpenPolicy2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *system_name, struct lsa_ObjectAttribute *attr, uint32_t access_mask, struct policy_handle *handle)
+NTSTATUS rpccli_lsa_OpenPolicy2(struct rpc_pipe_client *cli,
+                               TALLOC_CTX *mem_ctx,
+                               const char *system_name,
+                               struct lsa_ObjectAttribute *attr,
+                               uint32_t access_mask,
+                               struct policy_handle *handle)
 {
        struct lsa_OpenPolicy2 r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.system_name = system_name;
        r.in.attr = attr;
        r.in.access_mask = access_mask;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_OpenPolicy2, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_OPENPOLICY2, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_OPENPOLICY2,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_OpenPolicy2, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *handle = *r.out.handle;
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_GetUserName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *system_name, struct lsa_String *account_name, struct lsa_StringPointer *authority_name)
+NTSTATUS rpccli_lsa_GetUserName(struct rpc_pipe_client *cli,
+                               TALLOC_CTX *mem_ctx,
+                               const char *system_name,
+                               struct lsa_String *account_name,
+                               struct lsa_StringPointer *authority_name)
 {
        struct lsa_GetUserName r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.system_name = system_name;
        r.in.account_name = account_name;
        r.in.authority_name = authority_name;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_GetUserName, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_GETUSERNAME, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_GETUSERNAME,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_GetUserName, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        if (account_name && r.out.account_name) {
                *account_name = *r.out.account_name;
@@ -1496,369 +1986,498 @@ NTSTATUS rpccli_lsa_GetUserName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx
        if (authority_name && r.out.authority_name) {
                *authority_name = *r.out.authority_name;
        }
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_QueryInfoPolicy2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint16_t level, union lsa_PolicyInformation *info)
+NTSTATUS rpccli_lsa_QueryInfoPolicy2(struct rpc_pipe_client *cli,
+                                    TALLOC_CTX *mem_ctx,
+                                    struct policy_handle *handle,
+                                    enum lsa_PolicyInfo level,
+                                    union lsa_PolicyInformation *info)
 {
        struct lsa_QueryInfoPolicy2 r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.level = level;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_QueryInfoPolicy2, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_QUERYINFOPOLICY2, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_QUERYINFOPOLICY2,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_QueryInfoPolicy2, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        if (info && r.out.info) {
                *info = *r.out.info;
        }
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_SetInfoPolicy2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx)
+NTSTATUS rpccli_lsa_SetInfoPolicy2(struct rpc_pipe_client *cli,
+                                  TALLOC_CTX *mem_ctx,
+                                  struct policy_handle *handle,
+                                  enum lsa_PolicyInfo level,
+                                  union lsa_PolicyInformation *info)
 {
        struct lsa_SetInfoPolicy2 r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+       r.in.handle = handle;
+       r.in.level = level;
+       r.in.info = info;
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_SetInfoPolicy2, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_SETINFOPOLICY2, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_SETINFOPOLICY2,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_SetInfoPolicy2, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_QueryTrustedDomainInfoByName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_String trusted_domain, enum lsa_TrustDomInfoEnum level, union lsa_TrustedDomainInfo *info)
+NTSTATUS rpccli_lsa_QueryTrustedDomainInfoByName(struct rpc_pipe_client *cli,
+                                                TALLOC_CTX *mem_ctx,
+                                                struct policy_handle *handle,
+                                                struct lsa_String trusted_domain,
+                                                enum lsa_TrustDomInfoEnum level,
+                                                union lsa_TrustedDomainInfo *info)
 {
        struct lsa_QueryTrustedDomainInfoByName r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.trusted_domain = trusted_domain;
        r.in.level = level;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_QueryTrustedDomainInfoByName, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_QUERYTRUSTEDDOMAININFOBYNAME, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_QUERYTRUSTEDDOMAININFOBYNAME,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_QueryTrustedDomainInfoByName, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        if (info && r.out.info) {
                *info = *r.out.info;
        }
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_SetTrustedDomainInfoByName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_String trusted_domain, enum lsa_TrustDomInfoEnum level, union lsa_TrustedDomainInfo *info)
+NTSTATUS rpccli_lsa_SetTrustedDomainInfoByName(struct rpc_pipe_client *cli,
+                                              TALLOC_CTX *mem_ctx,
+                                              struct policy_handle *handle,
+                                              struct lsa_String trusted_domain,
+                                              enum lsa_TrustDomInfoEnum level,
+                                              union lsa_TrustedDomainInfo *info)
 {
        struct lsa_SetTrustedDomainInfoByName r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.trusted_domain = trusted_domain;
        r.in.level = level;
        r.in.info = info;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_SetTrustedDomainInfoByName, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_SETTRUSTEDDOMAININFOBYNAME, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_SETTRUSTEDDOMAININFOBYNAME,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_SetTrustedDomainInfoByName, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_EnumTrustedDomainsEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t *resume_handle, struct lsa_DomainListEx *domains, uint32_t max_size)
+NTSTATUS rpccli_lsa_EnumTrustedDomainsEx(struct rpc_pipe_client *cli,
+                                        TALLOC_CTX *mem_ctx,
+                                        struct policy_handle *handle,
+                                        uint32_t *resume_handle,
+                                        struct lsa_DomainListEx *domains,
+                                        uint32_t max_size)
 {
        struct lsa_EnumTrustedDomainsEx r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.resume_handle = resume_handle;
        r.in.max_size = max_size;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_EnumTrustedDomainsEx, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_ENUMTRUSTEDDOMAINSEX, &r);
-       
-       if (!NT_STATUS_IS_OK(status)) {
-               return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_ENUMTRUSTEDDOMAINSEX,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_EnumTrustedDomainsEx, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *resume_handle = *r.out.resume_handle;
        *domains = *r.out.domains;
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_CreateTrustedDomainEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx)
+NTSTATUS rpccli_lsa_CreateTrustedDomainEx(struct rpc_pipe_client *cli,
+                                         TALLOC_CTX *mem_ctx)
 {
        struct lsa_CreateTrustedDomainEx r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_CreateTrustedDomainEx, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_CREATETRUSTEDDOMAINEX, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_CREATETRUSTEDDOMAINEX,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_CreateTrustedDomainEx, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_CloseTrustedDomainEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle)
+NTSTATUS rpccli_lsa_CloseTrustedDomainEx(struct rpc_pipe_client *cli,
+                                        TALLOC_CTX *mem_ctx,
+                                        struct policy_handle *handle)
 {
        struct lsa_CloseTrustedDomainEx r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_CloseTrustedDomainEx, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_CLOSETRUSTEDDOMAINEX, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_CLOSETRUSTEDDOMAINEX,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_CloseTrustedDomainEx, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *handle = *r.out.handle;
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_QueryDomainInformationPolicy(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint16_t level, union lsa_DomainInformationPolicy *info)
+NTSTATUS rpccli_lsa_QueryDomainInformationPolicy(struct rpc_pipe_client *cli,
+                                                TALLOC_CTX *mem_ctx,
+                                                struct policy_handle *handle,
+                                                uint16_t level,
+                                                union lsa_DomainInformationPolicy *info)
 {
        struct lsa_QueryDomainInformationPolicy r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.level = level;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_QueryDomainInformationPolicy, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_QUERYDOMAININFORMATIONPOLICY, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_QUERYDOMAININFORMATIONPOLICY,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_QueryDomainInformationPolicy, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        if (info && r.out.info) {
                *info = *r.out.info;
        }
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_SetDomainInformationPolicy(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint16_t level, union lsa_DomainInformationPolicy *info)
+NTSTATUS rpccli_lsa_SetDomainInformationPolicy(struct rpc_pipe_client *cli,
+                                              TALLOC_CTX *mem_ctx,
+                                              struct policy_handle *handle,
+                                              uint16_t level,
+                                              union lsa_DomainInformationPolicy *info)
 {
        struct lsa_SetDomainInformationPolicy r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.level = level;
        r.in.info = info;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_SetDomainInformationPolicy, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_SETDOMAININFORMATIONPOLICY, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_SETDOMAININFORMATIONPOLICY,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_SetDomainInformationPolicy, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_OpenTrustedDomainByName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_String name, uint32_t access_mask, struct policy_handle *trustdom_handle)
+NTSTATUS rpccli_lsa_OpenTrustedDomainByName(struct rpc_pipe_client *cli,
+                                           TALLOC_CTX *mem_ctx,
+                                           struct policy_handle *handle,
+                                           struct lsa_String name,
+                                           uint32_t access_mask,
+                                           struct policy_handle *trustdom_handle)
 {
        struct lsa_OpenTrustedDomainByName r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.name = name;
        r.in.access_mask = access_mask;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_OpenTrustedDomainByName, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_OPENTRUSTEDDOMAINBYNAME, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_OPENTRUSTEDDOMAINBYNAME,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_OpenTrustedDomainByName, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *trustdom_handle = *r.out.trustdom_handle;
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_TestCall(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx)
+NTSTATUS rpccli_lsa_TestCall(struct rpc_pipe_client *cli,
+                            TALLOC_CTX *mem_ctx)
 {
        struct lsa_TestCall r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_TestCall, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_TESTCALL, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_TESTCALL,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_TestCall, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_LookupSids2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_SidArray *sids, struct lsa_RefDomainList *domains, struct lsa_TransNameArray2 *names, uint16_t level, uint32_t *count, uint32_t unknown1, uint32_t unknown2)
+NTSTATUS rpccli_lsa_LookupSids2(struct rpc_pipe_client *cli,
+                               TALLOC_CTX *mem_ctx,
+                               struct policy_handle *handle,
+                               struct lsa_SidArray *sids,
+                               struct lsa_RefDomainList *domains,
+                               struct lsa_TransNameArray2 *names,
+                               uint16_t level,
+                               uint32_t *count,
+                               uint32_t unknown1,
+                               uint32_t unknown2)
 {
        struct lsa_LookupSids2 r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.sids = sids;
@@ -1867,39 +2486,56 @@ NTSTATUS rpccli_lsa_LookupSids2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx
        r.in.count = count;
        r.in.unknown1 = unknown1;
        r.in.unknown2 = unknown2;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_LookupSids2, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_LOOKUPSIDS2, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_LOOKUPSIDS2,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_LookupSids2, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        if (domains && r.out.domains) {
                *domains = *r.out.domains;
        }
        *names = *r.out.names;
        *count = *r.out.count;
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_LookupNames2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t num_names, struct lsa_String *names, struct lsa_RefDomainList *domains, struct lsa_TransSidArray2 *sids, uint16_t level, uint32_t *count, uint32_t unknown1, uint32_t unknown2)
+NTSTATUS rpccli_lsa_LookupNames2(struct rpc_pipe_client *cli,
+                                TALLOC_CTX *mem_ctx,
+                                struct policy_handle *handle,
+                                uint32_t num_names,
+                                struct lsa_String *names,
+                                struct lsa_RefDomainList *domains,
+                                struct lsa_TransSidArray2 *sids,
+                                enum lsa_LookupNamesLevel level,
+                                uint32_t *count,
+                                uint32_t unknown1,
+                                uint32_t unknown2)
 {
        struct lsa_LookupNames2 r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.num_names = num_names;
@@ -1909,300 +2545,389 @@ NTSTATUS rpccli_lsa_LookupNames2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct
        r.in.count = count;
        r.in.unknown1 = unknown1;
        r.in.unknown2 = unknown2;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_LookupNames2, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_LOOKUPNAMES2, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_LOOKUPNAMES2,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_LookupNames2, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        if (domains && r.out.domains) {
                *domains = *r.out.domains;
        }
        *sids = *r.out.sids;
        *count = *r.out.count;
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_CreateTrustedDomainEx2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx)
+NTSTATUS rpccli_lsa_CreateTrustedDomainEx2(struct rpc_pipe_client *cli,
+                                          TALLOC_CTX *mem_ctx)
 {
        struct lsa_CreateTrustedDomainEx2 r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_CreateTrustedDomainEx2, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_CREATETRUSTEDDOMAINEX2, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_CREATETRUSTEDDOMAINEX2,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_CreateTrustedDomainEx2, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_CREDRWRITE(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx)
+NTSTATUS rpccli_lsa_CREDRWRITE(struct rpc_pipe_client *cli,
+                              TALLOC_CTX *mem_ctx)
 {
        struct lsa_CREDRWRITE r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_CREDRWRITE, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_CREDRWRITE, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_CREDRWRITE,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_CREDRWRITE, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_CREDRREAD(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx)
+NTSTATUS rpccli_lsa_CREDRREAD(struct rpc_pipe_client *cli,
+                             TALLOC_CTX *mem_ctx)
 {
        struct lsa_CREDRREAD r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_CREDRREAD, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_CREDRREAD, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_CREDRREAD,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_CREDRREAD, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_CREDRENUMERATE(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx)
+NTSTATUS rpccli_lsa_CREDRENUMERATE(struct rpc_pipe_client *cli,
+                                  TALLOC_CTX *mem_ctx)
 {
        struct lsa_CREDRENUMERATE r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_CREDRENUMERATE, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_CREDRENUMERATE, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_CREDRENUMERATE,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_CREDRENUMERATE, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_CREDRWRITEDOMAINCREDENTIALS(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx)
+NTSTATUS rpccli_lsa_CREDRWRITEDOMAINCREDENTIALS(struct rpc_pipe_client *cli,
+                                               TALLOC_CTX *mem_ctx)
 {
        struct lsa_CREDRWRITEDOMAINCREDENTIALS r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_CREDRWRITEDOMAINCREDENTIALS, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_CREDRWRITEDOMAINCREDENTIALS, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_CREDRWRITEDOMAINCREDENTIALS,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_CREDRWRITEDOMAINCREDENTIALS, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_CREDRREADDOMAINCREDENTIALS(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx)
+NTSTATUS rpccli_lsa_CREDRREADDOMAINCREDENTIALS(struct rpc_pipe_client *cli,
+                                              TALLOC_CTX *mem_ctx)
 {
        struct lsa_CREDRREADDOMAINCREDENTIALS r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_CREDRREADDOMAINCREDENTIALS, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_CREDRREADDOMAINCREDENTIALS, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_CREDRREADDOMAINCREDENTIALS,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_CREDRREADDOMAINCREDENTIALS, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_CREDRDELETE(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx)
+NTSTATUS rpccli_lsa_CREDRDELETE(struct rpc_pipe_client *cli,
+                               TALLOC_CTX *mem_ctx)
 {
        struct lsa_CREDRDELETE r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_CREDRDELETE, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_CREDRDELETE, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_CREDRDELETE,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_CREDRDELETE, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_CREDRGETTARGETINFO(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx)
+NTSTATUS rpccli_lsa_CREDRGETTARGETINFO(struct rpc_pipe_client *cli,
+                                      TALLOC_CTX *mem_ctx)
 {
        struct lsa_CREDRGETTARGETINFO r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_CREDRGETTARGETINFO, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_CREDRGETTARGETINFO, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_CREDRGETTARGETINFO,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_CREDRGETTARGETINFO, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_CREDRPROFILELOADED(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx)
+NTSTATUS rpccli_lsa_CREDRPROFILELOADED(struct rpc_pipe_client *cli,
+                                      TALLOC_CTX *mem_ctx)
 {
        struct lsa_CREDRPROFILELOADED r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_CREDRPROFILELOADED, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_CREDRPROFILELOADED, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_CREDRPROFILELOADED,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_CREDRPROFILELOADED, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_LookupNames3(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t num_names, struct lsa_String *names, struct lsa_RefDomainList *domains, struct lsa_TransSidArray3 *sids, uint16_t level, uint32_t *count, uint32_t unknown1, uint32_t unknown2)
+NTSTATUS rpccli_lsa_LookupNames3(struct rpc_pipe_client *cli,
+                                TALLOC_CTX *mem_ctx,
+                                struct policy_handle *handle,
+                                uint32_t num_names,
+                                struct lsa_String *names,
+                                struct lsa_RefDomainList *domains,
+                                struct lsa_TransSidArray3 *sids,
+                                enum lsa_LookupNamesLevel level,
+                                uint32_t *count,
+                                uint32_t unknown1,
+                                uint32_t unknown2)
 {
        struct lsa_LookupNames3 r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.num_names = num_names;
@@ -2212,242 +2937,321 @@ NTSTATUS rpccli_lsa_LookupNames3(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct
        r.in.count = count;
        r.in.unknown1 = unknown1;
        r.in.unknown2 = unknown2;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_LookupNames3, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_LOOKUPNAMES3, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_LOOKUPNAMES3,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_LookupNames3, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        if (domains && r.out.domains) {
                *domains = *r.out.domains;
        }
        *sids = *r.out.sids;
        *count = *r.out.count;
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_CREDRGETSESSIONTYPES(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx)
+NTSTATUS rpccli_lsa_CREDRGETSESSIONTYPES(struct rpc_pipe_client *cli,
+                                        TALLOC_CTX *mem_ctx)
 {
        struct lsa_CREDRGETSESSIONTYPES r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_CREDRGETSESSIONTYPES, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_CREDRGETSESSIONTYPES, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_CREDRGETSESSIONTYPES,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_CREDRGETSESSIONTYPES, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_LSARREGISTERAUDITEVENT(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx)
+NTSTATUS rpccli_lsa_LSARREGISTERAUDITEVENT(struct rpc_pipe_client *cli,
+                                          TALLOC_CTX *mem_ctx)
 {
        struct lsa_LSARREGISTERAUDITEVENT r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_LSARREGISTERAUDITEVENT, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_LSARREGISTERAUDITEVENT, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_LSARREGISTERAUDITEVENT,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_LSARREGISTERAUDITEVENT, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_LSARGENAUDITEVENT(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx)
+NTSTATUS rpccli_lsa_LSARGENAUDITEVENT(struct rpc_pipe_client *cli,
+                                     TALLOC_CTX *mem_ctx)
 {
        struct lsa_LSARGENAUDITEVENT r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_LSARGENAUDITEVENT, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_LSARGENAUDITEVENT, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_LSARGENAUDITEVENT,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_LSARGENAUDITEVENT, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_LSARUNREGISTERAUDITEVENT(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx)
+NTSTATUS rpccli_lsa_LSARUNREGISTERAUDITEVENT(struct rpc_pipe_client *cli,
+                                            TALLOC_CTX *mem_ctx)
 {
        struct lsa_LSARUNREGISTERAUDITEVENT r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_LSARUNREGISTERAUDITEVENT, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_LSARUNREGISTERAUDITEVENT, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_LSARUNREGISTERAUDITEVENT,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_LSARUNREGISTERAUDITEVENT, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_LSARQUERYFORESTTRUSTINFORMATION(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx)
+NTSTATUS rpccli_lsa_lsaRQueryForestTrustInformation(struct rpc_pipe_client *cli,
+                                                   TALLOC_CTX *mem_ctx,
+                                                   struct policy_handle *handle,
+                                                   struct lsa_String *trusted_domain_name,
+                                                   uint16_t unknown,
+                                                   struct lsa_ForestTrustInformation **forest_trust_info)
 {
-       struct lsa_LSARQUERYFORESTTRUSTINFORMATION r;
+       struct lsa_lsaRQueryForestTrustInformation r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
-               NDR_PRINT_IN_DEBUG(lsa_LSARQUERYFORESTTRUSTINFORMATION, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_LSARQUERYFORESTTRUSTINFORMATION, &r);
-       
+       r.in.handle = handle;
+       r.in.trusted_domain_name = trusted_domain_name;
+       r.in.unknown = unknown;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(lsa_lsaRQueryForestTrustInformation, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_LSARQUERYFORESTTRUSTINFORMATION,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
-               NDR_PRINT_OUT_DEBUG(lsa_LSARQUERYFORESTTRUSTINFORMATION, &r);
-       
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(lsa_lsaRQueryForestTrustInformation, &r);
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+       *forest_trust_info = *r.out.forest_trust_info;
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_LSARSETFORESTTRUSTINFORMATION(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx)
+NTSTATUS rpccli_lsa_LSARSETFORESTTRUSTINFORMATION(struct rpc_pipe_client *cli,
+                                                 TALLOC_CTX *mem_ctx)
 {
        struct lsa_LSARSETFORESTTRUSTINFORMATION r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_LSARSETFORESTTRUSTINFORMATION, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_LSARSETFORESTTRUSTINFORMATION, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_LSARSETFORESTTRUSTINFORMATION,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_LSARSETFORESTTRUSTINFORMATION, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_CREDRRENAME(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx)
+NTSTATUS rpccli_lsa_CREDRRENAME(struct rpc_pipe_client *cli,
+                               TALLOC_CTX *mem_ctx)
 {
        struct lsa_CREDRRENAME r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_CREDRRENAME, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_CREDRRENAME, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_CREDRRENAME,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_CREDRRENAME, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_LookupSids3(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct lsa_SidArray *sids, struct lsa_RefDomainList *domains, struct lsa_TransNameArray2 *names, uint16_t level, uint32_t *count, uint32_t unknown1, uint32_t unknown2)
+NTSTATUS rpccli_lsa_LookupSids3(struct rpc_pipe_client *cli,
+                               TALLOC_CTX *mem_ctx,
+                               struct lsa_SidArray *sids,
+                               struct lsa_RefDomainList *domains,
+                               struct lsa_TransNameArray2 *names,
+                               uint16_t level,
+                               uint32_t *count,
+                               uint32_t unknown1,
+                               uint32_t unknown2)
 {
        struct lsa_LookupSids3 r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.sids = sids;
        r.in.names = names;
@@ -2455,39 +3259,55 @@ NTSTATUS rpccli_lsa_LookupSids3(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx
        r.in.count = count;
        r.in.unknown1 = unknown1;
        r.in.unknown2 = unknown2;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_LookupSids3, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_LOOKUPSIDS3, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_LOOKUPSIDS3,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_LookupSids3, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        if (domains && r.out.domains) {
                *domains = *r.out.domains;
        }
        *names = *r.out.names;
        *count = *r.out.count;
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_LookupNames4(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t num_names, struct lsa_String *names, struct lsa_RefDomainList *domains, struct lsa_TransSidArray3 *sids, uint16_t level, uint32_t *count, uint32_t unknown1, uint32_t unknown2)
+NTSTATUS rpccli_lsa_LookupNames4(struct rpc_pipe_client *cli,
+                                TALLOC_CTX *mem_ctx,
+                                uint32_t num_names,
+                                struct lsa_String *names,
+                                struct lsa_RefDomainList *domains,
+                                struct lsa_TransSidArray3 *sids,
+                                enum lsa_LookupNamesLevel level,
+                                uint32_t *count,
+                                uint32_t unknown1,
+                                uint32_t unknown2)
 {
        struct lsa_LookupNames4 r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.num_names = num_names;
        r.in.names = names;
@@ -2496,146 +3316,185 @@ NTSTATUS rpccli_lsa_LookupNames4(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct
        r.in.count = count;
        r.in.unknown1 = unknown1;
        r.in.unknown2 = unknown2;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_LookupNames4, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_LOOKUPNAMES4, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_LOOKUPNAMES4,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_LookupNames4, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        if (domains && r.out.domains) {
                *domains = *r.out.domains;
        }
        *sids = *r.out.sids;
        *count = *r.out.count;
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_LSAROPENPOLICYSCE(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx)
+NTSTATUS rpccli_lsa_LSAROPENPOLICYSCE(struct rpc_pipe_client *cli,
+                                     TALLOC_CTX *mem_ctx)
 {
        struct lsa_LSAROPENPOLICYSCE r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_LSAROPENPOLICYSCE, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_LSAROPENPOLICYSCE, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_LSAROPENPOLICYSCE,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_LSAROPENPOLICYSCE, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_LSARADTREGISTERSECURITYEVENTSOURCE(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx)
+NTSTATUS rpccli_lsa_LSARADTREGISTERSECURITYEVENTSOURCE(struct rpc_pipe_client *cli,
+                                                      TALLOC_CTX *mem_ctx)
 {
        struct lsa_LSARADTREGISTERSECURITYEVENTSOURCE r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_LSARADTREGISTERSECURITYEVENTSOURCE, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_LSARADTREGISTERSECURITYEVENTSOURCE, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_LSARADTREGISTERSECURITYEVENTSOURCE,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_LSARADTREGISTERSECURITYEVENTSOURCE, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx)
+NTSTATUS rpccli_lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE(struct rpc_pipe_client *cli,
+                                                        TALLOC_CTX *mem_ctx)
 {
        struct lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_LSARADTUNREGISTERSECURITYEVENTSOURCE, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_LSARADTUNREGISTERSECURITYEVENTSOURCE,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_lsa_LSARADTREPORTSECURITYEVENT(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx)
+NTSTATUS rpccli_lsa_LSARADTREPORTSECURITYEVENT(struct rpc_pipe_client *cli,
+                                              TALLOC_CTX *mem_ctx)
 {
        struct lsa_LSARADTREPORTSECURITYEVENT r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_LSARADTREPORTSECURITYEVENT, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_LSARADTREPORTSECURITYEVENT, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_LSARPC,
+                               &ndr_table_lsarpc,
+                               NDR_LSA_LSARADTREPORTSECURITYEVENT,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_LSARADTREPORTSECURITYEVENT, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        return r.out.result;
 }
index a44105ea9c617d833353a07c321b44f3acf6c320..c45aed1d3758cbb9d2e843ee57800f07f6c4156a 100644 (file)
 #include "librpc/gen_ndr/ndr_lsa.h"
 #ifndef __CLI_LSARPC__
 #define __CLI_LSARPC__
-NTSTATUS rpccli_lsa_Close(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle);
-NTSTATUS rpccli_lsa_Delete(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle);
-NTSTATUS rpccli_lsa_EnumPrivs(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t *resume_handle, uint32_t max_count, struct lsa_PrivArray *privs);
-NTSTATUS rpccli_lsa_QuerySecurity(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t sec_info, struct sec_desc_buf *sdbuf);
-NTSTATUS rpccli_lsa_SetSecObj(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx);
-NTSTATUS rpccli_lsa_ChangePassword(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx);
-NTSTATUS rpccli_lsa_OpenPolicy(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *system_name, struct lsa_ObjectAttribute *attr, uint32_t access_mask, struct policy_handle *handle);
-NTSTATUS rpccli_lsa_QueryInfoPolicy(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint16_t level, union lsa_PolicyInformation *info);
-NTSTATUS rpccli_lsa_SetInfoPolicy(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx);
-NTSTATUS rpccli_lsa_ClearAuditLog(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx);
-NTSTATUS rpccli_lsa_CreateAccount(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct dom_sid2 *sid, uint32_t access_mask, struct policy_handle *acct_handle);
-NTSTATUS rpccli_lsa_EnumAccounts(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t *resume_handle, uint32_t num_entries, struct lsa_SidArray *sids);
-NTSTATUS rpccli_lsa_CreateTrustedDomain(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_DomainInfo *info, uint32_t access_mask, struct policy_handle *trustdom_handle);
-NTSTATUS rpccli_lsa_EnumTrustDom(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t *resume_handle, uint32_t max_size, struct lsa_DomainList *domains);
-NTSTATUS rpccli_lsa_LookupNames(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t num_names, struct lsa_String *names, struct lsa_RefDomainList *domains, struct lsa_TransSidArray *sids, uint16_t level, uint32_t *count);
-NTSTATUS rpccli_lsa_LookupSids(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_SidArray *sids, struct lsa_RefDomainList *domains, struct lsa_TransNameArray *names, uint16_t level, uint32_t *count);
-NTSTATUS rpccli_lsa_CreateSecret(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_String name, uint32_t access_mask, struct policy_handle *sec_handle);
-NTSTATUS rpccli_lsa_OpenAccount(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct dom_sid2 *sid, uint32_t access_mask, struct policy_handle *acct_handle);
-NTSTATUS rpccli_lsa_EnumPrivsAccount(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_PrivilegeSet *privs);
-NTSTATUS rpccli_lsa_AddPrivilegesToAccount(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_PrivilegeSet *privs);
-NTSTATUS rpccli_lsa_RemovePrivilegesFromAccount(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint8_t remove_all, struct lsa_PrivilegeSet *privs);
-NTSTATUS rpccli_lsa_GetQuotasForAccount(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx);
-NTSTATUS rpccli_lsa_SetQuotasForAccount(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx);
-NTSTATUS rpccli_lsa_GetSystemAccessAccount(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx);
-NTSTATUS rpccli_lsa_SetSystemAccessAccount(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx);
-NTSTATUS rpccli_lsa_OpenTrustedDomain(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct dom_sid2 *sid, uint32_t access_mask, struct policy_handle *trustdom_handle);
-NTSTATUS rpccli_lsa_QueryTrustedDomainInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *trustdom_handle, enum lsa_TrustDomInfoEnum level, union lsa_TrustedDomainInfo *info);
-NTSTATUS rpccli_lsa_SetInformationTrustedDomain(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx);
-NTSTATUS rpccli_lsa_OpenSecret(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_String name, uint32_t access_mask, struct policy_handle *sec_handle);
-NTSTATUS rpccli_lsa_SetSecret(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *sec_handle, struct lsa_DATA_BUF *new_val, struct lsa_DATA_BUF *old_val);
-NTSTATUS rpccli_lsa_QuerySecret(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *sec_handle, struct lsa_DATA_BUF_PTR *new_val, NTTIME *new_mtime, struct lsa_DATA_BUF_PTR *old_val, NTTIME *old_mtime);
-NTSTATUS rpccli_lsa_LookupPrivValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_String *name, struct lsa_LUID *luid);
-NTSTATUS rpccli_lsa_LookupPrivName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_LUID *luid, struct lsa_StringLarge *name);
-NTSTATUS rpccli_lsa_LookupPrivDisplayName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_String *name, struct lsa_StringLarge *disp_name, uint16_t *language_id, uint16_t unknown);
-NTSTATUS rpccli_lsa_DeleteObject(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx);
-NTSTATUS rpccli_lsa_EnumAccountsWithUserRight(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_String *name, struct lsa_SidArray *sids);
-NTSTATUS rpccli_lsa_EnumAccountRights(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct dom_sid2 *sid, struct lsa_RightSet *rights);
-NTSTATUS rpccli_lsa_AddAccountRights(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct dom_sid2 *sid, struct lsa_RightSet *rights);
-NTSTATUS rpccli_lsa_RemoveAccountRights(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct dom_sid2 *sid, uint32_t unknown, struct lsa_RightSet *rights);
-NTSTATUS rpccli_lsa_QueryTrustedDomainInfoBySid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct dom_sid2 *dom_sid, enum lsa_TrustDomInfoEnum level, union lsa_TrustedDomainInfo *info);
-NTSTATUS rpccli_lsa_SetTrustedDomainInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx);
-NTSTATUS rpccli_lsa_DeleteTrustedDomain(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct dom_sid2 *dom_sid);
-NTSTATUS rpccli_lsa_StorePrivateData(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx);
-NTSTATUS rpccli_lsa_RetrievePrivateData(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx);
-NTSTATUS rpccli_lsa_OpenPolicy2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *system_name, struct lsa_ObjectAttribute *attr, uint32_t access_mask, struct policy_handle *handle);
-NTSTATUS rpccli_lsa_GetUserName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *system_name, struct lsa_String *account_name, struct lsa_StringPointer *authority_name);
-NTSTATUS rpccli_lsa_QueryInfoPolicy2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint16_t level, union lsa_PolicyInformation *info);
-NTSTATUS rpccli_lsa_SetInfoPolicy2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx);
-NTSTATUS rpccli_lsa_QueryTrustedDomainInfoByName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_String trusted_domain, enum lsa_TrustDomInfoEnum level, union lsa_TrustedDomainInfo *info);
-NTSTATUS rpccli_lsa_SetTrustedDomainInfoByName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_String trusted_domain, enum lsa_TrustDomInfoEnum level, union lsa_TrustedDomainInfo *info);
-NTSTATUS rpccli_lsa_EnumTrustedDomainsEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t *resume_handle, struct lsa_DomainListEx *domains, uint32_t max_size);
-NTSTATUS rpccli_lsa_CreateTrustedDomainEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx);
-NTSTATUS rpccli_lsa_CloseTrustedDomainEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle);
-NTSTATUS rpccli_lsa_QueryDomainInformationPolicy(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint16_t level, union lsa_DomainInformationPolicy *info);
-NTSTATUS rpccli_lsa_SetDomainInformationPolicy(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint16_t level, union lsa_DomainInformationPolicy *info);
-NTSTATUS rpccli_lsa_OpenTrustedDomainByName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_String name, uint32_t access_mask, struct policy_handle *trustdom_handle);
-NTSTATUS rpccli_lsa_TestCall(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx);
-NTSTATUS rpccli_lsa_LookupSids2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_SidArray *sids, struct lsa_RefDomainList *domains, struct lsa_TransNameArray2 *names, uint16_t level, uint32_t *count, uint32_t unknown1, uint32_t unknown2);
-NTSTATUS rpccli_lsa_LookupNames2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t num_names, struct lsa_String *names, struct lsa_RefDomainList *domains, struct lsa_TransSidArray2 *sids, uint16_t level, uint32_t *count, uint32_t unknown1, uint32_t unknown2);
-NTSTATUS rpccli_lsa_CreateTrustedDomainEx2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx);
-NTSTATUS rpccli_lsa_CREDRWRITE(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx);
-NTSTATUS rpccli_lsa_CREDRREAD(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx);
-NTSTATUS rpccli_lsa_CREDRENUMERATE(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx);
-NTSTATUS rpccli_lsa_CREDRWRITEDOMAINCREDENTIALS(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx);
-NTSTATUS rpccli_lsa_CREDRREADDOMAINCREDENTIALS(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx);
-NTSTATUS rpccli_lsa_CREDRDELETE(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx);
-NTSTATUS rpccli_lsa_CREDRGETTARGETINFO(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx);
-NTSTATUS rpccli_lsa_CREDRPROFILELOADED(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx);
-NTSTATUS rpccli_lsa_LookupNames3(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t num_names, struct lsa_String *names, struct lsa_RefDomainList *domains, struct lsa_TransSidArray3 *sids, uint16_t level, uint32_t *count, uint32_t unknown1, uint32_t unknown2);
-NTSTATUS rpccli_lsa_CREDRGETSESSIONTYPES(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx);
-NTSTATUS rpccli_lsa_LSARREGISTERAUDITEVENT(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx);
-NTSTATUS rpccli_lsa_LSARGENAUDITEVENT(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx);
-NTSTATUS rpccli_lsa_LSARUNREGISTERAUDITEVENT(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx);
-NTSTATUS rpccli_lsa_LSARQUERYFORESTTRUSTINFORMATION(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx);
-NTSTATUS rpccli_lsa_LSARSETFORESTTRUSTINFORMATION(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx);
-NTSTATUS rpccli_lsa_CREDRRENAME(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx);
-NTSTATUS rpccli_lsa_LookupSids3(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct lsa_SidArray *sids, struct lsa_RefDomainList *domains, struct lsa_TransNameArray2 *names, uint16_t level, uint32_t *count, uint32_t unknown1, uint32_t unknown2);
-NTSTATUS rpccli_lsa_LookupNames4(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t num_names, struct lsa_String *names, struct lsa_RefDomainList *domains, struct lsa_TransSidArray3 *sids, uint16_t level, uint32_t *count, uint32_t unknown1, uint32_t unknown2);
-NTSTATUS rpccli_lsa_LSAROPENPOLICYSCE(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx);
-NTSTATUS rpccli_lsa_LSARADTREGISTERSECURITYEVENTSOURCE(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx);
-NTSTATUS rpccli_lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx);
-NTSTATUS rpccli_lsa_LSARADTREPORTSECURITYEVENT(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx);
+NTSTATUS rpccli_lsa_Close(struct rpc_pipe_client *cli,
+                         TALLOC_CTX *mem_ctx,
+                         struct policy_handle *handle);
+NTSTATUS rpccli_lsa_Delete(struct rpc_pipe_client *cli,
+                          TALLOC_CTX *mem_ctx,
+                          struct policy_handle *handle);
+NTSTATUS rpccli_lsa_EnumPrivs(struct rpc_pipe_client *cli,
+                             TALLOC_CTX *mem_ctx,
+                             struct policy_handle *handle,
+                             uint32_t *resume_handle,
+                             uint32_t max_count,
+                             struct lsa_PrivArray *privs);
+NTSTATUS rpccli_lsa_QuerySecurity(struct rpc_pipe_client *cli,
+                                 TALLOC_CTX *mem_ctx,
+                                 struct policy_handle *handle,
+                                 uint32_t sec_info,
+                                 struct sec_desc_buf *sdbuf);
+NTSTATUS rpccli_lsa_SetSecObj(struct rpc_pipe_client *cli,
+                             TALLOC_CTX *mem_ctx);
+NTSTATUS rpccli_lsa_ChangePassword(struct rpc_pipe_client *cli,
+                                  TALLOC_CTX *mem_ctx);
+NTSTATUS rpccli_lsa_OpenPolicy(struct rpc_pipe_client *cli,
+                              TALLOC_CTX *mem_ctx,
+                              uint16_t *system_name,
+                              struct lsa_ObjectAttribute *attr,
+                              uint32_t access_mask,
+                              struct policy_handle *handle);
+NTSTATUS rpccli_lsa_QueryInfoPolicy(struct rpc_pipe_client *cli,
+                                   TALLOC_CTX *mem_ctx,
+                                   struct policy_handle *handle,
+                                   enum lsa_PolicyInfo level,
+                                   union lsa_PolicyInformation *info);
+NTSTATUS rpccli_lsa_SetInfoPolicy(struct rpc_pipe_client *cli,
+                                 TALLOC_CTX *mem_ctx,
+                                 struct policy_handle *handle,
+                                 enum lsa_PolicyInfo level,
+                                 union lsa_PolicyInformation *info);
+NTSTATUS rpccli_lsa_ClearAuditLog(struct rpc_pipe_client *cli,
+                                 TALLOC_CTX *mem_ctx);
+NTSTATUS rpccli_lsa_CreateAccount(struct rpc_pipe_client *cli,
+                                 TALLOC_CTX *mem_ctx,
+                                 struct policy_handle *handle,
+                                 struct dom_sid2 *sid,
+                                 uint32_t access_mask,
+                                 struct policy_handle *acct_handle);
+NTSTATUS rpccli_lsa_EnumAccounts(struct rpc_pipe_client *cli,
+                                TALLOC_CTX *mem_ctx,
+                                struct policy_handle *handle,
+                                uint32_t *resume_handle,
+                                uint32_t num_entries,
+                                struct lsa_SidArray *sids);
+NTSTATUS rpccli_lsa_CreateTrustedDomain(struct rpc_pipe_client *cli,
+                                       TALLOC_CTX *mem_ctx,
+                                       struct policy_handle *handle,
+                                       struct lsa_DomainInfo *info,
+                                       uint32_t access_mask,
+                                       struct policy_handle *trustdom_handle);
+NTSTATUS rpccli_lsa_EnumTrustDom(struct rpc_pipe_client *cli,
+                                TALLOC_CTX *mem_ctx,
+                                struct policy_handle *handle,
+                                uint32_t *resume_handle,
+                                uint32_t max_size,
+                                struct lsa_DomainList *domains);
+NTSTATUS rpccli_lsa_LookupNames(struct rpc_pipe_client *cli,
+                               TALLOC_CTX *mem_ctx,
+                               struct policy_handle *handle,
+                               uint32_t num_names,
+                               struct lsa_String *names,
+                               struct lsa_RefDomainList *domains,
+                               struct lsa_TransSidArray *sids,
+                               enum lsa_LookupNamesLevel level,
+                               uint32_t *count);
+NTSTATUS rpccli_lsa_LookupSids(struct rpc_pipe_client *cli,
+                              TALLOC_CTX *mem_ctx,
+                              struct policy_handle *handle,
+                              struct lsa_SidArray *sids,
+                              struct lsa_RefDomainList *domains,
+                              struct lsa_TransNameArray *names,
+                              uint16_t level,
+                              uint32_t *count);
+NTSTATUS rpccli_lsa_CreateSecret(struct rpc_pipe_client *cli,
+                                TALLOC_CTX *mem_ctx,
+                                struct policy_handle *handle,
+                                struct lsa_String name,
+                                uint32_t access_mask,
+                                struct policy_handle *sec_handle);
+NTSTATUS rpccli_lsa_OpenAccount(struct rpc_pipe_client *cli,
+                               TALLOC_CTX *mem_ctx,
+                               struct policy_handle *handle,
+                               struct dom_sid2 *sid,
+                               uint32_t access_mask,
+                               struct policy_handle *acct_handle);
+NTSTATUS rpccli_lsa_EnumPrivsAccount(struct rpc_pipe_client *cli,
+                                    TALLOC_CTX *mem_ctx,
+                                    struct policy_handle *handle,
+                                    struct lsa_PrivilegeSet *privs);
+NTSTATUS rpccli_lsa_AddPrivilegesToAccount(struct rpc_pipe_client *cli,
+                                          TALLOC_CTX *mem_ctx,
+                                          struct policy_handle *handle,
+                                          struct lsa_PrivilegeSet *privs);
+NTSTATUS rpccli_lsa_RemovePrivilegesFromAccount(struct rpc_pipe_client *cli,
+                                               TALLOC_CTX *mem_ctx,
+                                               struct policy_handle *handle,
+                                               uint8_t remove_all,
+                                               struct lsa_PrivilegeSet *privs);
+NTSTATUS rpccli_lsa_GetQuotasForAccount(struct rpc_pipe_client *cli,
+                                       TALLOC_CTX *mem_ctx);
+NTSTATUS rpccli_lsa_SetQuotasForAccount(struct rpc_pipe_client *cli,
+                                       TALLOC_CTX *mem_ctx);
+NTSTATUS rpccli_lsa_GetSystemAccessAccount(struct rpc_pipe_client *cli,
+                                          TALLOC_CTX *mem_ctx);
+NTSTATUS rpccli_lsa_SetSystemAccessAccount(struct rpc_pipe_client *cli,
+                                          TALLOC_CTX *mem_ctx);
+NTSTATUS rpccli_lsa_OpenTrustedDomain(struct rpc_pipe_client *cli,
+                                     TALLOC_CTX *mem_ctx,
+                                     struct policy_handle *handle,
+                                     struct dom_sid2 *sid,
+                                     uint32_t access_mask,
+                                     struct policy_handle *trustdom_handle);
+NTSTATUS rpccli_lsa_QueryTrustedDomainInfo(struct rpc_pipe_client *cli,
+                                          TALLOC_CTX *mem_ctx,
+                                          struct policy_handle *trustdom_handle,
+                                          enum lsa_TrustDomInfoEnum level,
+                                          union lsa_TrustedDomainInfo *info);
+NTSTATUS rpccli_lsa_SetInformationTrustedDomain(struct rpc_pipe_client *cli,
+                                               TALLOC_CTX *mem_ctx);
+NTSTATUS rpccli_lsa_OpenSecret(struct rpc_pipe_client *cli,
+                              TALLOC_CTX *mem_ctx,
+                              struct policy_handle *handle,
+                              struct lsa_String name,
+                              uint32_t access_mask,
+                              struct policy_handle *sec_handle);
+NTSTATUS rpccli_lsa_SetSecret(struct rpc_pipe_client *cli,
+                             TALLOC_CTX *mem_ctx,
+                             struct policy_handle *sec_handle,
+                             struct lsa_DATA_BUF *new_val,
+                             struct lsa_DATA_BUF *old_val);
+NTSTATUS rpccli_lsa_QuerySecret(struct rpc_pipe_client *cli,
+                               TALLOC_CTX *mem_ctx,
+                               struct policy_handle *sec_handle,
+                               struct lsa_DATA_BUF_PTR *new_val,
+                               NTTIME *new_mtime,
+                               struct lsa_DATA_BUF_PTR *old_val,
+                               NTTIME *old_mtime);
+NTSTATUS rpccli_lsa_LookupPrivValue(struct rpc_pipe_client *cli,
+                                   TALLOC_CTX *mem_ctx,
+                                   struct policy_handle *handle,
+                                   struct lsa_String *name,
+                                   struct lsa_LUID *luid);
+NTSTATUS rpccli_lsa_LookupPrivName(struct rpc_pipe_client *cli,
+                                  TALLOC_CTX *mem_ctx,
+                                  struct policy_handle *handle,
+                                  struct lsa_LUID *luid,
+                                  struct lsa_StringLarge *name);
+NTSTATUS rpccli_lsa_LookupPrivDisplayName(struct rpc_pipe_client *cli,
+                                         TALLOC_CTX *mem_ctx,
+                                         struct policy_handle *handle,
+                                         struct lsa_String *name,
+                                         struct lsa_StringLarge *disp_name,
+                                         uint16_t *language_id,
+                                         uint16_t unknown);
+NTSTATUS rpccli_lsa_DeleteObject(struct rpc_pipe_client *cli,
+                                TALLOC_CTX *mem_ctx);
+NTSTATUS rpccli_lsa_EnumAccountsWithUserRight(struct rpc_pipe_client *cli,
+                                             TALLOC_CTX *mem_ctx,
+                                             struct policy_handle *handle,
+                                             struct lsa_String *name,
+                                             struct lsa_SidArray *sids);
+NTSTATUS rpccli_lsa_EnumAccountRights(struct rpc_pipe_client *cli,
+                                     TALLOC_CTX *mem_ctx,
+                                     struct policy_handle *handle,
+                                     struct dom_sid2 *sid,
+                                     struct lsa_RightSet *rights);
+NTSTATUS rpccli_lsa_AddAccountRights(struct rpc_pipe_client *cli,
+                                    TALLOC_CTX *mem_ctx,
+                                    struct policy_handle *handle,
+                                    struct dom_sid2 *sid,
+                                    struct lsa_RightSet *rights);
+NTSTATUS rpccli_lsa_RemoveAccountRights(struct rpc_pipe_client *cli,
+                                       TALLOC_CTX *mem_ctx,
+                                       struct policy_handle *handle,
+                                       struct dom_sid2 *sid,
+                                       uint32_t unknown,
+                                       struct lsa_RightSet *rights);
+NTSTATUS rpccli_lsa_QueryTrustedDomainInfoBySid(struct rpc_pipe_client *cli,
+                                               TALLOC_CTX *mem_ctx,
+                                               struct policy_handle *handle,
+                                               struct dom_sid2 *dom_sid,
+                                               enum lsa_TrustDomInfoEnum level,
+                                               union lsa_TrustedDomainInfo *info);
+NTSTATUS rpccli_lsa_SetTrustedDomainInfo(struct rpc_pipe_client *cli,
+                                        TALLOC_CTX *mem_ctx);
+NTSTATUS rpccli_lsa_DeleteTrustedDomain(struct rpc_pipe_client *cli,
+                                       TALLOC_CTX *mem_ctx,
+                                       struct policy_handle *handle,
+                                       struct dom_sid2 *dom_sid);
+NTSTATUS rpccli_lsa_StorePrivateData(struct rpc_pipe_client *cli,
+                                    TALLOC_CTX *mem_ctx);
+NTSTATUS rpccli_lsa_RetrievePrivateData(struct rpc_pipe_client *cli,
+                                       TALLOC_CTX *mem_ctx);
+NTSTATUS rpccli_lsa_OpenPolicy2(struct rpc_pipe_client *cli,
+                               TALLOC_CTX *mem_ctx,
+                               const char *system_name,
+                               struct lsa_ObjectAttribute *attr,
+                               uint32_t access_mask,
+                               struct policy_handle *handle);
+NTSTATUS rpccli_lsa_GetUserName(struct rpc_pipe_client *cli,
+                               TALLOC_CTX *mem_ctx,
+                               const char *system_name,
+                               struct lsa_String *account_name,
+                               struct lsa_StringPointer *authority_name);
+NTSTATUS rpccli_lsa_QueryInfoPolicy2(struct rpc_pipe_client *cli,
+                                    TALLOC_CTX *mem_ctx,
+                                    struct policy_handle *handle,
+                                    enum lsa_PolicyInfo level,
+                                    union lsa_PolicyInformation *info);
+NTSTATUS rpccli_lsa_SetInfoPolicy2(struct rpc_pipe_client *cli,
+                                  TALLOC_CTX *mem_ctx,
+                                  struct policy_handle *handle,
+                                  enum lsa_PolicyInfo level,
+                                  union lsa_PolicyInformation *info);
+NTSTATUS rpccli_lsa_QueryTrustedDomainInfoByName(struct rpc_pipe_client *cli,
+                                                TALLOC_CTX *mem_ctx,
+                                                struct policy_handle *handle,
+                                                struct lsa_String trusted_domain,
+                                                enum lsa_TrustDomInfoEnum level,
+                                                union lsa_TrustedDomainInfo *info);
+NTSTATUS rpccli_lsa_SetTrustedDomainInfoByName(struct rpc_pipe_client *cli,
+                                              TALLOC_CTX *mem_ctx,
+                                              struct policy_handle *handle,
+                                              struct lsa_String trusted_domain,
+                                              enum lsa_TrustDomInfoEnum level,
+                                              union lsa_TrustedDomainInfo *info);
+NTSTATUS rpccli_lsa_EnumTrustedDomainsEx(struct rpc_pipe_client *cli,
+                                        TALLOC_CTX *mem_ctx,
+                                        struct policy_handle *handle,
+                                        uint32_t *resume_handle,
+                                        struct lsa_DomainListEx *domains,
+                                        uint32_t max_size);
+NTSTATUS rpccli_lsa_CreateTrustedDomainEx(struct rpc_pipe_client *cli,
+                                         TALLOC_CTX *mem_ctx);
+NTSTATUS rpccli_lsa_CloseTrustedDomainEx(struct rpc_pipe_client *cli,
+                                        TALLOC_CTX *mem_ctx,
+                                        struct policy_handle *handle);
+NTSTATUS rpccli_lsa_QueryDomainInformationPolicy(struct rpc_pipe_client *cli,
+                                                TALLOC_CTX *mem_ctx,
+                                                struct policy_handle *handle,
+                                                uint16_t level,
+                                                union lsa_DomainInformationPolicy *info);
+NTSTATUS rpccli_lsa_SetDomainInformationPolicy(struct rpc_pipe_client *cli,
+                                              TALLOC_CTX *mem_ctx,
+                                              struct policy_handle *handle,
+                                              uint16_t level,
+                                              union lsa_DomainInformationPolicy *info);
+NTSTATUS rpccli_lsa_OpenTrustedDomainByName(struct rpc_pipe_client *cli,
+                                           TALLOC_CTX *mem_ctx,
+                                           struct policy_handle *handle,
+                                           struct lsa_String name,
+                                           uint32_t access_mask,
+                                           struct policy_handle *trustdom_handle);
+NTSTATUS rpccli_lsa_TestCall(struct rpc_pipe_client *cli,
+                            TALLOC_CTX *mem_ctx);
+NTSTATUS rpccli_lsa_LookupSids2(struct rpc_pipe_client *cli,
+                               TALLOC_CTX *mem_ctx,
+                               struct policy_handle *handle,
+                               struct lsa_SidArray *sids,
+                               struct lsa_RefDomainList *domains,
+                               struct lsa_TransNameArray2 *names,
+                               uint16_t level,
+                               uint32_t *count,
+                               uint32_t unknown1,
+                               uint32_t unknown2);
+NTSTATUS rpccli_lsa_LookupNames2(struct rpc_pipe_client *cli,
+                                TALLOC_CTX *mem_ctx,
+                                struct policy_handle *handle,
+                                uint32_t num_names,
+                                struct lsa_String *names,
+                                struct lsa_RefDomainList *domains,
+                                struct lsa_TransSidArray2 *sids,
+                                enum lsa_LookupNamesLevel level,
+                                uint32_t *count,
+                                uint32_t unknown1,
+                                uint32_t unknown2);
+NTSTATUS rpccli_lsa_CreateTrustedDomainEx2(struct rpc_pipe_client *cli,
+                                          TALLOC_CTX *mem_ctx);
+NTSTATUS rpccli_lsa_CREDRWRITE(struct rpc_pipe_client *cli,
+                              TALLOC_CTX *mem_ctx);
+NTSTATUS rpccli_lsa_CREDRREAD(struct rpc_pipe_client *cli,
+                             TALLOC_CTX *mem_ctx);
+NTSTATUS rpccli_lsa_CREDRENUMERATE(struct rpc_pipe_client *cli,
+                                  TALLOC_CTX *mem_ctx);
+NTSTATUS rpccli_lsa_CREDRWRITEDOMAINCREDENTIALS(struct rpc_pipe_client *cli,
+                                               TALLOC_CTX *mem_ctx);
+NTSTATUS rpccli_lsa_CREDRREADDOMAINCREDENTIALS(struct rpc_pipe_client *cli,
+                                              TALLOC_CTX *mem_ctx);
+NTSTATUS rpccli_lsa_CREDRDELETE(struct rpc_pipe_client *cli,
+                               TALLOC_CTX *mem_ctx);
+NTSTATUS rpccli_lsa_CREDRGETTARGETINFO(struct rpc_pipe_client *cli,
+                                      TALLOC_CTX *mem_ctx);
+NTSTATUS rpccli_lsa_CREDRPROFILELOADED(struct rpc_pipe_client *cli,
+                                      TALLOC_CTX *mem_ctx);
+NTSTATUS rpccli_lsa_LookupNames3(struct rpc_pipe_client *cli,
+                                TALLOC_CTX *mem_ctx,
+                                struct policy_handle *handle,
+                                uint32_t num_names,
+                                struct lsa_String *names,
+                                struct lsa_RefDomainList *domains,
+                                struct lsa_TransSidArray3 *sids,
+                                enum lsa_LookupNamesLevel level,
+                                uint32_t *count,
+                                uint32_t unknown1,
+                                uint32_t unknown2);
+NTSTATUS rpccli_lsa_CREDRGETSESSIONTYPES(struct rpc_pipe_client *cli,
+                                        TALLOC_CTX *mem_ctx);
+NTSTATUS rpccli_lsa_LSARREGISTERAUDITEVENT(struct rpc_pipe_client *cli,
+                                          TALLOC_CTX *mem_ctx);
+NTSTATUS rpccli_lsa_LSARGENAUDITEVENT(struct rpc_pipe_client *cli,
+                                     TALLOC_CTX *mem_ctx);
+NTSTATUS rpccli_lsa_LSARUNREGISTERAUDITEVENT(struct rpc_pipe_client *cli,
+                                            TALLOC_CTX *mem_ctx);
+NTSTATUS rpccli_lsa_lsaRQueryForestTrustInformation(struct rpc_pipe_client *cli,
+                                                   TALLOC_CTX *mem_ctx,
+                                                   struct policy_handle *handle,
+                                                   struct lsa_String *trusted_domain_name,
+                                                   uint16_t unknown,
+                                                   struct lsa_ForestTrustInformation **forest_trust_info);
+NTSTATUS rpccli_lsa_LSARSETFORESTTRUSTINFORMATION(struct rpc_pipe_client *cli,
+                                                 TALLOC_CTX *mem_ctx);
+NTSTATUS rpccli_lsa_CREDRRENAME(struct rpc_pipe_client *cli,
+                               TALLOC_CTX *mem_ctx);
+NTSTATUS rpccli_lsa_LookupSids3(struct rpc_pipe_client *cli,
+                               TALLOC_CTX *mem_ctx,
+                               struct lsa_SidArray *sids,
+                               struct lsa_RefDomainList *domains,
+                               struct lsa_TransNameArray2 *names,
+                               uint16_t level,
+                               uint32_t *count,
+                               uint32_t unknown1,
+                               uint32_t unknown2);
+NTSTATUS rpccli_lsa_LookupNames4(struct rpc_pipe_client *cli,
+                                TALLOC_CTX *mem_ctx,
+                                uint32_t num_names,
+                                struct lsa_String *names,
+                                struct lsa_RefDomainList *domains,
+                                struct lsa_TransSidArray3 *sids,
+                                enum lsa_LookupNamesLevel level,
+                                uint32_t *count,
+                                uint32_t unknown1,
+                                uint32_t unknown2);
+NTSTATUS rpccli_lsa_LSAROPENPOLICYSCE(struct rpc_pipe_client *cli,
+                                     TALLOC_CTX *mem_ctx);
+NTSTATUS rpccli_lsa_LSARADTREGISTERSECURITYEVENTSOURCE(struct rpc_pipe_client *cli,
+                                                      TALLOC_CTX *mem_ctx);
+NTSTATUS rpccli_lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE(struct rpc_pipe_client *cli,
+                                                        TALLOC_CTX *mem_ctx);
+NTSTATUS rpccli_lsa_LSARADTREPORTSECURITYEVENT(struct rpc_pipe_client *cli,
+                                              TALLOC_CTX *mem_ctx);
 #endif /* __CLI_LSARPC__ */
index e53254efa5182b3d66e05f467b45ec4a4cc68589..cac3962073c37b481535f9f5760c982f3559127b 100644 (file)
 #include "includes.h"
 #include "librpc/gen_ndr/cli_netlogon.h"
 
-NTSTATUS rpccli_netr_LogonUasLogon(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *account_name, const char *workstation, struct netr_UasInfo *info, WERROR *werror)
+NTSTATUS rpccli_netr_LogonUasLogon(struct rpc_pipe_client *cli,
+                                  TALLOC_CTX *mem_ctx,
+                                  const char *server_name,
+                                  const char *account_name,
+                                  const char *workstation,
+                                  struct netr_UasInfo *info,
+                                  WERROR *werror)
 {
        struct netr_LogonUasLogon r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_name = server_name;
        r.in.account_name = account_name;
        r.in.workstation = workstation;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_LogonUasLogon, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_LOGONUASLOGON, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETLOGON,
+                               &ndr_table_netlogon,
+                               NDR_NETR_LOGONUASLOGON,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_LogonUasLogon, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       if (info && r.out.info) {
-               *info = *r.out.info;
-       }
-       
+       *info = *r.out.info;
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_netr_LogonUasLogoff(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *account_name, const char *workstation, struct netr_UasLogoffInfo *info, WERROR *werror)
+NTSTATUS rpccli_netr_LogonUasLogoff(struct rpc_pipe_client *cli,
+                                   TALLOC_CTX *mem_ctx,
+                                   const char *server_name,
+                                   const char *account_name,
+                                   const char *workstation,
+                                   struct netr_UasLogoffInfo *info,
+                                   WERROR *werror)
 {
        struct netr_LogonUasLogoff r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_name = server_name;
        r.in.account_name = account_name;
        r.in.workstation = workstation;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_LogonUasLogoff, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_LOGONUASLOGOFF, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETLOGON,
+                               &ndr_table_netlogon,
+                               NDR_NETR_LOGONUASLOGOFF,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_LogonUasLogoff, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *info = *r.out.info;
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_netr_LogonSamLogon(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *computer_name, struct netr_Authenticator *credential, struct netr_Authenticator *return_authenticator, uint16_t logon_level, union netr_LogonLevel logon, uint16_t validation_level, union netr_Validation *validation, uint8_t *authoritative)
+NTSTATUS rpccli_netr_LogonSamLogon(struct rpc_pipe_client *cli,
+                                  TALLOC_CTX *mem_ctx,
+                                  const char *server_name,
+                                  const char *computer_name,
+                                  struct netr_Authenticator *credential,
+                                  struct netr_Authenticator *return_authenticator,
+                                  uint16_t logon_level,
+                                  union netr_LogonLevel logon,
+                                  uint16_t validation_level,
+                                  union netr_Validation *validation,
+                                  uint8_t *authoritative)
 {
        struct netr_LogonSamLogon r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_name = server_name;
        r.in.computer_name = computer_name;
@@ -95,39 +129,53 @@ NTSTATUS rpccli_netr_LogonSamLogon(struct rpc_pipe_client *cli, TALLOC_CTX *mem_
        r.in.logon_level = logon_level;
        r.in.logon = logon;
        r.in.validation_level = validation_level;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_LogonSamLogon, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_LOGONSAMLOGON, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETLOGON,
+                               &ndr_table_netlogon,
+                               NDR_NETR_LOGONSAMLOGON,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_LogonSamLogon, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        if (return_authenticator && r.out.return_authenticator) {
                *return_authenticator = *r.out.return_authenticator;
        }
        *validation = *r.out.validation;
        *authoritative = *r.out.authoritative;
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_netr_LogonSamLogoff(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *computer_name, struct netr_Authenticator *credential, struct netr_Authenticator *return_authenticator, uint16_t logon_level, union netr_LogonLevel logon)
+NTSTATUS rpccli_netr_LogonSamLogoff(struct rpc_pipe_client *cli,
+                                   TALLOC_CTX *mem_ctx,
+                                   const char *server_name,
+                                   const char *computer_name,
+                                   struct netr_Authenticator *credential,
+                                   struct netr_Authenticator *return_authenticator,
+                                   uint16_t logon_level,
+                                   union netr_LogonLevel logon)
 {
        struct netr_LogonSamLogoff r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_name = server_name;
        r.in.computer_name = computer_name;
@@ -135,105 +183,144 @@ NTSTATUS rpccli_netr_LogonSamLogoff(struct rpc_pipe_client *cli, TALLOC_CTX *mem
        r.in.return_authenticator = return_authenticator;
        r.in.logon_level = logon_level;
        r.in.logon = logon;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_LogonSamLogoff, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_LOGONSAMLOGOFF, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETLOGON,
+                               &ndr_table_netlogon,
+                               NDR_NETR_LOGONSAMLOGOFF,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_LogonSamLogoff, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        if (return_authenticator && r.out.return_authenticator) {
                *return_authenticator = *r.out.return_authenticator;
        }
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_netr_ServerReqChallenge(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *computer_name, struct netr_Credential *credentials)
+NTSTATUS rpccli_netr_ServerReqChallenge(struct rpc_pipe_client *cli,
+                                       TALLOC_CTX *mem_ctx,
+                                       const char *server_name,
+                                       const char *computer_name,
+                                       struct netr_Credential *credentials)
 {
        struct netr_ServerReqChallenge r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_name = server_name;
        r.in.computer_name = computer_name;
        r.in.credentials = credentials;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_ServerReqChallenge, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_SERVERREQCHALLENGE, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETLOGON,
+                               &ndr_table_netlogon,
+                               NDR_NETR_SERVERREQCHALLENGE,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_ServerReqChallenge, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *credentials = *r.out.credentials;
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_netr_ServerAuthenticate(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *account_name, enum netr_SchannelType secure_channel_type, const char *computer_name, struct netr_Credential *credentials)
+NTSTATUS rpccli_netr_ServerAuthenticate(struct rpc_pipe_client *cli,
+                                       TALLOC_CTX *mem_ctx,
+                                       const char *server_name,
+                                       const char *account_name,
+                                       enum netr_SchannelType secure_channel_type,
+                                       const char *computer_name,
+                                       struct netr_Credential *credentials)
 {
        struct netr_ServerAuthenticate r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_name = server_name;
        r.in.account_name = account_name;
        r.in.secure_channel_type = secure_channel_type;
        r.in.computer_name = computer_name;
        r.in.credentials = credentials;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_ServerAuthenticate, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_SERVERAUTHENTICATE, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETLOGON,
+                               &ndr_table_netlogon,
+                               NDR_NETR_SERVERAUTHENTICATE,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_ServerAuthenticate, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *credentials = *r.out.credentials;
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_netr_ServerPasswordSet(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *account_name, enum netr_SchannelType secure_channel_type, const char *computer_name, struct netr_Authenticator credential, struct samr_Password new_password, struct netr_Authenticator *return_authenticator)
+NTSTATUS rpccli_netr_ServerPasswordSet(struct rpc_pipe_client *cli,
+                                      TALLOC_CTX *mem_ctx,
+                                      const char *server_name,
+                                      const char *account_name,
+                                      enum netr_SchannelType secure_channel_type,
+                                      const char *computer_name,
+                                      struct netr_Authenticator credential,
+                                      struct samr_Password new_password,
+                                      struct netr_Authenticator *return_authenticator)
 {
        struct netr_ServerPasswordSet r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_name = server_name;
        r.in.account_name = account_name;
@@ -241,35 +328,51 @@ NTSTATUS rpccli_netr_ServerPasswordSet(struct rpc_pipe_client *cli, TALLOC_CTX *
        r.in.computer_name = computer_name;
        r.in.credential = credential;
        r.in.new_password = new_password;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_ServerPasswordSet, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_SERVERPASSWORDSET, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETLOGON,
+                               &ndr_table_netlogon,
+                               NDR_NETR_SERVERPASSWORDSET,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_ServerPasswordSet, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *return_authenticator = *r.out.return_authenticator;
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_netr_DatabaseDeltas(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *logon_server, const char *computername, struct netr_Authenticator credential, struct netr_Authenticator *return_authenticator, enum netr_SamDatabaseID database_id, uint64_t *sequence_num, uint32_t preferredmaximumlength, struct netr_DELTA_ENUM_ARRAY *delta_enum_array)
+NTSTATUS rpccli_netr_DatabaseDeltas(struct rpc_pipe_client *cli,
+                                   TALLOC_CTX *mem_ctx,
+                                   const char *logon_server,
+                                   const char *computername,
+                                   struct netr_Authenticator credential,
+                                   struct netr_Authenticator *return_authenticator,
+                                   enum netr_SamDatabaseID database_id,
+                                   uint64_t *sequence_num,
+                                   uint32_t preferredmaximumlength,
+                                   struct netr_DELTA_ENUM_ARRAY *delta_enum_array)
 {
        struct netr_DatabaseDeltas r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.logon_server = logon_server;
        r.in.computername = computername;
@@ -278,39 +381,53 @@ NTSTATUS rpccli_netr_DatabaseDeltas(struct rpc_pipe_client *cli, TALLOC_CTX *mem
        r.in.database_id = database_id;
        r.in.sequence_num = sequence_num;
        r.in.preferredmaximumlength = preferredmaximumlength;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_DatabaseDeltas, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_DATABASEDELTAS, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETLOGON,
+                               &ndr_table_netlogon,
+                               NDR_NETR_DATABASEDELTAS,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_DatabaseDeltas, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *return_authenticator = *r.out.return_authenticator;
        *sequence_num = *r.out.sequence_num;
-       if (delta_enum_array && r.out.delta_enum_array) {
-               *delta_enum_array = *r.out.delta_enum_array;
-       }
-       
+       *delta_enum_array = *r.out.delta_enum_array;
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_netr_DatabaseSync(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *logon_server, const char *computername, struct netr_Authenticator credential, struct netr_Authenticator *return_authenticator, enum netr_SamDatabaseID database_id, uint32_t *sync_context, uint32_t preferredmaximumlength, struct netr_DELTA_ENUM_ARRAY *delta_enum_array)
+NTSTATUS rpccli_netr_DatabaseSync(struct rpc_pipe_client *cli,
+                                 TALLOC_CTX *mem_ctx,
+                                 const char *logon_server,
+                                 const char *computername,
+                                 struct netr_Authenticator credential,
+                                 struct netr_Authenticator *return_authenticator,
+                                 enum netr_SamDatabaseID database_id,
+                                 uint32_t *sync_context,
+                                 uint32_t preferredmaximumlength,
+                                 struct netr_DELTA_ENUM_ARRAY *delta_enum_array)
 {
        struct netr_DatabaseSync r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.logon_server = logon_server;
        r.in.computername = computername;
@@ -319,39 +436,57 @@ NTSTATUS rpccli_netr_DatabaseSync(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c
        r.in.database_id = database_id;
        r.in.sync_context = sync_context;
        r.in.preferredmaximumlength = preferredmaximumlength;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_DatabaseSync, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_DATABASESYNC, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETLOGON,
+                               &ndr_table_netlogon,
+                               NDR_NETR_DATABASESYNC,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_DatabaseSync, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *return_authenticator = *r.out.return_authenticator;
        *sync_context = *r.out.sync_context;
-       if (delta_enum_array && r.out.delta_enum_array) {
-               *delta_enum_array = *r.out.delta_enum_array;
-       }
-       
+       *delta_enum_array = *r.out.delta_enum_array;
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_netr_AccountDeltas(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *logon_server, const char *computername, struct netr_Authenticator credential, struct netr_Authenticator *return_authenticator, struct netr_UAS_INFO_0 uas, uint32_t count, uint32_t level, uint32_t buffersize, struct netr_AccountBuffer *buffer, uint32_t *count_returned, uint32_t *total_entries, struct netr_UAS_INFO_0 *recordid)
+NTSTATUS rpccli_netr_AccountDeltas(struct rpc_pipe_client *cli,
+                                  TALLOC_CTX *mem_ctx,
+                                  const char *logon_server,
+                                  const char *computername,
+                                  struct netr_Authenticator credential,
+                                  struct netr_Authenticator *return_authenticator,
+                                  struct netr_UAS_INFO_0 uas,
+                                  uint32_t count,
+                                  uint32_t level,
+                                  uint32_t buffersize,
+                                  struct netr_AccountBuffer *buffer,
+                                  uint32_t *count_returned,
+                                  uint32_t *total_entries,
+                                  struct netr_UAS_INFO_0 *recordid)
 {
        struct netr_AccountDeltas r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.logon_server = logon_server;
        r.in.computername = computername;
@@ -361,39 +496,59 @@ NTSTATUS rpccli_netr_AccountDeltas(struct rpc_pipe_client *cli, TALLOC_CTX *mem_
        r.in.count = count;
        r.in.level = level;
        r.in.buffersize = buffersize;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_AccountDeltas, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_ACCOUNTDELTAS, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETLOGON,
+                               &ndr_table_netlogon,
+                               NDR_NETR_ACCOUNTDELTAS,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_AccountDeltas, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *return_authenticator = *r.out.return_authenticator;
        *buffer = *r.out.buffer;
        *count_returned = *r.out.count_returned;
        *total_entries = *r.out.total_entries;
        *recordid = *r.out.recordid;
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_netr_AccountSync(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *logon_server, const char *computername, struct netr_Authenticator credential, struct netr_Authenticator *return_authenticator, uint32_t reference, uint32_t level, uint32_t buffersize, struct netr_AccountBuffer *buffer, uint32_t *count_returned, uint32_t *total_entries, uint32_t *next_reference, struct netr_UAS_INFO_0 *recordid)
+NTSTATUS rpccli_netr_AccountSync(struct rpc_pipe_client *cli,
+                                TALLOC_CTX *mem_ctx,
+                                const char *logon_server,
+                                const char *computername,
+                                struct netr_Authenticator credential,
+                                struct netr_Authenticator *return_authenticator,
+                                uint32_t reference,
+                                uint32_t level,
+                                uint32_t buffersize,
+                                struct netr_AccountBuffer *buffer,
+                                uint32_t *count_returned,
+                                uint32_t *total_entries,
+                                uint32_t *next_reference,
+                                struct netr_UAS_INFO_0 *recordid)
 {
        struct netr_AccountSync r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.logon_server = logon_server;
        r.in.computername = computername;
@@ -403,23 +558,30 @@ NTSTATUS rpccli_netr_AccountSync(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct
        r.in.level = level;
        r.in.buffersize = buffersize;
        r.in.recordid = recordid;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_AccountSync, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_ACCOUNTSYNC, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETLOGON,
+                               &ndr_table_netlogon,
+                               NDR_NETR_ACCOUNTSYNC,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_AccountSync, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *return_authenticator = *r.out.return_authenticator;
        *buffer = *r.out.buffer;
@@ -427,159 +589,221 @@ NTSTATUS rpccli_netr_AccountSync(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct
        *total_entries = *r.out.total_entries;
        *next_reference = *r.out.next_reference;
        *recordid = *r.out.recordid;
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_netr_GetDcName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *logon_server, const char *domainname, const char **dcname)
+NTSTATUS rpccli_netr_GetDcName(struct rpc_pipe_client *cli,
+                              TALLOC_CTX *mem_ctx,
+                              const char *logon_server,
+                              const char *domainname,
+                              const char **dcname,
+                              WERROR *werror)
 {
        struct netr_GetDcName r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.logon_server = logon_server;
        r.in.domainname = domainname;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_GetDcName, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_GETDCNAME, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETLOGON,
+                               &ndr_table_netlogon,
+                               NDR_NETR_GETDCNAME,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_GetDcName, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *dcname = *r.out.dcname;
-       
+
        /* Return result */
-       return r.out.result;
+       if (werror) {
+               *werror = r.out.result;
+       }
+
+       return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_netr_LogonControl(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *logon_server, enum netr_LogonControlCode function_code, uint32_t level, union netr_CONTROL_QUERY_INFORMATION *info, WERROR *werror)
+NTSTATUS rpccli_netr_LogonControl(struct rpc_pipe_client *cli,
+                                 TALLOC_CTX *mem_ctx,
+                                 const char *logon_server,
+                                 enum netr_LogonControlCode function_code,
+                                 uint32_t level,
+                                 union netr_CONTROL_QUERY_INFORMATION *info,
+                                 WERROR *werror)
 {
        struct netr_LogonControl r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.logon_server = logon_server;
        r.in.function_code = function_code;
        r.in.level = level;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_LogonControl, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_LOGONCONTROL, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETLOGON,
+                               &ndr_table_netlogon,
+                               NDR_NETR_LOGONCONTROL,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_LogonControl, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *info = *r.out.info;
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_netr_GetAnyDCName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *logon_server, const char *domainname, const char **dcname, WERROR *werror)
+NTSTATUS rpccli_netr_GetAnyDCName(struct rpc_pipe_client *cli,
+                                 TALLOC_CTX *mem_ctx,
+                                 const char *logon_server,
+                                 const char *domainname,
+                                 const char **dcname,
+                                 WERROR *werror)
 {
        struct netr_GetAnyDCName r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.logon_server = logon_server;
        r.in.domainname = domainname;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_GetAnyDCName, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_GETANYDCNAME, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETLOGON,
+                               &ndr_table_netlogon,
+                               NDR_NETR_GETANYDCNAME,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_GetAnyDCName, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *dcname = *r.out.dcname;
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_netr_LogonControl2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *logon_server, uint32_t function_code, uint32_t level, union netr_CONTROL_DATA_INFORMATION data, union netr_CONTROL_QUERY_INFORMATION *query, WERROR *werror)
+NTSTATUS rpccli_netr_LogonControl2(struct rpc_pipe_client *cli,
+                                  TALLOC_CTX *mem_ctx,
+                                  const char *logon_server,
+                                  uint32_t function_code,
+                                  uint32_t level,
+                                  union netr_CONTROL_DATA_INFORMATION data,
+                                  union netr_CONTROL_QUERY_INFORMATION *query,
+                                  WERROR *werror)
 {
        struct netr_LogonControl2 r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.logon_server = logon_server;
        r.in.function_code = function_code;
        r.in.level = level;
        r.in.data = data;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_LogonControl2, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_LOGONCONTROL2, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETLOGON,
+                               &ndr_table_netlogon,
+                               NDR_NETR_LOGONCONTROL2,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_LogonControl2, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *query = *r.out.query;
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_netr_ServerAuthenticate2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *account_name, enum netr_SchannelType secure_channel_type, const char *computer_name, struct netr_Credential *credentials, uint32_t *negotiate_flags)
+NTSTATUS rpccli_netr_ServerAuthenticate2(struct rpc_pipe_client *cli,
+                                        TALLOC_CTX *mem_ctx,
+                                        const char *server_name,
+                                        const char *account_name,
+                                        enum netr_SchannelType secure_channel_type,
+                                        const char *computer_name,
+                                        struct netr_Credential *credentials,
+                                        uint32_t *negotiate_flags)
 {
        struct netr_ServerAuthenticate2 r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_name = server_name;
        r.in.account_name = account_name;
@@ -587,36 +811,53 @@ NTSTATUS rpccli_netr_ServerAuthenticate2(struct rpc_pipe_client *cli, TALLOC_CTX
        r.in.computer_name = computer_name;
        r.in.credentials = credentials;
        r.in.negotiate_flags = negotiate_flags;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_ServerAuthenticate2, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_SERVERAUTHENTICATE2, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETLOGON,
+                               &ndr_table_netlogon,
+                               NDR_NETR_SERVERAUTHENTICATE2,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_ServerAuthenticate2, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *credentials = *r.out.credentials;
        *negotiate_flags = *r.out.negotiate_flags;
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_netr_DatabaseSync2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *logon_server, const char *computername, struct netr_Authenticator credential, struct netr_Authenticator *return_authenticator, enum netr_SamDatabaseID database_id, uint16_t restart_state, uint32_t *sync_context, uint32_t preferredmaximumlength, struct netr_DELTA_ENUM_ARRAY *delta_enum_array)
+NTSTATUS rpccli_netr_DatabaseSync2(struct rpc_pipe_client *cli,
+                                  TALLOC_CTX *mem_ctx,
+                                  const char *logon_server,
+                                  const char *computername,
+                                  struct netr_Authenticator credential,
+                                  struct netr_Authenticator *return_authenticator,
+                                  enum netr_SamDatabaseID database_id,
+                                  uint16_t restart_state,
+                                  uint32_t *sync_context,
+                                  uint32_t preferredmaximumlength,
+                                  struct netr_DELTA_ENUM_ARRAY *delta_enum_array)
 {
        struct netr_DatabaseSync2 r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.logon_server = logon_server;
        r.in.computername = computername;
@@ -626,39 +867,52 @@ NTSTATUS rpccli_netr_DatabaseSync2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_
        r.in.restart_state = restart_state;
        r.in.sync_context = sync_context;
        r.in.preferredmaximumlength = preferredmaximumlength;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_DatabaseSync2, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_DATABASESYNC2, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETLOGON,
+                               &ndr_table_netlogon,
+                               NDR_NETR_DATABASESYNC2,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_DatabaseSync2, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *return_authenticator = *r.out.return_authenticator;
        *sync_context = *r.out.sync_context;
-       if (delta_enum_array && r.out.delta_enum_array) {
-               *delta_enum_array = *r.out.delta_enum_array;
-       }
-       
+       *delta_enum_array = *r.out.delta_enum_array;
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_netr_DatabaseRedo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *logon_server, const char *computername, struct netr_Authenticator credential, struct netr_Authenticator *return_authenticator, uint8_t *change_log_entry, uint32_t change_log_entry_size, struct netr_DELTA_ENUM_ARRAY *delta_enum_array)
+NTSTATUS rpccli_netr_DatabaseRedo(struct rpc_pipe_client *cli,
+                                 TALLOC_CTX *mem_ctx,
+                                 const char *logon_server,
+                                 const char *computername,
+                                 struct netr_Authenticator credential,
+                                 struct netr_Authenticator *return_authenticator,
+                                 uint8_t *change_log_entry,
+                                 uint32_t change_log_entry_size,
+                                 struct netr_DELTA_ENUM_ARRAY *delta_enum_array)
 {
        struct netr_DatabaseRedo r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.logon_server = logon_server;
        r.in.computername = computername;
@@ -666,315 +920,419 @@ NTSTATUS rpccli_netr_DatabaseRedo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c
        r.in.return_authenticator = return_authenticator;
        r.in.change_log_entry = change_log_entry;
        r.in.change_log_entry_size = change_log_entry_size;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_DatabaseRedo, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_DATABASEREDO, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETLOGON,
+                               &ndr_table_netlogon,
+                               NDR_NETR_DATABASEREDO,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_DatabaseRedo, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *return_authenticator = *r.out.return_authenticator;
-       if (delta_enum_array && r.out.delta_enum_array) {
-               *delta_enum_array = *r.out.delta_enum_array;
-       }
-       
+       *delta_enum_array = *r.out.delta_enum_array;
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_netr_LogonControl2Ex(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *logon_server, uint32_t function_code, uint32_t level, union netr_CONTROL_DATA_INFORMATION data, union netr_CONTROL_QUERY_INFORMATION *query, WERROR *werror)
+NTSTATUS rpccli_netr_LogonControl2Ex(struct rpc_pipe_client *cli,
+                                    TALLOC_CTX *mem_ctx,
+                                    const char *logon_server,
+                                    uint32_t function_code,
+                                    uint32_t level,
+                                    union netr_CONTROL_DATA_INFORMATION data,
+                                    union netr_CONTROL_QUERY_INFORMATION *query,
+                                    WERROR *werror)
 {
        struct netr_LogonControl2Ex r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.logon_server = logon_server;
        r.in.function_code = function_code;
        r.in.level = level;
        r.in.data = data;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_LogonControl2Ex, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_LOGONCONTROL2EX, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETLOGON,
+                               &ndr_table_netlogon,
+                               NDR_NETR_LOGONCONTROL2EX,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_LogonControl2Ex, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *query = *r.out.query;
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_netr_NETRENUMERATETRUSTEDDOMAINS(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror)
+NTSTATUS rpccli_netr_NetrEnumerateTrustedDomains(struct rpc_pipe_client *cli,
+                                                TALLOC_CTX *mem_ctx,
+                                                const char *server_name,
+                                                struct netr_Blob *trusted_domains_blob,
+                                                WERROR *werror)
 {
-       struct netr_NETRENUMERATETRUSTEDDOMAINS r;
+       struct netr_NetrEnumerateTrustedDomains r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
-               NDR_PRINT_IN_DEBUG(netr_NETRENUMERATETRUSTEDDOMAINS, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_NETRENUMERATETRUSTEDDOMAINS, &r);
-       
+       r.in.server_name = server_name;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(netr_NetrEnumerateTrustedDomains, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETLOGON,
+                               &ndr_table_netlogon,
+                               NDR_NETR_NETRENUMERATETRUSTEDDOMAINS,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
-               NDR_PRINT_OUT_DEBUG(netr_NETRENUMERATETRUSTEDDOMAINS, &r);
-       
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(netr_NetrEnumerateTrustedDomains, &r);
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+       *trusted_domains_blob = *r.out.trusted_domains_blob;
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_netr_DsRGetDCName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *domain_name, struct GUID *domain_guid, struct GUID *site_guid, uint32_t flags, struct netr_DsRGetDCNameInfo *info, WERROR *werror)
+NTSTATUS rpccli_netr_DsRGetDCName(struct rpc_pipe_client *cli,
+                                 TALLOC_CTX *mem_ctx,
+                                 const char *server_unc,
+                                 const char *domain_name,
+                                 struct GUID *domain_guid,
+                                 struct GUID *site_guid,
+                                 uint32_t flags,
+                                 struct netr_DsRGetDCNameInfo *info,
+                                 WERROR *werror)
 {
        struct netr_DsRGetDCName r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_unc = server_unc;
        r.in.domain_name = domain_name;
        r.in.domain_guid = domain_guid;
        r.in.site_guid = site_guid;
        r.in.flags = flags;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_DsRGetDCName, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_DSRGETDCNAME, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETLOGON,
+                               &ndr_table_netlogon,
+                               NDR_NETR_DSRGETDCNAME,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_DsRGetDCName, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       if (info && r.out.info) {
-               *info = *r.out.info;
-       }
-       
+       *info = *r.out.info;
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_netr_NETRLOGONDUMMYROUTINE1(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror)
+NTSTATUS rpccli_netr_NETRLOGONDUMMYROUTINE1(struct rpc_pipe_client *cli,
+                                           TALLOC_CTX *mem_ctx,
+                                           WERROR *werror)
 {
        struct netr_NETRLOGONDUMMYROUTINE1 r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_NETRLOGONDUMMYROUTINE1, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_NETRLOGONDUMMYROUTINE1, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETLOGON,
+                               &ndr_table_netlogon,
+                               NDR_NETR_NETRLOGONDUMMYROUTINE1,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_NETRLOGONDUMMYROUTINE1, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_netr_NETRLOGONSETSERVICEBITS(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror)
+NTSTATUS rpccli_netr_NETRLOGONSETSERVICEBITS(struct rpc_pipe_client *cli,
+                                            TALLOC_CTX *mem_ctx,
+                                            WERROR *werror)
 {
        struct netr_NETRLOGONSETSERVICEBITS r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_NETRLOGONSETSERVICEBITS, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_NETRLOGONSETSERVICEBITS, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETLOGON,
+                               &ndr_table_netlogon,
+                               NDR_NETR_NETRLOGONSETSERVICEBITS,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_NETRLOGONSETSERVICEBITS, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_netr_NETRLOGONGETTRUSTRID(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror)
+NTSTATUS rpccli_netr_LogonGetTrustRid(struct rpc_pipe_client *cli,
+                                     TALLOC_CTX *mem_ctx,
+                                     const char *server_name,
+                                     const char *domain_name,
+                                     uint32_t *rid,
+                                     WERROR *werror)
 {
-       struct netr_NETRLOGONGETTRUSTRID r;
+       struct netr_LogonGetTrustRid r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
-               NDR_PRINT_IN_DEBUG(netr_NETRLOGONGETTRUSTRID, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_NETRLOGONGETTRUSTRID, &r);
-       
+       r.in.server_name = server_name;
+       r.in.domain_name = domain_name;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(netr_LogonGetTrustRid, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETLOGON,
+                               &ndr_table_netlogon,
+                               NDR_NETR_LOGONGETTRUSTRID,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
-               NDR_PRINT_OUT_DEBUG(netr_NETRLOGONGETTRUSTRID, &r);
-       
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(netr_LogonGetTrustRid, &r);
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+       *rid = *r.out.rid;
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_netr_NETRLOGONCOMPUTESERVERDIGEST(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror)
+NTSTATUS rpccli_netr_NETRLOGONCOMPUTESERVERDIGEST(struct rpc_pipe_client *cli,
+                                                 TALLOC_CTX *mem_ctx,
+                                                 WERROR *werror)
 {
        struct netr_NETRLOGONCOMPUTESERVERDIGEST r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_NETRLOGONCOMPUTESERVERDIGEST, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_NETRLOGONCOMPUTESERVERDIGEST, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETLOGON,
+                               &ndr_table_netlogon,
+                               NDR_NETR_NETRLOGONCOMPUTESERVERDIGEST,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_NETRLOGONCOMPUTESERVERDIGEST, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_netr_NETRLOGONCOMPUTECLIENTDIGEST(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror)
+NTSTATUS rpccli_netr_NETRLOGONCOMPUTECLIENTDIGEST(struct rpc_pipe_client *cli,
+                                                 TALLOC_CTX *mem_ctx,
+                                                 WERROR *werror)
 {
        struct netr_NETRLOGONCOMPUTECLIENTDIGEST r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_NETRLOGONCOMPUTECLIENTDIGEST, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_NETRLOGONCOMPUTECLIENTDIGEST, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETLOGON,
+                               &ndr_table_netlogon,
+                               NDR_NETR_NETRLOGONCOMPUTECLIENTDIGEST,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_NETRLOGONCOMPUTECLIENTDIGEST, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_netr_ServerAuthenticate3(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *account_name, enum netr_SchannelType secure_channel_type, const char *computer_name, struct netr_Credential *credentials, uint32_t *negotiate_flags, uint32_t *rid)
+NTSTATUS rpccli_netr_ServerAuthenticate3(struct rpc_pipe_client *cli,
+                                        TALLOC_CTX *mem_ctx,
+                                        const char *server_name,
+                                        const char *account_name,
+                                        enum netr_SchannelType secure_channel_type,
+                                        const char *computer_name,
+                                        struct netr_Credential *credentials,
+                                        uint32_t *negotiate_flags,
+                                        uint32_t *rid)
 {
        struct netr_ServerAuthenticate3 r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_name = server_name;
        r.in.account_name = account_name;
@@ -982,113 +1340,152 @@ NTSTATUS rpccli_netr_ServerAuthenticate3(struct rpc_pipe_client *cli, TALLOC_CTX
        r.in.computer_name = computer_name;
        r.in.credentials = credentials;
        r.in.negotiate_flags = negotiate_flags;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_ServerAuthenticate3, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_SERVERAUTHENTICATE3, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETLOGON,
+                               &ndr_table_netlogon,
+                               NDR_NETR_SERVERAUTHENTICATE3,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_ServerAuthenticate3, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *credentials = *r.out.credentials;
        *negotiate_flags = *r.out.negotiate_flags;
        *rid = *r.out.rid;
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_netr_DsRGetDCNameEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *domain_name, struct GUID *domain_guid, const char *site_name, uint32_t flags, struct netr_DsRGetDCNameInfo *info, WERROR *werror)
+NTSTATUS rpccli_netr_DsRGetDCNameEx(struct rpc_pipe_client *cli,
+                                   TALLOC_CTX *mem_ctx,
+                                   const char *server_unc,
+                                   const char *domain_name,
+                                   struct GUID *domain_guid,
+                                   const char *site_name,
+                                   uint32_t flags,
+                                   struct netr_DsRGetDCNameInfo **info,
+                                   WERROR *werror)
 {
        struct netr_DsRGetDCNameEx r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_unc = server_unc;
        r.in.domain_name = domain_name;
        r.in.domain_guid = domain_guid;
        r.in.site_name = site_name;
        r.in.flags = flags;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_DsRGetDCNameEx, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_DSRGETDCNAMEEX, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETLOGON,
+                               &ndr_table_netlogon,
+                               NDR_NETR_DSRGETDCNAMEEX,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_DsRGetDCNameEx, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       if (info && r.out.info) {
-               *info = *r.out.info;
-       }
-       
+       *info = *r.out.info;
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_netr_DsRGetSiteName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *computer_name, const char **site, WERROR *werror)
+NTSTATUS rpccli_netr_DsRGetSiteName(struct rpc_pipe_client *cli,
+                                   TALLOC_CTX *mem_ctx,
+                                   const char *computer_name,
+                                   const char **site,
+                                   WERROR *werror)
 {
        struct netr_DsRGetSiteName r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.computer_name = computer_name;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_DsRGetSiteName, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_DSRGETSITENAME, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETLOGON,
+                               &ndr_table_netlogon,
+                               NDR_NETR_DSRGETSITENAME,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_DsRGetSiteName, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *site = *r.out.site;
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_netr_LogonGetDomainInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *computer_name, struct netr_Authenticator *credential, struct netr_Authenticator *return_authenticator, uint32_t level, union netr_DomainQuery query, union netr_DomainInfo *info)
+NTSTATUS rpccli_netr_LogonGetDomainInfo(struct rpc_pipe_client *cli,
+                                       TALLOC_CTX *mem_ctx,
+                                       const char *server_name,
+                                       const char *computer_name,
+                                       struct netr_Authenticator *credential,
+                                       struct netr_Authenticator *return_authenticator,
+                                       uint32_t level,
+                                       union netr_DomainQuery query,
+                                       union netr_DomainInfo *info)
 {
        struct netr_LogonGetDomainInfo r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_name = server_name;
        r.in.computer_name = computer_name;
@@ -1096,36 +1493,51 @@ NTSTATUS rpccli_netr_LogonGetDomainInfo(struct rpc_pipe_client *cli, TALLOC_CTX
        r.in.return_authenticator = return_authenticator;
        r.in.level = level;
        r.in.query = query;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_LogonGetDomainInfo, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_LOGONGETDOMAININFO, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETLOGON,
+                               &ndr_table_netlogon,
+                               NDR_NETR_LOGONGETDOMAININFO,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_LogonGetDomainInfo, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *return_authenticator = *r.out.return_authenticator;
        *info = *r.out.info;
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_netr_ServerPasswordSet2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *account_name, enum netr_SchannelType secure_channel_type, const char *computer_name, struct netr_Authenticator credential, struct netr_CryptPassword new_password, struct netr_Authenticator *return_authenticator)
+NTSTATUS rpccli_netr_ServerPasswordSet2(struct rpc_pipe_client *cli,
+                                       TALLOC_CTX *mem_ctx,
+                                       const char *server_name,
+                                       const char *account_name,
+                                       enum netr_SchannelType secure_channel_type,
+                                       const char *computer_name,
+                                       struct netr_Authenticator credential,
+                                       struct netr_CryptPassword new_password,
+                                       struct netr_Authenticator *return_authenticator)
 {
        struct netr_ServerPasswordSet2 r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_name = server_name;
        r.in.account_name = account_name;
@@ -1133,134 +1545,200 @@ NTSTATUS rpccli_netr_ServerPasswordSet2(struct rpc_pipe_client *cli, TALLOC_CTX
        r.in.computer_name = computer_name;
        r.in.credential = credential;
        r.in.new_password = new_password;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_ServerPasswordSet2, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_SERVERPASSWORDSET2, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETLOGON,
+                               &ndr_table_netlogon,
+                               NDR_NETR_SERVERPASSWORDSET2,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_ServerPasswordSet2, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *return_authenticator = *r.out.return_authenticator;
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_netr_NETRSERVERPASSWORDGET(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror)
+NTSTATUS rpccli_netr_ServerPasswordGet(struct rpc_pipe_client *cli,
+                                      TALLOC_CTX *mem_ctx,
+                                      const char *server_name,
+                                      const char *account_name,
+                                      enum netr_SchannelType secure_channel_type,
+                                      const char *computer_name,
+                                      struct netr_Authenticator *credential,
+                                      struct netr_Authenticator *return_authenticator,
+                                      struct samr_Password *password,
+                                      WERROR *werror)
 {
-       struct netr_NETRSERVERPASSWORDGET r;
+       struct netr_ServerPasswordGet r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
-               NDR_PRINT_IN_DEBUG(netr_NETRSERVERPASSWORDGET, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_NETRSERVERPASSWORDGET, &r);
-       
+       r.in.server_name = server_name;
+       r.in.account_name = account_name;
+       r.in.secure_channel_type = secure_channel_type;
+       r.in.computer_name = computer_name;
+       r.in.credential = credential;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(netr_ServerPasswordGet, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETLOGON,
+                               &ndr_table_netlogon,
+                               NDR_NETR_SERVERPASSWORDGET,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
-               NDR_PRINT_OUT_DEBUG(netr_NETRSERVERPASSWORDGET, &r);
-       
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(netr_ServerPasswordGet, &r);
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+       *return_authenticator = *r.out.return_authenticator;
+       *password = *r.out.password;
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_netr_NETRLOGONSENDTOSAM(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror)
+NTSTATUS rpccli_netr_NETRLOGONSENDTOSAM(struct rpc_pipe_client *cli,
+                                       TALLOC_CTX *mem_ctx,
+                                       WERROR *werror)
 {
        struct netr_NETRLOGONSENDTOSAM r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_NETRLOGONSENDTOSAM, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_NETRLOGONSENDTOSAM, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETLOGON,
+                               &ndr_table_netlogon,
+                               NDR_NETR_NETRLOGONSENDTOSAM,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_NETRLOGONSENDTOSAM, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_netr_DSRADDRESSTOSITENAMESW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror)
+NTSTATUS rpccli_netr_DsRAddressToSitenamesW(struct rpc_pipe_client *cli,
+                                           TALLOC_CTX *mem_ctx,
+                                           const char *server_name,
+                                           uint32_t count,
+                                           struct netr_DsRAddress *addresses,
+                                           struct netr_DsRAddressToSitenamesWCtr **ctr,
+                                           WERROR *werror)
 {
-       struct netr_DSRADDRESSTOSITENAMESW r;
+       struct netr_DsRAddressToSitenamesW r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
-               NDR_PRINT_IN_DEBUG(netr_DSRADDRESSTOSITENAMESW, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_DSRADDRESSTOSITENAMESW, &r);
-       
+       r.in.server_name = server_name;
+       r.in.count = count;
+       r.in.addresses = addresses;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(netr_DsRAddressToSitenamesW, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETLOGON,
+                               &ndr_table_netlogon,
+                               NDR_NETR_DSRADDRESSTOSITENAMESW,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
-               NDR_PRINT_OUT_DEBUG(netr_DSRADDRESSTOSITENAMESW, &r);
-       
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(netr_DsRAddressToSitenamesW, &r);
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+       *ctr = *r.out.ctr;
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_netr_DsRGetDCNameEx2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *client_account, uint32_t mask, const char *domain_name, struct GUID *domain_guid, const char *site_name, uint32_t flags, struct netr_DsRGetDCNameInfo *info, WERROR *werror)
+NTSTATUS rpccli_netr_DsRGetDCNameEx2(struct rpc_pipe_client *cli,
+                                    TALLOC_CTX *mem_ctx,
+                                    const char *server_unc,
+                                    const char *client_account,
+                                    uint32_t mask,
+                                    const char *domain_name,
+                                    struct GUID *domain_guid,
+                                    const char *site_name,
+                                    uint32_t flags,
+                                    struct netr_DsRGetDCNameInfo **info,
+                                    WERROR *werror)
 {
        struct netr_DsRGetDCNameEx2 r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_unc = server_unc;
        r.in.client_account = client_account;
@@ -1269,173 +1747,239 @@ NTSTATUS rpccli_netr_DsRGetDCNameEx2(struct rpc_pipe_client *cli, TALLOC_CTX *me
        r.in.domain_guid = domain_guid;
        r.in.site_name = site_name;
        r.in.flags = flags;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_DsRGetDCNameEx2, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_DSRGETDCNAMEEX2, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETLOGON,
+                               &ndr_table_netlogon,
+                               NDR_NETR_DSRGETDCNAMEEX2,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_DsRGetDCNameEx2, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       if (info && r.out.info) {
-               *info = *r.out.info;
-       }
-       
+       *info = *r.out.info;
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror)
+NTSTATUS rpccli_netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN(struct rpc_pipe_client *cli,
+                                                        TALLOC_CTX *mem_ctx,
+                                                        WERROR *werror)
 {
        struct netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_NETRLOGONGETTIMESERVICEPARENTDOMAIN, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETLOGON,
+                               &ndr_table_netlogon,
+                               NDR_NETR_NETRLOGONGETTIMESERVICEPARENTDOMAIN,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_netr_NETRENUMERATETRUSTEDDOMAINSEX(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror)
+NTSTATUS rpccli_netr_NetrEnumerateTrustedDomainsEx(struct rpc_pipe_client *cli,
+                                                  TALLOC_CTX *mem_ctx,
+                                                  const char *server_name,
+                                                  struct netr_DomainTrustList *dom_trust_list,
+                                                  WERROR *werror)
 {
-       struct netr_NETRENUMERATETRUSTEDDOMAINSEX r;
+       struct netr_NetrEnumerateTrustedDomainsEx r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
-               NDR_PRINT_IN_DEBUG(netr_NETRENUMERATETRUSTEDDOMAINSEX, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_NETRENUMERATETRUSTEDDOMAINSEX, &r);
-       
+       r.in.server_name = server_name;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(netr_NetrEnumerateTrustedDomainsEx, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETLOGON,
+                               &ndr_table_netlogon,
+                               NDR_NETR_NETRENUMERATETRUSTEDDOMAINSEX,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
-               NDR_PRINT_OUT_DEBUG(netr_NETRENUMERATETRUSTEDDOMAINSEX, &r);
-       
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(netr_NetrEnumerateTrustedDomainsEx, &r);
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+       *dom_trust_list = *r.out.dom_trust_list;
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_netr_DSRADDRESSTOSITENAMESEXW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror)
+NTSTATUS rpccli_netr_DsRAddressToSitenamesExW(struct rpc_pipe_client *cli,
+                                             TALLOC_CTX *mem_ctx,
+                                             const char *server_name,
+                                             uint32_t count,
+                                             struct netr_DsRAddress *addresses,
+                                             struct netr_DsRAddressToSitenamesExWCtr **ctr,
+                                             WERROR *werror)
 {
-       struct netr_DSRADDRESSTOSITENAMESEXW r;
+       struct netr_DsRAddressToSitenamesExW r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
-               NDR_PRINT_IN_DEBUG(netr_DSRADDRESSTOSITENAMESEXW, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_DSRADDRESSTOSITENAMESEXW, &r);
-       
+       r.in.server_name = server_name;
+       r.in.count = count;
+       r.in.addresses = addresses;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(netr_DsRAddressToSitenamesExW, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETLOGON,
+                               &ndr_table_netlogon,
+                               NDR_NETR_DSRADDRESSTOSITENAMESEXW,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
-               NDR_PRINT_OUT_DEBUG(netr_DSRADDRESSTOSITENAMESEXW, &r);
-       
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(netr_DsRAddressToSitenamesExW, &r);
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+       *ctr = *r.out.ctr;
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_netr_DSRGETDCSITECOVERAGEW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror)
+NTSTATUS rpccli_netr_DsrGetDcSiteCoverageW(struct rpc_pipe_client *cli,
+                                          TALLOC_CTX *mem_ctx,
+                                          const char *server_name,
+                                          struct DcSitesCtr *ctr,
+                                          WERROR *werror)
 {
-       struct netr_DSRGETDCSITECOVERAGEW r;
+       struct netr_DsrGetDcSiteCoverageW r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
-               NDR_PRINT_IN_DEBUG(netr_DSRGETDCSITECOVERAGEW, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_DSRGETDCSITECOVERAGEW, &r);
-       
+       r.in.server_name = server_name;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(netr_DsrGetDcSiteCoverageW, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETLOGON,
+                               &ndr_table_netlogon,
+                               NDR_NETR_DSRGETDCSITECOVERAGEW,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
-               NDR_PRINT_OUT_DEBUG(netr_DSRGETDCSITECOVERAGEW, &r);
-       
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(netr_DsrGetDcSiteCoverageW, &r);
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+       *ctr = *r.out.ctr;
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_netr_LogonSamLogonEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *computer_name, uint16_t logon_level, union netr_LogonLevel logon, uint16_t validation_level, union netr_Validation *validation, uint8_t *authoritative, uint32_t *flags)
+NTSTATUS rpccli_netr_LogonSamLogonEx(struct rpc_pipe_client *cli,
+                                    TALLOC_CTX *mem_ctx,
+                                    const char *server_name,
+                                    const char *computer_name,
+                                    uint16_t logon_level,
+                                    union netr_LogonLevel logon,
+                                    uint16_t validation_level,
+                                    union netr_Validation *validation,
+                                    uint8_t *authoritative,
+                                    uint32_t *flags)
 {
        struct netr_LogonSamLogonEx r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_name = server_name;
        r.in.computer_name = computer_name;
@@ -1443,206 +1987,312 @@ NTSTATUS rpccli_netr_LogonSamLogonEx(struct rpc_pipe_client *cli, TALLOC_CTX *me
        r.in.logon = logon;
        r.in.validation_level = validation_level;
        r.in.flags = flags;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_LogonSamLogonEx, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_LOGONSAMLOGONEX, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETLOGON,
+                               &ndr_table_netlogon,
+                               NDR_NETR_LOGONSAMLOGONEX,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_LogonSamLogonEx, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *validation = *r.out.validation;
        *authoritative = *r.out.authoritative;
        *flags = *r.out.flags;
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_netr_DsrEnumerateDomainTrusts(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, uint32_t trust_flags, uint32_t *count, struct netr_DomainTrust **trusts, WERROR *werror)
+NTSTATUS rpccli_netr_DsrEnumerateDomainTrusts(struct rpc_pipe_client *cli,
+                                             TALLOC_CTX *mem_ctx,
+                                             const char *server_name,
+                                             uint32_t trust_flags,
+                                             struct netr_DomainTrustList *trusts,
+                                             WERROR *werror)
 {
        struct netr_DsrEnumerateDomainTrusts r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_name = server_name;
        r.in.trust_flags = trust_flags;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_DsrEnumerateDomainTrusts, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_DSRENUMERATEDOMAINTRUSTS, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETLOGON,
+                               &ndr_table_netlogon,
+                               NDR_NETR_DSRENUMERATEDOMAINTRUSTS,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_DsrEnumerateDomainTrusts, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       *count = *r.out.count;
-       memcpy(trusts, r.out.trusts, count);
-       
+       *trusts = *r.out.trusts;
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_netr_DSRDEREGISTERDNSHOSTRECORDS(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror)
+NTSTATUS rpccli_netr_DsrDeregisterDNSHostRecords(struct rpc_pipe_client *cli,
+                                                TALLOC_CTX *mem_ctx,
+                                                const char *server_name,
+                                                const char *domain,
+                                                struct GUID *domain_guid,
+                                                struct GUID *dsa_guid,
+                                                const char *dns_host,
+                                                WERROR *werror)
 {
-       struct netr_DSRDEREGISTERDNSHOSTRECORDS r;
+       struct netr_DsrDeregisterDNSHostRecords r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
-               NDR_PRINT_IN_DEBUG(netr_DSRDEREGISTERDNSHOSTRECORDS, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_DSRDEREGISTERDNSHOSTRECORDS, &r);
-       
+       r.in.server_name = server_name;
+       r.in.domain = domain;
+       r.in.domain_guid = domain_guid;
+       r.in.dsa_guid = dsa_guid;
+       r.in.dns_host = dns_host;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(netr_DsrDeregisterDNSHostRecords, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETLOGON,
+                               &ndr_table_netlogon,
+                               NDR_NETR_DSRDEREGISTERDNSHOSTRECORDS,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
-               NDR_PRINT_OUT_DEBUG(netr_DSRDEREGISTERDNSHOSTRECORDS, &r);
-       
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(netr_DsrDeregisterDNSHostRecords, &r);
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_netr_NETRSERVERTRUSTPASSWORDSGET(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror)
+NTSTATUS rpccli_netr_ServerTrustPasswordsGet(struct rpc_pipe_client *cli,
+                                            TALLOC_CTX *mem_ctx,
+                                            const char *server_name,
+                                            const char *account_name,
+                                            enum netr_SchannelType secure_channel_type,
+                                            const char *computer_name,
+                                            struct netr_Authenticator *credential,
+                                            struct netr_Authenticator *return_authenticator,
+                                            struct samr_Password *password,
+                                            struct samr_Password *password2)
 {
-       struct netr_NETRSERVERTRUSTPASSWORDSGET r;
+       struct netr_ServerTrustPasswordsGet r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
-               NDR_PRINT_IN_DEBUG(netr_NETRSERVERTRUSTPASSWORDSGET, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_NETRSERVERTRUSTPASSWORDSGET, &r);
-       
+       r.in.server_name = server_name;
+       r.in.account_name = account_name;
+       r.in.secure_channel_type = secure_channel_type;
+       r.in.computer_name = computer_name;
+       r.in.credential = credential;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(netr_ServerTrustPasswordsGet, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETLOGON,
+                               &ndr_table_netlogon,
+                               NDR_NETR_SERVERTRUSTPASSWORDSGET,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
-               NDR_PRINT_OUT_DEBUG(netr_NETRSERVERTRUSTPASSWORDSGET, &r);
-       
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(netr_ServerTrustPasswordsGet, &r);
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+       *return_authenticator = *r.out.return_authenticator;
+       *password = *r.out.password;
+       *password2 = *r.out.password2;
+
        /* Return result */
-       if (werror) {
-               *werror = r.out.result;
-       }
-       
-       return werror_to_ntstatus(r.out.result);
+       return r.out.result;
 }
 
-NTSTATUS rpccli_netr_DSRGETFORESTTRUSTINFORMATION(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror)
+NTSTATUS rpccli_netr_DsRGetForestTrustInformation(struct rpc_pipe_client *cli,
+                                                 TALLOC_CTX *mem_ctx,
+                                                 const char *server_name,
+                                                 const char *trusted_domain_name,
+                                                 uint32_t flags,
+                                                 struct lsa_ForestTrustInformation **forest_trust_info,
+                                                 WERROR *werror)
 {
-       struct netr_DSRGETFORESTTRUSTINFORMATION r;
+       struct netr_DsRGetForestTrustInformation r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
-               NDR_PRINT_IN_DEBUG(netr_DSRGETFORESTTRUSTINFORMATION, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_DSRGETFORESTTRUSTINFORMATION, &r);
-       
+       r.in.server_name = server_name;
+       r.in.trusted_domain_name = trusted_domain_name;
+       r.in.flags = flags;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(netr_DsRGetForestTrustInformation, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETLOGON,
+                               &ndr_table_netlogon,
+                               NDR_NETR_DSRGETFORESTTRUSTINFORMATION,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
-               NDR_PRINT_OUT_DEBUG(netr_DSRGETFORESTTRUSTINFORMATION, &r);
-       
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(netr_DsRGetForestTrustInformation, &r);
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+       *forest_trust_info = *r.out.forest_trust_info;
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_netr_NETRGETFORESTTRUSTINFORMATION(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror)
+NTSTATUS rpccli_netr_GetForestTrustInformation(struct rpc_pipe_client *cli,
+                                              TALLOC_CTX *mem_ctx,
+                                              const char *server_name,
+                                              const char *trusted_domain_name,
+                                              struct netr_Authenticator *credential,
+                                              struct netr_Authenticator *return_authenticator,
+                                              uint32_t flags,
+                                              struct lsa_ForestTrustInformation **forest_trust_info,
+                                              WERROR *werror)
 {
-       struct netr_NETRGETFORESTTRUSTINFORMATION r;
+       struct netr_GetForestTrustInformation r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
-               NDR_PRINT_IN_DEBUG(netr_NETRGETFORESTTRUSTINFORMATION, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_NETRGETFORESTTRUSTINFORMATION, &r);
-       
+       r.in.server_name = server_name;
+       r.in.trusted_domain_name = trusted_domain_name;
+       r.in.credential = credential;
+       r.in.flags = flags;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(netr_GetForestTrustInformation, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETLOGON,
+                               &ndr_table_netlogon,
+                               NDR_NETR_GETFORESTTRUSTINFORMATION,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
-               NDR_PRINT_OUT_DEBUG(netr_NETRGETFORESTTRUSTINFORMATION, &r);
-       
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(netr_GetForestTrustInformation, &r);
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+       *return_authenticator = *r.out.return_authenticator;
+       *forest_trust_info = *r.out.forest_trust_info;
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_netr_LogonSamLogonWithFlags(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *computer_name, struct netr_Authenticator *credential, struct netr_Authenticator *return_authenticator, uint16_t logon_level, union netr_LogonLevel logon, uint16_t validation_level, union netr_Validation *validation, uint8_t *authoritative, uint32_t *flags)
+NTSTATUS rpccli_netr_LogonSamLogonWithFlags(struct rpc_pipe_client *cli,
+                                           TALLOC_CTX *mem_ctx,
+                                           const char *server_name,
+                                           const char *computer_name,
+                                           struct netr_Authenticator *credential,
+                                           struct netr_Authenticator *return_authenticator,
+                                           uint16_t logon_level,
+                                           union netr_LogonLevel logon,
+                                           uint16_t validation_level,
+                                           union netr_Validation *validation,
+                                           uint8_t *authoritative,
+                                           uint32_t *flags)
 {
        struct netr_LogonSamLogonWithFlags r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_name = server_name;
        r.in.computer_name = computer_name;
@@ -1652,23 +2302,30 @@ NTSTATUS rpccli_netr_LogonSamLogonWithFlags(struct rpc_pipe_client *cli, TALLOC_
        r.in.logon = logon;
        r.in.validation_level = validation_level;
        r.in.flags = flags;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_LogonSamLogonWithFlags, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_LOGONSAMLOGONWITHFLAGS, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETLOGON,
+                               &ndr_table_netlogon,
+                               NDR_NETR_LOGONSAMLOGONWITHFLAGS,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_LogonSamLogonWithFlags, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        if (return_authenticator && r.out.return_authenticator) {
                *return_authenticator = *r.out.return_authenticator;
@@ -1676,41 +2333,50 @@ NTSTATUS rpccli_netr_LogonSamLogonWithFlags(struct rpc_pipe_client *cli, TALLOC_
        *validation = *r.out.validation;
        *authoritative = *r.out.authoritative;
        *flags = *r.out.flags;
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_netr_NETRSERVERGETTRUSTINFO(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror)
+NTSTATUS rpccli_netr_NETRSERVERGETTRUSTINFO(struct rpc_pipe_client *cli,
+                                           TALLOC_CTX *mem_ctx,
+                                           WERROR *werror)
 {
        struct netr_NETRSERVERGETTRUSTINFO r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_NETRSERVERGETTRUSTINFO, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_NETRSERVERGETTRUSTINFO, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_NETLOGON,
+                               &ndr_table_netlogon,
+                               NDR_NETR_NETRSERVERGETTRUSTINFO,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_NETRSERVERGETTRUSTINFO, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
index 4273fedf137dbea08f45bb40ff290726cabf12d6..fa043233ea66ed3387c4073f798389df45fd6d99 100644 (file)
 #include "librpc/gen_ndr/ndr_netlogon.h"
 #ifndef __CLI_NETLOGON__
 #define __CLI_NETLOGON__
-NTSTATUS rpccli_netr_LogonUasLogon(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *account_name, const char *workstation, struct netr_UasInfo *info, WERROR *werror);
-NTSTATUS rpccli_netr_LogonUasLogoff(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *account_name, const char *workstation, struct netr_UasLogoffInfo *info, WERROR *werror);
-NTSTATUS rpccli_netr_LogonSamLogon(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *computer_name, struct netr_Authenticator *credential, struct netr_Authenticator *return_authenticator, uint16_t logon_level, union netr_LogonLevel logon, uint16_t validation_level, union netr_Validation *validation, uint8_t *authoritative);
-NTSTATUS rpccli_netr_LogonSamLogoff(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *computer_name, struct netr_Authenticator *credential, struct netr_Authenticator *return_authenticator, uint16_t logon_level, union netr_LogonLevel logon);
-NTSTATUS rpccli_netr_ServerReqChallenge(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *computer_name, struct netr_Credential *credentials);
-NTSTATUS rpccli_netr_ServerAuthenticate(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *account_name, enum netr_SchannelType secure_channel_type, const char *computer_name, struct netr_Credential *credentials);
-NTSTATUS rpccli_netr_ServerPasswordSet(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *account_name, enum netr_SchannelType secure_channel_type, const char *computer_name, struct netr_Authenticator credential, struct samr_Password new_password, struct netr_Authenticator *return_authenticator);
-NTSTATUS rpccli_netr_DatabaseDeltas(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *logon_server, const char *computername, struct netr_Authenticator credential, struct netr_Authenticator *return_authenticator, enum netr_SamDatabaseID database_id, uint64_t *sequence_num, uint32_t preferredmaximumlength, struct netr_DELTA_ENUM_ARRAY *delta_enum_array);
-NTSTATUS rpccli_netr_DatabaseSync(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *logon_server, const char *computername, struct netr_Authenticator credential, struct netr_Authenticator *return_authenticator, enum netr_SamDatabaseID database_id, uint32_t *sync_context, uint32_t preferredmaximumlength, struct netr_DELTA_ENUM_ARRAY *delta_enum_array);
-NTSTATUS rpccli_netr_AccountDeltas(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *logon_server, const char *computername, struct netr_Authenticator credential, struct netr_Authenticator *return_authenticator, struct netr_UAS_INFO_0 uas, uint32_t count, uint32_t level, uint32_t buffersize, struct netr_AccountBuffer *buffer, uint32_t *count_returned, uint32_t *total_entries, struct netr_UAS_INFO_0 *recordid);
-NTSTATUS rpccli_netr_AccountSync(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *logon_server, const char *computername, struct netr_Authenticator credential, struct netr_Authenticator *return_authenticator, uint32_t reference, uint32_t level, uint32_t buffersize, struct netr_AccountBuffer *buffer, uint32_t *count_returned, uint32_t *total_entries, uint32_t *next_reference, struct netr_UAS_INFO_0 *recordid);
-NTSTATUS rpccli_netr_GetDcName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *logon_server, const char *domainname, const char **dcname);
-NTSTATUS rpccli_netr_LogonControl(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *logon_server, enum netr_LogonControlCode function_code, uint32_t level, union netr_CONTROL_QUERY_INFORMATION *info, WERROR *werror);
-NTSTATUS rpccli_netr_GetAnyDCName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *logon_server, const char *domainname, const char **dcname, WERROR *werror);
-NTSTATUS rpccli_netr_LogonControl2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *logon_server, uint32_t function_code, uint32_t level, union netr_CONTROL_DATA_INFORMATION data, union netr_CONTROL_QUERY_INFORMATION *query, WERROR *werror);
-NTSTATUS rpccli_netr_ServerAuthenticate2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *account_name, enum netr_SchannelType secure_channel_type, const char *computer_name, struct netr_Credential *credentials, uint32_t *negotiate_flags);
-NTSTATUS rpccli_netr_DatabaseSync2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *logon_server, const char *computername, struct netr_Authenticator credential, struct netr_Authenticator *return_authenticator, enum netr_SamDatabaseID database_id, uint16_t restart_state, uint32_t *sync_context, uint32_t preferredmaximumlength, struct netr_DELTA_ENUM_ARRAY *delta_enum_array);
-NTSTATUS rpccli_netr_DatabaseRedo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *logon_server, const char *computername, struct netr_Authenticator credential, struct netr_Authenticator *return_authenticator, uint8_t *change_log_entry, uint32_t change_log_entry_size, struct netr_DELTA_ENUM_ARRAY *delta_enum_array);
-NTSTATUS rpccli_netr_LogonControl2Ex(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *logon_server, uint32_t function_code, uint32_t level, union netr_CONTROL_DATA_INFORMATION data, union netr_CONTROL_QUERY_INFORMATION *query, WERROR *werror);
-NTSTATUS rpccli_netr_NETRENUMERATETRUSTEDDOMAINS(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror);
-NTSTATUS rpccli_netr_DsRGetDCName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *domain_name, struct GUID *domain_guid, struct GUID *site_guid, uint32_t flags, struct netr_DsRGetDCNameInfo *info, WERROR *werror);
-NTSTATUS rpccli_netr_NETRLOGONDUMMYROUTINE1(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror);
-NTSTATUS rpccli_netr_NETRLOGONSETSERVICEBITS(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror);
-NTSTATUS rpccli_netr_NETRLOGONGETTRUSTRID(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror);
-NTSTATUS rpccli_netr_NETRLOGONCOMPUTESERVERDIGEST(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror);
-NTSTATUS rpccli_netr_NETRLOGONCOMPUTECLIENTDIGEST(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror);
-NTSTATUS rpccli_netr_ServerAuthenticate3(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *account_name, enum netr_SchannelType secure_channel_type, const char *computer_name, struct netr_Credential *credentials, uint32_t *negotiate_flags, uint32_t *rid);
-NTSTATUS rpccli_netr_DsRGetDCNameEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *domain_name, struct GUID *domain_guid, const char *site_name, uint32_t flags, struct netr_DsRGetDCNameInfo *info, WERROR *werror);
-NTSTATUS rpccli_netr_DsRGetSiteName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *computer_name, const char **site, WERROR *werror);
-NTSTATUS rpccli_netr_LogonGetDomainInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *computer_name, struct netr_Authenticator *credential, struct netr_Authenticator *return_authenticator, uint32_t level, union netr_DomainQuery query, union netr_DomainInfo *info);
-NTSTATUS rpccli_netr_ServerPasswordSet2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *account_name, enum netr_SchannelType secure_channel_type, const char *computer_name, struct netr_Authenticator credential, struct netr_CryptPassword new_password, struct netr_Authenticator *return_authenticator);
-NTSTATUS rpccli_netr_NETRSERVERPASSWORDGET(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror);
-NTSTATUS rpccli_netr_NETRLOGONSENDTOSAM(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror);
-NTSTATUS rpccli_netr_DSRADDRESSTOSITENAMESW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror);
-NTSTATUS rpccli_netr_DsRGetDCNameEx2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *client_account, uint32_t mask, const char *domain_name, struct GUID *domain_guid, const char *site_name, uint32_t flags, struct netr_DsRGetDCNameInfo *info, WERROR *werror);
-NTSTATUS rpccli_netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror);
-NTSTATUS rpccli_netr_NETRENUMERATETRUSTEDDOMAINSEX(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror);
-NTSTATUS rpccli_netr_DSRADDRESSTOSITENAMESEXW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror);
-NTSTATUS rpccli_netr_DSRGETDCSITECOVERAGEW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror);
-NTSTATUS rpccli_netr_LogonSamLogonEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *computer_name, uint16_t logon_level, union netr_LogonLevel logon, uint16_t validation_level, union netr_Validation *validation, uint8_t *authoritative, uint32_t *flags);
-NTSTATUS rpccli_netr_DsrEnumerateDomainTrusts(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, uint32_t trust_flags, uint32_t *count, struct netr_DomainTrust **trusts, WERROR *werror);
-NTSTATUS rpccli_netr_DSRDEREGISTERDNSHOSTRECORDS(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror);
-NTSTATUS rpccli_netr_NETRSERVERTRUSTPASSWORDSGET(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror);
-NTSTATUS rpccli_netr_DSRGETFORESTTRUSTINFORMATION(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror);
-NTSTATUS rpccli_netr_NETRGETFORESTTRUSTINFORMATION(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror);
-NTSTATUS rpccli_netr_LogonSamLogonWithFlags(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *computer_name, struct netr_Authenticator *credential, struct netr_Authenticator *return_authenticator, uint16_t logon_level, union netr_LogonLevel logon, uint16_t validation_level, union netr_Validation *validation, uint8_t *authoritative, uint32_t *flags);
-NTSTATUS rpccli_netr_NETRSERVERGETTRUSTINFO(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror);
+NTSTATUS rpccli_netr_LogonUasLogon(struct rpc_pipe_client *cli,
+                                  TALLOC_CTX *mem_ctx,
+                                  const char *server_name,
+                                  const char *account_name,
+                                  const char *workstation,
+                                  struct netr_UasInfo *info,
+                                  WERROR *werror);
+NTSTATUS rpccli_netr_LogonUasLogoff(struct rpc_pipe_client *cli,
+                                   TALLOC_CTX *mem_ctx,
+                                   const char *server_name,
+                                   const char *account_name,
+                                   const char *workstation,
+                                   struct netr_UasLogoffInfo *info,
+                                   WERROR *werror);
+NTSTATUS rpccli_netr_LogonSamLogon(struct rpc_pipe_client *cli,
+                                  TALLOC_CTX *mem_ctx,
+                                  const char *server_name,
+                                  const char *computer_name,
+                                  struct netr_Authenticator *credential,
+                                  struct netr_Authenticator *return_authenticator,
+                                  uint16_t logon_level,
+                                  union netr_LogonLevel logon,
+                                  uint16_t validation_level,
+                                  union netr_Validation *validation,
+                                  uint8_t *authoritative);
+NTSTATUS rpccli_netr_LogonSamLogoff(struct rpc_pipe_client *cli,
+                                   TALLOC_CTX *mem_ctx,
+                                   const char *server_name,
+                                   const char *computer_name,
+                                   struct netr_Authenticator *credential,
+                                   struct netr_Authenticator *return_authenticator,
+                                   uint16_t logon_level,
+                                   union netr_LogonLevel logon);
+NTSTATUS rpccli_netr_ServerReqChallenge(struct rpc_pipe_client *cli,
+                                       TALLOC_CTX *mem_ctx,
+                                       const char *server_name,
+                                       const char *computer_name,
+                                       struct netr_Credential *credentials);
+NTSTATUS rpccli_netr_ServerAuthenticate(struct rpc_pipe_client *cli,
+                                       TALLOC_CTX *mem_ctx,
+                                       const char *server_name,
+                                       const char *account_name,
+                                       enum netr_SchannelType secure_channel_type,
+                                       const char *computer_name,
+                                       struct netr_Credential *credentials);
+NTSTATUS rpccli_netr_ServerPasswordSet(struct rpc_pipe_client *cli,
+                                      TALLOC_CTX *mem_ctx,
+                                      const char *server_name,
+                                      const char *account_name,
+                                      enum netr_SchannelType secure_channel_type,
+                                      const char *computer_name,
+                                      struct netr_Authenticator credential,
+                                      struct samr_Password new_password,
+                                      struct netr_Authenticator *return_authenticator);
+NTSTATUS rpccli_netr_DatabaseDeltas(struct rpc_pipe_client *cli,
+                                   TALLOC_CTX *mem_ctx,
+                                   const char *logon_server,
+                                   const char *computername,
+                                   struct netr_Authenticator credential,
+                                   struct netr_Authenticator *return_authenticator,
+                                   enum netr_SamDatabaseID database_id,
+                                   uint64_t *sequence_num,
+                                   uint32_t preferredmaximumlength,
+                                   struct netr_DELTA_ENUM_ARRAY *delta_enum_array);
+NTSTATUS rpccli_netr_DatabaseSync(struct rpc_pipe_client *cli,
+                                 TALLOC_CTX *mem_ctx,
+                                 const char *logon_server,
+                                 const char *computername,
+                                 struct netr_Authenticator credential,
+                                 struct netr_Authenticator *return_authenticator,
+                                 enum netr_SamDatabaseID database_id,
+                                 uint32_t *sync_context,
+                                 uint32_t preferredmaximumlength,
+                                 struct netr_DELTA_ENUM_ARRAY *delta_enum_array);
+NTSTATUS rpccli_netr_AccountDeltas(struct rpc_pipe_client *cli,
+                                  TALLOC_CTX *mem_ctx,
+                                  const char *logon_server,
+                                  const char *computername,
+                                  struct netr_Authenticator credential,
+                                  struct netr_Authenticator *return_authenticator,
+                                  struct netr_UAS_INFO_0 uas,
+                                  uint32_t count,
+                                  uint32_t level,
+                                  uint32_t buffersize,
+                                  struct netr_AccountBuffer *buffer,
+                                  uint32_t *count_returned,
+                                  uint32_t *total_entries,
+                                  struct netr_UAS_INFO_0 *recordid);
+NTSTATUS rpccli_netr_AccountSync(struct rpc_pipe_client *cli,
+                                TALLOC_CTX *mem_ctx,
+                                const char *logon_server,
+                                const char *computername,
+                                struct netr_Authenticator credential,
+                                struct netr_Authenticator *return_authenticator,
+                                uint32_t reference,
+                                uint32_t level,
+                                uint32_t buffersize,
+                                struct netr_AccountBuffer *buffer,
+                                uint32_t *count_returned,
+                                uint32_t *total_entries,
+                                uint32_t *next_reference,
+                                struct netr_UAS_INFO_0 *recordid);
+NTSTATUS rpccli_netr_GetDcName(struct rpc_pipe_client *cli,
+                              TALLOC_CTX *mem_ctx,
+                              const char *logon_server,
+                              const char *domainname,
+                              const char **dcname,
+                              WERROR *werror);
+NTSTATUS rpccli_netr_LogonControl(struct rpc_pipe_client *cli,
+                                 TALLOC_CTX *mem_ctx,
+                                 const char *logon_server,
+                                 enum netr_LogonControlCode function_code,
+                                 uint32_t level,
+                                 union netr_CONTROL_QUERY_INFORMATION *info,
+                                 WERROR *werror);
+NTSTATUS rpccli_netr_GetAnyDCName(struct rpc_pipe_client *cli,
+                                 TALLOC_CTX *mem_ctx,
+                                 const char *logon_server,
+                                 const char *domainname,
+                                 const char **dcname,
+                                 WERROR *werror);
+NTSTATUS rpccli_netr_LogonControl2(struct rpc_pipe_client *cli,
+                                  TALLOC_CTX *mem_ctx,
+                                  const char *logon_server,
+                                  uint32_t function_code,
+                                  uint32_t level,
+                                  union netr_CONTROL_DATA_INFORMATION data,
+                                  union netr_CONTROL_QUERY_INFORMATION *query,
+                                  WERROR *werror);
+NTSTATUS rpccli_netr_ServerAuthenticate2(struct rpc_pipe_client *cli,
+                                        TALLOC_CTX *mem_ctx,
+                                        const char *server_name,
+                                        const char *account_name,
+                                        enum netr_SchannelType secure_channel_type,
+                                        const char *computer_name,
+                                        struct netr_Credential *credentials,
+                                        uint32_t *negotiate_flags);
+NTSTATUS rpccli_netr_DatabaseSync2(struct rpc_pipe_client *cli,
+                                  TALLOC_CTX *mem_ctx,
+                                  const char *logon_server,
+                                  const char *computername,
+                                  struct netr_Authenticator credential,
+                                  struct netr_Authenticator *return_authenticator,
+                                  enum netr_SamDatabaseID database_id,
+                                  uint16_t restart_state,
+                                  uint32_t *sync_context,
+                                  uint32_t preferredmaximumlength,
+                                  struct netr_DELTA_ENUM_ARRAY *delta_enum_array);
+NTSTATUS rpccli_netr_DatabaseRedo(struct rpc_pipe_client *cli,
+                                 TALLOC_CTX *mem_ctx,
+                                 const char *logon_server,
+                                 const char *computername,
+                                 struct netr_Authenticator credential,
+                                 struct netr_Authenticator *return_authenticator,
+                                 uint8_t *change_log_entry,
+                                 uint32_t change_log_entry_size,
+                                 struct netr_DELTA_ENUM_ARRAY *delta_enum_array);
+NTSTATUS rpccli_netr_LogonControl2Ex(struct rpc_pipe_client *cli,
+                                    TALLOC_CTX *mem_ctx,
+                                    const char *logon_server,
+                                    uint32_t function_code,
+                                    uint32_t level,
+                                    union netr_CONTROL_DATA_INFORMATION data,
+                                    union netr_CONTROL_QUERY_INFORMATION *query,
+                                    WERROR *werror);
+NTSTATUS rpccli_netr_NetrEnumerateTrustedDomains(struct rpc_pipe_client *cli,
+                                                TALLOC_CTX *mem_ctx,
+                                                const char *server_name,
+                                                struct netr_Blob *trusted_domains_blob,
+                                                WERROR *werror);
+NTSTATUS rpccli_netr_DsRGetDCName(struct rpc_pipe_client *cli,
+                                 TALLOC_CTX *mem_ctx,
+                                 const char *server_unc,
+                                 const char *domain_name,
+                                 struct GUID *domain_guid,
+                                 struct GUID *site_guid,
+                                 uint32_t flags,
+                                 struct netr_DsRGetDCNameInfo *info,
+                                 WERROR *werror);
+NTSTATUS rpccli_netr_NETRLOGONDUMMYROUTINE1(struct rpc_pipe_client *cli,
+                                           TALLOC_CTX *mem_ctx,
+                                           WERROR *werror);
+NTSTATUS rpccli_netr_NETRLOGONSETSERVICEBITS(struct rpc_pipe_client *cli,
+                                            TALLOC_CTX *mem_ctx,
+                                            WERROR *werror);
+NTSTATUS rpccli_netr_LogonGetTrustRid(struct rpc_pipe_client *cli,
+                                     TALLOC_CTX *mem_ctx,
+                                     const char *server_name,
+                                     const char *domain_name,
+                                     uint32_t *rid,
+                                     WERROR *werror);
+NTSTATUS rpccli_netr_NETRLOGONCOMPUTESERVERDIGEST(struct rpc_pipe_client *cli,
+                                                 TALLOC_CTX *mem_ctx,
+                                                 WERROR *werror);
+NTSTATUS rpccli_netr_NETRLOGONCOMPUTECLIENTDIGEST(struct rpc_pipe_client *cli,
+                                                 TALLOC_CTX *mem_ctx,
+                                                 WERROR *werror);
+NTSTATUS rpccli_netr_ServerAuthenticate3(struct rpc_pipe_client *cli,
+                                        TALLOC_CTX *mem_ctx,
+                                        const char *server_name,
+                                        const char *account_name,
+                                        enum netr_SchannelType secure_channel_type,
+                                        const char *computer_name,
+                                        struct netr_Credential *credentials,
+                                        uint32_t *negotiate_flags,
+                                        uint32_t *rid);
+NTSTATUS rpccli_netr_DsRGetDCNameEx(struct rpc_pipe_client *cli,
+                                   TALLOC_CTX *mem_ctx,
+                                   const char *server_unc,
+                                   const char *domain_name,
+                                   struct GUID *domain_guid,
+                                   const char *site_name,
+                                   uint32_t flags,
+                                   struct netr_DsRGetDCNameInfo **info,
+                                   WERROR *werror);
+NTSTATUS rpccli_netr_DsRGetSiteName(struct rpc_pipe_client *cli,
+                                   TALLOC_CTX *mem_ctx,
+                                   const char *computer_name,
+                                   const char **site,
+                                   WERROR *werror);
+NTSTATUS rpccli_netr_LogonGetDomainInfo(struct rpc_pipe_client *cli,
+                                       TALLOC_CTX *mem_ctx,
+                                       const char *server_name,
+                                       const char *computer_name,
+                                       struct netr_Authenticator *credential,
+                                       struct netr_Authenticator *return_authenticator,
+                                       uint32_t level,
+                                       union netr_DomainQuery query,
+                                       union netr_DomainInfo *info);
+NTSTATUS rpccli_netr_ServerPasswordSet2(struct rpc_pipe_client *cli,
+                                       TALLOC_CTX *mem_ctx,
+                                       const char *server_name,
+                                       const char *account_name,
+                                       enum netr_SchannelType secure_channel_type,
+                                       const char *computer_name,
+                                       struct netr_Authenticator credential,
+                                       struct netr_CryptPassword new_password,
+                                       struct netr_Authenticator *return_authenticator);
+NTSTATUS rpccli_netr_ServerPasswordGet(struct rpc_pipe_client *cli,
+                                      TALLOC_CTX *mem_ctx,
+                                      const char *server_name,
+                                      const char *account_name,
+                                      enum netr_SchannelType secure_channel_type,
+                                      const char *computer_name,
+                                      struct netr_Authenticator *credential,
+                                      struct netr_Authenticator *return_authenticator,
+                                      struct samr_Password *password,
+                                      WERROR *werror);
+NTSTATUS rpccli_netr_NETRLOGONSENDTOSAM(struct rpc_pipe_client *cli,
+                                       TALLOC_CTX *mem_ctx,
+                                       WERROR *werror);
+NTSTATUS rpccli_netr_DsRAddressToSitenamesW(struct rpc_pipe_client *cli,
+                                           TALLOC_CTX *mem_ctx,
+                                           const char *server_name,
+                                           uint32_t count,
+                                           struct netr_DsRAddress *addresses,
+                                           struct netr_DsRAddressToSitenamesWCtr **ctr,
+                                           WERROR *werror);
+NTSTATUS rpccli_netr_DsRGetDCNameEx2(struct rpc_pipe_client *cli,
+                                    TALLOC_CTX *mem_ctx,
+                                    const char *server_unc,
+                                    const char *client_account,
+                                    uint32_t mask,
+                                    const char *domain_name,
+                                    struct GUID *domain_guid,
+                                    const char *site_name,
+                                    uint32_t flags,
+                                    struct netr_DsRGetDCNameInfo **info,
+                                    WERROR *werror);
+NTSTATUS rpccli_netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN(struct rpc_pipe_client *cli,
+                                                        TALLOC_CTX *mem_ctx,
+                                                        WERROR *werror);
+NTSTATUS rpccli_netr_NetrEnumerateTrustedDomainsEx(struct rpc_pipe_client *cli,
+                                                  TALLOC_CTX *mem_ctx,
+                                                  const char *server_name,
+                                                  struct netr_DomainTrustList *dom_trust_list,
+                                                  WERROR *werror);
+NTSTATUS rpccli_netr_DsRAddressToSitenamesExW(struct rpc_pipe_client *cli,
+                                             TALLOC_CTX *mem_ctx,
+                                             const char *server_name,
+                                             uint32_t count,
+                                             struct netr_DsRAddress *addresses,
+                                             struct netr_DsRAddressToSitenamesExWCtr **ctr,
+                                             WERROR *werror);
+NTSTATUS rpccli_netr_DsrGetDcSiteCoverageW(struct rpc_pipe_client *cli,
+                                          TALLOC_CTX *mem_ctx,
+                                          const char *server_name,
+                                          struct DcSitesCtr *ctr,
+                                          WERROR *werror);
+NTSTATUS rpccli_netr_LogonSamLogonEx(struct rpc_pipe_client *cli,
+                                    TALLOC_CTX *mem_ctx,
+                                    const char *server_name,
+                                    const char *computer_name,
+                                    uint16_t logon_level,
+                                    union netr_LogonLevel logon,
+                                    uint16_t validation_level,
+                                    union netr_Validation *validation,
+                                    uint8_t *authoritative,
+                                    uint32_t *flags);
+NTSTATUS rpccli_netr_DsrEnumerateDomainTrusts(struct rpc_pipe_client *cli,
+                                             TALLOC_CTX *mem_ctx,
+                                             const char *server_name,
+                                             uint32_t trust_flags,
+                                             struct netr_DomainTrustList *trusts,
+                                             WERROR *werror);
+NTSTATUS rpccli_netr_DsrDeregisterDNSHostRecords(struct rpc_pipe_client *cli,
+                                                TALLOC_CTX *mem_ctx,
+                                                const char *server_name,
+                                                const char *domain,
+                                                struct GUID *domain_guid,
+                                                struct GUID *dsa_guid,
+                                                const char *dns_host,
+                                                WERROR *werror);
+NTSTATUS rpccli_netr_ServerTrustPasswordsGet(struct rpc_pipe_client *cli,
+                                            TALLOC_CTX *mem_ctx,
+                                            const char *server_name,
+                                            const char *account_name,
+                                            enum netr_SchannelType secure_channel_type,
+                                            const char *computer_name,
+                                            struct netr_Authenticator *credential,
+                                            struct netr_Authenticator *return_authenticator,
+                                            struct samr_Password *password,
+                                            struct samr_Password *password2);
+NTSTATUS rpccli_netr_DsRGetForestTrustInformation(struct rpc_pipe_client *cli,
+                                                 TALLOC_CTX *mem_ctx,
+                                                 const char *server_name,
+                                                 const char *trusted_domain_name,
+                                                 uint32_t flags,
+                                                 struct lsa_ForestTrustInformation **forest_trust_info,
+                                                 WERROR *werror);
+NTSTATUS rpccli_netr_GetForestTrustInformation(struct rpc_pipe_client *cli,
+                                              TALLOC_CTX *mem_ctx,
+                                              const char *server_name,
+                                              const char *trusted_domain_name,
+                                              struct netr_Authenticator *credential,
+                                              struct netr_Authenticator *return_authenticator,
+                                              uint32_t flags,
+                                              struct lsa_ForestTrustInformation **forest_trust_info,
+                                              WERROR *werror);
+NTSTATUS rpccli_netr_LogonSamLogonWithFlags(struct rpc_pipe_client *cli,
+                                           TALLOC_CTX *mem_ctx,
+                                           const char *server_name,
+                                           const char *computer_name,
+                                           struct netr_Authenticator *credential,
+                                           struct netr_Authenticator *return_authenticator,
+                                           uint16_t logon_level,
+                                           union netr_LogonLevel logon,
+                                           uint16_t validation_level,
+                                           union netr_Validation *validation,
+                                           uint8_t *authoritative,
+                                           uint32_t *flags);
+NTSTATUS rpccli_netr_NETRSERVERGETTRUSTINFO(struct rpc_pipe_client *cli,
+                                           TALLOC_CTX *mem_ctx,
+                                           WERROR *werror);
 #endif /* __CLI_NETLOGON__ */
diff --git a/source/librpc/gen_ndr/cli_samr.c b/source/librpc/gen_ndr/cli_samr.c
new file mode 100644 (file)
index 0000000..73c123b
--- /dev/null
@@ -0,0 +1,3032 @@
+/*
+ * Unix SMB/CIFS implementation.
+ * client auto-generated by pidl. DO NOT MODIFY!
+ */
+
+#include "includes.h"
+#include "librpc/gen_ndr/cli_samr.h"
+
+NTSTATUS rpccli_samr_Connect(struct rpc_pipe_client *cli,
+                            TALLOC_CTX *mem_ctx,
+                            uint16_t *system_name,
+                            uint32_t access_mask,
+                            struct policy_handle *connect_handle)
+{
+       struct samr_Connect r;
+       NTSTATUS status;
+
+       /* In parameters */
+       r.in.system_name = system_name;
+       r.in.access_mask = access_mask;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_Connect, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SAMR,
+                               &ndr_table_samr,
+                               NDR_SAMR_CONNECT,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_Connect, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+       *connect_handle = *r.out.connect_handle;
+
+       /* Return result */
+       return r.out.result;
+}
+
+NTSTATUS rpccli_samr_Close(struct rpc_pipe_client *cli,
+                          TALLOC_CTX *mem_ctx,
+                          struct policy_handle *handle)
+{
+       struct samr_Close r;
+       NTSTATUS status;
+
+       /* In parameters */
+       r.in.handle = handle;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_Close, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SAMR,
+                               &ndr_table_samr,
+                               NDR_SAMR_CLOSE,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_Close, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+       *handle = *r.out.handle;
+
+       /* Return result */
+       return r.out.result;
+}
+
+NTSTATUS rpccli_samr_SetSecurity(struct rpc_pipe_client *cli,
+                                TALLOC_CTX *mem_ctx,
+                                struct policy_handle *handle,
+                                uint32_t sec_info,
+                                struct sec_desc_buf *sdbuf)
+{
+       struct samr_SetSecurity r;
+       NTSTATUS status;
+
+       /* In parameters */
+       r.in.handle = handle;
+       r.in.sec_info = sec_info;
+       r.in.sdbuf = sdbuf;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_SetSecurity, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SAMR,
+                               &ndr_table_samr,
+                               NDR_SAMR_SETSECURITY,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_SetSecurity, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+
+       /* Return result */
+       return r.out.result;
+}
+
+NTSTATUS rpccli_samr_QuerySecurity(struct rpc_pipe_client *cli,
+                                  TALLOC_CTX *mem_ctx,
+                                  struct policy_handle *handle,
+                                  uint32_t sec_info,
+                                  struct sec_desc_buf *sdbuf)
+{
+       struct samr_QuerySecurity r;
+       NTSTATUS status;
+
+       /* In parameters */
+       r.in.handle = handle;
+       r.in.sec_info = sec_info;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_QuerySecurity, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SAMR,
+                               &ndr_table_samr,
+                               NDR_SAMR_QUERYSECURITY,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_QuerySecurity, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+       *sdbuf = *r.out.sdbuf;
+
+       /* Return result */
+       return r.out.result;
+}
+
+NTSTATUS rpccli_samr_Shutdown(struct rpc_pipe_client *cli,
+                             TALLOC_CTX *mem_ctx,
+                             struct policy_handle *connect_handle)
+{
+       struct samr_Shutdown r;
+       NTSTATUS status;
+
+       /* In parameters */
+       r.in.connect_handle = connect_handle;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_Shutdown, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SAMR,
+                               &ndr_table_samr,
+                               NDR_SAMR_SHUTDOWN,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_Shutdown, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+
+       /* Return result */
+       return r.out.result;
+}
+
+NTSTATUS rpccli_samr_LookupDomain(struct rpc_pipe_client *cli,
+                                 TALLOC_CTX *mem_ctx,
+                                 struct policy_handle *connect_handle,
+                                 struct lsa_String *domain_name,
+                                 struct dom_sid2 *sid)
+{
+       struct samr_LookupDomain r;
+       NTSTATUS status;
+
+       /* In parameters */
+       r.in.connect_handle = connect_handle;
+       r.in.domain_name = domain_name;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_LookupDomain, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SAMR,
+                               &ndr_table_samr,
+                               NDR_SAMR_LOOKUPDOMAIN,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_LookupDomain, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+       *sid = *r.out.sid;
+
+       /* Return result */
+       return r.out.result;
+}
+
+NTSTATUS rpccli_samr_EnumDomains(struct rpc_pipe_client *cli,
+                                TALLOC_CTX *mem_ctx,
+                                struct policy_handle *connect_handle,
+                                uint32_t *resume_handle,
+                                uint32_t buf_size,
+                                struct samr_SamArray *sam,
+                                uint32_t *num_entries)
+{
+       struct samr_EnumDomains r;
+       NTSTATUS status;
+
+       /* In parameters */
+       r.in.connect_handle = connect_handle;
+       r.in.resume_handle = resume_handle;
+       r.in.buf_size = buf_size;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_EnumDomains, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SAMR,
+                               &ndr_table_samr,
+                               NDR_SAMR_ENUMDOMAINS,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_EnumDomains, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+       *resume_handle = *r.out.resume_handle;
+       *sam = *r.out.sam;
+       *num_entries = *r.out.num_entries;
+
+       /* Return result */
+       return r.out.result;
+}
+
+NTSTATUS rpccli_samr_OpenDomain(struct rpc_pipe_client *cli,
+                               TALLOC_CTX *mem_ctx,
+                               struct policy_handle *connect_handle,
+                               uint32_t access_mask,
+                               struct dom_sid2 *sid,
+                               struct policy_handle *domain_handle)
+{
+       struct samr_OpenDomain r;
+       NTSTATUS status;
+
+       /* In parameters */
+       r.in.connect_handle = connect_handle;
+       r.in.access_mask = access_mask;
+       r.in.sid = sid;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_OpenDomain, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SAMR,
+                               &ndr_table_samr,
+                               NDR_SAMR_OPENDOMAIN,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_OpenDomain, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+       *domain_handle = *r.out.domain_handle;
+
+       /* Return result */
+       return r.out.result;
+}
+
+NTSTATUS rpccli_samr_QueryDomainInfo(struct rpc_pipe_client *cli,
+                                    TALLOC_CTX *mem_ctx,
+                                    struct policy_handle *domain_handle,
+                                    uint16_t level,
+                                    union samr_DomainInfo *info)
+{
+       struct samr_QueryDomainInfo r;
+       NTSTATUS status;
+
+       /* In parameters */
+       r.in.domain_handle = domain_handle;
+       r.in.level = level;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_QueryDomainInfo, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SAMR,
+                               &ndr_table_samr,
+                               NDR_SAMR_QUERYDOMAININFO,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_QueryDomainInfo, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+       *info = *r.out.info;
+
+       /* Return result */
+       return r.out.result;
+}
+
+NTSTATUS rpccli_samr_SetDomainInfo(struct rpc_pipe_client *cli,
+                                  TALLOC_CTX *mem_ctx,
+                                  struct policy_handle *domain_handle,
+                                  uint16_t level,
+                                  union samr_DomainInfo *info)
+{
+       struct samr_SetDomainInfo r;
+       NTSTATUS status;
+
+       /* In parameters */
+       r.in.domain_handle = domain_handle;
+       r.in.level = level;
+       r.in.info = info;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_SetDomainInfo, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SAMR,
+                               &ndr_table_samr,
+                               NDR_SAMR_SETDOMAININFO,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_SetDomainInfo, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+
+       /* Return result */
+       return r.out.result;
+}
+
+NTSTATUS rpccli_samr_CreateDomainGroup(struct rpc_pipe_client *cli,
+                                      TALLOC_CTX *mem_ctx,
+                                      struct policy_handle *domain_handle,
+                                      struct lsa_String *name,
+                                      uint32_t access_mask,
+                                      struct policy_handle *group_handle,
+                                      uint32_t *rid)
+{
+       struct samr_CreateDomainGroup r;
+       NTSTATUS status;
+
+       /* In parameters */
+       r.in.domain_handle = domain_handle;
+       r.in.name = name;
+       r.in.access_mask = access_mask;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_CreateDomainGroup, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SAMR,
+                               &ndr_table_samr,
+                               NDR_SAMR_CREATEDOMAINGROUP,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_CreateDomainGroup, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+       *group_handle = *r.out.group_handle;
+       *rid = *r.out.rid;
+
+       /* Return result */
+       return r.out.result;
+}
+
+NTSTATUS rpccli_samr_EnumDomainGroups(struct rpc_pipe_client *cli,
+                                     TALLOC_CTX *mem_ctx,
+                                     struct policy_handle *domain_handle,
+                                     uint32_t *resume_handle,
+                                     uint32_t max_size,
+                                     struct samr_SamArray *sam,
+                                     uint32_t *num_entries)
+{
+       struct samr_EnumDomainGroups r;
+       NTSTATUS status;
+
+       /* In parameters */
+       r.in.domain_handle = domain_handle;
+       r.in.resume_handle = resume_handle;
+       r.in.max_size = max_size;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_EnumDomainGroups, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SAMR,
+                               &ndr_table_samr,
+                               NDR_SAMR_ENUMDOMAINGROUPS,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_EnumDomainGroups, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+       *resume_handle = *r.out.resume_handle;
+       *sam = *r.out.sam;
+       *num_entries = *r.out.num_entries;
+
+       /* Return result */
+       return r.out.result;
+}
+
+NTSTATUS rpccli_samr_CreateUser(struct rpc_pipe_client *cli,
+                               TALLOC_CTX *mem_ctx,
+                               struct policy_handle *domain_handle,
+                               struct lsa_String *account_name,
+                               uint32_t access_mask,
+                               struct policy_handle *user_handle,
+                               uint32_t *rid)
+{
+       struct samr_CreateUser r;
+       NTSTATUS status;
+
+       /* In parameters */
+       r.in.domain_handle = domain_handle;
+       r.in.account_name = account_name;
+       r.in.access_mask = access_mask;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_CreateUser, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SAMR,
+                               &ndr_table_samr,
+                               NDR_SAMR_CREATEUSER,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_CreateUser, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+       *user_handle = *r.out.user_handle;
+       *rid = *r.out.rid;
+
+       /* Return result */
+       return r.out.result;
+}
+
+NTSTATUS rpccli_samr_EnumDomainUsers(struct rpc_pipe_client *cli,
+                                    TALLOC_CTX *mem_ctx,
+                                    struct policy_handle *domain_handle,
+                                    uint32_t *resume_handle,
+                                    uint32_t acct_flags,
+                                    uint32_t max_size,
+                                    struct samr_SamArray *sam,
+                                    uint32_t *num_entries)
+{
+       struct samr_EnumDomainUsers r;
+       NTSTATUS status;
+
+       /* In parameters */
+       r.in.domain_handle = domain_handle;
+       r.in.resume_handle = resume_handle;
+       r.in.acct_flags = acct_flags;
+       r.in.max_size = max_size;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_EnumDomainUsers, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SAMR,
+                               &ndr_table_samr,
+                               NDR_SAMR_ENUMDOMAINUSERS,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_EnumDomainUsers, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+       *resume_handle = *r.out.resume_handle;
+       if (sam && r.out.sam) {
+               *sam = *r.out.sam;
+       }
+       *num_entries = *r.out.num_entries;
+
+       /* Return result */
+       return r.out.result;
+}
+
+NTSTATUS rpccli_samr_CreateDomAlias(struct rpc_pipe_client *cli,
+                                   TALLOC_CTX *mem_ctx,
+                                   struct policy_handle *domain_handle,
+                                   struct lsa_String *alias_name,
+                                   uint32_t access_mask,
+                                   struct policy_handle *alias_handle,
+                                   uint32_t *rid)
+{
+       struct samr_CreateDomAlias r;
+       NTSTATUS status;
+
+       /* In parameters */
+       r.in.domain_handle = domain_handle;
+       r.in.alias_name = alias_name;
+       r.in.access_mask = access_mask;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_CreateDomAlias, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SAMR,
+                               &ndr_table_samr,
+                               NDR_SAMR_CREATEDOMALIAS,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_CreateDomAlias, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+       *alias_handle = *r.out.alias_handle;
+       *rid = *r.out.rid;
+
+       /* Return result */
+       return r.out.result;
+}
+
+NTSTATUS rpccli_samr_EnumDomainAliases(struct rpc_pipe_client *cli,
+                                      TALLOC_CTX *mem_ctx,
+                                      struct policy_handle *domain_handle,
+                                      uint32_t *resume_handle,
+                                      uint32_t acct_flags,
+                                      struct samr_SamArray *sam,
+                                      uint32_t *num_entries)
+{
+       struct samr_EnumDomainAliases r;
+       NTSTATUS status;
+
+       /* In parameters */
+       r.in.domain_handle = domain_handle;
+       r.in.resume_handle = resume_handle;
+       r.in.acct_flags = acct_flags;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_EnumDomainAliases, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SAMR,
+                               &ndr_table_samr,
+                               NDR_SAMR_ENUMDOMAINALIASES,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_EnumDomainAliases, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+       *resume_handle = *r.out.resume_handle;
+       *sam = *r.out.sam;
+       *num_entries = *r.out.num_entries;
+
+       /* Return result */
+       return r.out.result;
+}
+
+NTSTATUS rpccli_samr_GetAliasMembership(struct rpc_pipe_client *cli,
+                                       TALLOC_CTX *mem_ctx,
+                                       struct policy_handle *domain_handle,
+                                       struct lsa_SidArray *sids,
+                                       struct samr_Ids *rids)
+{
+       struct samr_GetAliasMembership r;
+       NTSTATUS status;
+
+       /* In parameters */
+       r.in.domain_handle = domain_handle;
+       r.in.sids = sids;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_GetAliasMembership, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SAMR,
+                               &ndr_table_samr,
+                               NDR_SAMR_GETALIASMEMBERSHIP,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_GetAliasMembership, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+       *rids = *r.out.rids;
+
+       /* Return result */
+       return r.out.result;
+}
+
+NTSTATUS rpccli_samr_LookupNames(struct rpc_pipe_client *cli,
+                                TALLOC_CTX *mem_ctx,
+                                struct policy_handle *domain_handle,
+                                uint32_t num_names,
+                                struct lsa_String *names,
+                                struct samr_Ids *rids,
+                                struct samr_Ids *types)
+{
+       struct samr_LookupNames r;
+       NTSTATUS status;
+
+       /* In parameters */
+       r.in.domain_handle = domain_handle;
+       r.in.num_names = num_names;
+       r.in.names = names;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_LookupNames, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SAMR,
+                               &ndr_table_samr,
+                               NDR_SAMR_LOOKUPNAMES,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_LookupNames, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+       *rids = *r.out.rids;
+       *types = *r.out.types;
+
+       /* Return result */
+       return r.out.result;
+}
+
+NTSTATUS rpccli_samr_LookupRids(struct rpc_pipe_client *cli,
+                               TALLOC_CTX *mem_ctx,
+                               struct policy_handle *domain_handle,
+                               uint32_t num_rids,
+                               uint32_t *rids,
+                               struct lsa_Strings *names,
+                               struct samr_Ids *types)
+{
+       struct samr_LookupRids r;
+       NTSTATUS status;
+
+       /* In parameters */
+       r.in.domain_handle = domain_handle;
+       r.in.num_rids = num_rids;
+       r.in.rids = rids;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_LookupRids, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SAMR,
+                               &ndr_table_samr,
+                               NDR_SAMR_LOOKUPRIDS,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_LookupRids, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+       *names = *r.out.names;
+       *types = *r.out.types;
+
+       /* Return result */
+       return r.out.result;
+}
+
+NTSTATUS rpccli_samr_OpenGroup(struct rpc_pipe_client *cli,
+                              TALLOC_CTX *mem_ctx,
+                              struct policy_handle *domain_handle,
+                              uint32_t access_mask,
+                              uint32_t rid,
+                              struct policy_handle *group_handle)
+{
+       struct samr_OpenGroup r;
+       NTSTATUS status;
+
+       /* In parameters */
+       r.in.domain_handle = domain_handle;
+       r.in.access_mask = access_mask;
+       r.in.rid = rid;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_OpenGroup, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SAMR,
+                               &ndr_table_samr,
+                               NDR_SAMR_OPENGROUP,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_OpenGroup, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+       *group_handle = *r.out.group_handle;
+
+       /* Return result */
+       return r.out.result;
+}
+
+NTSTATUS rpccli_samr_QueryGroupInfo(struct rpc_pipe_client *cli,
+                                   TALLOC_CTX *mem_ctx,
+                                   struct policy_handle *group_handle,
+                                   enum samr_GroupInfoEnum level,
+                                   union samr_GroupInfo *info)
+{
+       struct samr_QueryGroupInfo r;
+       NTSTATUS status;
+
+       /* In parameters */
+       r.in.group_handle = group_handle;
+       r.in.level = level;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_QueryGroupInfo, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SAMR,
+                               &ndr_table_samr,
+                               NDR_SAMR_QUERYGROUPINFO,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_QueryGroupInfo, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+       *info = *r.out.info;
+
+       /* Return result */
+       return r.out.result;
+}
+
+NTSTATUS rpccli_samr_SetGroupInfo(struct rpc_pipe_client *cli,
+                                 TALLOC_CTX *mem_ctx,
+                                 struct policy_handle *group_handle,
+                                 enum samr_GroupInfoEnum level,
+                                 union samr_GroupInfo *info)
+{
+       struct samr_SetGroupInfo r;
+       NTSTATUS status;
+
+       /* In parameters */
+       r.in.group_handle = group_handle;
+       r.in.level = level;
+       r.in.info = info;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_SetGroupInfo, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SAMR,
+                               &ndr_table_samr,
+                               NDR_SAMR_SETGROUPINFO,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_SetGroupInfo, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+
+       /* Return result */
+       return r.out.result;
+}
+
+NTSTATUS rpccli_samr_AddGroupMember(struct rpc_pipe_client *cli,
+                                   TALLOC_CTX *mem_ctx,
+                                   struct policy_handle *group_handle,
+                                   uint32_t rid,
+                                   uint32_t flags)
+{
+       struct samr_AddGroupMember r;
+       NTSTATUS status;
+
+       /* In parameters */
+       r.in.group_handle = group_handle;
+       r.in.rid = rid;
+       r.in.flags = flags;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_AddGroupMember, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SAMR,
+                               &ndr_table_samr,
+                               NDR_SAMR_ADDGROUPMEMBER,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_AddGroupMember, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+
+       /* Return result */
+       return r.out.result;
+}
+
+NTSTATUS rpccli_samr_DeleteDomainGroup(struct rpc_pipe_client *cli,
+                                      TALLOC_CTX *mem_ctx,
+                                      struct policy_handle *group_handle)
+{
+       struct samr_DeleteDomainGroup r;
+       NTSTATUS status;
+
+       /* In parameters */
+       r.in.group_handle = group_handle;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_DeleteDomainGroup, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SAMR,
+                               &ndr_table_samr,
+                               NDR_SAMR_DELETEDOMAINGROUP,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_DeleteDomainGroup, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+       *group_handle = *r.out.group_handle;
+
+       /* Return result */
+       return r.out.result;
+}
+
+NTSTATUS rpccli_samr_DeleteGroupMember(struct rpc_pipe_client *cli,
+                                      TALLOC_CTX *mem_ctx,
+                                      struct policy_handle *group_handle,
+                                      uint32_t rid)
+{
+       struct samr_DeleteGroupMember r;
+       NTSTATUS status;
+
+       /* In parameters */
+       r.in.group_handle = group_handle;
+       r.in.rid = rid;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_DeleteGroupMember, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SAMR,
+                               &ndr_table_samr,
+                               NDR_SAMR_DELETEGROUPMEMBER,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_DeleteGroupMember, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+
+       /* Return result */
+       return r.out.result;
+}
+
+NTSTATUS rpccli_samr_QueryGroupMember(struct rpc_pipe_client *cli,
+                                     TALLOC_CTX *mem_ctx,
+                                     struct policy_handle *group_handle,
+                                     struct samr_RidTypeArray *rids)
+{
+       struct samr_QueryGroupMember r;
+       NTSTATUS status;
+
+       /* In parameters */
+       r.in.group_handle = group_handle;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_QueryGroupMember, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SAMR,
+                               &ndr_table_samr,
+                               NDR_SAMR_QUERYGROUPMEMBER,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_QueryGroupMember, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+       *rids = *r.out.rids;
+
+       /* Return result */
+       return r.out.result;
+}
+
+NTSTATUS rpccli_samr_SetMemberAttributesOfGroup(struct rpc_pipe_client *cli,
+                                               TALLOC_CTX *mem_ctx,
+                                               struct policy_handle *group_handle,
+                                               uint32_t unknown1,
+                                               uint32_t unknown2)
+{
+       struct samr_SetMemberAttributesOfGroup r;
+       NTSTATUS status;
+
+       /* In parameters */
+       r.in.group_handle = group_handle;
+       r.in.unknown1 = unknown1;
+       r.in.unknown2 = unknown2;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_SetMemberAttributesOfGroup, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SAMR,
+                               &ndr_table_samr,
+                               NDR_SAMR_SETMEMBERATTRIBUTESOFGROUP,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_SetMemberAttributesOfGroup, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+
+       /* Return result */
+       return r.out.result;
+}
+
+NTSTATUS rpccli_samr_OpenAlias(struct rpc_pipe_client *cli,
+                              TALLOC_CTX *mem_ctx,
+                              struct policy_handle *domain_handle,
+                              uint32_t access_mask,
+                              uint32_t rid,
+                              struct policy_handle *alias_handle)
+{
+       struct samr_OpenAlias r;
+       NTSTATUS status;
+
+       /* In parameters */
+       r.in.domain_handle = domain_handle;
+       r.in.access_mask = access_mask;
+       r.in.rid = rid;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_OpenAlias, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SAMR,
+                               &ndr_table_samr,
+                               NDR_SAMR_OPENALIAS,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_OpenAlias, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+       *alias_handle = *r.out.alias_handle;
+
+       /* Return result */
+       return r.out.result;
+}
+
+NTSTATUS rpccli_samr_QueryAliasInfo(struct rpc_pipe_client *cli,
+                                   TALLOC_CTX *mem_ctx,
+                                   struct policy_handle *alias_handle,
+                                   enum samr_AliasInfoEnum level,
+                                   union samr_AliasInfo *info)
+{
+       struct samr_QueryAliasInfo r;
+       NTSTATUS status;
+
+       /* In parameters */
+       r.in.alias_handle = alias_handle;
+       r.in.level = level;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_QueryAliasInfo, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SAMR,
+                               &ndr_table_samr,
+                               NDR_SAMR_QUERYALIASINFO,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_QueryAliasInfo, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+       *info = *r.out.info;
+
+       /* Return result */
+       return r.out.result;
+}
+
+NTSTATUS rpccli_samr_SetAliasInfo(struct rpc_pipe_client *cli,
+                                 TALLOC_CTX *mem_ctx,
+                                 struct policy_handle *alias_handle,
+                                 enum samr_AliasInfoEnum level,
+                                 union samr_AliasInfo *info)
+{
+       struct samr_SetAliasInfo r;
+       NTSTATUS status;
+
+       /* In parameters */
+       r.in.alias_handle = alias_handle;
+       r.in.level = level;
+       r.in.info = info;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_SetAliasInfo, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SAMR,
+                               &ndr_table_samr,
+                               NDR_SAMR_SETALIASINFO,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_SetAliasInfo, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+
+       /* Return result */
+       return r.out.result;
+}
+
+NTSTATUS rpccli_samr_DeleteDomAlias(struct rpc_pipe_client *cli,
+                                   TALLOC_CTX *mem_ctx,
+                                   struct policy_handle *alias_handle)
+{
+       struct samr_DeleteDomAlias r;
+       NTSTATUS status;
+
+       /* In parameters */
+       r.in.alias_handle = alias_handle;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_DeleteDomAlias, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SAMR,
+                               &ndr_table_samr,
+                               NDR_SAMR_DELETEDOMALIAS,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_DeleteDomAlias, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+       *alias_handle = *r.out.alias_handle;
+
+       /* Return result */
+       return r.out.result;
+}
+
+NTSTATUS rpccli_samr_AddAliasMember(struct rpc_pipe_client *cli,
+                                   TALLOC_CTX *mem_ctx,
+                                   struct policy_handle *alias_handle,
+                                   struct dom_sid2 *sid)
+{
+       struct samr_AddAliasMember r;
+       NTSTATUS status;
+
+       /* In parameters */
+       r.in.alias_handle = alias_handle;
+       r.in.sid = sid;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_AddAliasMember, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SAMR,
+                               &ndr_table_samr,
+                               NDR_SAMR_ADDALIASMEMBER,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_AddAliasMember, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+
+       /* Return result */
+       return r.out.result;
+}
+
+NTSTATUS rpccli_samr_DeleteAliasMember(struct rpc_pipe_client *cli,
+                                      TALLOC_CTX *mem_ctx,
+                                      struct policy_handle *alias_handle,
+                                      struct dom_sid2 *sid)
+{
+       struct samr_DeleteAliasMember r;
+       NTSTATUS status;
+
+       /* In parameters */
+       r.in.alias_handle = alias_handle;
+       r.in.sid = sid;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_DeleteAliasMember, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SAMR,
+                               &ndr_table_samr,
+                               NDR_SAMR_DELETEALIASMEMBER,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_DeleteAliasMember, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+
+       /* Return result */
+       return r.out.result;
+}
+
+NTSTATUS rpccli_samr_GetMembersInAlias(struct rpc_pipe_client *cli,
+                                      TALLOC_CTX *mem_ctx,
+                                      struct policy_handle *alias_handle,
+                                      struct lsa_SidArray *sids)
+{
+       struct samr_GetMembersInAlias r;
+       NTSTATUS status;
+
+       /* In parameters */
+       r.in.alias_handle = alias_handle;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_GetMembersInAlias, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SAMR,
+                               &ndr_table_samr,
+                               NDR_SAMR_GETMEMBERSINALIAS,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_GetMembersInAlias, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+       *sids = *r.out.sids;
+
+       /* Return result */
+       return r.out.result;
+}
+
+NTSTATUS rpccli_samr_OpenUser(struct rpc_pipe_client *cli,
+                             TALLOC_CTX *mem_ctx,
+                             struct policy_handle *domain_handle,
+                             uint32_t access_mask,
+                             uint32_t rid,
+                             struct policy_handle *user_handle)
+{
+       struct samr_OpenUser r;
+       NTSTATUS status;
+
+       /* In parameters */
+       r.in.domain_handle = domain_handle;
+       r.in.access_mask = access_mask;
+       r.in.rid = rid;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_OpenUser, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SAMR,
+                               &ndr_table_samr,
+                               NDR_SAMR_OPENUSER,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_OpenUser, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+       *user_handle = *r.out.user_handle;
+
+       /* Return result */
+       return r.out.result;
+}
+
+NTSTATUS rpccli_samr_DeleteUser(struct rpc_pipe_client *cli,
+                               TALLOC_CTX *mem_ctx,
+                               struct policy_handle *user_handle)
+{
+       struct samr_DeleteUser r;
+       NTSTATUS status;
+
+       /* In parameters */
+       r.in.user_handle = user_handle;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_DeleteUser, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SAMR,
+                               &ndr_table_samr,
+                               NDR_SAMR_DELETEUSER,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_DeleteUser, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+       *user_handle = *r.out.user_handle;
+
+       /* Return result */
+       return r.out.result;
+}
+
+NTSTATUS rpccli_samr_QueryUserInfo(struct rpc_pipe_client *cli,
+                                  TALLOC_CTX *mem_ctx,
+                                  struct policy_handle *user_handle,
+                                  uint16_t level,
+                                  union samr_UserInfo *info)
+{
+       struct samr_QueryUserInfo r;
+       NTSTATUS status;
+
+       /* In parameters */
+       r.in.user_handle = user_handle;
+       r.in.level = level;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_QueryUserInfo, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SAMR,
+                               &ndr_table_samr,
+                               NDR_SAMR_QUERYUSERINFO,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_QueryUserInfo, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+       *info = *r.out.info;
+
+       /* Return result */
+       return r.out.result;
+}
+
+NTSTATUS rpccli_samr_SetUserInfo(struct rpc_pipe_client *cli,
+                                TALLOC_CTX *mem_ctx,
+                                struct policy_handle *user_handle,
+                                uint16_t level,
+                                union samr_UserInfo *info)
+{
+       struct samr_SetUserInfo r;
+       NTSTATUS status;
+
+       /* In parameters */
+       r.in.user_handle = user_handle;
+       r.in.level = level;
+       r.in.info = info;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_SetUserInfo, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SAMR,
+                               &ndr_table_samr,
+                               NDR_SAMR_SETUSERINFO,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_SetUserInfo, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+
+       /* Return result */
+       return r.out.result;
+}
+
+NTSTATUS rpccli_samr_ChangePasswordUser(struct rpc_pipe_client *cli,
+                                       TALLOC_CTX *mem_ctx,
+                                       struct policy_handle *user_handle,
+                                       uint8_t lm_present,
+                                       struct samr_Password *old_lm_crypted,
+                                       struct samr_Password *new_lm_crypted,
+                                       uint8_t nt_present,
+                                       struct samr_Password *old_nt_crypted,
+                                       struct samr_Password *new_nt_crypted,
+                                       uint8_t cross1_present,
+                                       struct samr_Password *nt_cross,
+                                       uint8_t cross2_present,
+                                       struct samr_Password *lm_cross)
+{
+       struct samr_ChangePasswordUser r;
+       NTSTATUS status;
+
+       /* In parameters */
+       r.in.user_handle = user_handle;
+       r.in.lm_present = lm_present;
+       r.in.old_lm_crypted = old_lm_crypted;
+       r.in.new_lm_crypted = new_lm_crypted;
+       r.in.nt_present = nt_present;
+       r.in.old_nt_crypted = old_nt_crypted;
+       r.in.new_nt_crypted = new_nt_crypted;
+       r.in.cross1_present = cross1_present;
+       r.in.nt_cross = nt_cross;
+       r.in.cross2_present = cross2_present;
+       r.in.lm_cross = lm_cross;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_ChangePasswordUser, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SAMR,
+                               &ndr_table_samr,
+                               NDR_SAMR_CHANGEPASSWORDUSER,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_ChangePasswordUser, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+
+       /* Return result */
+       return r.out.result;
+}
+
+NTSTATUS rpccli_samr_GetGroupsForUser(struct rpc_pipe_client *cli,
+                                     TALLOC_CTX *mem_ctx,
+                                     struct policy_handle *user_handle,
+                                     struct samr_RidWithAttributeArray *rids)
+{
+       struct samr_GetGroupsForUser r;
+       NTSTATUS status;
+
+       /* In parameters */
+       r.in.user_handle = user_handle;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_GetGroupsForUser, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SAMR,
+                               &ndr_table_samr,
+                               NDR_SAMR_GETGROUPSFORUSER,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_GetGroupsForUser, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+       *rids = *r.out.rids;
+
+       /* Return result */
+       return r.out.result;
+}
+
+NTSTATUS rpccli_samr_QueryDisplayInfo(struct rpc_pipe_client *cli,
+                                     TALLOC_CTX *mem_ctx,
+                                     struct policy_handle *domain_handle,
+                                     uint16_t level,
+                                     uint32_t start_idx,
+                                     uint32_t max_entries,
+                                     uint32_t buf_size,
+                                     uint32_t *total_size,
+                                     uint32_t *returned_size,
+                                     union samr_DispInfo *info)
+{
+       struct samr_QueryDisplayInfo r;
+       NTSTATUS status;
+
+       /* In parameters */
+       r.in.domain_handle = domain_handle;
+       r.in.level = level;
+       r.in.start_idx = start_idx;
+       r.in.max_entries = max_entries;
+       r.in.buf_size = buf_size;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_QueryDisplayInfo, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SAMR,
+                               &ndr_table_samr,
+                               NDR_SAMR_QUERYDISPLAYINFO,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_QueryDisplayInfo, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+       *total_size = *r.out.total_size;
+       *returned_size = *r.out.returned_size;
+       *info = *r.out.info;
+
+       /* Return result */
+       return r.out.result;
+}
+
+NTSTATUS rpccli_samr_GetDisplayEnumerationIndex(struct rpc_pipe_client *cli,
+                                               TALLOC_CTX *mem_ctx,
+                                               struct policy_handle *domain_handle,
+                                               uint16_t level,
+                                               struct lsa_String name,
+                                               uint32_t *idx)
+{
+       struct samr_GetDisplayEnumerationIndex r;
+       NTSTATUS status;
+
+       /* In parameters */
+       r.in.domain_handle = domain_handle;
+       r.in.level = level;
+       r.in.name = name;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_GetDisplayEnumerationIndex, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SAMR,
+                               &ndr_table_samr,
+                               NDR_SAMR_GETDISPLAYENUMERATIONINDEX,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_GetDisplayEnumerationIndex, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+       *idx = *r.out.idx;
+
+       /* Return result */
+       return r.out.result;
+}
+
+NTSTATUS rpccli_samr_TestPrivateFunctionsDomain(struct rpc_pipe_client *cli,
+                                               TALLOC_CTX *mem_ctx,
+                                               struct policy_handle *domain_handle)
+{
+       struct samr_TestPrivateFunctionsDomain r;
+       NTSTATUS status;
+
+       /* In parameters */
+       r.in.domain_handle = domain_handle;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_TestPrivateFunctionsDomain, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SAMR,
+                               &ndr_table_samr,
+                               NDR_SAMR_TESTPRIVATEFUNCTIONSDOMAIN,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_TestPrivateFunctionsDomain, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+
+       /* Return result */
+       return r.out.result;
+}
+
+NTSTATUS rpccli_samr_TestPrivateFunctionsUser(struct rpc_pipe_client *cli,
+                                             TALLOC_CTX *mem_ctx,
+                                             struct policy_handle *user_handle)
+{
+       struct samr_TestPrivateFunctionsUser r;
+       NTSTATUS status;
+
+       /* In parameters */
+       r.in.user_handle = user_handle;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_TestPrivateFunctionsUser, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SAMR,
+                               &ndr_table_samr,
+                               NDR_SAMR_TESTPRIVATEFUNCTIONSUSER,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_TestPrivateFunctionsUser, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+
+       /* Return result */
+       return r.out.result;
+}
+
+NTSTATUS rpccli_samr_GetUserPwInfo(struct rpc_pipe_client *cli,
+                                  TALLOC_CTX *mem_ctx,
+                                  struct policy_handle *user_handle,
+                                  struct samr_PwInfo *info)
+{
+       struct samr_GetUserPwInfo r;
+       NTSTATUS status;
+
+       /* In parameters */
+       r.in.user_handle = user_handle;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_GetUserPwInfo, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SAMR,
+                               &ndr_table_samr,
+                               NDR_SAMR_GETUSERPWINFO,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_GetUserPwInfo, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+       *info = *r.out.info;
+
+       /* Return result */
+       return r.out.result;
+}
+
+NTSTATUS rpccli_samr_RemoveMemberFromForeignDomain(struct rpc_pipe_client *cli,
+                                                  TALLOC_CTX *mem_ctx,
+                                                  struct policy_handle *domain_handle,
+                                                  struct dom_sid2 *sid)
+{
+       struct samr_RemoveMemberFromForeignDomain r;
+       NTSTATUS status;
+
+       /* In parameters */
+       r.in.domain_handle = domain_handle;
+       r.in.sid = sid;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_RemoveMemberFromForeignDomain, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SAMR,
+                               &ndr_table_samr,
+                               NDR_SAMR_REMOVEMEMBERFROMFOREIGNDOMAIN,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_RemoveMemberFromForeignDomain, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+
+       /* Return result */
+       return r.out.result;
+}
+
+NTSTATUS rpccli_samr_QueryDomainInfo2(struct rpc_pipe_client *cli,
+                                     TALLOC_CTX *mem_ctx,
+                                     struct policy_handle *domain_handle,
+                                     uint16_t level,
+                                     union samr_DomainInfo *info)
+{
+       struct samr_QueryDomainInfo2 r;
+       NTSTATUS status;
+
+       /* In parameters */
+       r.in.domain_handle = domain_handle;
+       r.in.level = level;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_QueryDomainInfo2, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SAMR,
+                               &ndr_table_samr,
+                               NDR_SAMR_QUERYDOMAININFO2,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_QueryDomainInfo2, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+       *info = *r.out.info;
+
+       /* Return result */
+       return r.out.result;
+}
+
+NTSTATUS rpccli_samr_QueryUserInfo2(struct rpc_pipe_client *cli,
+                                   TALLOC_CTX *mem_ctx,
+                                   struct policy_handle *user_handle,
+                                   uint16_t level,
+                                   union samr_UserInfo *info)
+{
+       struct samr_QueryUserInfo2 r;
+       NTSTATUS status;
+
+       /* In parameters */
+       r.in.user_handle = user_handle;
+       r.in.level = level;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_QueryUserInfo2, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SAMR,
+                               &ndr_table_samr,
+                               NDR_SAMR_QUERYUSERINFO2,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_QueryUserInfo2, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+       *info = *r.out.info;
+
+       /* Return result */
+       return r.out.result;
+}
+
+NTSTATUS rpccli_samr_QueryDisplayInfo2(struct rpc_pipe_client *cli,
+                                      TALLOC_CTX *mem_ctx,
+                                      struct policy_handle *domain_handle,
+                                      uint16_t level,
+                                      uint32_t start_idx,
+                                      uint32_t max_entries,
+                                      uint32_t buf_size,
+                                      uint32_t *total_size,
+                                      uint32_t *returned_size,
+                                      union samr_DispInfo *info)
+{
+       struct samr_QueryDisplayInfo2 r;
+       NTSTATUS status;
+
+       /* In parameters */
+       r.in.domain_handle = domain_handle;
+       r.in.level = level;
+       r.in.start_idx = start_idx;
+       r.in.max_entries = max_entries;
+       r.in.buf_size = buf_size;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_QueryDisplayInfo2, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SAMR,
+                               &ndr_table_samr,
+                               NDR_SAMR_QUERYDISPLAYINFO2,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_QueryDisplayInfo2, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+       *total_size = *r.out.total_size;
+       *returned_size = *r.out.returned_size;
+       *info = *r.out.info;
+
+       /* Return result */
+       return r.out.result;
+}
+
+NTSTATUS rpccli_samr_GetDisplayEnumerationIndex2(struct rpc_pipe_client *cli,
+                                                TALLOC_CTX *mem_ctx,
+                                                struct policy_handle *domain_handle,
+                                                uint16_t level,
+                                                struct lsa_String name,
+                                                uint32_t *idx)
+{
+       struct samr_GetDisplayEnumerationIndex2 r;
+       NTSTATUS status;
+
+       /* In parameters */
+       r.in.domain_handle = domain_handle;
+       r.in.level = level;
+       r.in.name = name;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_GetDisplayEnumerationIndex2, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SAMR,
+                               &ndr_table_samr,
+                               NDR_SAMR_GETDISPLAYENUMERATIONINDEX2,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_GetDisplayEnumerationIndex2, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+       *idx = *r.out.idx;
+
+       /* Return result */
+       return r.out.result;
+}
+
+NTSTATUS rpccli_samr_CreateUser2(struct rpc_pipe_client *cli,
+                                TALLOC_CTX *mem_ctx,
+                                struct policy_handle *domain_handle,
+                                struct lsa_String *account_name,
+                                uint32_t acct_flags,
+                                uint32_t access_mask,
+                                struct policy_handle *user_handle,
+                                uint32_t *access_granted,
+                                uint32_t *rid)
+{
+       struct samr_CreateUser2 r;
+       NTSTATUS status;
+
+       /* In parameters */
+       r.in.domain_handle = domain_handle;
+       r.in.account_name = account_name;
+       r.in.acct_flags = acct_flags;
+       r.in.access_mask = access_mask;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_CreateUser2, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SAMR,
+                               &ndr_table_samr,
+                               NDR_SAMR_CREATEUSER2,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_CreateUser2, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+       *user_handle = *r.out.user_handle;
+       *access_granted = *r.out.access_granted;
+       *rid = *r.out.rid;
+
+       /* Return result */
+       return r.out.result;
+}
+
+NTSTATUS rpccli_samr_QueryDisplayInfo3(struct rpc_pipe_client *cli,
+                                      TALLOC_CTX *mem_ctx,
+                                      struct policy_handle *domain_handle,
+                                      uint16_t level,
+                                      uint32_t start_idx,
+                                      uint32_t max_entries,
+                                      uint32_t buf_size,
+                                      uint32_t *total_size,
+                                      uint32_t *returned_size,
+                                      union samr_DispInfo *info)
+{
+       struct samr_QueryDisplayInfo3 r;
+       NTSTATUS status;
+
+       /* In parameters */
+       r.in.domain_handle = domain_handle;
+       r.in.level = level;
+       r.in.start_idx = start_idx;
+       r.in.max_entries = max_entries;
+       r.in.buf_size = buf_size;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_QueryDisplayInfo3, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SAMR,
+                               &ndr_table_samr,
+                               NDR_SAMR_QUERYDISPLAYINFO3,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_QueryDisplayInfo3, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+       *total_size = *r.out.total_size;
+       *returned_size = *r.out.returned_size;
+       *info = *r.out.info;
+
+       /* Return result */
+       return r.out.result;
+}
+
+NTSTATUS rpccli_samr_AddMultipleMembersToAlias(struct rpc_pipe_client *cli,
+                                              TALLOC_CTX *mem_ctx,
+                                              struct policy_handle *alias_handle,
+                                              struct lsa_SidArray *sids)
+{
+       struct samr_AddMultipleMembersToAlias r;
+       NTSTATUS status;
+
+       /* In parameters */
+       r.in.alias_handle = alias_handle;
+       r.in.sids = sids;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_AddMultipleMembersToAlias, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SAMR,
+                               &ndr_table_samr,
+                               NDR_SAMR_ADDMULTIPLEMEMBERSTOALIAS,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_AddMultipleMembersToAlias, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+
+       /* Return result */
+       return r.out.result;
+}
+
+NTSTATUS rpccli_samr_RemoveMultipleMembersFromAlias(struct rpc_pipe_client *cli,
+                                                   TALLOC_CTX *mem_ctx,
+                                                   struct policy_handle *alias_handle,
+                                                   struct lsa_SidArray *sids)
+{
+       struct samr_RemoveMultipleMembersFromAlias r;
+       NTSTATUS status;
+
+       /* In parameters */
+       r.in.alias_handle = alias_handle;
+       r.in.sids = sids;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_RemoveMultipleMembersFromAlias, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SAMR,
+                               &ndr_table_samr,
+                               NDR_SAMR_REMOVEMULTIPLEMEMBERSFROMALIAS,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_RemoveMultipleMembersFromAlias, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+
+       /* Return result */
+       return r.out.result;
+}
+
+NTSTATUS rpccli_samr_OemChangePasswordUser2(struct rpc_pipe_client *cli,
+                                           TALLOC_CTX *mem_ctx,
+                                           struct lsa_AsciiString *server,
+                                           struct lsa_AsciiString *account,
+                                           struct samr_CryptPassword *password,
+                                           struct samr_Password *hash)
+{
+       struct samr_OemChangePasswordUser2 r;
+       NTSTATUS status;
+
+       /* In parameters */
+       r.in.server = server;
+       r.in.account = account;
+       r.in.password = password;
+       r.in.hash = hash;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_OemChangePasswordUser2, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SAMR,
+                               &ndr_table_samr,
+                               NDR_SAMR_OEMCHANGEPASSWORDUSER2,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_OemChangePasswordUser2, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+
+       /* Return result */
+       return r.out.result;
+}
+
+NTSTATUS rpccli_samr_ChangePasswordUser2(struct rpc_pipe_client *cli,
+                                        TALLOC_CTX *mem_ctx,
+                                        struct lsa_String *server,
+                                        struct lsa_String *account,
+                                        struct samr_CryptPassword *nt_password,
+                                        struct samr_Password *nt_verifier,
+                                        uint8_t lm_change,
+                                        struct samr_CryptPassword *lm_password,
+                                        struct samr_Password *lm_verifier)
+{
+       struct samr_ChangePasswordUser2 r;
+       NTSTATUS status;
+
+       /* In parameters */
+       r.in.server = server;
+       r.in.account = account;
+       r.in.nt_password = nt_password;
+       r.in.nt_verifier = nt_verifier;
+       r.in.lm_change = lm_change;
+       r.in.lm_password = lm_password;
+       r.in.lm_verifier = lm_verifier;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_ChangePasswordUser2, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SAMR,
+                               &ndr_table_samr,
+                               NDR_SAMR_CHANGEPASSWORDUSER2,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_ChangePasswordUser2, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+
+       /* Return result */
+       return r.out.result;
+}
+
+NTSTATUS rpccli_samr_GetDomPwInfo(struct rpc_pipe_client *cli,
+                                 TALLOC_CTX *mem_ctx,
+                                 struct lsa_String *domain_name,
+                                 struct samr_PwInfo *info)
+{
+       struct samr_GetDomPwInfo r;
+       NTSTATUS status;
+
+       /* In parameters */
+       r.in.domain_name = domain_name;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_GetDomPwInfo, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SAMR,
+                               &ndr_table_samr,
+                               NDR_SAMR_GETDOMPWINFO,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_GetDomPwInfo, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+       *info = *r.out.info;
+
+       /* Return result */
+       return r.out.result;
+}
+
+NTSTATUS rpccli_samr_Connect2(struct rpc_pipe_client *cli,
+                             TALLOC_CTX *mem_ctx,
+                             const char *system_name,
+                             uint32_t access_mask,
+                             struct policy_handle *connect_handle)
+{
+       struct samr_Connect2 r;
+       NTSTATUS status;
+
+       /* In parameters */
+       r.in.system_name = system_name;
+       r.in.access_mask = access_mask;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_Connect2, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SAMR,
+                               &ndr_table_samr,
+                               NDR_SAMR_CONNECT2,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_Connect2, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+       *connect_handle = *r.out.connect_handle;
+
+       /* Return result */
+       return r.out.result;
+}
+
+NTSTATUS rpccli_samr_SetUserInfo2(struct rpc_pipe_client *cli,
+                                 TALLOC_CTX *mem_ctx,
+                                 struct policy_handle *user_handle,
+                                 uint16_t level,
+                                 union samr_UserInfo *info)
+{
+       struct samr_SetUserInfo2 r;
+       NTSTATUS status;
+
+       /* In parameters */
+       r.in.user_handle = user_handle;
+       r.in.level = level;
+       r.in.info = info;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_SetUserInfo2, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SAMR,
+                               &ndr_table_samr,
+                               NDR_SAMR_SETUSERINFO2,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_SetUserInfo2, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+
+       /* Return result */
+       return r.out.result;
+}
+
+NTSTATUS rpccli_samr_SetBootKeyInformation(struct rpc_pipe_client *cli,
+                                          TALLOC_CTX *mem_ctx,
+                                          struct policy_handle *connect_handle,
+                                          uint32_t unknown1,
+                                          uint32_t unknown2,
+                                          uint32_t unknown3)
+{
+       struct samr_SetBootKeyInformation r;
+       NTSTATUS status;
+
+       /* In parameters */
+       r.in.connect_handle = connect_handle;
+       r.in.unknown1 = unknown1;
+       r.in.unknown2 = unknown2;
+       r.in.unknown3 = unknown3;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_SetBootKeyInformation, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SAMR,
+                               &ndr_table_samr,
+                               NDR_SAMR_SETBOOTKEYINFORMATION,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_SetBootKeyInformation, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+
+       /* Return result */
+       return r.out.result;
+}
+
+NTSTATUS rpccli_samr_GetBootKeyInformation(struct rpc_pipe_client *cli,
+                                          TALLOC_CTX *mem_ctx,
+                                          struct policy_handle *domain_handle,
+                                          uint32_t *unknown)
+{
+       struct samr_GetBootKeyInformation r;
+       NTSTATUS status;
+
+       /* In parameters */
+       r.in.domain_handle = domain_handle;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_GetBootKeyInformation, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SAMR,
+                               &ndr_table_samr,
+                               NDR_SAMR_GETBOOTKEYINFORMATION,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_GetBootKeyInformation, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+       *unknown = *r.out.unknown;
+
+       /* Return result */
+       return r.out.result;
+}
+
+NTSTATUS rpccli_samr_Connect3(struct rpc_pipe_client *cli,
+                             TALLOC_CTX *mem_ctx,
+                             const char *system_name,
+                             uint32_t unknown,
+                             uint32_t access_mask,
+                             struct policy_handle *connect_handle)
+{
+       struct samr_Connect3 r;
+       NTSTATUS status;
+
+       /* In parameters */
+       r.in.system_name = system_name;
+       r.in.unknown = unknown;
+       r.in.access_mask = access_mask;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_Connect3, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SAMR,
+                               &ndr_table_samr,
+                               NDR_SAMR_CONNECT3,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_Connect3, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+       *connect_handle = *r.out.connect_handle;
+
+       /* Return result */
+       return r.out.result;
+}
+
+NTSTATUS rpccli_samr_Connect4(struct rpc_pipe_client *cli,
+                             TALLOC_CTX *mem_ctx,
+                             const char *system_name,
+                             uint32_t unknown,
+                             uint32_t access_mask,
+                             struct policy_handle *connect_handle)
+{
+       struct samr_Connect4 r;
+       NTSTATUS status;
+
+       /* In parameters */
+       r.in.system_name = system_name;
+       r.in.unknown = unknown;
+       r.in.access_mask = access_mask;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_Connect4, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SAMR,
+                               &ndr_table_samr,
+                               NDR_SAMR_CONNECT4,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_Connect4, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+       *connect_handle = *r.out.connect_handle;
+
+       /* Return result */
+       return r.out.result;
+}
+
+NTSTATUS rpccli_samr_ChangePasswordUser3(struct rpc_pipe_client *cli,
+                                        TALLOC_CTX *mem_ctx,
+                                        struct lsa_String *server,
+                                        struct lsa_String *account,
+                                        struct samr_CryptPassword *nt_password,
+                                        struct samr_Password *nt_verifier,
+                                        uint8_t lm_change,
+                                        struct samr_CryptPassword *lm_password,
+                                        struct samr_Password *lm_verifier,
+                                        struct samr_CryptPassword *password3,
+                                        struct samr_DomInfo1 *dominfo,
+                                        struct samr_ChangeReject *reject)
+{
+       struct samr_ChangePasswordUser3 r;
+       NTSTATUS status;
+
+       /* In parameters */
+       r.in.server = server;
+       r.in.account = account;
+       r.in.nt_password = nt_password;
+       r.in.nt_verifier = nt_verifier;
+       r.in.lm_change = lm_change;
+       r.in.lm_password = lm_password;
+       r.in.lm_verifier = lm_verifier;
+       r.in.password3 = password3;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_ChangePasswordUser3, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SAMR,
+                               &ndr_table_samr,
+                               NDR_SAMR_CHANGEPASSWORDUSER3,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_ChangePasswordUser3, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+       *dominfo = *r.out.dominfo;
+       *reject = *r.out.reject;
+
+       /* Return result */
+       return r.out.result;
+}
+
+NTSTATUS rpccli_samr_Connect5(struct rpc_pipe_client *cli,
+                             TALLOC_CTX *mem_ctx,
+                             const char *system_name,
+                             uint32_t access_mask,
+                             uint32_t level_in,
+                             union samr_ConnectInfo *info_in,
+                             uint32_t *level_out,
+                             union samr_ConnectInfo *info_out,
+                             struct policy_handle *connect_handle)
+{
+       struct samr_Connect5 r;
+       NTSTATUS status;
+
+       /* In parameters */
+       r.in.system_name = system_name;
+       r.in.access_mask = access_mask;
+       r.in.level_in = level_in;
+       r.in.info_in = info_in;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_Connect5, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SAMR,
+                               &ndr_table_samr,
+                               NDR_SAMR_CONNECT5,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_Connect5, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+       *level_out = *r.out.level_out;
+       *info_out = *r.out.info_out;
+       *connect_handle = *r.out.connect_handle;
+
+       /* Return result */
+       return r.out.result;
+}
+
+NTSTATUS rpccli_samr_RidToSid(struct rpc_pipe_client *cli,
+                             TALLOC_CTX *mem_ctx,
+                             struct policy_handle *domain_handle,
+                             uint32_t rid,
+                             struct dom_sid2 *sid)
+{
+       struct samr_RidToSid r;
+       NTSTATUS status;
+
+       /* In parameters */
+       r.in.domain_handle = domain_handle;
+       r.in.rid = rid;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_RidToSid, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SAMR,
+                               &ndr_table_samr,
+                               NDR_SAMR_RIDTOSID,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_RidToSid, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+       *sid = *r.out.sid;
+
+       /* Return result */
+       return r.out.result;
+}
+
+NTSTATUS rpccli_samr_SetDsrmPassword(struct rpc_pipe_client *cli,
+                                    TALLOC_CTX *mem_ctx,
+                                    struct lsa_String *name,
+                                    uint32_t unknown,
+                                    struct samr_Password *hash)
+{
+       struct samr_SetDsrmPassword r;
+       NTSTATUS status;
+
+       /* In parameters */
+       r.in.name = name;
+       r.in.unknown = unknown;
+       r.in.hash = hash;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_SetDsrmPassword, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SAMR,
+                               &ndr_table_samr,
+                               NDR_SAMR_SETDSRMPASSWORD,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_SetDsrmPassword, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+
+       /* Return result */
+       return r.out.result;
+}
+
+NTSTATUS rpccli_samr_ValidatePassword(struct rpc_pipe_client *cli,
+                                     TALLOC_CTX *mem_ctx,
+                                     enum samr_ValidatePasswordLevel level,
+                                     union samr_ValidatePasswordReq req,
+                                     union samr_ValidatePasswordRep *rep)
+{
+       struct samr_ValidatePassword r;
+       NTSTATUS status;
+
+       /* In parameters */
+       r.in.level = level;
+       r.in.req = req;
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_ValidatePassword, &r);
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SAMR,
+                               &ndr_table_samr,
+                               NDR_SAMR_VALIDATEPASSWORD,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_ValidatePassword, &r);
+       }
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       /* Return variables */
+       *rep = *r.out.rep;
+
+       /* Return result */
+       return r.out.result;
+}
+
diff --git a/source/librpc/gen_ndr/cli_samr.h b/source/librpc/gen_ndr/cli_samr.h
new file mode 100644 (file)
index 0000000..23f2d1f
--- /dev/null
@@ -0,0 +1,389 @@
+#include "librpc/gen_ndr/ndr_samr.h"
+#ifndef __CLI_SAMR__
+#define __CLI_SAMR__
+NTSTATUS rpccli_samr_Connect(struct rpc_pipe_client *cli,
+                            TALLOC_CTX *mem_ctx,
+                            uint16_t *system_name,
+                            uint32_t access_mask,
+                            struct policy_handle *connect_handle);
+NTSTATUS rpccli_samr_Close(struct rpc_pipe_client *cli,
+                          TALLOC_CTX *mem_ctx,
+                          struct policy_handle *handle);
+NTSTATUS rpccli_samr_SetSecurity(struct rpc_pipe_client *cli,
+                                TALLOC_CTX *mem_ctx,
+                                struct policy_handle *handle,
+                                uint32_t sec_info,
+                                struct sec_desc_buf *sdbuf);
+NTSTATUS rpccli_samr_QuerySecurity(struct rpc_pipe_client *cli,
+                                  TALLOC_CTX *mem_ctx,
+                                  struct policy_handle *handle,
+                                  uint32_t sec_info,
+                                  struct sec_desc_buf *sdbuf);
+NTSTATUS rpccli_samr_Shutdown(struct rpc_pipe_client *cli,
+                             TALLOC_CTX *mem_ctx,
+                             struct policy_handle *connect_handle);
+NTSTATUS rpccli_samr_LookupDomain(struct rpc_pipe_client *cli,
+                                 TALLOC_CTX *mem_ctx,
+                                 struct policy_handle *connect_handle,
+                                 struct lsa_String *domain_name,
+                                 struct dom_sid2 *sid);
+NTSTATUS rpccli_samr_EnumDomains(struct rpc_pipe_client *cli,
+                                TALLOC_CTX *mem_ctx,
+                                struct policy_handle *connect_handle,
+                                uint32_t *resume_handle,
+                                uint32_t buf_size,
+                                struct samr_SamArray *sam,
+                                uint32_t *num_entries);
+NTSTATUS rpccli_samr_OpenDomain(struct rpc_pipe_client *cli,
+                               TALLOC_CTX *mem_ctx,
+                               struct policy_handle *connect_handle,
+                               uint32_t access_mask,
+                               struct dom_sid2 *sid,
+                               struct policy_handle *domain_handle);
+NTSTATUS rpccli_samr_QueryDomainInfo(struct rpc_pipe_client *cli,
+                                    TALLOC_CTX *mem_ctx,
+                                    struct policy_handle *domain_handle,
+                                    uint16_t level,
+                                    union samr_DomainInfo *info);
+NTSTATUS rpccli_samr_SetDomainInfo(struct rpc_pipe_client *cli,
+                                  TALLOC_CTX *mem_ctx,
+                                  struct policy_handle *domain_handle,
+                                  uint16_t level,
+                                  union samr_DomainInfo *info);
+NTSTATUS rpccli_samr_CreateDomainGroup(struct rpc_pipe_client *cli,
+                                      TALLOC_CTX *mem_ctx,
+                                      struct policy_handle *domain_handle,
+                                      struct lsa_String *name,
+                                      uint32_t access_mask,
+                                      struct policy_handle *group_handle,
+                                      uint32_t *rid);
+NTSTATUS rpccli_samr_EnumDomainGroups(struct rpc_pipe_client *cli,
+                                     TALLOC_CTX *mem_ctx,
+                                     struct policy_handle *domain_handle,
+                                     uint32_t *resume_handle,
+                                     uint32_t max_size,
+                                     struct samr_SamArray *sam,
+                                     uint32_t *num_entries);
+NTSTATUS rpccli_samr_CreateUser(struct rpc_pipe_client *cli,
+                               TALLOC_CTX *mem_ctx,
+                               struct policy_handle *domain_handle,
+                               struct lsa_String *account_name,
+                               uint32_t access_mask,
+                               struct policy_handle *user_handle,
+                               uint32_t *rid);
+NTSTATUS rpccli_samr_EnumDomainUsers(struct rpc_pipe_client *cli,
+                                    TALLOC_CTX *mem_ctx,
+                                    struct policy_handle *domain_handle,
+                                    uint32_t *resume_handle,
+                                    uint32_t acct_flags,
+                                    uint32_t max_size,
+                                    struct samr_SamArray *sam,
+                                    uint32_t *num_entries);
+NTSTATUS rpccli_samr_CreateDomAlias(struct rpc_pipe_client *cli,
+                                   TALLOC_CTX *mem_ctx,
+                                   struct policy_handle *domain_handle,
+                                   struct lsa_String *alias_name,
+                                   uint32_t access_mask,
+                                   struct policy_handle *alias_handle,
+                                   uint32_t *rid);
+NTSTATUS rpccli_samr_EnumDomainAliases(struct rpc_pipe_client *cli,
+                                      TALLOC_CTX *mem_ctx,
+                                      struct policy_handle *domain_handle,
+                                      uint32_t *resume_handle,
+                                      uint32_t acct_flags,
+                                      struct samr_SamArray *sam,
+                                      uint32_t *num_entries);
+NTSTATUS rpccli_samr_GetAliasMembership(struct rpc_pipe_client *cli,
+                                       TALLOC_CTX *mem_ctx,
+                                       struct policy_handle *domain_handle,
+                                       struct lsa_SidArray *sids,
+                                       struct samr_Ids *rids);
+NTSTATUS rpccli_samr_LookupNames(struct rpc_pipe_client *cli,
+                                TALLOC_CTX *mem_ctx,
+                                struct policy_handle *domain_handle,
+                                uint32_t num_names,
+                                struct lsa_String *names,
+                                struct samr_Ids *rids,
+                                struct samr_Ids *types);
+NTSTATUS rpccli_samr_LookupRids(struct rpc_pipe_client *cli,
+                               TALLOC_CTX *mem_ctx,
+                               struct policy_handle *domain_handle,
+                               uint32_t num_rids,
+                               uint32_t *rids,
+                               struct lsa_Strings *names,
+                               struct samr_Ids *types);
+NTSTATUS rpccli_samr_OpenGroup(struct rpc_pipe_client *cli,
+                              TALLOC_CTX *mem_ctx,
+                              struct policy_handle *domain_handle,
+                              uint32_t access_mask,
+                              uint32_t rid,
+                              struct policy_handle *group_handle);
+NTSTATUS rpccli_samr_QueryGroupInfo(struct rpc_pipe_client *cli,
+                                   TALLOC_CTX *mem_ctx,
+                                   struct policy_handle *group_handle,
+                                   enum samr_GroupInfoEnum level,
+                                   union samr_GroupInfo *info);
+NTSTATUS rpccli_samr_SetGroupInfo(struct rpc_pipe_client *cli,
+                                 TALLOC_CTX *mem_ctx,
+                                 struct policy_handle *group_handle,
+                                 enum samr_GroupInfoEnum level,
+                                 union samr_GroupInfo *info);
+NTSTATUS rpccli_samr_AddGroupMember(struct rpc_pipe_client *cli,
+                                   TALLOC_CTX *mem_ctx,
+                                   struct policy_handle *group_handle,
+                                   uint32_t rid,
+                                   uint32_t flags);
+NTSTATUS rpccli_samr_DeleteDomainGroup(struct rpc_pipe_client *cli,
+                                      TALLOC_CTX *mem_ctx,
+                                      struct policy_handle *group_handle);
+NTSTATUS rpccli_samr_DeleteGroupMember(struct rpc_pipe_client *cli,
+                                      TALLOC_CTX *mem_ctx,
+                                      struct policy_handle *group_handle,
+                                      uint32_t rid);
+NTSTATUS rpccli_samr_QueryGroupMember(struct rpc_pipe_client *cli,
+                                     TALLOC_CTX *mem_ctx,
+                                     struct policy_handle *group_handle,
+                                     struct samr_RidTypeArray *rids);
+NTSTATUS rpccli_samr_SetMemberAttributesOfGroup(struct rpc_pipe_client *cli,
+                                               TALLOC_CTX *mem_ctx,
+                                               struct policy_handle *group_handle,
+                                               uint32_t unknown1,
+                                               uint32_t unknown2);
+NTSTATUS rpccli_samr_OpenAlias(struct rpc_pipe_client *cli,
+                              TALLOC_CTX *mem_ctx,
+                              struct policy_handle *domain_handle,
+                              uint32_t access_mask,
+                              uint32_t rid,
+                              struct policy_handle *alias_handle);
+NTSTATUS rpccli_samr_QueryAliasInfo(struct rpc_pipe_client *cli,
+                                   TALLOC_CTX *mem_ctx,
+                                   struct policy_handle *alias_handle,
+                                   enum samr_AliasInfoEnum level,
+                                   union samr_AliasInfo *info);
+NTSTATUS rpccli_samr_SetAliasInfo(struct rpc_pipe_client *cli,
+                                 TALLOC_CTX *mem_ctx,
+                                 struct policy_handle *alias_handle,
+                                 enum samr_AliasInfoEnum level,
+                                 union samr_AliasInfo *info);
+NTSTATUS rpccli_samr_DeleteDomAlias(struct rpc_pipe_client *cli,
+                                   TALLOC_CTX *mem_ctx,
+                                   struct policy_handle *alias_handle);
+NTSTATUS rpccli_samr_AddAliasMember(struct rpc_pipe_client *cli,
+                                   TALLOC_CTX *mem_ctx,
+                                   struct policy_handle *alias_handle,
+                                   struct dom_sid2 *sid);
+NTSTATUS rpccli_samr_DeleteAliasMember(struct rpc_pipe_client *cli,
+                                      TALLOC_CTX *mem_ctx,
+                                      struct policy_handle *alias_handle,
+                                      struct dom_sid2 *sid);
+NTSTATUS rpccli_samr_GetMembersInAlias(struct rpc_pipe_client *cli,
+                                      TALLOC_CTX *mem_ctx,
+                                      struct policy_handle *alias_handle,
+                                      struct lsa_SidArray *sids);
+NTSTATUS rpccli_samr_OpenUser(struct rpc_pipe_client *cli,
+                             TALLOC_CTX *mem_ctx,
+                             struct policy_handle *domain_handle,
+                             uint32_t access_mask,
+                             uint32_t rid,
+                             struct policy_handle *user_handle);
+NTSTATUS rpccli_samr_DeleteUser(struct rpc_pipe_client *cli,
+                               TALLOC_CTX *mem_ctx,
+                               struct policy_handle *user_handle);
+NTSTATUS rpccli_samr_QueryUserInfo(struct rpc_pipe_client *cli,
+                                  TALLOC_CTX *mem_ctx,
+                                  struct policy_handle *user_handle,
+                                  uint16_t level,
+                                  union samr_UserInfo *info);
+NTSTATUS rpccli_samr_SetUserInfo(struct rpc_pipe_client *cli,
+                                TALLOC_CTX *mem_ctx,
+                                struct policy_handle *user_handle,
+                                uint16_t level,
+                                union samr_UserInfo *info);
+NTSTATUS rpccli_samr_ChangePasswordUser(struct rpc_pipe_client *cli,
+                                       TALLOC_CTX *mem_ctx,
+                                       struct policy_handle *user_handle,
+                                       uint8_t lm_present,
+                                       struct samr_Password *old_lm_crypted,
+                                       struct samr_Password *new_lm_crypted,
+                                       uint8_t nt_present,
+                                       struct samr_Password *old_nt_crypted,
+                                       struct samr_Password *new_nt_crypted,
+                                       uint8_t cross1_present,
+                                       struct samr_Password *nt_cross,
+                                       uint8_t cross2_present,
+                                       struct samr_Password *lm_cross);
+NTSTATUS rpccli_samr_GetGroupsForUser(struct rpc_pipe_client *cli,
+                                     TALLOC_CTX *mem_ctx,
+                                     struct policy_handle *user_handle,
+                                     struct samr_RidWithAttributeArray *rids);
+NTSTATUS rpccli_samr_QueryDisplayInfo(struct rpc_pipe_client *cli,
+                                     TALLOC_CTX *mem_ctx,
+                                     struct policy_handle *domain_handle,
+                                     uint16_t level,
+                                     uint32_t start_idx,
+                                     uint32_t max_entries,
+                                     uint32_t buf_size,
+                                     uint32_t *total_size,
+                                     uint32_t *returned_size,
+                                     union samr_DispInfo *info);
+NTSTATUS rpccli_samr_GetDisplayEnumerationIndex(struct rpc_pipe_client *cli,
+                                               TALLOC_CTX *mem_ctx,
+                                               struct policy_handle *domain_handle,
+                                               uint16_t level,
+                                               struct lsa_String name,
+                                               uint32_t *idx);
+NTSTATUS rpccli_samr_TestPrivateFunctionsDomain(struct rpc_pipe_client *cli,
+                                               TALLOC_CTX *mem_ctx,
+                                               struct policy_handle *domain_handle);
+NTSTATUS rpccli_samr_TestPrivateFunctionsUser(struct rpc_pipe_client *cli,
+                                             TALLOC_CTX *mem_ctx,
+                                             struct policy_handle *user_handle);
+NTSTATUS rpccli_samr_GetUserPwInfo(struct rpc_pipe_client *cli,
+                                  TALLOC_CTX *mem_ctx,
+                                  struct policy_handle *user_handle,
+                                  struct samr_PwInfo *info);
+NTSTATUS rpccli_samr_RemoveMemberFromForeignDomain(struct rpc_pipe_client *cli,
+                                                  TALLOC_CTX *mem_ctx,
+                                                  struct policy_handle *domain_handle,
+                                                  struct dom_sid2 *sid);
+NTSTATUS rpccli_samr_QueryDomainInfo2(struct rpc_pipe_client *cli,
+                                     TALLOC_CTX *mem_ctx,
+                                     struct policy_handle *domain_handle,
+                                     uint16_t level,
+                                     union samr_DomainInfo *info);
+NTSTATUS rpccli_samr_QueryUserInfo2(struct rpc_pipe_client *cli,
+                                   TALLOC_CTX *mem_ctx,
+                                   struct policy_handle *user_handle,
+                                   uint16_t level,
+                                   union samr_UserInfo *info);
+NTSTATUS rpccli_samr_QueryDisplayInfo2(struct rpc_pipe_client *cli,
+                                      TALLOC_CTX *mem_ctx,
+                                      struct policy_handle *domain_handle,
+                                      uint16_t level,
+                                      uint32_t start_idx,
+                                      uint32_t max_entries,
+                                      uint32_t buf_size,
+                                      uint32_t *total_size,
+                                      uint32_t *returned_size,
+                                      union samr_DispInfo *info);
+NTSTATUS rpccli_samr_GetDisplayEnumerationIndex2(struct rpc_pipe_client *cli,
+                                                TALLOC_CTX *mem_ctx,
+                                                struct policy_handle *domain_handle,
+                                                uint16_t level,
+                                                struct lsa_String name,
+                                                uint32_t *idx);
+NTSTATUS rpccli_samr_CreateUser2(struct rpc_pipe_client *cli,
+                                TALLOC_CTX *mem_ctx,
+                                struct policy_handle *domain_handle,
+                                struct lsa_String *account_name,
+                                uint32_t acct_flags,
+                                uint32_t access_mask,
+                                struct policy_handle *user_handle,
+                                uint32_t *access_granted,
+                                uint32_t *rid);
+NTSTATUS rpccli_samr_QueryDisplayInfo3(struct rpc_pipe_client *cli,
+                                      TALLOC_CTX *mem_ctx,
+                                      struct policy_handle *domain_handle,
+                                      uint16_t level,
+                                      uint32_t start_idx,
+                                      uint32_t max_entries,
+                                      uint32_t buf_size,
+                                      uint32_t *total_size,
+                                      uint32_t *returned_size,
+                                      union samr_DispInfo *info);
+NTSTATUS rpccli_samr_AddMultipleMembersToAlias(struct rpc_pipe_client *cli,
+                                              TALLOC_CTX *mem_ctx,
+                                              struct policy_handle *alias_handle,
+                                              struct lsa_SidArray *sids);
+NTSTATUS rpccli_samr_RemoveMultipleMembersFromAlias(struct rpc_pipe_client *cli,
+                                                   TALLOC_CTX *mem_ctx,
+                                                   struct policy_handle *alias_handle,
+                                                   struct lsa_SidArray *sids);
+NTSTATUS rpccli_samr_OemChangePasswordUser2(struct rpc_pipe_client *cli,
+                                           TALLOC_CTX *mem_ctx,
+                                           struct lsa_AsciiString *server,
+                                           struct lsa_AsciiString *account,
+                                           struct samr_CryptPassword *password,
+                                           struct samr_Password *hash);
+NTSTATUS rpccli_samr_ChangePasswordUser2(struct rpc_pipe_client *cli,
+                                        TALLOC_CTX *mem_ctx,
+                                        struct lsa_String *server,
+                                        struct lsa_String *account,
+                                        struct samr_CryptPassword *nt_password,
+                                        struct samr_Password *nt_verifier,
+                                        uint8_t lm_change,
+                                        struct samr_CryptPassword *lm_password,
+                                        struct samr_Password *lm_verifier);
+NTSTATUS rpccli_samr_GetDomPwInfo(struct rpc_pipe_client *cli,
+                                 TALLOC_CTX *mem_ctx,
+                                 struct lsa_String *domain_name,
+                                 struct samr_PwInfo *info);
+NTSTATUS rpccli_samr_Connect2(struct rpc_pipe_client *cli,
+                             TALLOC_CTX *mem_ctx,
+                             const char *system_name,
+                             uint32_t access_mask,
+                             struct policy_handle *connect_handle);
+NTSTATUS rpccli_samr_SetUserInfo2(struct rpc_pipe_client *cli,
+                                 TALLOC_CTX *mem_ctx,
+                                 struct policy_handle *user_handle,
+                                 uint16_t level,
+                                 union samr_UserInfo *info);
+NTSTATUS rpccli_samr_SetBootKeyInformation(struct rpc_pipe_client *cli,
+                                          TALLOC_CTX *mem_ctx,
+                                          struct policy_handle *connect_handle,
+                                          uint32_t unknown1,
+                                          uint32_t unknown2,
+                                          uint32_t unknown3);
+NTSTATUS rpccli_samr_GetBootKeyInformation(struct rpc_pipe_client *cli,
+                                          TALLOC_CTX *mem_ctx,
+                                          struct policy_handle *domain_handle,
+                                          uint32_t *unknown);
+NTSTATUS rpccli_samr_Connect3(struct rpc_pipe_client *cli,
+                             TALLOC_CTX *mem_ctx,
+                             const char *system_name,
+                             uint32_t unknown,
+                             uint32_t access_mask,
+                             struct policy_handle *connect_handle);
+NTSTATUS rpccli_samr_Connect4(struct rpc_pipe_client *cli,
+                             TALLOC_CTX *mem_ctx,
+                             const char *system_name,
+                             uint32_t unknown,
+                             uint32_t access_mask,
+                             struct policy_handle *connect_handle);
+NTSTATUS rpccli_samr_ChangePasswordUser3(struct rpc_pipe_client *cli,
+                                        TALLOC_CTX *mem_ctx,
+                                        struct lsa_String *server,
+                                        struct lsa_String *account,
+                                        struct samr_CryptPassword *nt_password,
+                                        struct samr_Password *nt_verifier,
+                                        uint8_t lm_change,
+                                        struct samr_CryptPassword *lm_password,
+                                        struct samr_Password *lm_verifier,
+                                        struct samr_CryptPassword *password3,
+                                        struct samr_DomInfo1 *dominfo,
+                                        struct samr_ChangeReject *reject);
+NTSTATUS rpccli_samr_Connect5(struct rpc_pipe_client *cli,
+                             TALLOC_CTX *mem_ctx,
+                             const char *system_name,
+                             uint32_t access_mask,
+                             uint32_t level_in,
+                             union samr_ConnectInfo *info_in,
+                             uint32_t *level_out,
+                             union samr_ConnectInfo *info_out,
+                             struct policy_handle *connect_handle);
+NTSTATUS rpccli_samr_RidToSid(struct rpc_pipe_client *cli,
+                             TALLOC_CTX *mem_ctx,
+                             struct policy_handle *domain_handle,
+                             uint32_t rid,
+                             struct dom_sid2 *sid);
+NTSTATUS rpccli_samr_SetDsrmPassword(struct rpc_pipe_client *cli,
+                                    TALLOC_CTX *mem_ctx,
+                                    struct lsa_String *name,
+                                    uint32_t unknown,
+                                    struct samr_Password *hash);
+NTSTATUS rpccli_samr_ValidatePassword(struct rpc_pipe_client *cli,
+                                     TALLOC_CTX *mem_ctx,
+                                     enum samr_ValidatePasswordLevel level,
+                                     union samr_ValidatePasswordReq req,
+                                     union samr_ValidatePasswordRep *rep);
+#endif /* __CLI_SAMR__ */
index b7f1521dd3f77f16cce29fa46dde7ce6fa875d8e..2b1d050a145e340b81ae467b38ec3560307a4106 100644 (file)
@@ -6,34 +6,49 @@
 #include "includes.h"
 #include "librpc/gen_ndr/cli_srvsvc.h"
 
-NTSTATUS rpccli_srvsvc_NetCharDevEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, uint32_t *level, union srvsvc_NetCharDevCtr *ctr, uint32_t max_buffer, uint32_t *totalentries, uint32_t *resume_handle, WERROR *werror)
+NTSTATUS rpccli_srvsvc_NetCharDevEnum(struct rpc_pipe_client *cli,
+                                     TALLOC_CTX *mem_ctx,
+                                     const char *server_unc,
+                                     uint32_t *level,
+                                     union srvsvc_NetCharDevCtr *ctr,
+                                     uint32_t max_buffer,
+                                     uint32_t *totalentries,
+                                     uint32_t *resume_handle,
+                                     WERROR *werror)
 {
        struct srvsvc_NetCharDevEnum r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_unc = server_unc;
        r.in.level = level;
        r.in.ctr = ctr;
        r.in.max_buffer = max_buffer;
        r.in.resume_handle = resume_handle;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetCharDevEnum, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETCHARDEVENUM, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SRVSVC,
+                               &ndr_table_srvsvc,
+                               NDR_SRVSVC_NETCHARDEVENUM,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetCharDevEnum, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *level = *r.out.level;
        *ctr = *r.out.ctr;
@@ -41,93 +56,127 @@ NTSTATUS rpccli_srvsvc_NetCharDevEnum(struct rpc_pipe_client *cli, TALLOC_CTX *m
        if (resume_handle && r.out.resume_handle) {
                *resume_handle = *r.out.resume_handle;
        }
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_srvsvc_NetCharDevGetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *device_name, uint32_t level, union srvsvc_NetCharDevInfo *info, WERROR *werror)
+NTSTATUS rpccli_srvsvc_NetCharDevGetInfo(struct rpc_pipe_client *cli,
+                                        TALLOC_CTX *mem_ctx,
+                                        const char *server_unc,
+                                        const char *device_name,
+                                        uint32_t level,
+                                        union srvsvc_NetCharDevInfo *info,
+                                        WERROR *werror)
 {
        struct srvsvc_NetCharDevGetInfo r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_unc = server_unc;
        r.in.device_name = device_name;
        r.in.level = level;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetCharDevGetInfo, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETCHARDEVGETINFO, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SRVSVC,
+                               &ndr_table_srvsvc,
+                               NDR_SRVSVC_NETCHARDEVGETINFO,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetCharDevGetInfo, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *info = *r.out.info;
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_srvsvc_NetCharDevControl(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *device_name, uint32_t opcode, WERROR *werror)
+NTSTATUS rpccli_srvsvc_NetCharDevControl(struct rpc_pipe_client *cli,
+                                        TALLOC_CTX *mem_ctx,
+                                        const char *server_unc,
+                                        const char *device_name,
+                                        uint32_t opcode,
+                                        WERROR *werror)
 {
        struct srvsvc_NetCharDevControl r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_unc = server_unc;
        r.in.device_name = device_name;
        r.in.opcode = opcode;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetCharDevControl, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETCHARDEVCONTROL, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SRVSVC,
+                               &ndr_table_srvsvc,
+                               NDR_SRVSVC_NETCHARDEVCONTROL,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetCharDevControl, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_srvsvc_NetCharDevQEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *user, uint32_t *level, union srvsvc_NetCharDevQCtr *ctr, uint32_t max_buffer, uint32_t *totalentries, uint32_t *resume_handle, WERROR *werror)
+NTSTATUS rpccli_srvsvc_NetCharDevQEnum(struct rpc_pipe_client *cli,
+                                      TALLOC_CTX *mem_ctx,
+                                      const char *server_unc,
+                                      const char *user,
+                                      uint32_t *level,
+                                      union srvsvc_NetCharDevQCtr *ctr,
+                                      uint32_t max_buffer,
+                                      uint32_t *totalentries,
+                                      uint32_t *resume_handle,
+                                      WERROR *werror)
 {
        struct srvsvc_NetCharDevQEnum r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_unc = server_unc;
        r.in.user = user;
@@ -135,23 +184,30 @@ NTSTATUS rpccli_srvsvc_NetCharDevQEnum(struct rpc_pipe_client *cli, TALLOC_CTX *
        r.in.ctr = ctr;
        r.in.max_buffer = max_buffer;
        r.in.resume_handle = resume_handle;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetCharDevQEnum, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETCHARDEVQENUM, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SRVSVC,
+                               &ndr_table_srvsvc,
+                               NDR_SRVSVC_NETCHARDEVQENUM,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetCharDevQEnum, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *level = *r.out.level;
        *ctr = *r.out.ctr;
@@ -159,170 +215,230 @@ NTSTATUS rpccli_srvsvc_NetCharDevQEnum(struct rpc_pipe_client *cli, TALLOC_CTX *
        if (resume_handle && r.out.resume_handle) {
                *resume_handle = *r.out.resume_handle;
        }
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_srvsvc_NetCharDevQGetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *queue_name, const char *user, uint32_t level, union srvsvc_NetCharDevQInfo *info, WERROR *werror)
+NTSTATUS rpccli_srvsvc_NetCharDevQGetInfo(struct rpc_pipe_client *cli,
+                                         TALLOC_CTX *mem_ctx,
+                                         const char *server_unc,
+                                         const char *queue_name,
+                                         const char *user,
+                                         uint32_t level,
+                                         union srvsvc_NetCharDevQInfo *info,
+                                         WERROR *werror)
 {
        struct srvsvc_NetCharDevQGetInfo r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_unc = server_unc;
        r.in.queue_name = queue_name;
        r.in.user = user;
        r.in.level = level;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetCharDevQGetInfo, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETCHARDEVQGETINFO, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SRVSVC,
+                               &ndr_table_srvsvc,
+                               NDR_SRVSVC_NETCHARDEVQGETINFO,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetCharDevQGetInfo, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *info = *r.out.info;
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_srvsvc_NetCharDevQSetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *queue_name, uint32_t level, union srvsvc_NetCharDevQInfo info, uint32_t *parm_error, WERROR *werror)
+NTSTATUS rpccli_srvsvc_NetCharDevQSetInfo(struct rpc_pipe_client *cli,
+                                         TALLOC_CTX *mem_ctx,
+                                         const char *server_unc,
+                                         const char *queue_name,
+                                         uint32_t level,
+                                         union srvsvc_NetCharDevQInfo info,
+                                         uint32_t *parm_error,
+                                         WERROR *werror)
 {
        struct srvsvc_NetCharDevQSetInfo r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_unc = server_unc;
        r.in.queue_name = queue_name;
        r.in.level = level;
        r.in.info = info;
        r.in.parm_error = parm_error;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetCharDevQSetInfo, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETCHARDEVQSETINFO, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SRVSVC,
+                               &ndr_table_srvsvc,
+                               NDR_SRVSVC_NETCHARDEVQSETINFO,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetCharDevQSetInfo, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        if (parm_error && r.out.parm_error) {
                *parm_error = *r.out.parm_error;
        }
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_srvsvc_NetCharDevQPurge(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *queue_name, WERROR *werror)
+NTSTATUS rpccli_srvsvc_NetCharDevQPurge(struct rpc_pipe_client *cli,
+                                       TALLOC_CTX *mem_ctx,
+                                       const char *server_unc,
+                                       const char *queue_name,
+                                       WERROR *werror)
 {
        struct srvsvc_NetCharDevQPurge r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_unc = server_unc;
        r.in.queue_name = queue_name;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetCharDevQPurge, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETCHARDEVQPURGE, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SRVSVC,
+                               &ndr_table_srvsvc,
+                               NDR_SRVSVC_NETCHARDEVQPURGE,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetCharDevQPurge, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_srvsvc_NetCharDevQPurgeSelf(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *queue_name, const char *computer_name, WERROR *werror)
+NTSTATUS rpccli_srvsvc_NetCharDevQPurgeSelf(struct rpc_pipe_client *cli,
+                                           TALLOC_CTX *mem_ctx,
+                                           const char *server_unc,
+                                           const char *queue_name,
+                                           const char *computer_name,
+                                           WERROR *werror)
 {
        struct srvsvc_NetCharDevQPurgeSelf r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_unc = server_unc;
        r.in.queue_name = queue_name;
        r.in.computer_name = computer_name;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetCharDevQPurgeSelf, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETCHARDEVQPURGESELF, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SRVSVC,
+                               &ndr_table_srvsvc,
+                               NDR_SRVSVC_NETCHARDEVQPURGESELF,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetCharDevQPurgeSelf, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_srvsvc_NetConnEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *path, uint32_t *level, union srvsvc_NetConnCtr *ctr, uint32_t max_buffer, uint32_t *totalentries, uint32_t *resume_handle, WERROR *werror)
+NTSTATUS rpccli_srvsvc_NetConnEnum(struct rpc_pipe_client *cli,
+                                  TALLOC_CTX *mem_ctx,
+                                  const char *server_unc,
+                                  const char *path,
+                                  uint32_t *level,
+                                  union srvsvc_NetConnCtr *ctr,
+                                  uint32_t max_buffer,
+                                  uint32_t *totalentries,
+                                  uint32_t *resume_handle,
+                                  WERROR *werror)
 {
        struct srvsvc_NetConnEnum r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_unc = server_unc;
        r.in.path = path;
@@ -330,23 +446,30 @@ NTSTATUS rpccli_srvsvc_NetConnEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_
        r.in.ctr = ctr;
        r.in.max_buffer = max_buffer;
        r.in.resume_handle = resume_handle;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetConnEnum, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETCONNENUM, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SRVSVC,
+                               &ndr_table_srvsvc,
+                               NDR_SRVSVC_NETCONNENUM,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetConnEnum, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *level = *r.out.level;
        *ctr = *r.out.ctr;
@@ -354,20 +477,30 @@ NTSTATUS rpccli_srvsvc_NetConnEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_
        if (resume_handle && r.out.resume_handle) {
                *resume_handle = *r.out.resume_handle;
        }
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_srvsvc_NetFileEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *path, const char *user, uint32_t *level, union srvsvc_NetFileCtr *ctr, uint32_t max_buffer, uint32_t *totalentries, uint32_t *resume_handle, WERROR *werror)
+NTSTATUS rpccli_srvsvc_NetFileEnum(struct rpc_pipe_client *cli,
+                                  TALLOC_CTX *mem_ctx,
+                                  const char *server_unc,
+                                  const char *path,
+                                  const char *user,
+                                  uint32_t *level,
+                                  union srvsvc_NetFileCtr *ctr,
+                                  uint32_t max_buffer,
+                                  uint32_t *totalentries,
+                                  uint32_t *resume_handle,
+                                  WERROR *werror)
 {
        struct srvsvc_NetFileEnum r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_unc = server_unc;
        r.in.path = path;
@@ -376,23 +509,30 @@ NTSTATUS rpccli_srvsvc_NetFileEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_
        r.in.ctr = ctr;
        r.in.max_buffer = max_buffer;
        r.in.resume_handle = resume_handle;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetFileEnum, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETFILEENUM, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SRVSVC,
+                               &ndr_table_srvsvc,
+                               NDR_SRVSVC_NETFILEENUM,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetFileEnum, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *level = *r.out.level;
        *ctr = *r.out.ctr;
@@ -400,92 +540,126 @@ NTSTATUS rpccli_srvsvc_NetFileEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_
        if (resume_handle && r.out.resume_handle) {
                *resume_handle = *r.out.resume_handle;
        }
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_srvsvc_NetFileGetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, uint32_t fid, uint32_t level, union srvsvc_NetFileInfo *info, WERROR *werror)
+NTSTATUS rpccli_srvsvc_NetFileGetInfo(struct rpc_pipe_client *cli,
+                                     TALLOC_CTX *mem_ctx,
+                                     const char *server_unc,
+                                     uint32_t fid,
+                                     uint32_t level,
+                                     union srvsvc_NetFileInfo *info,
+                                     WERROR *werror)
 {
        struct srvsvc_NetFileGetInfo r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_unc = server_unc;
        r.in.fid = fid;
        r.in.level = level;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetFileGetInfo, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETFILEGETINFO, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SRVSVC,
+                               &ndr_table_srvsvc,
+                               NDR_SRVSVC_NETFILEGETINFO,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetFileGetInfo, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *info = *r.out.info;
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_srvsvc_NetFileClose(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, uint32_t fid, WERROR *werror)
+NTSTATUS rpccli_srvsvc_NetFileClose(struct rpc_pipe_client *cli,
+                                   TALLOC_CTX *mem_ctx,
+                                   const char *server_unc,
+                                   uint32_t fid,
+                                   WERROR *werror)
 {
        struct srvsvc_NetFileClose r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_unc = server_unc;
        r.in.fid = fid;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetFileClose, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETFILECLOSE, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SRVSVC,
+                               &ndr_table_srvsvc,
+                               NDR_SRVSVC_NETFILECLOSE,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetFileClose, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_srvsvc_NetSessEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *client, const char *user, uint32_t *level, union srvsvc_NetSessCtr *ctr, uint32_t max_buffer, uint32_t *totalentries, uint32_t *resume_handle, WERROR *werror)
+NTSTATUS rpccli_srvsvc_NetSessEnum(struct rpc_pipe_client *cli,
+                                  TALLOC_CTX *mem_ctx,
+                                  const char *server_unc,
+                                  const char *client,
+                                  const char *user,
+                                  uint32_t *level,
+                                  union srvsvc_NetSessCtr *ctr,
+                                  uint32_t max_buffer,
+                                  uint32_t *totalentries,
+                                  uint32_t *resume_handle,
+                                  WERROR *werror)
 {
        struct srvsvc_NetSessEnum r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_unc = server_unc;
        r.in.client = client;
@@ -494,23 +668,30 @@ NTSTATUS rpccli_srvsvc_NetSessEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_
        r.in.ctr = ctr;
        r.in.max_buffer = max_buffer;
        r.in.resume_handle = resume_handle;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetSessEnum, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETSESSENUM, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SRVSVC,
+                               &ndr_table_srvsvc,
+                               NDR_SRVSVC_NETSESSENUM,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetSessEnum, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *level = *r.out.level;
        *ctr = *r.out.ctr;
@@ -518,119 +699,159 @@ NTSTATUS rpccli_srvsvc_NetSessEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_
        if (resume_handle && r.out.resume_handle) {
                *resume_handle = *r.out.resume_handle;
        }
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_srvsvc_NetSessDel(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *client, const char *user, WERROR *werror)
+NTSTATUS rpccli_srvsvc_NetSessDel(struct rpc_pipe_client *cli,
+                                 TALLOC_CTX *mem_ctx,
+                                 const char *server_unc,
+                                 const char *client,
+                                 const char *user,
+                                 WERROR *werror)
 {
        struct srvsvc_NetSessDel r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_unc = server_unc;
        r.in.client = client;
        r.in.user = user;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetSessDel, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETSESSDEL, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SRVSVC,
+                               &ndr_table_srvsvc,
+                               NDR_SRVSVC_NETSESSDEL,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetSessDel, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_srvsvc_NetShareAdd(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, uint32_t level, union srvsvc_NetShareInfo info, uint32_t *parm_error, WERROR *werror)
+NTSTATUS rpccli_srvsvc_NetShareAdd(struct rpc_pipe_client *cli,
+                                  TALLOC_CTX *mem_ctx,
+                                  const char *server_unc,
+                                  uint32_t level,
+                                  union srvsvc_NetShareInfo info,
+                                  uint32_t *parm_error,
+                                  WERROR *werror)
 {
        struct srvsvc_NetShareAdd r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_unc = server_unc;
        r.in.level = level;
        r.in.info = info;
        r.in.parm_error = parm_error;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetShareAdd, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETSHAREADD, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SRVSVC,
+                               &ndr_table_srvsvc,
+                               NDR_SRVSVC_NETSHAREADD,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetShareAdd, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        if (parm_error && r.out.parm_error) {
                *parm_error = *r.out.parm_error;
        }
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_srvsvc_NetShareEnumAll(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, uint32_t *level, union srvsvc_NetShareCtr *ctr, uint32_t max_buffer, uint32_t *totalentries, uint32_t *resume_handle, WERROR *werror)
+NTSTATUS rpccli_srvsvc_NetShareEnumAll(struct rpc_pipe_client *cli,
+                                      TALLOC_CTX *mem_ctx,
+                                      const char *server_unc,
+                                      uint32_t *level,
+                                      union srvsvc_NetShareCtr *ctr,
+                                      uint32_t max_buffer,
+                                      uint32_t *totalentries,
+                                      uint32_t *resume_handle,
+                                      WERROR *werror)
 {
        struct srvsvc_NetShareEnumAll r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_unc = server_unc;
        r.in.level = level;
        r.in.ctr = ctr;
        r.in.max_buffer = max_buffer;
        r.in.resume_handle = resume_handle;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetShareEnumAll, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETSHAREENUMALL, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SRVSVC,
+                               &ndr_table_srvsvc,
+                               NDR_SRVSVC_NETSHAREENUMALL,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetShareEnumAll, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *level = *r.out.level;
        *ctr = *r.out.ctr;
@@ -638,422 +859,566 @@ NTSTATUS rpccli_srvsvc_NetShareEnumAll(struct rpc_pipe_client *cli, TALLOC_CTX *
        if (resume_handle && r.out.resume_handle) {
                *resume_handle = *r.out.resume_handle;
        }
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_srvsvc_NetShareGetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *share_name, uint32_t level, union srvsvc_NetShareInfo *info, WERROR *werror)
+NTSTATUS rpccli_srvsvc_NetShareGetInfo(struct rpc_pipe_client *cli,
+                                      TALLOC_CTX *mem_ctx,
+                                      const char *server_unc,
+                                      const char *share_name,
+                                      uint32_t level,
+                                      union srvsvc_NetShareInfo *info,
+                                      WERROR *werror)
 {
        struct srvsvc_NetShareGetInfo r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_unc = server_unc;
        r.in.share_name = share_name;
        r.in.level = level;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetShareGetInfo, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETSHAREGETINFO, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SRVSVC,
+                               &ndr_table_srvsvc,
+                               NDR_SRVSVC_NETSHAREGETINFO,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetShareGetInfo, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *info = *r.out.info;
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_srvsvc_NetShareSetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *share_name, uint32_t level, union srvsvc_NetShareInfo info, uint32_t *parm_error, WERROR *werror)
+NTSTATUS rpccli_srvsvc_NetShareSetInfo(struct rpc_pipe_client *cli,
+                                      TALLOC_CTX *mem_ctx,
+                                      const char *server_unc,
+                                      const char *share_name,
+                                      uint32_t level,
+                                      union srvsvc_NetShareInfo info,
+                                      uint32_t *parm_error,
+                                      WERROR *werror)
 {
        struct srvsvc_NetShareSetInfo r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_unc = server_unc;
        r.in.share_name = share_name;
        r.in.level = level;
        r.in.info = info;
        r.in.parm_error = parm_error;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetShareSetInfo, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETSHARESETINFO, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SRVSVC,
+                               &ndr_table_srvsvc,
+                               NDR_SRVSVC_NETSHARESETINFO,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetShareSetInfo, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        if (parm_error && r.out.parm_error) {
                *parm_error = *r.out.parm_error;
        }
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_srvsvc_NetShareDel(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *share_name, uint32_t reserved, WERROR *werror)
+NTSTATUS rpccli_srvsvc_NetShareDel(struct rpc_pipe_client *cli,
+                                  TALLOC_CTX *mem_ctx,
+                                  const char *server_unc,
+                                  const char *share_name,
+                                  uint32_t reserved,
+                                  WERROR *werror)
 {
        struct srvsvc_NetShareDel r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_unc = server_unc;
        r.in.share_name = share_name;
        r.in.reserved = reserved;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetShareDel, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETSHAREDEL, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SRVSVC,
+                               &ndr_table_srvsvc,
+                               NDR_SRVSVC_NETSHAREDEL,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetShareDel, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_srvsvc_NetShareDelSticky(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *share_name, uint32_t reserved, WERROR *werror)
+NTSTATUS rpccli_srvsvc_NetShareDelSticky(struct rpc_pipe_client *cli,
+                                        TALLOC_CTX *mem_ctx,
+                                        const char *server_unc,
+                                        const char *share_name,
+                                        uint32_t reserved,
+                                        WERROR *werror)
 {
        struct srvsvc_NetShareDelSticky r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_unc = server_unc;
        r.in.share_name = share_name;
        r.in.reserved = reserved;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetShareDelSticky, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETSHAREDELSTICKY, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SRVSVC,
+                               &ndr_table_srvsvc,
+                               NDR_SRVSVC_NETSHAREDELSTICKY,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetShareDelSticky, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_srvsvc_NetShareCheck(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *device_name, enum srvsvc_ShareType *type, WERROR *werror)
+NTSTATUS rpccli_srvsvc_NetShareCheck(struct rpc_pipe_client *cli,
+                                    TALLOC_CTX *mem_ctx,
+                                    const char *server_unc,
+                                    const char *device_name,
+                                    enum srvsvc_ShareType *type,
+                                    WERROR *werror)
 {
        struct srvsvc_NetShareCheck r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_unc = server_unc;
        r.in.device_name = device_name;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetShareCheck, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETSHARECHECK, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SRVSVC,
+                               &ndr_table_srvsvc,
+                               NDR_SRVSVC_NETSHARECHECK,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetShareCheck, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *type = *r.out.type;
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_srvsvc_NetSrvGetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, uint32_t level, union srvsvc_NetSrvInfo *info, WERROR *werror)
+NTSTATUS rpccli_srvsvc_NetSrvGetInfo(struct rpc_pipe_client *cli,
+                                    TALLOC_CTX *mem_ctx,
+                                    const char *server_unc,
+                                    uint32_t level,
+                                    union srvsvc_NetSrvInfo *info,
+                                    WERROR *werror)
 {
        struct srvsvc_NetSrvGetInfo r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_unc = server_unc;
        r.in.level = level;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetSrvGetInfo, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETSRVGETINFO, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SRVSVC,
+                               &ndr_table_srvsvc,
+                               NDR_SRVSVC_NETSRVGETINFO,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetSrvGetInfo, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *info = *r.out.info;
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_srvsvc_NetSrvSetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, uint32_t level, union srvsvc_NetSrvInfo info, uint32_t *parm_error, WERROR *werror)
+NTSTATUS rpccli_srvsvc_NetSrvSetInfo(struct rpc_pipe_client *cli,
+                                    TALLOC_CTX *mem_ctx,
+                                    const char *server_unc,
+                                    uint32_t level,
+                                    union srvsvc_NetSrvInfo info,
+                                    uint32_t *parm_error,
+                                    WERROR *werror)
 {
        struct srvsvc_NetSrvSetInfo r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_unc = server_unc;
        r.in.level = level;
        r.in.info = info;
        r.in.parm_error = parm_error;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetSrvSetInfo, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETSRVSETINFO, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SRVSVC,
+                               &ndr_table_srvsvc,
+                               NDR_SRVSVC_NETSRVSETINFO,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetSrvSetInfo, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        if (parm_error && r.out.parm_error) {
                *parm_error = *r.out.parm_error;
        }
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_srvsvc_NetDiskEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, uint32_t level, struct srvsvc_NetDiskInfo *info, uint32_t maxlen, uint32_t *totalentries, uint32_t *resume_handle, WERROR *werror)
+NTSTATUS rpccli_srvsvc_NetDiskEnum(struct rpc_pipe_client *cli,
+                                  TALLOC_CTX *mem_ctx,
+                                  const char *server_unc,
+                                  uint32_t level,
+                                  struct srvsvc_NetDiskInfo *info,
+                                  uint32_t maxlen,
+                                  uint32_t *totalentries,
+                                  uint32_t *resume_handle,
+                                  WERROR *werror)
 {
        struct srvsvc_NetDiskEnum r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_unc = server_unc;
        r.in.level = level;
        r.in.info = info;
        r.in.maxlen = maxlen;
        r.in.resume_handle = resume_handle;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetDiskEnum, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETDISKENUM, &r);
-       
-       if (!NT_STATUS_IS_OK(status)) {
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SRVSVC,
+                               &ndr_table_srvsvc,
+                               NDR_SRVSVC_NETDISKENUM,
+                               &r);
+
+       if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetDiskEnum, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *info = *r.out.info;
        *totalentries = *r.out.totalentries;
        if (resume_handle && r.out.resume_handle) {
                *resume_handle = *r.out.resume_handle;
        }
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_srvsvc_NetServerStatisticsGet(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *service, uint32_t level, uint32_t options, struct srvsvc_Statistics *stats, WERROR *werror)
+NTSTATUS rpccli_srvsvc_NetServerStatisticsGet(struct rpc_pipe_client *cli,
+                                             TALLOC_CTX *mem_ctx,
+                                             const char *server_unc,
+                                             const char *service,
+                                             uint32_t level,
+                                             uint32_t options,
+                                             struct srvsvc_Statistics *stats,
+                                             WERROR *werror)
 {
        struct srvsvc_NetServerStatisticsGet r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_unc = server_unc;
        r.in.service = service;
        r.in.level = level;
        r.in.options = options;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetServerStatisticsGet, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETSERVERSTATISTICSGET, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SRVSVC,
+                               &ndr_table_srvsvc,
+                               NDR_SRVSVC_NETSERVERSTATISTICSGET,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetServerStatisticsGet, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *stats = *r.out.stats;
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_srvsvc_NetTransportAdd(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, uint32_t level, union srvsvc_NetTransportInfo info, WERROR *werror)
+NTSTATUS rpccli_srvsvc_NetTransportAdd(struct rpc_pipe_client *cli,
+                                      TALLOC_CTX *mem_ctx,
+                                      const char *server_unc,
+                                      uint32_t level,
+                                      union srvsvc_NetTransportInfo info,
+                                      WERROR *werror)
 {
        struct srvsvc_NetTransportAdd r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_unc = server_unc;
        r.in.level = level;
        r.in.info = info;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetTransportAdd, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETTRANSPORTADD, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SRVSVC,
+                               &ndr_table_srvsvc,
+                               NDR_SRVSVC_NETTRANSPORTADD,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetTransportAdd, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_srvsvc_NetTransportEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, uint32_t *level, union srvsvc_NetTransportCtr *transports, uint32_t max_buffer, uint32_t *totalentries, uint32_t *resume_handle, WERROR *werror)
+NTSTATUS rpccli_srvsvc_NetTransportEnum(struct rpc_pipe_client *cli,
+                                       TALLOC_CTX *mem_ctx,
+                                       const char *server_unc,
+                                       uint32_t *level,
+                                       union srvsvc_NetTransportCtr *transports,
+                                       uint32_t max_buffer,
+                                       uint32_t *totalentries,
+                                       uint32_t *resume_handle,
+                                       WERROR *werror)
 {
        struct srvsvc_NetTransportEnum r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_unc = server_unc;
        r.in.level = level;
        r.in.transports = transports;
        r.in.max_buffer = max_buffer;
        r.in.resume_handle = resume_handle;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetTransportEnum, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETTRANSPORTENUM, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SRVSVC,
+                               &ndr_table_srvsvc,
+                               NDR_SRVSVC_NETTRANSPORTENUM,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetTransportEnum, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *level = *r.out.level;
        *transports = *r.out.transports;
@@ -1061,167 +1426,225 @@ NTSTATUS rpccli_srvsvc_NetTransportEnum(struct rpc_pipe_client *cli, TALLOC_CTX
        if (resume_handle && r.out.resume_handle) {
                *resume_handle = *r.out.resume_handle;
        }
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_srvsvc_NetTransportDel(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, uint32_t unknown, struct srvsvc_NetTransportInfo0 transport, WERROR *werror)
+NTSTATUS rpccli_srvsvc_NetTransportDel(struct rpc_pipe_client *cli,
+                                      TALLOC_CTX *mem_ctx,
+                                      const char *server_unc,
+                                      uint32_t unknown,
+                                      struct srvsvc_NetTransportInfo0 transport,
+                                      WERROR *werror)
 {
        struct srvsvc_NetTransportDel r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_unc = server_unc;
        r.in.unknown = unknown;
        r.in.transport = transport;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetTransportDel, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETTRANSPORTDEL, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SRVSVC,
+                               &ndr_table_srvsvc,
+                               NDR_SRVSVC_NETTRANSPORTDEL,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetTransportDel, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_srvsvc_NetRemoteTOD(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, struct srvsvc_NetRemoteTODInfo *info, WERROR *werror)
+NTSTATUS rpccli_srvsvc_NetRemoteTOD(struct rpc_pipe_client *cli,
+                                   TALLOC_CTX *mem_ctx,
+                                   const char *server_unc,
+                                   struct srvsvc_NetRemoteTODInfo *info,
+                                   WERROR *werror)
 {
        struct srvsvc_NetRemoteTOD r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_unc = server_unc;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetRemoteTOD, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETREMOTETOD, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SRVSVC,
+                               &ndr_table_srvsvc,
+                               NDR_SRVSVC_NETREMOTETOD,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetRemoteTOD, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        if (info && r.out.info) {
                *info = *r.out.info;
        }
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_srvsvc_NetSetServiceBits(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *transport, uint32_t servicebits, uint32_t updateimmediately, WERROR *werror)
+NTSTATUS rpccli_srvsvc_NetSetServiceBits(struct rpc_pipe_client *cli,
+                                        TALLOC_CTX *mem_ctx,
+                                        const char *server_unc,
+                                        const char *transport,
+                                        uint32_t servicebits,
+                                        uint32_t updateimmediately,
+                                        WERROR *werror)
 {
        struct srvsvc_NetSetServiceBits r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_unc = server_unc;
        r.in.transport = transport;
        r.in.servicebits = servicebits;
        r.in.updateimmediately = updateimmediately;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetSetServiceBits, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETSETSERVICEBITS, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SRVSVC,
+                               &ndr_table_srvsvc,
+                               NDR_SRVSVC_NETSETSERVICEBITS,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetSetServiceBits, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_srvsvc_NetPathType(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *path, uint32_t pathflags, uint32_t *pathtype, WERROR *werror)
+NTSTATUS rpccli_srvsvc_NetPathType(struct rpc_pipe_client *cli,
+                                  TALLOC_CTX *mem_ctx,
+                                  const char *server_unc,
+                                  const char *path,
+                                  uint32_t pathflags,
+                                  uint32_t *pathtype,
+                                  WERROR *werror)
 {
        struct srvsvc_NetPathType r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_unc = server_unc;
        r.in.path = path;
        r.in.pathflags = pathflags;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetPathType, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETPATHTYPE, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SRVSVC,
+                               &ndr_table_srvsvc,
+                               NDR_SRVSVC_NETPATHTYPE,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetPathType, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *pathtype = *r.out.pathtype;
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_srvsvc_NetPathCanonicalize(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *path, uint8_t *can_path, uint32_t maxbuf, const char *prefix, uint32_t *pathtype, uint32_t pathflags, WERROR *werror)
+NTSTATUS rpccli_srvsvc_NetPathCanonicalize(struct rpc_pipe_client *cli,
+                                          TALLOC_CTX *mem_ctx,
+                                          const char *server_unc,
+                                          const char *path,
+                                          uint8_t *can_path,
+                                          uint32_t maxbuf,
+                                          const char *prefix,
+                                          uint32_t *pathtype,
+                                          uint32_t pathflags,
+                                          WERROR *werror)
 {
        struct srvsvc_NetPathCanonicalize r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_unc = server_unc;
        r.in.path = path;
@@ -1229,209 +1652,281 @@ NTSTATUS rpccli_srvsvc_NetPathCanonicalize(struct rpc_pipe_client *cli, TALLOC_C
        r.in.prefix = prefix;
        r.in.pathtype = pathtype;
        r.in.pathflags = pathflags;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetPathCanonicalize, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETPATHCANONICALIZE, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SRVSVC,
+                               &ndr_table_srvsvc,
+                               NDR_SRVSVC_NETPATHCANONICALIZE,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetPathCanonicalize, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        memcpy(can_path, r.out.can_path, r.in.maxbuf);
        *pathtype = *r.out.pathtype;
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_srvsvc_NetPathCompare(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *path1, const char *path2, uint32_t pathtype, uint32_t pathflags, WERROR *werror)
+NTSTATUS rpccli_srvsvc_NetPathCompare(struct rpc_pipe_client *cli,
+                                     TALLOC_CTX *mem_ctx,
+                                     const char *server_unc,
+                                     const char *path1,
+                                     const char *path2,
+                                     uint32_t pathtype,
+                                     uint32_t pathflags,
+                                     WERROR *werror)
 {
        struct srvsvc_NetPathCompare r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_unc = server_unc;
        r.in.path1 = path1;
        r.in.path2 = path2;
        r.in.pathtype = pathtype;
        r.in.pathflags = pathflags;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetPathCompare, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETPATHCOMPARE, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SRVSVC,
+                               &ndr_table_srvsvc,
+                               NDR_SRVSVC_NETPATHCOMPARE,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetPathCompare, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_srvsvc_NetNameValidate(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *name, uint32_t name_type, uint32_t flags, WERROR *werror)
+NTSTATUS rpccli_srvsvc_NetNameValidate(struct rpc_pipe_client *cli,
+                                      TALLOC_CTX *mem_ctx,
+                                      const char *server_unc,
+                                      const char *name,
+                                      uint32_t name_type,
+                                      uint32_t flags,
+                                      WERROR *werror)
 {
        struct srvsvc_NetNameValidate r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_unc = server_unc;
        r.in.name = name;
        r.in.name_type = name_type;
        r.in.flags = flags;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetNameValidate, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETNAMEVALIDATE, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SRVSVC,
+                               &ndr_table_srvsvc,
+                               NDR_SRVSVC_NETNAMEVALIDATE,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetNameValidate, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_srvsvc_NETRPRNAMECANONICALIZE(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror)
+NTSTATUS rpccli_srvsvc_NETRPRNAMECANONICALIZE(struct rpc_pipe_client *cli,
+                                             TALLOC_CTX *mem_ctx,
+                                             WERROR *werror)
 {
        struct srvsvc_NETRPRNAMECANONICALIZE r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NETRPRNAMECANONICALIZE, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETRPRNAMECANONICALIZE, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SRVSVC,
+                               &ndr_table_srvsvc,
+                               NDR_SRVSVC_NETRPRNAMECANONICALIZE,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NETRPRNAMECANONICALIZE, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_srvsvc_NetPRNameCompare(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *name1, const char *name2, uint32_t name_type, uint32_t flags, WERROR *werror)
+NTSTATUS rpccli_srvsvc_NetPRNameCompare(struct rpc_pipe_client *cli,
+                                       TALLOC_CTX *mem_ctx,
+                                       const char *server_unc,
+                                       const char *name1,
+                                       const char *name2,
+                                       uint32_t name_type,
+                                       uint32_t flags,
+                                       WERROR *werror)
 {
        struct srvsvc_NetPRNameCompare r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_unc = server_unc;
        r.in.name1 = name1;
        r.in.name2 = name2;
        r.in.name_type = name_type;
        r.in.flags = flags;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetPRNameCompare, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETPRNAMECOMPARE, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SRVSVC,
+                               &ndr_table_srvsvc,
+                               NDR_SRVSVC_NETPRNAMECOMPARE,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetPRNameCompare, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_srvsvc_NetShareEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, uint32_t *level, union srvsvc_NetShareCtr *ctr, uint32_t max_buffer, uint32_t *totalentries, uint32_t *resume_handle, WERROR *werror)
+NTSTATUS rpccli_srvsvc_NetShareEnum(struct rpc_pipe_client *cli,
+                                   TALLOC_CTX *mem_ctx,
+                                   const char *server_unc,
+                                   uint32_t *level,
+                                   union srvsvc_NetShareCtr *ctr,
+                                   uint32_t max_buffer,
+                                   uint32_t *totalentries,
+                                   uint32_t *resume_handle,
+                                   WERROR *werror)
 {
        struct srvsvc_NetShareEnum r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_unc = server_unc;
        r.in.level = level;
        r.in.ctr = ctr;
        r.in.max_buffer = max_buffer;
        r.in.resume_handle = resume_handle;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetShareEnum, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETSHAREENUM, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SRVSVC,
+                               &ndr_table_srvsvc,
+                               NDR_SRVSVC_NETSHAREENUM,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetShareEnum, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *level = *r.out.level;
        *ctr = *r.out.ctr;
@@ -1439,210 +1934,281 @@ NTSTATUS rpccli_srvsvc_NetShareEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem
        if (resume_handle && r.out.resume_handle) {
                *resume_handle = *r.out.resume_handle;
        }
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_srvsvc_NetShareDelStart(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *share, uint32_t reserved, struct policy_handle *hnd, WERROR *werror)
+NTSTATUS rpccli_srvsvc_NetShareDelStart(struct rpc_pipe_client *cli,
+                                       TALLOC_CTX *mem_ctx,
+                                       const char *server_unc,
+                                       const char *share,
+                                       uint32_t reserved,
+                                       struct policy_handle *hnd,
+                                       WERROR *werror)
 {
        struct srvsvc_NetShareDelStart r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_unc = server_unc;
        r.in.share = share;
        r.in.reserved = reserved;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetShareDelStart, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETSHAREDELSTART, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SRVSVC,
+                               &ndr_table_srvsvc,
+                               NDR_SRVSVC_NETSHAREDELSTART,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetShareDelStart, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        if (hnd && r.out.hnd) {
                *hnd = *r.out.hnd;
        }
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_srvsvc_NetShareDelCommit(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *hnd, WERROR *werror)
+NTSTATUS rpccli_srvsvc_NetShareDelCommit(struct rpc_pipe_client *cli,
+                                        TALLOC_CTX *mem_ctx,
+                                        struct policy_handle *hnd,
+                                        WERROR *werror)
 {
        struct srvsvc_NetShareDelCommit r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.hnd = hnd;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetShareDelCommit, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETSHAREDELCOMMIT, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SRVSVC,
+                               &ndr_table_srvsvc,
+                               NDR_SRVSVC_NETSHAREDELCOMMIT,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetShareDelCommit, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        if (hnd && r.out.hnd) {
                *hnd = *r.out.hnd;
        }
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_srvsvc_NetGetFileSecurity(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *share, const char *file, uint32_t securityinformation, struct sec_desc_buf *sd_buf, WERROR *werror)
+NTSTATUS rpccli_srvsvc_NetGetFileSecurity(struct rpc_pipe_client *cli,
+                                         TALLOC_CTX *mem_ctx,
+                                         const char *server_unc,
+                                         const char *share,
+                                         const char *file,
+                                         uint32_t securityinformation,
+                                         struct sec_desc_buf *sd_buf,
+                                         WERROR *werror)
 {
        struct srvsvc_NetGetFileSecurity r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_unc = server_unc;
        r.in.share = share;
        r.in.file = file;
        r.in.securityinformation = securityinformation;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetGetFileSecurity, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETGETFILESECURITY, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SRVSVC,
+                               &ndr_table_srvsvc,
+                               NDR_SRVSVC_NETGETFILESECURITY,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetGetFileSecurity, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        if (sd_buf && r.out.sd_buf) {
                *sd_buf = *r.out.sd_buf;
        }
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_srvsvc_NetSetFileSecurity(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *share, const char *file, uint32_t securityinformation, struct sec_desc_buf sd_buf, WERROR *werror)
+NTSTATUS rpccli_srvsvc_NetSetFileSecurity(struct rpc_pipe_client *cli,
+                                         TALLOC_CTX *mem_ctx,
+                                         const char *server_unc,
+                                         const char *share,
+                                         const char *file,
+                                         uint32_t securityinformation,
+                                         struct sec_desc_buf sd_buf,
+                                         WERROR *werror)
 {
        struct srvsvc_NetSetFileSecurity r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_unc = server_unc;
        r.in.share = share;
        r.in.file = file;
        r.in.securityinformation = securityinformation;
        r.in.sd_buf = sd_buf;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetSetFileSecurity, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETSETFILESECURITY, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SRVSVC,
+                               &ndr_table_srvsvc,
+                               NDR_SRVSVC_NETSETFILESECURITY,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetSetFileSecurity, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_srvsvc_NetServerTransportAddEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, uint32_t level, union srvsvc_NetTransportInfo info, WERROR *werror)
+NTSTATUS rpccli_srvsvc_NetServerTransportAddEx(struct rpc_pipe_client *cli,
+                                              TALLOC_CTX *mem_ctx,
+                                              const char *server_unc,
+                                              uint32_t level,
+                                              union srvsvc_NetTransportInfo info,
+                                              WERROR *werror)
 {
        struct srvsvc_NetServerTransportAddEx r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_unc = server_unc;
        r.in.level = level;
        r.in.info = info;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetServerTransportAddEx, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETSERVERTRANSPORTADDEX, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SRVSVC,
+                               &ndr_table_srvsvc,
+                               NDR_SRVSVC_NETSERVERTRANSPORTADDEX,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetServerTransportAddEx, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_srvsvc_NetServerSetServiceBitsEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *emulated_server_unc, const char *transport, uint32_t servicebitsofinterest, uint32_t servicebits, uint32_t updateimmediately, WERROR *werror)
+NTSTATUS rpccli_srvsvc_NetServerSetServiceBitsEx(struct rpc_pipe_client *cli,
+                                                TALLOC_CTX *mem_ctx,
+                                                const char *server_unc,
+                                                const char *emulated_server_unc,
+                                                const char *transport,
+                                                uint32_t servicebitsofinterest,
+                                                uint32_t servicebits,
+                                                uint32_t updateimmediately,
+                                                WERROR *werror)
 {
        struct srvsvc_NetServerSetServiceBitsEx r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_unc = server_unc;
        r.in.emulated_server_unc = emulated_server_unc;
@@ -1650,393 +2216,499 @@ NTSTATUS rpccli_srvsvc_NetServerSetServiceBitsEx(struct rpc_pipe_client *cli, TA
        r.in.servicebitsofinterest = servicebitsofinterest;
        r.in.servicebits = servicebits;
        r.in.updateimmediately = updateimmediately;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetServerSetServiceBitsEx, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETSERVERSETSERVICEBITSEX, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SRVSVC,
+                               &ndr_table_srvsvc,
+                               NDR_SRVSVC_NETSERVERSETSERVICEBITSEX,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetServerSetServiceBitsEx, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_srvsvc_NETRDFSGETVERSION(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror)
+NTSTATUS rpccli_srvsvc_NETRDFSGETVERSION(struct rpc_pipe_client *cli,
+                                        TALLOC_CTX *mem_ctx,
+                                        WERROR *werror)
 {
        struct srvsvc_NETRDFSGETVERSION r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NETRDFSGETVERSION, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETRDFSGETVERSION, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SRVSVC,
+                               &ndr_table_srvsvc,
+                               NDR_SRVSVC_NETRDFSGETVERSION,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSGETVERSION, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_srvsvc_NETRDFSCREATELOCALPARTITION(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror)
+NTSTATUS rpccli_srvsvc_NETRDFSCREATELOCALPARTITION(struct rpc_pipe_client *cli,
+                                                  TALLOC_CTX *mem_ctx,
+                                                  WERROR *werror)
 {
        struct srvsvc_NETRDFSCREATELOCALPARTITION r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NETRDFSCREATELOCALPARTITION, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETRDFSCREATELOCALPARTITION, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SRVSVC,
+                               &ndr_table_srvsvc,
+                               NDR_SRVSVC_NETRDFSCREATELOCALPARTITION,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSCREATELOCALPARTITION, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_srvsvc_NETRDFSDELETELOCALPARTITION(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror)
+NTSTATUS rpccli_srvsvc_NETRDFSDELETELOCALPARTITION(struct rpc_pipe_client *cli,
+                                                  TALLOC_CTX *mem_ctx,
+                                                  WERROR *werror)
 {
        struct srvsvc_NETRDFSDELETELOCALPARTITION r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NETRDFSDELETELOCALPARTITION, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETRDFSDELETELOCALPARTITION, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SRVSVC,
+                               &ndr_table_srvsvc,
+                               NDR_SRVSVC_NETRDFSDELETELOCALPARTITION,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSDELETELOCALPARTITION, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_srvsvc_NETRDFSSETLOCALVOLUMESTATE(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror)
+NTSTATUS rpccli_srvsvc_NETRDFSSETLOCALVOLUMESTATE(struct rpc_pipe_client *cli,
+                                                 TALLOC_CTX *mem_ctx,
+                                                 WERROR *werror)
 {
        struct srvsvc_NETRDFSSETLOCALVOLUMESTATE r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NETRDFSSETLOCALVOLUMESTATE, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETRDFSSETLOCALVOLUMESTATE, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SRVSVC,
+                               &ndr_table_srvsvc,
+                               NDR_SRVSVC_NETRDFSSETLOCALVOLUMESTATE,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSSETLOCALVOLUMESTATE, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_srvsvc_NETRDFSSETSERVERINFO(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror)
+NTSTATUS rpccli_srvsvc_NETRDFSSETSERVERINFO(struct rpc_pipe_client *cli,
+                                           TALLOC_CTX *mem_ctx,
+                                           WERROR *werror)
 {
        struct srvsvc_NETRDFSSETSERVERINFO r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NETRDFSSETSERVERINFO, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETRDFSSETSERVERINFO, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SRVSVC,
+                               &ndr_table_srvsvc,
+                               NDR_SRVSVC_NETRDFSSETSERVERINFO,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSSETSERVERINFO, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_srvsvc_NETRDFSCREATEEXITPOINT(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror)
+NTSTATUS rpccli_srvsvc_NETRDFSCREATEEXITPOINT(struct rpc_pipe_client *cli,
+                                             TALLOC_CTX *mem_ctx,
+                                             WERROR *werror)
 {
        struct srvsvc_NETRDFSCREATEEXITPOINT r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NETRDFSCREATEEXITPOINT, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETRDFSCREATEEXITPOINT, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SRVSVC,
+                               &ndr_table_srvsvc,
+                               NDR_SRVSVC_NETRDFSCREATEEXITPOINT,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSCREATEEXITPOINT, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_srvsvc_NETRDFSDELETEEXITPOINT(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror)
+NTSTATUS rpccli_srvsvc_NETRDFSDELETEEXITPOINT(struct rpc_pipe_client *cli,
+                                             TALLOC_CTX *mem_ctx,
+                                             WERROR *werror)
 {
        struct srvsvc_NETRDFSDELETEEXITPOINT r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NETRDFSDELETEEXITPOINT, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETRDFSDELETEEXITPOINT, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SRVSVC,
+                               &ndr_table_srvsvc,
+                               NDR_SRVSVC_NETRDFSDELETEEXITPOINT,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSDELETEEXITPOINT, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_srvsvc_NETRDFSMODIFYPREFIX(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror)
+NTSTATUS rpccli_srvsvc_NETRDFSMODIFYPREFIX(struct rpc_pipe_client *cli,
+                                          TALLOC_CTX *mem_ctx,
+                                          WERROR *werror)
 {
        struct srvsvc_NETRDFSMODIFYPREFIX r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NETRDFSMODIFYPREFIX, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETRDFSMODIFYPREFIX, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SRVSVC,
+                               &ndr_table_srvsvc,
+                               NDR_SRVSVC_NETRDFSMODIFYPREFIX,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSMODIFYPREFIX, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_srvsvc_NETRDFSFIXLOCALVOLUME(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror)
+NTSTATUS rpccli_srvsvc_NETRDFSFIXLOCALVOLUME(struct rpc_pipe_client *cli,
+                                            TALLOC_CTX *mem_ctx,
+                                            WERROR *werror)
 {
        struct srvsvc_NETRDFSFIXLOCALVOLUME r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NETRDFSFIXLOCALVOLUME, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETRDFSFIXLOCALVOLUME, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SRVSVC,
+                               &ndr_table_srvsvc,
+                               NDR_SRVSVC_NETRDFSFIXLOCALVOLUME,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSFIXLOCALVOLUME, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_srvsvc_NETRDFSMANAGERREPORTSITEINFO(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror)
+NTSTATUS rpccli_srvsvc_NETRDFSMANAGERREPORTSITEINFO(struct rpc_pipe_client *cli,
+                                                   TALLOC_CTX *mem_ctx,
+                                                   WERROR *werror)
 {
        struct srvsvc_NETRDFSMANAGERREPORTSITEINFO r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NETRDFSMANAGERREPORTSITEINFO, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETRDFSMANAGERREPORTSITEINFO, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SRVSVC,
+                               &ndr_table_srvsvc,
+                               NDR_SRVSVC_NETRDFSMANAGERREPORTSITEINFO,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSMANAGERREPORTSITEINFO, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_srvsvc_NETRSERVERTRANSPORTDELEX(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror)
+NTSTATUS rpccli_srvsvc_NETRSERVERTRANSPORTDELEX(struct rpc_pipe_client *cli,
+                                               TALLOC_CTX *mem_ctx,
+                                               WERROR *werror)
 {
        struct srvsvc_NETRSERVERTRANSPORTDELEX r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NETRSERVERTRANSPORTDELEX, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETRSERVERTRANSPORTDELEX, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SRVSVC,
+                               &ndr_table_srvsvc,
+                               NDR_SRVSVC_NETRSERVERTRANSPORTDELEX,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NETRSERVERTRANSPORTDELEX, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
index 7f9385b9857a7378c4ae478cd5acf215e2e9585b..eb19db37bd8d3d44b4d761fef56af284a7ec121f 100644 (file)
 #include "librpc/gen_ndr/ndr_srvsvc.h"
 #ifndef __CLI_SRVSVC__
 #define __CLI_SRVSVC__
-NTSTATUS rpccli_srvsvc_NetCharDevEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, uint32_t *level, union srvsvc_NetCharDevCtr *ctr, uint32_t max_buffer, uint32_t *totalentries, uint32_t *resume_handle, WERROR *werror);
-NTSTATUS rpccli_srvsvc_NetCharDevGetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *device_name, uint32_t level, union srvsvc_NetCharDevInfo *info, WERROR *werror);
-NTSTATUS rpccli_srvsvc_NetCharDevControl(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *device_name, uint32_t opcode, WERROR *werror);
-NTSTATUS rpccli_srvsvc_NetCharDevQEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *user, uint32_t *level, union srvsvc_NetCharDevQCtr *ctr, uint32_t max_buffer, uint32_t *totalentries, uint32_t *resume_handle, WERROR *werror);
-NTSTATUS rpccli_srvsvc_NetCharDevQGetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *queue_name, const char *user, uint32_t level, union srvsvc_NetCharDevQInfo *info, WERROR *werror);
-NTSTATUS rpccli_srvsvc_NetCharDevQSetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *queue_name, uint32_t level, union srvsvc_NetCharDevQInfo info, uint32_t *parm_error, WERROR *werror);
-NTSTATUS rpccli_srvsvc_NetCharDevQPurge(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *queue_name, WERROR *werror);
-NTSTATUS rpccli_srvsvc_NetCharDevQPurgeSelf(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *queue_name, const char *computer_name, WERROR *werror);
-NTSTATUS rpccli_srvsvc_NetConnEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *path, uint32_t *level, union srvsvc_NetConnCtr *ctr, uint32_t max_buffer, uint32_t *totalentries, uint32_t *resume_handle, WERROR *werror);
-NTSTATUS rpccli_srvsvc_NetFileEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *path, const char *user, uint32_t *level, union srvsvc_NetFileCtr *ctr, uint32_t max_buffer, uint32_t *totalentries, uint32_t *resume_handle, WERROR *werror);
-NTSTATUS rpccli_srvsvc_NetFileGetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, uint32_t fid, uint32_t level, union srvsvc_NetFileInfo *info, WERROR *werror);
-NTSTATUS rpccli_srvsvc_NetFileClose(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, uint32_t fid, WERROR *werror);
-NTSTATUS rpccli_srvsvc_NetSessEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *client, const char *user, uint32_t *level, union srvsvc_NetSessCtr *ctr, uint32_t max_buffer, uint32_t *totalentries, uint32_t *resume_handle, WERROR *werror);
-NTSTATUS rpccli_srvsvc_NetSessDel(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *client, const char *user, WERROR *werror);
-NTSTATUS rpccli_srvsvc_NetShareAdd(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, uint32_t level, union srvsvc_NetShareInfo info, uint32_t *parm_error, WERROR *werror);
-NTSTATUS rpccli_srvsvc_NetShareEnumAll(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, uint32_t *level, union srvsvc_NetShareCtr *ctr, uint32_t max_buffer, uint32_t *totalentries, uint32_t *resume_handle, WERROR *werror);
-NTSTATUS rpccli_srvsvc_NetShareGetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *share_name, uint32_t level, union srvsvc_NetShareInfo *info, WERROR *werror);
-NTSTATUS rpccli_srvsvc_NetShareSetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *share_name, uint32_t level, union srvsvc_NetShareInfo info, uint32_t *parm_error, WERROR *werror);
-NTSTATUS rpccli_srvsvc_NetShareDel(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *share_name, uint32_t reserved, WERROR *werror);
-NTSTATUS rpccli_srvsvc_NetShareDelSticky(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *share_name, uint32_t reserved, WERROR *werror);
-NTSTATUS rpccli_srvsvc_NetShareCheck(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *device_name, enum srvsvc_ShareType *type, WERROR *werror);
-NTSTATUS rpccli_srvsvc_NetSrvGetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, uint32_t level, union srvsvc_NetSrvInfo *info, WERROR *werror);
-NTSTATUS rpccli_srvsvc_NetSrvSetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, uint32_t level, union srvsvc_NetSrvInfo info, uint32_t *parm_error, WERROR *werror);
-NTSTATUS rpccli_srvsvc_NetDiskEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, uint32_t level, struct srvsvc_NetDiskInfo *info, uint32_t maxlen, uint32_t *totalentries, uint32_t *resume_handle, WERROR *werror);
-NTSTATUS rpccli_srvsvc_NetServerStatisticsGet(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *service, uint32_t level, uint32_t options, struct srvsvc_Statistics *stats, WERROR *werror);
-NTSTATUS rpccli_srvsvc_NetTransportAdd(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, uint32_t level, union srvsvc_NetTransportInfo info, WERROR *werror);
-NTSTATUS rpccli_srvsvc_NetTransportEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, uint32_t *level, union srvsvc_NetTransportCtr *transports, uint32_t max_buffer, uint32_t *totalentries, uint32_t *resume_handle, WERROR *werror);
-NTSTATUS rpccli_srvsvc_NetTransportDel(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, uint32_t unknown, struct srvsvc_NetTransportInfo0 transport, WERROR *werror);
-NTSTATUS rpccli_srvsvc_NetRemoteTOD(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, struct srvsvc_NetRemoteTODInfo *info, WERROR *werror);
-NTSTATUS rpccli_srvsvc_NetSetServiceBits(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *transport, uint32_t servicebits, uint32_t updateimmediately, WERROR *werror);
-NTSTATUS rpccli_srvsvc_NetPathType(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *path, uint32_t pathflags, uint32_t *pathtype, WERROR *werror);
-NTSTATUS rpccli_srvsvc_NetPathCanonicalize(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *path, uint8_t *can_path, uint32_t maxbuf, const char *prefix, uint32_t *pathtype, uint32_t pathflags, WERROR *werror);
-NTSTATUS rpccli_srvsvc_NetPathCompare(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *path1, const char *path2, uint32_t pathtype, uint32_t pathflags, WERROR *werror);
-NTSTATUS rpccli_srvsvc_NetNameValidate(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *name, uint32_t name_type, uint32_t flags, WERROR *werror);
-NTSTATUS rpccli_srvsvc_NETRPRNAMECANONICALIZE(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror);
-NTSTATUS rpccli_srvsvc_NetPRNameCompare(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *name1, const char *name2, uint32_t name_type, uint32_t flags, WERROR *werror);
-NTSTATUS rpccli_srvsvc_NetShareEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, uint32_t *level, union srvsvc_NetShareCtr *ctr, uint32_t max_buffer, uint32_t *totalentries, uint32_t *resume_handle, WERROR *werror);
-NTSTATUS rpccli_srvsvc_NetShareDelStart(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *share, uint32_t reserved, struct policy_handle *hnd, WERROR *werror);
-NTSTATUS rpccli_srvsvc_NetShareDelCommit(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *hnd, WERROR *werror);
-NTSTATUS rpccli_srvsvc_NetGetFileSecurity(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *share, const char *file, uint32_t securityinformation, struct sec_desc_buf *sd_buf, WERROR *werror);
-NTSTATUS rpccli_srvsvc_NetSetFileSecurity(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *share, const char *file, uint32_t securityinformation, struct sec_desc_buf sd_buf, WERROR *werror);
-NTSTATUS rpccli_srvsvc_NetServerTransportAddEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, uint32_t level, union srvsvc_NetTransportInfo info, WERROR *werror);
-NTSTATUS rpccli_srvsvc_NetServerSetServiceBitsEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *emulated_server_unc, const char *transport, uint32_t servicebitsofinterest, uint32_t servicebits, uint32_t updateimmediately, WERROR *werror);
-NTSTATUS rpccli_srvsvc_NETRDFSGETVERSION(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror);
-NTSTATUS rpccli_srvsvc_NETRDFSCREATELOCALPARTITION(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror);
-NTSTATUS rpccli_srvsvc_NETRDFSDELETELOCALPARTITION(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror);
-NTSTATUS rpccli_srvsvc_NETRDFSSETLOCALVOLUMESTATE(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror);
-NTSTATUS rpccli_srvsvc_NETRDFSSETSERVERINFO(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror);
-NTSTATUS rpccli_srvsvc_NETRDFSCREATEEXITPOINT(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror);
-NTSTATUS rpccli_srvsvc_NETRDFSDELETEEXITPOINT(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror);
-NTSTATUS rpccli_srvsvc_NETRDFSMODIFYPREFIX(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror);
-NTSTATUS rpccli_srvsvc_NETRDFSFIXLOCALVOLUME(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror);
-NTSTATUS rpccli_srvsvc_NETRDFSMANAGERREPORTSITEINFO(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror);
-NTSTATUS rpccli_srvsvc_NETRSERVERTRANSPORTDELEX(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror);
+NTSTATUS rpccli_srvsvc_NetCharDevEnum(struct rpc_pipe_client *cli,
+                                     TALLOC_CTX *mem_ctx,
+                                     const char *server_unc,
+                                     uint32_t *level,
+                                     union srvsvc_NetCharDevCtr *ctr,
+                                     uint32_t max_buffer,
+                                     uint32_t *totalentries,
+                                     uint32_t *resume_handle,
+                                     WERROR *werror);
+NTSTATUS rpccli_srvsvc_NetCharDevGetInfo(struct rpc_pipe_client *cli,
+                                        TALLOC_CTX *mem_ctx,
+                                        const char *server_unc,
+                                        const char *device_name,
+                                        uint32_t level,
+                                        union srvsvc_NetCharDevInfo *info,
+                                        WERROR *werror);
+NTSTATUS rpccli_srvsvc_NetCharDevControl(struct rpc_pipe_client *cli,
+                                        TALLOC_CTX *mem_ctx,
+                                        const char *server_unc,
+                                        const char *device_name,
+                                        uint32_t opcode,
+                                        WERROR *werror);
+NTSTATUS rpccli_srvsvc_NetCharDevQEnum(struct rpc_pipe_client *cli,
+                                      TALLOC_CTX *mem_ctx,
+                                      const char *server_unc,
+                                      const char *user,
+                                      uint32_t *level,
+                                      union srvsvc_NetCharDevQCtr *ctr,
+                                      uint32_t max_buffer,
+                                      uint32_t *totalentries,
+                                      uint32_t *resume_handle,
+                                      WERROR *werror);
+NTSTATUS rpccli_srvsvc_NetCharDevQGetInfo(struct rpc_pipe_client *cli,
+                                         TALLOC_CTX *mem_ctx,
+                                         const char *server_unc,
+                                         const char *queue_name,
+                                         const char *user,
+                                         uint32_t level,
+                                         union srvsvc_NetCharDevQInfo *info,
+                                         WERROR *werror);
+NTSTATUS rpccli_srvsvc_NetCharDevQSetInfo(struct rpc_pipe_client *cli,
+                                         TALLOC_CTX *mem_ctx,
+                                         const char *server_unc,
+                                         const char *queue_name,
+                                         uint32_t level,
+                                         union srvsvc_NetCharDevQInfo info,
+                                         uint32_t *parm_error,
+                                         WERROR *werror);
+NTSTATUS rpccli_srvsvc_NetCharDevQPurge(struct rpc_pipe_client *cli,
+                                       TALLOC_CTX *mem_ctx,
+                                       const char *server_unc,
+                                       const char *queue_name,
+                                       WERROR *werror);
+NTSTATUS rpccli_srvsvc_NetCharDevQPurgeSelf(struct rpc_pipe_client *cli,
+                                           TALLOC_CTX *mem_ctx,
+                                           const char *server_unc,
+                                           const char *queue_name,
+                                           const char *computer_name,
+                                           WERROR *werror);
+NTSTATUS rpccli_srvsvc_NetConnEnum(struct rpc_pipe_client *cli,
+                                  TALLOC_CTX *mem_ctx,
+                                  const char *server_unc,
+                                  const char *path,
+                                  uint32_t *level,
+                                  union srvsvc_NetConnCtr *ctr,
+                                  uint32_t max_buffer,
+                                  uint32_t *totalentries,
+                                  uint32_t *resume_handle,
+                                  WERROR *werror);
+NTSTATUS rpccli_srvsvc_NetFileEnum(struct rpc_pipe_client *cli,
+                                  TALLOC_CTX *mem_ctx,
+                                  const char *server_unc,
+                                  const char *path,
+                                  const char *user,
+                                  uint32_t *level,
+                                  union srvsvc_NetFileCtr *ctr,
+                                  uint32_t max_buffer,
+                                  uint32_t *totalentries,
+                                  uint32_t *resume_handle,
+                                  WERROR *werror);
+NTSTATUS rpccli_srvsvc_NetFileGetInfo(struct rpc_pipe_client *cli,
+                                     TALLOC_CTX *mem_ctx,
+                                     const char *server_unc,
+                                     uint32_t fid,
+                                     uint32_t level,
+                                     union srvsvc_NetFileInfo *info,
+                                     WERROR *werror);
+NTSTATUS rpccli_srvsvc_NetFileClose(struct rpc_pipe_client *cli,
+                                   TALLOC_CTX *mem_ctx,
+                                   const char *server_unc,
+                                   uint32_t fid,
+                                   WERROR *werror);
+NTSTATUS rpccli_srvsvc_NetSessEnum(struct rpc_pipe_client *cli,
+                                  TALLOC_CTX *mem_ctx,
+                                  const char *server_unc,
+                                  const char *client,
+                                  const char *user,
+                                  uint32_t *level,
+                                  union srvsvc_NetSessCtr *ctr,
+                                  uint32_t max_buffer,
+                                  uint32_t *totalentries,
+                                  uint32_t *resume_handle,
+                                  WERROR *werror);
+NTSTATUS rpccli_srvsvc_NetSessDel(struct rpc_pipe_client *cli,
+                                 TALLOC_CTX *mem_ctx,
+                                 const char *server_unc,
+                                 const char *client,
+                                 const char *user,
+                                 WERROR *werror);
+NTSTATUS rpccli_srvsvc_NetShareAdd(struct rpc_pipe_client *cli,
+                                  TALLOC_CTX *mem_ctx,
+                                  const char *server_unc,
+                                  uint32_t level,
+                                  union srvsvc_NetShareInfo info,
+                                  uint32_t *parm_error,
+                                  WERROR *werror);
+NTSTATUS rpccli_srvsvc_NetShareEnumAll(struct rpc_pipe_client *cli,
+                                      TALLOC_CTX *mem_ctx,
+                                      const char *server_unc,
+                                      uint32_t *level,
+                                      union srvsvc_NetShareCtr *ctr,
+                                      uint32_t max_buffer,
+                                      uint32_t *totalentries,
+                                      uint32_t *resume_handle,
+                                      WERROR *werror);
+NTSTATUS rpccli_srvsvc_NetShareGetInfo(struct rpc_pipe_client *cli,
+                                      TALLOC_CTX *mem_ctx,
+                                      const char *server_unc,
+                                      const char *share_name,
+                                      uint32_t level,
+                                      union srvsvc_NetShareInfo *info,
+                                      WERROR *werror);
+NTSTATUS rpccli_srvsvc_NetShareSetInfo(struct rpc_pipe_client *cli,
+                                      TALLOC_CTX *mem_ctx,
+                                      const char *server_unc,
+                                      const char *share_name,
+                                      uint32_t level,
+                                      union srvsvc_NetShareInfo info,
+                                      uint32_t *parm_error,
+                                      WERROR *werror);
+NTSTATUS rpccli_srvsvc_NetShareDel(struct rpc_pipe_client *cli,
+                                  TALLOC_CTX *mem_ctx,
+                                  const char *server_unc,
+                                  const char *share_name,
+                                  uint32_t reserved,
+                                  WERROR *werror);
+NTSTATUS rpccli_srvsvc_NetShareDelSticky(struct rpc_pipe_client *cli,
+                                        TALLOC_CTX *mem_ctx,
+                                        const char *server_unc,
+                                        const char *share_name,
+                                        uint32_t reserved,
+                                        WERROR *werror);
+NTSTATUS rpccli_srvsvc_NetShareCheck(struct rpc_pipe_client *cli,
+                                    TALLOC_CTX *mem_ctx,
+                                    const char *server_unc,
+                                    const char *device_name,
+                                    enum srvsvc_ShareType *type,
+                                    WERROR *werror);
+NTSTATUS rpccli_srvsvc_NetSrvGetInfo(struct rpc_pipe_client *cli,
+                                    TALLOC_CTX *mem_ctx,
+                                    const char *server_unc,
+                                    uint32_t level,
+                                    union srvsvc_NetSrvInfo *info,
+                                    WERROR *werror);
+NTSTATUS rpccli_srvsvc_NetSrvSetInfo(struct rpc_pipe_client *cli,
+                                    TALLOC_CTX *mem_ctx,
+                                    const char *server_unc,
+                                    uint32_t level,
+                                    union srvsvc_NetSrvInfo info,
+                                    uint32_t *parm_error,
+                                    WERROR *werror);
+NTSTATUS rpccli_srvsvc_NetDiskEnum(struct rpc_pipe_client *cli,
+                                  TALLOC_CTX *mem_ctx,
+                                  const char *server_unc,
+                                  uint32_t level,
+                                  struct srvsvc_NetDiskInfo *info,
+                                  uint32_t maxlen,
+                                  uint32_t *totalentries,
+                                  uint32_t *resume_handle,
+                                  WERROR *werror);
+NTSTATUS rpccli_srvsvc_NetServerStatisticsGet(struct rpc_pipe_client *cli,
+                                             TALLOC_CTX *mem_ctx,
+                                             const char *server_unc,
+                                             const char *service,
+                                             uint32_t level,
+                                             uint32_t options,
+                                             struct srvsvc_Statistics *stats,
+                                             WERROR *werror);
+NTSTATUS rpccli_srvsvc_NetTransportAdd(struct rpc_pipe_client *cli,
+                                      TALLOC_CTX *mem_ctx,
+                                      const char *server_unc,
+                                      uint32_t level,
+                                      union srvsvc_NetTransportInfo info,
+                                      WERROR *werror);
+NTSTATUS rpccli_srvsvc_NetTransportEnum(struct rpc_pipe_client *cli,
+                                       TALLOC_CTX *mem_ctx,
+                                       const char *server_unc,
+                                       uint32_t *level,
+                                       union srvsvc_NetTransportCtr *transports,
+                                       uint32_t max_buffer,
+                                       uint32_t *totalentries,
+                                       uint32_t *resume_handle,
+                                       WERROR *werror);
+NTSTATUS rpccli_srvsvc_NetTransportDel(struct rpc_pipe_client *cli,
+                                      TALLOC_CTX *mem_ctx,
+                                      const char *server_unc,
+                                      uint32_t unknown,
+                                      struct srvsvc_NetTransportInfo0 transport,
+                                      WERROR *werror);
+NTSTATUS rpccli_srvsvc_NetRemoteTOD(struct rpc_pipe_client *cli,
+                                   TALLOC_CTX *mem_ctx,
+                                   const char *server_unc,
+                                   struct srvsvc_NetRemoteTODInfo *info,
+                                   WERROR *werror);
+NTSTATUS rpccli_srvsvc_NetSetServiceBits(struct rpc_pipe_client *cli,
+                                        TALLOC_CTX *mem_ctx,
+                                        const char *server_unc,
+                                        const char *transport,
+                                        uint32_t servicebits,
+                                        uint32_t updateimmediately,
+                                        WERROR *werror);
+NTSTATUS rpccli_srvsvc_NetPathType(struct rpc_pipe_client *cli,
+                                  TALLOC_CTX *mem_ctx,
+                                  const char *server_unc,
+                                  const char *path,
+                                  uint32_t pathflags,
+                                  uint32_t *pathtype,
+                                  WERROR *werror);
+NTSTATUS rpccli_srvsvc_NetPathCanonicalize(struct rpc_pipe_client *cli,
+                                          TALLOC_CTX *mem_ctx,
+                                          const char *server_unc,
+                                          const char *path,
+                                          uint8_t *can_path,
+                                          uint32_t maxbuf,
+                                          const char *prefix,
+                                          uint32_t *pathtype,
+                                          uint32_t pathflags,
+                                          WERROR *werror);
+NTSTATUS rpccli_srvsvc_NetPathCompare(struct rpc_pipe_client *cli,
+                                     TALLOC_CTX *mem_ctx,
+                                     const char *server_unc,
+                                     const char *path1,
+                                     const char *path2,
+                                     uint32_t pathtype,
+                                     uint32_t pathflags,
+                                     WERROR *werror);
+NTSTATUS rpccli_srvsvc_NetNameValidate(struct rpc_pipe_client *cli,
+                                      TALLOC_CTX *mem_ctx,
+                                      const char *server_unc,
+                                      const char *name,
+                                      uint32_t name_type,
+                                      uint32_t flags,
+                                      WERROR *werror);
+NTSTATUS rpccli_srvsvc_NETRPRNAMECANONICALIZE(struct rpc_pipe_client *cli,
+                                             TALLOC_CTX *mem_ctx,
+                                             WERROR *werror);
+NTSTATUS rpccli_srvsvc_NetPRNameCompare(struct rpc_pipe_client *cli,
+                                       TALLOC_CTX *mem_ctx,
+                                       const char *server_unc,
+                                       const char *name1,
+                                       const char *name2,
+                                       uint32_t name_type,
+                                       uint32_t flags,
+                                       WERROR *werror);
+NTSTATUS rpccli_srvsvc_NetShareEnum(struct rpc_pipe_client *cli,
+                                   TALLOC_CTX *mem_ctx,
+                                   const char *server_unc,
+                                   uint32_t *level,
+                                   union srvsvc_NetShareCtr *ctr,
+                                   uint32_t max_buffer,
+                                   uint32_t *totalentries,
+                                   uint32_t *resume_handle,
+                                   WERROR *werror);
+NTSTATUS rpccli_srvsvc_NetShareDelStart(struct rpc_pipe_client *cli,
+                                       TALLOC_CTX *mem_ctx,
+                                       const char *server_unc,
+                                       const char *share,
+                                       uint32_t reserved,
+                                       struct policy_handle *hnd,
+                                       WERROR *werror);
+NTSTATUS rpccli_srvsvc_NetShareDelCommit(struct rpc_pipe_client *cli,
+                                        TALLOC_CTX *mem_ctx,
+                                        struct policy_handle *hnd,
+                                        WERROR *werror);
+NTSTATUS rpccli_srvsvc_NetGetFileSecurity(struct rpc_pipe_client *cli,
+                                         TALLOC_CTX *mem_ctx,
+                                         const char *server_unc,
+                                         const char *share,
+                                         const char *file,
+                                         uint32_t securityinformation,
+                                         struct sec_desc_buf *sd_buf,
+                                         WERROR *werror);
+NTSTATUS rpccli_srvsvc_NetSetFileSecurity(struct rpc_pipe_client *cli,
+                                         TALLOC_CTX *mem_ctx,
+                                         const char *server_unc,
+                                         const char *share,
+                                         const char *file,
+                                         uint32_t securityinformation,
+                                         struct sec_desc_buf sd_buf,
+                                         WERROR *werror);
+NTSTATUS rpccli_srvsvc_NetServerTransportAddEx(struct rpc_pipe_client *cli,
+                                              TALLOC_CTX *mem_ctx,
+                                              const char *server_unc,
+                                              uint32_t level,
+                                              union srvsvc_NetTransportInfo info,
+                                              WERROR *werror);
+NTSTATUS rpccli_srvsvc_NetServerSetServiceBitsEx(struct rpc_pipe_client *cli,
+                                                TALLOC_CTX *mem_ctx,
+                                                const char *server_unc,
+                                                const char *emulated_server_unc,
+                                                const char *transport,
+                                                uint32_t servicebitsofinterest,
+                                                uint32_t servicebits,
+                                                uint32_t updateimmediately,
+                                                WERROR *werror);
+NTSTATUS rpccli_srvsvc_NETRDFSGETVERSION(struct rpc_pipe_client *cli,
+                                        TALLOC_CTX *mem_ctx,
+                                        WERROR *werror);
+NTSTATUS rpccli_srvsvc_NETRDFSCREATELOCALPARTITION(struct rpc_pipe_client *cli,
+                                                  TALLOC_CTX *mem_ctx,
+                                                  WERROR *werror);
+NTSTATUS rpccli_srvsvc_NETRDFSDELETELOCALPARTITION(struct rpc_pipe_client *cli,
+                                                  TALLOC_CTX *mem_ctx,
+                                                  WERROR *werror);
+NTSTATUS rpccli_srvsvc_NETRDFSSETLOCALVOLUMESTATE(struct rpc_pipe_client *cli,
+                                                 TALLOC_CTX *mem_ctx,
+                                                 WERROR *werror);
+NTSTATUS rpccli_srvsvc_NETRDFSSETSERVERINFO(struct rpc_pipe_client *cli,
+                                           TALLOC_CTX *mem_ctx,
+                                           WERROR *werror);
+NTSTATUS rpccli_srvsvc_NETRDFSCREATEEXITPOINT(struct rpc_pipe_client *cli,
+                                             TALLOC_CTX *mem_ctx,
+                                             WERROR *werror);
+NTSTATUS rpccli_srvsvc_NETRDFSDELETEEXITPOINT(struct rpc_pipe_client *cli,
+                                             TALLOC_CTX *mem_ctx,
+                                             WERROR *werror);
+NTSTATUS rpccli_srvsvc_NETRDFSMODIFYPREFIX(struct rpc_pipe_client *cli,
+                                          TALLOC_CTX *mem_ctx,
+                                          WERROR *werror);
+NTSTATUS rpccli_srvsvc_NETRDFSFIXLOCALVOLUME(struct rpc_pipe_client *cli,
+                                            TALLOC_CTX *mem_ctx,
+                                            WERROR *werror);
+NTSTATUS rpccli_srvsvc_NETRDFSMANAGERREPORTSITEINFO(struct rpc_pipe_client *cli,
+                                                   TALLOC_CTX *mem_ctx,
+                                                   WERROR *werror);
+NTSTATUS rpccli_srvsvc_NETRSERVERTRANSPORTDELEX(struct rpc_pipe_client *cli,
+                                               TALLOC_CTX *mem_ctx,
+                                               WERROR *werror);
 #endif /* __CLI_SRVSVC__ */
index 8010d20919e05589ba14d25b70d872e7d5d54b99..2a5d6badc60b97cd30cdd84197e91621cecceba9 100644 (file)
 #include "includes.h"
 #include "librpc/gen_ndr/cli_svcctl.h"
 
-NTSTATUS rpccli_svcctl_CloseServiceHandle(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, WERROR *werror)
+NTSTATUS rpccli_svcctl_CloseServiceHandle(struct rpc_pipe_client *cli,
+                                         TALLOC_CTX *mem_ctx,
+                                         struct policy_handle *handle,
+                                         WERROR *werror)
 {
        struct svcctl_CloseServiceHandle r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_CloseServiceHandle, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_CLOSESERVICEHANDLE, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SVCCTL,
+                               &ndr_table_svcctl,
+                               NDR_SVCCTL_CLOSESERVICEHANDLE,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_CloseServiceHandle, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *handle = *r.out.handle;
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_svcctl_ControlService(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t control, struct SERVICE_STATUS *service_status, WERROR *werror)
+NTSTATUS rpccli_svcctl_ControlService(struct rpc_pipe_client *cli,
+                                     TALLOC_CTX *mem_ctx,
+                                     struct policy_handle *handle,
+                                     uint32_t control,
+                                     struct SERVICE_STATUS *service_status,
+                                     WERROR *werror)
 {
        struct svcctl_ControlService r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.control = control;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_ControlService, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_CONTROLSERVICE, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SVCCTL,
+                               &ndr_table_svcctl,
+                               NDR_SVCCTL_CONTROLSERVICE,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_ControlService, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *service_status = *r.out.service_status;
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_svcctl_DeleteService(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, WERROR *werror)
+NTSTATUS rpccli_svcctl_DeleteService(struct rpc_pipe_client *cli,
+                                    TALLOC_CTX *mem_ctx,
+                                    struct policy_handle *handle,
+                                    WERROR *werror)
 {
        struct svcctl_DeleteService r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_DeleteService, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_DELETESERVICE, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SVCCTL,
+                               &ndr_table_svcctl,
+                               NDR_SVCCTL_DELETESERVICE,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_DeleteService, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_svcctl_LockServiceDatabase(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct policy_handle *lock, WERROR *werror)
+NTSTATUS rpccli_svcctl_LockServiceDatabase(struct rpc_pipe_client *cli,
+                                          TALLOC_CTX *mem_ctx,
+                                          struct policy_handle *handle,
+                                          struct policy_handle *lock,
+                                          WERROR *werror)
 {
        struct svcctl_LockServiceDatabase r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_LockServiceDatabase, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_LOCKSERVICEDATABASE, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SVCCTL,
+                               &ndr_table_svcctl,
+                               NDR_SVCCTL_LOCKSERVICEDATABASE,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_LockServiceDatabase, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *lock = *r.out.lock;
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_svcctl_QueryServiceObjectSecurity(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror)
+NTSTATUS rpccli_svcctl_QueryServiceObjectSecurity(struct rpc_pipe_client *cli,
+                                                 TALLOC_CTX *mem_ctx,
+                                                 WERROR *werror)
 {
        struct svcctl_QueryServiceObjectSecurity r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_QueryServiceObjectSecurity, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_QUERYSERVICEOBJECTSECURITY, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SVCCTL,
+                               &ndr_table_svcctl,
+                               NDR_SVCCTL_QUERYSERVICEOBJECTSECURITY,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceObjectSecurity, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_svcctl_SetServiceObjectSecurity(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror)
+NTSTATUS rpccli_svcctl_SetServiceObjectSecurity(struct rpc_pipe_client *cli,
+                                               TALLOC_CTX *mem_ctx,
+                                               WERROR *werror)
 {
        struct svcctl_SetServiceObjectSecurity r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_SetServiceObjectSecurity, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_SETSERVICEOBJECTSECURITY, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SVCCTL,
+                               &ndr_table_svcctl,
+                               NDR_SVCCTL_SETSERVICEOBJECTSECURITY,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_SetServiceObjectSecurity, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_svcctl_QueryServiceStatus(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct SERVICE_STATUS *service_status, WERROR *werror)
+NTSTATUS rpccli_svcctl_QueryServiceStatus(struct rpc_pipe_client *cli,
+                                         TALLOC_CTX *mem_ctx,
+                                         struct policy_handle *handle,
+                                         struct SERVICE_STATUS *service_status,
+                                         WERROR *werror)
 {
        struct svcctl_QueryServiceStatus r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_QueryServiceStatus, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_QUERYSERVICESTATUS, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SVCCTL,
+                               &ndr_table_svcctl,
+                               NDR_SVCCTL_QUERYSERVICESTATUS,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceStatus, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *service_status = *r.out.service_status;
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_svcctl_SetServiceStatus(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror)
+NTSTATUS rpccli_svcctl_SetServiceStatus(struct rpc_pipe_client *cli,
+                                       TALLOC_CTX *mem_ctx,
+                                       WERROR *werror)
 {
        struct svcctl_SetServiceStatus r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_SetServiceStatus, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_SETSERVICESTATUS, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SVCCTL,
+                               &ndr_table_svcctl,
+                               NDR_SVCCTL_SETSERVICESTATUS,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_SetServiceStatus, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_svcctl_UnlockServiceDatabase(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *lock, WERROR *werror)
+NTSTATUS rpccli_svcctl_UnlockServiceDatabase(struct rpc_pipe_client *cli,
+                                            TALLOC_CTX *mem_ctx,
+                                            struct policy_handle *lock,
+                                            WERROR *werror)
 {
        struct svcctl_UnlockServiceDatabase r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.lock = lock;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_UnlockServiceDatabase, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_UNLOCKSERVICEDATABASE, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SVCCTL,
+                               &ndr_table_svcctl,
+                               NDR_SVCCTL_UNLOCKSERVICEDATABASE,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_UnlockServiceDatabase, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *lock = *r.out.lock;
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_svcctl_NotifyBootConfigStatus(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror)
+NTSTATUS rpccli_svcctl_NotifyBootConfigStatus(struct rpc_pipe_client *cli,
+                                             TALLOC_CTX *mem_ctx,
+                                             WERROR *werror)
 {
        struct svcctl_NotifyBootConfigStatus r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_NotifyBootConfigStatus, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_NOTIFYBOOTCONFIGSTATUS, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SVCCTL,
+                               &ndr_table_svcctl,
+                               NDR_SVCCTL_NOTIFYBOOTCONFIGSTATUS,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_NotifyBootConfigStatus, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_svcctl_SCSetServiceBitsW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t bits, uint32_t bitson, uint32_t immediate, WERROR *werror)
+NTSTATUS rpccli_svcctl_SCSetServiceBitsW(struct rpc_pipe_client *cli,
+                                        TALLOC_CTX *mem_ctx,
+                                        struct policy_handle *handle,
+                                        uint32_t bits,
+                                        uint32_t bitson,
+                                        uint32_t immediate,
+                                        WERROR *werror)
 {
        struct svcctl_SCSetServiceBitsW r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.bits = bits;
        r.in.bitson = bitson;
        r.in.immediate = immediate;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_SCSetServiceBitsW, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_SCSETSERVICEBITSW, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SVCCTL,
+                               &ndr_table_svcctl,
+                               NDR_SVCCTL_SCSETSERVICEBITSW,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_SCSetServiceBitsW, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_svcctl_ChangeServiceConfigW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t type, uint32_t start, uint32_t error, const char *binary_path, const char *load_order_group, uint32_t *tag_id, const char *dependencies, const char *service_start_name, const char *password, const char *display_name, WERROR *werror)
+NTSTATUS rpccli_svcctl_ChangeServiceConfigW(struct rpc_pipe_client *cli,
+                                           TALLOC_CTX *mem_ctx,
+                                           struct policy_handle *handle,
+                                           uint32_t type,
+                                           uint32_t start,
+                                           uint32_t error,
+                                           const char *binary_path,
+                                           const char *load_order_group,
+                                           uint32_t *tag_id,
+                                           const char *dependencies,
+                                           const char *service_start_name,
+                                           const char *password,
+                                           const char *display_name,
+                                           WERROR *werror)
 {
        struct svcctl_ChangeServiceConfigW r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.type = type;
@@ -401,39 +527,64 @@ NTSTATUS rpccli_svcctl_ChangeServiceConfigW(struct rpc_pipe_client *cli, TALLOC_
        r.in.service_start_name = service_start_name;
        r.in.password = password;
        r.in.display_name = display_name;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_ChangeServiceConfigW, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_CHANGESERVICECONFIGW, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SVCCTL,
+                               &ndr_table_svcctl,
+                               NDR_SVCCTL_CHANGESERVICECONFIGW,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_ChangeServiceConfigW, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *tag_id = *r.out.tag_id;
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_svcctl_CreateServiceW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *scmanager_handle, const char *ServiceName, const char *DisplayName, uint32_t desired_access, uint32_t type, uint32_t start_type, uint32_t error_control, const char *binary_path, const char *LoadOrderGroupKey, uint32_t *TagId, uint8_t *dependencies, uint32_t dependencies_size, const char *service_start_name, uint8_t *password, uint32_t password_size, struct policy_handle *handle, WERROR *werror)
+NTSTATUS rpccli_svcctl_CreateServiceW(struct rpc_pipe_client *cli,
+                                     TALLOC_CTX *mem_ctx,
+                                     struct policy_handle *scmanager_handle,
+                                     const char *ServiceName,
+                                     const char *DisplayName,
+                                     uint32_t desired_access,
+                                     uint32_t type,
+                                     uint32_t start_type,
+                                     uint32_t error_control,
+                                     const char *binary_path,
+                                     const char *LoadOrderGroupKey,
+                                     uint32_t *TagId,
+                                     uint8_t *dependencies,
+                                     uint32_t dependencies_size,
+                                     const char *service_start_name,
+                                     uint8_t *password,
+                                     uint32_t password_size,
+                                     struct policy_handle *handle,
+                                     WERROR *werror)
 {
        struct svcctl_CreateServiceW r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.scmanager_handle = scmanager_handle;
        r.in.ServiceName = ServiceName;
@@ -450,106 +601,145 @@ NTSTATUS rpccli_svcctl_CreateServiceW(struct rpc_pipe_client *cli, TALLOC_CTX *m
        r.in.service_start_name = service_start_name;
        r.in.password = password;
        r.in.password_size = password_size;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_CreateServiceW, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_CREATESERVICEW, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SVCCTL,
+                               &ndr_table_svcctl,
+                               NDR_SVCCTL_CREATESERVICEW,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_CreateServiceW, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        if (TagId && r.out.TagId) {
                *TagId = *r.out.TagId;
        }
        *handle = *r.out.handle;
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_svcctl_EnumDependentServicesW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *service, uint32_t state, struct ENUM_SERVICE_STATUS *service_status, uint32_t buf_size, uint32_t *bytes_needed, uint32_t *services_returned, WERROR *werror)
+NTSTATUS rpccli_svcctl_EnumDependentServicesW(struct rpc_pipe_client *cli,
+                                             TALLOC_CTX *mem_ctx,
+                                             struct policy_handle *service,
+                                             uint32_t state,
+                                             struct ENUM_SERVICE_STATUS *service_status,
+                                             uint32_t buf_size,
+                                             uint32_t *bytes_needed,
+                                             uint32_t *services_returned,
+                                             WERROR *werror)
 {
        struct svcctl_EnumDependentServicesW r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.service = service;
        r.in.state = state;
        r.in.buf_size = buf_size;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_EnumDependentServicesW, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_ENUMDEPENDENTSERVICESW, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SVCCTL,
+                               &ndr_table_svcctl,
+                               NDR_SVCCTL_ENUMDEPENDENTSERVICESW,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_EnumDependentServicesW, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        if (service_status && r.out.service_status) {
                *service_status = *r.out.service_status;
        }
        *bytes_needed = *r.out.bytes_needed;
        *services_returned = *r.out.services_returned;
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_svcctl_EnumServicesStatusW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t type, uint32_t state, uint32_t buf_size, uint8_t *service, uint32_t *bytes_needed, uint32_t *services_returned, uint32_t *resume_handle, WERROR *werror)
+NTSTATUS rpccli_svcctl_EnumServicesStatusW(struct rpc_pipe_client *cli,
+                                          TALLOC_CTX *mem_ctx,
+                                          struct policy_handle *handle,
+                                          uint32_t type,
+                                          uint32_t state,
+                                          uint32_t buf_size,
+                                          uint8_t *service,
+                                          uint32_t *bytes_needed,
+                                          uint32_t *services_returned,
+                                          uint32_t *resume_handle,
+                                          WERROR *werror)
 {
        struct svcctl_EnumServicesStatusW r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.type = type;
        r.in.state = state;
        r.in.buf_size = buf_size;
        r.in.resume_handle = resume_handle;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_EnumServicesStatusW, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_ENUMSERVICESSTATUSW, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SVCCTL,
+                               &ndr_table_svcctl,
+                               NDR_SVCCTL_ENUMSERVICESSTATUSW,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_EnumServicesStatusW, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        memcpy(service, r.out.service, r.in.buf_size);
        *bytes_needed = *r.out.bytes_needed;
@@ -557,321 +747,437 @@ NTSTATUS rpccli_svcctl_EnumServicesStatusW(struct rpc_pipe_client *cli, TALLOC_C
        if (resume_handle && r.out.resume_handle) {
                *resume_handle = *r.out.resume_handle;
        }
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_svcctl_OpenSCManagerW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *MachineName, const char *DatabaseName, uint32_t access_mask, struct policy_handle *handle, WERROR *werror)
+NTSTATUS rpccli_svcctl_OpenSCManagerW(struct rpc_pipe_client *cli,
+                                     TALLOC_CTX *mem_ctx,
+                                     const char *MachineName,
+                                     const char *DatabaseName,
+                                     uint32_t access_mask,
+                                     struct policy_handle *handle,
+                                     WERROR *werror)
 {
        struct svcctl_OpenSCManagerW r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.MachineName = MachineName;
        r.in.DatabaseName = DatabaseName;
        r.in.access_mask = access_mask;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_OpenSCManagerW, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_OPENSCMANAGERW, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SVCCTL,
+                               &ndr_table_svcctl,
+                               NDR_SVCCTL_OPENSCMANAGERW,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_OpenSCManagerW, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *handle = *r.out.handle;
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_svcctl_OpenServiceW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *scmanager_handle, const char *ServiceName, uint32_t access_mask, struct policy_handle *handle, WERROR *werror)
+NTSTATUS rpccli_svcctl_OpenServiceW(struct rpc_pipe_client *cli,
+                                   TALLOC_CTX *mem_ctx,
+                                   struct policy_handle *scmanager_handle,
+                                   const char *ServiceName,
+                                   uint32_t access_mask,
+                                   struct policy_handle *handle,
+                                   WERROR *werror)
 {
        struct svcctl_OpenServiceW r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.scmanager_handle = scmanager_handle;
        r.in.ServiceName = ServiceName;
        r.in.access_mask = access_mask;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_OpenServiceW, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_OPENSERVICEW, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SVCCTL,
+                               &ndr_table_svcctl,
+                               NDR_SVCCTL_OPENSERVICEW,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_OpenServiceW, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *handle = *r.out.handle;
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_svcctl_QueryServiceConfigW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint8_t *query, uint32_t buf_size, uint32_t *bytes_needed, WERROR *werror)
+NTSTATUS rpccli_svcctl_QueryServiceConfigW(struct rpc_pipe_client *cli,
+                                          TALLOC_CTX *mem_ctx,
+                                          struct policy_handle *handle,
+                                          uint8_t *query,
+                                          uint32_t buf_size,
+                                          uint32_t *bytes_needed,
+                                          WERROR *werror)
 {
        struct svcctl_QueryServiceConfigW r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.buf_size = buf_size;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_QueryServiceConfigW, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_QUERYSERVICECONFIGW, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SVCCTL,
+                               &ndr_table_svcctl,
+                               NDR_SVCCTL_QUERYSERVICECONFIGW,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceConfigW, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        memcpy(query, r.out.query, r.in.buf_size);
        *bytes_needed = *r.out.bytes_needed;
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_svcctl_QueryServiceLockStatusW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t buf_size, struct SERVICE_LOCK_STATUS *lock_status, uint32_t *required_buf_size, WERROR *werror)
+NTSTATUS rpccli_svcctl_QueryServiceLockStatusW(struct rpc_pipe_client *cli,
+                                              TALLOC_CTX *mem_ctx,
+                                              struct policy_handle *handle,
+                                              uint32_t buf_size,
+                                              struct SERVICE_LOCK_STATUS *lock_status,
+                                              uint32_t *required_buf_size,
+                                              WERROR *werror)
 {
        struct svcctl_QueryServiceLockStatusW r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.buf_size = buf_size;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_QueryServiceLockStatusW, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_QUERYSERVICELOCKSTATUSW, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SVCCTL,
+                               &ndr_table_svcctl,
+                               NDR_SVCCTL_QUERYSERVICELOCKSTATUSW,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceLockStatusW, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *lock_status = *r.out.lock_status;
        *required_buf_size = *r.out.required_buf_size;
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_svcctl_StartServiceW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t NumArgs, const char *Arguments, WERROR *werror)
+NTSTATUS rpccli_svcctl_StartServiceW(struct rpc_pipe_client *cli,
+                                    TALLOC_CTX *mem_ctx,
+                                    struct policy_handle *handle,
+                                    uint32_t NumArgs,
+                                    const char *Arguments,
+                                    WERROR *werror)
 {
        struct svcctl_StartServiceW r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.NumArgs = NumArgs;
        r.in.Arguments = Arguments;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_StartServiceW, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_STARTSERVICEW, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SVCCTL,
+                               &ndr_table_svcctl,
+                               NDR_SVCCTL_STARTSERVICEW,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_StartServiceW, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_svcctl_GetServiceDisplayNameW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, const char *service_name, const char **display_name, uint32_t *display_name_length, WERROR *werror)
+NTSTATUS rpccli_svcctl_GetServiceDisplayNameW(struct rpc_pipe_client *cli,
+                                             TALLOC_CTX *mem_ctx,
+                                             struct policy_handle *handle,
+                                             const char *service_name,
+                                             const char **display_name,
+                                             uint32_t *display_name_length,
+                                             WERROR *werror)
 {
        struct svcctl_GetServiceDisplayNameW r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.service_name = service_name;
        r.in.display_name_length = display_name_length;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_GetServiceDisplayNameW, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_GETSERVICEDISPLAYNAMEW, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SVCCTL,
+                               &ndr_table_svcctl,
+                               NDR_SVCCTL_GETSERVICEDISPLAYNAMEW,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_GetServiceDisplayNameW, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *display_name = *r.out.display_name;
        if (display_name_length && r.out.display_name_length) {
                *display_name_length = *r.out.display_name_length;
        }
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_svcctl_GetServiceKeyNameW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, const char *service_name, const char **key_name, uint32_t *display_name_length, WERROR *werror)
+NTSTATUS rpccli_svcctl_GetServiceKeyNameW(struct rpc_pipe_client *cli,
+                                         TALLOC_CTX *mem_ctx,
+                                         struct policy_handle *handle,
+                                         const char *service_name,
+                                         const char **key_name,
+                                         uint32_t *display_name_length,
+                                         WERROR *werror)
 {
        struct svcctl_GetServiceKeyNameW r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.service_name = service_name;
        r.in.display_name_length = display_name_length;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_GetServiceKeyNameW, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_GETSERVICEKEYNAMEW, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SVCCTL,
+                               &ndr_table_svcctl,
+                               NDR_SVCCTL_GETSERVICEKEYNAMEW,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_GetServiceKeyNameW, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *key_name = *r.out.key_name;
        if (display_name_length && r.out.display_name_length) {
                *display_name_length = *r.out.display_name_length;
        }
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_svcctl_SCSetServiceBitsA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t bits, uint32_t bitson, uint32_t immediate, WERROR *werror)
+NTSTATUS rpccli_svcctl_SCSetServiceBitsA(struct rpc_pipe_client *cli,
+                                        TALLOC_CTX *mem_ctx,
+                                        struct policy_handle *handle,
+                                        uint32_t bits,
+                                        uint32_t bitson,
+                                        uint32_t immediate,
+                                        WERROR *werror)
 {
        struct svcctl_SCSetServiceBitsA r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.bits = bits;
        r.in.bitson = bitson;
        r.in.immediate = immediate;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_SCSetServiceBitsA, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_SCSETSERVICEBITSA, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SVCCTL,
+                               &ndr_table_svcctl,
+                               NDR_SVCCTL_SCSETSERVICEBITSA,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_SCSetServiceBitsA, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_svcctl_ChangeServiceConfigA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t type, uint32_t start, uint32_t error, const char *binary_path, const char *load_order_group, uint32_t *tag_id, const char *dependencies, const char *service_start_name, const char *password, const char *display_name, WERROR *werror)
+NTSTATUS rpccli_svcctl_ChangeServiceConfigA(struct rpc_pipe_client *cli,
+                                           TALLOC_CTX *mem_ctx,
+                                           struct policy_handle *handle,
+                                           uint32_t type,
+                                           uint32_t start,
+                                           uint32_t error,
+                                           const char *binary_path,
+                                           const char *load_order_group,
+                                           uint32_t *tag_id,
+                                           const char *dependencies,
+                                           const char *service_start_name,
+                                           const char *password,
+                                           const char *display_name,
+                                           WERROR *werror)
 {
        struct svcctl_ChangeServiceConfigA r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.type = type;
@@ -883,39 +1189,61 @@ NTSTATUS rpccli_svcctl_ChangeServiceConfigA(struct rpc_pipe_client *cli, TALLOC_
        r.in.service_start_name = service_start_name;
        r.in.password = password;
        r.in.display_name = display_name;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_ChangeServiceConfigA, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_CHANGESERVICECONFIGA, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SVCCTL,
+                               &ndr_table_svcctl,
+                               NDR_SVCCTL_CHANGESERVICECONFIGA,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_ChangeServiceConfigA, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *tag_id = *r.out.tag_id;
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_svcctl_CreateServiceA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, const char *ServiceName, const char *DisplayName, uint32_t desired_access, uint32_t type, uint32_t start_type, uint32_t error_control, const char *binary_path, const char *LoadOrderGroupKey, uint32_t *TagId, const char *dependencies, const char *service_start_name, const char *password, WERROR *werror)
+NTSTATUS rpccli_svcctl_CreateServiceA(struct rpc_pipe_client *cli,
+                                     TALLOC_CTX *mem_ctx,
+                                     struct policy_handle *handle,
+                                     const char *ServiceName,
+                                     const char *DisplayName,
+                                     uint32_t desired_access,
+                                     uint32_t type,
+                                     uint32_t start_type,
+                                     uint32_t error_control,
+                                     const char *binary_path,
+                                     const char *LoadOrderGroupKey,
+                                     uint32_t *TagId,
+                                     const char *dependencies,
+                                     const char *service_start_name,
+                                     const char *password,
+                                     WERROR *werror)
 {
        struct svcctl_CreateServiceA r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.ServiceName = ServiceName;
@@ -929,105 +1257,144 @@ NTSTATUS rpccli_svcctl_CreateServiceA(struct rpc_pipe_client *cli, TALLOC_CTX *m
        r.in.dependencies = dependencies;
        r.in.service_start_name = service_start_name;
        r.in.password = password;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_CreateServiceA, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_CREATESERVICEA, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SVCCTL,
+                               &ndr_table_svcctl,
+                               NDR_SVCCTL_CREATESERVICEA,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_CreateServiceA, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        if (TagId && r.out.TagId) {
                *TagId = *r.out.TagId;
        }
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_svcctl_EnumDependentServicesA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *service, uint32_t state, struct ENUM_SERVICE_STATUS *service_status, uint32_t buf_size, uint32_t *bytes_needed, uint32_t *services_returned, WERROR *werror)
+NTSTATUS rpccli_svcctl_EnumDependentServicesA(struct rpc_pipe_client *cli,
+                                             TALLOC_CTX *mem_ctx,
+                                             struct policy_handle *service,
+                                             uint32_t state,
+                                             struct ENUM_SERVICE_STATUS *service_status,
+                                             uint32_t buf_size,
+                                             uint32_t *bytes_needed,
+                                             uint32_t *services_returned,
+                                             WERROR *werror)
 {
        struct svcctl_EnumDependentServicesA r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.service = service;
        r.in.state = state;
        r.in.buf_size = buf_size;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_EnumDependentServicesA, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_ENUMDEPENDENTSERVICESA, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SVCCTL,
+                               &ndr_table_svcctl,
+                               NDR_SVCCTL_ENUMDEPENDENTSERVICESA,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_EnumDependentServicesA, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        if (service_status && r.out.service_status) {
                *service_status = *r.out.service_status;
        }
        *bytes_needed = *r.out.bytes_needed;
        *services_returned = *r.out.services_returned;
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_svcctl_EnumServicesStatusA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t type, uint32_t state, uint32_t buf_size, uint8_t *service, uint32_t *bytes_needed, uint32_t *services_returned, uint32_t *resume_handle, WERROR *werror)
+NTSTATUS rpccli_svcctl_EnumServicesStatusA(struct rpc_pipe_client *cli,
+                                          TALLOC_CTX *mem_ctx,
+                                          struct policy_handle *handle,
+                                          uint32_t type,
+                                          uint32_t state,
+                                          uint32_t buf_size,
+                                          uint8_t *service,
+                                          uint32_t *bytes_needed,
+                                          uint32_t *services_returned,
+                                          uint32_t *resume_handle,
+                                          WERROR *werror)
 {
        struct svcctl_EnumServicesStatusA r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.type = type;
        r.in.state = state;
        r.in.buf_size = buf_size;
        r.in.resume_handle = resume_handle;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_EnumServicesStatusA, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_ENUMSERVICESSTATUSA, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SVCCTL,
+                               &ndr_table_svcctl,
+                               NDR_SVCCTL_ENUMSERVICESSTATUSA,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_EnumServicesStatusA, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        memcpy(service, r.out.service, r.in.buf_size);
        *bytes_needed = *r.out.bytes_needed;
@@ -1035,535 +1402,720 @@ NTSTATUS rpccli_svcctl_EnumServicesStatusA(struct rpc_pipe_client *cli, TALLOC_C
        if (resume_handle && r.out.resume_handle) {
                *resume_handle = *r.out.resume_handle;
        }
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_svcctl_OpenSCManagerA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *MachineName, const char *DatabaseName, uint32_t access_mask, struct policy_handle *handle, WERROR *werror)
+NTSTATUS rpccli_svcctl_OpenSCManagerA(struct rpc_pipe_client *cli,
+                                     TALLOC_CTX *mem_ctx,
+                                     const char *MachineName,
+                                     const char *DatabaseName,
+                                     uint32_t access_mask,
+                                     struct policy_handle *handle,
+                                     WERROR *werror)
 {
        struct svcctl_OpenSCManagerA r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.MachineName = MachineName;
        r.in.DatabaseName = DatabaseName;
        r.in.access_mask = access_mask;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_OpenSCManagerA, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_OPENSCMANAGERA, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SVCCTL,
+                               &ndr_table_svcctl,
+                               NDR_SVCCTL_OPENSCMANAGERA,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_OpenSCManagerA, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *handle = *r.out.handle;
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_svcctl_OpenServiceA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *scmanager_handle, const char *ServiceName, uint32_t access_mask, WERROR *werror)
+NTSTATUS rpccli_svcctl_OpenServiceA(struct rpc_pipe_client *cli,
+                                   TALLOC_CTX *mem_ctx,
+                                   struct policy_handle *scmanager_handle,
+                                   const char *ServiceName,
+                                   uint32_t access_mask,
+                                   WERROR *werror)
 {
        struct svcctl_OpenServiceA r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.scmanager_handle = scmanager_handle;
        r.in.ServiceName = ServiceName;
        r.in.access_mask = access_mask;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_OpenServiceA, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_OPENSERVICEA, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SVCCTL,
+                               &ndr_table_svcctl,
+                               NDR_SVCCTL_OPENSERVICEA,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_OpenServiceA, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_svcctl_QueryServiceConfigA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint8_t *query, uint32_t buf_size, uint32_t *bytes_needed, WERROR *werror)
+NTSTATUS rpccli_svcctl_QueryServiceConfigA(struct rpc_pipe_client *cli,
+                                          TALLOC_CTX *mem_ctx,
+                                          struct policy_handle *handle,
+                                          uint8_t *query,
+                                          uint32_t buf_size,
+                                          uint32_t *bytes_needed,
+                                          WERROR *werror)
 {
        struct svcctl_QueryServiceConfigA r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.buf_size = buf_size;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_QueryServiceConfigA, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_QUERYSERVICECONFIGA, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SVCCTL,
+                               &ndr_table_svcctl,
+                               NDR_SVCCTL_QUERYSERVICECONFIGA,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceConfigA, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        memcpy(query, r.out.query, r.in.buf_size);
        *bytes_needed = *r.out.bytes_needed;
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_svcctl_QueryServiceLockStatusA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t buf_size, struct SERVICE_LOCK_STATUS *lock_status, uint32_t *required_buf_size, WERROR *werror)
+NTSTATUS rpccli_svcctl_QueryServiceLockStatusA(struct rpc_pipe_client *cli,
+                                              TALLOC_CTX *mem_ctx,
+                                              struct policy_handle *handle,
+                                              uint32_t buf_size,
+                                              struct SERVICE_LOCK_STATUS *lock_status,
+                                              uint32_t *required_buf_size,
+                                              WERROR *werror)
 {
        struct svcctl_QueryServiceLockStatusA r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.buf_size = buf_size;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_QueryServiceLockStatusA, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_QUERYSERVICELOCKSTATUSA, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SVCCTL,
+                               &ndr_table_svcctl,
+                               NDR_SVCCTL_QUERYSERVICELOCKSTATUSA,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceLockStatusA, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *lock_status = *r.out.lock_status;
        *required_buf_size = *r.out.required_buf_size;
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_svcctl_StartServiceA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t NumArgs, const char *Arguments, WERROR *werror)
+NTSTATUS rpccli_svcctl_StartServiceA(struct rpc_pipe_client *cli,
+                                    TALLOC_CTX *mem_ctx,
+                                    struct policy_handle *handle,
+                                    uint32_t NumArgs,
+                                    const char *Arguments,
+                                    WERROR *werror)
 {
        struct svcctl_StartServiceA r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.NumArgs = NumArgs;
        r.in.Arguments = Arguments;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_StartServiceA, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_STARTSERVICEA, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SVCCTL,
+                               &ndr_table_svcctl,
+                               NDR_SVCCTL_STARTSERVICEA,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_StartServiceA, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_svcctl_GetServiceDisplayNameA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, const char *service_name, const char **display_name, uint32_t *display_name_length, WERROR *werror)
+NTSTATUS rpccli_svcctl_GetServiceDisplayNameA(struct rpc_pipe_client *cli,
+                                             TALLOC_CTX *mem_ctx,
+                                             struct policy_handle *handle,
+                                             const char *service_name,
+                                             const char **display_name,
+                                             uint32_t *display_name_length,
+                                             WERROR *werror)
 {
        struct svcctl_GetServiceDisplayNameA r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.service_name = service_name;
        r.in.display_name_length = display_name_length;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_GetServiceDisplayNameA, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_GETSERVICEDISPLAYNAMEA, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SVCCTL,
+                               &ndr_table_svcctl,
+                               NDR_SVCCTL_GETSERVICEDISPLAYNAMEA,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_GetServiceDisplayNameA, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *display_name = *r.out.display_name;
        if (display_name_length && r.out.display_name_length) {
                *display_name_length = *r.out.display_name_length;
        }
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_svcctl_GetServiceKeyNameA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, const char *service_name, const char **key_name, uint32_t *display_name_length, WERROR *werror)
+NTSTATUS rpccli_svcctl_GetServiceKeyNameA(struct rpc_pipe_client *cli,
+                                         TALLOC_CTX *mem_ctx,
+                                         struct policy_handle *handle,
+                                         const char *service_name,
+                                         const char **key_name,
+                                         uint32_t *display_name_length,
+                                         WERROR *werror)
 {
        struct svcctl_GetServiceKeyNameA r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.service_name = service_name;
        r.in.display_name_length = display_name_length;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_GetServiceKeyNameA, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_GETSERVICEKEYNAMEA, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SVCCTL,
+                               &ndr_table_svcctl,
+                               NDR_SVCCTL_GETSERVICEKEYNAMEA,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_GetServiceKeyNameA, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *key_name = *r.out.key_name;
        if (display_name_length && r.out.display_name_length) {
                *display_name_length = *r.out.display_name_length;
        }
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_svcctl_GetCurrentGroupeStateW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror)
+NTSTATUS rpccli_svcctl_GetCurrentGroupeStateW(struct rpc_pipe_client *cli,
+                                             TALLOC_CTX *mem_ctx,
+                                             WERROR *werror)
 {
        struct svcctl_GetCurrentGroupeStateW r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_GetCurrentGroupeStateW, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_GETCURRENTGROUPESTATEW, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SVCCTL,
+                               &ndr_table_svcctl,
+                               NDR_SVCCTL_GETCURRENTGROUPESTATEW,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_GetCurrentGroupeStateW, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_svcctl_EnumServiceGroupW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror)
+NTSTATUS rpccli_svcctl_EnumServiceGroupW(struct rpc_pipe_client *cli,
+                                        TALLOC_CTX *mem_ctx,
+                                        WERROR *werror)
 {
        struct svcctl_EnumServiceGroupW r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_EnumServiceGroupW, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_ENUMSERVICEGROUPW, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SVCCTL,
+                               &ndr_table_svcctl,
+                               NDR_SVCCTL_ENUMSERVICEGROUPW,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_EnumServiceGroupW, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_svcctl_ChangeServiceConfig2A(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t info_level, uint8_t *info, WERROR *werror)
+NTSTATUS rpccli_svcctl_ChangeServiceConfig2A(struct rpc_pipe_client *cli,
+                                            TALLOC_CTX *mem_ctx,
+                                            struct policy_handle *handle,
+                                            uint32_t info_level,
+                                            uint8_t *info,
+                                            WERROR *werror)
 {
        struct svcctl_ChangeServiceConfig2A r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.info_level = info_level;
        r.in.info = info;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_ChangeServiceConfig2A, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_CHANGESERVICECONFIG2A, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SVCCTL,
+                               &ndr_table_svcctl,
+                               NDR_SVCCTL_CHANGESERVICECONFIG2A,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_ChangeServiceConfig2A, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_svcctl_ChangeServiceConfig2W(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t info_level, uint8_t *info, WERROR *werror)
+NTSTATUS rpccli_svcctl_ChangeServiceConfig2W(struct rpc_pipe_client *cli,
+                                            TALLOC_CTX *mem_ctx,
+                                            struct policy_handle *handle,
+                                            uint32_t info_level,
+                                            uint8_t *info,
+                                            WERROR *werror)
 {
        struct svcctl_ChangeServiceConfig2W r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.info_level = info_level;
        r.in.info = info;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_ChangeServiceConfig2W, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_CHANGESERVICECONFIG2W, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SVCCTL,
+                               &ndr_table_svcctl,
+                               NDR_SVCCTL_CHANGESERVICECONFIG2W,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_ChangeServiceConfig2W, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_svcctl_QueryServiceConfig2A(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t info_level, uint8_t *buffer, uint32_t buf_size, uint32_t *bytes_needed, WERROR *werror)
+NTSTATUS rpccli_svcctl_QueryServiceConfig2A(struct rpc_pipe_client *cli,
+                                           TALLOC_CTX *mem_ctx,
+                                           struct policy_handle *handle,
+                                           uint32_t info_level,
+                                           uint8_t *buffer,
+                                           uint32_t buf_size,
+                                           uint32_t *bytes_needed,
+                                           WERROR *werror)
 {
        struct svcctl_QueryServiceConfig2A r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.info_level = info_level;
        r.in.buf_size = buf_size;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_QueryServiceConfig2A, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_QUERYSERVICECONFIG2A, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SVCCTL,
+                               &ndr_table_svcctl,
+                               NDR_SVCCTL_QUERYSERVICECONFIG2A,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceConfig2A, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        memcpy(buffer, r.out.buffer, r.in.buf_size);
        *bytes_needed = *r.out.bytes_needed;
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_svcctl_QueryServiceConfig2W(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t info_level, uint8_t *buffer, uint32_t buf_size, uint32_t *bytes_needed, WERROR *werror)
+NTSTATUS rpccli_svcctl_QueryServiceConfig2W(struct rpc_pipe_client *cli,
+                                           TALLOC_CTX *mem_ctx,
+                                           struct policy_handle *handle,
+                                           uint32_t info_level,
+                                           uint8_t *buffer,
+                                           uint32_t buf_size,
+                                           uint32_t *bytes_needed,
+                                           WERROR *werror)
 {
        struct svcctl_QueryServiceConfig2W r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.info_level = info_level;
        r.in.buf_size = buf_size;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_QueryServiceConfig2W, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_QUERYSERVICECONFIG2W, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SVCCTL,
+                               &ndr_table_svcctl,
+                               NDR_SVCCTL_QUERYSERVICECONFIG2W,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceConfig2W, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        memcpy(buffer, r.out.buffer, r.in.buf_size);
        *bytes_needed = *r.out.bytes_needed;
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_svcctl_QueryServiceStatusEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t info_level, uint8_t *buffer, uint32_t buf_size, uint32_t *bytes_needed, WERROR *werror)
+NTSTATUS rpccli_svcctl_QueryServiceStatusEx(struct rpc_pipe_client *cli,
+                                           TALLOC_CTX *mem_ctx,
+                                           struct policy_handle *handle,
+                                           uint32_t info_level,
+                                           uint8_t *buffer,
+                                           uint32_t buf_size,
+                                           uint32_t *bytes_needed,
+                                           WERROR *werror)
 {
        struct svcctl_QueryServiceStatusEx r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.info_level = info_level;
        r.in.buf_size = buf_size;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_QueryServiceStatusEx, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_QUERYSERVICESTATUSEX, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SVCCTL,
+                               &ndr_table_svcctl,
+                               NDR_SVCCTL_QUERYSERVICESTATUSEX,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceStatusEx, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        memcpy(buffer, r.out.buffer, r.in.buf_size);
        *bytes_needed = *r.out.bytes_needed;
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_EnumServicesStatusExA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *scmanager, uint32_t info_level, uint32_t type, uint32_t state, uint8_t *services, uint32_t buf_size, uint32_t *bytes_needed, uint32_t *service_returned, uint32_t *resume_handle, const char **group_name, WERROR *werror)
+NTSTATUS rpccli_EnumServicesStatusExA(struct rpc_pipe_client *cli,
+                                     TALLOC_CTX *mem_ctx,
+                                     struct policy_handle *scmanager,
+                                     uint32_t info_level,
+                                     uint32_t type,
+                                     uint32_t state,
+                                     uint8_t *services,
+                                     uint32_t buf_size,
+                                     uint32_t *bytes_needed,
+                                     uint32_t *service_returned,
+                                     uint32_t *resume_handle,
+                                     const char **group_name,
+                                     WERROR *werror)
 {
        struct EnumServicesStatusExA r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.scmanager = scmanager;
        r.in.info_level = info_level;
@@ -1571,23 +2123,30 @@ NTSTATUS rpccli_EnumServicesStatusExA(struct rpc_pipe_client *cli, TALLOC_CTX *m
        r.in.state = state;
        r.in.buf_size = buf_size;
        r.in.resume_handle = resume_handle;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(EnumServicesStatusExA, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_ENUMSERVICESSTATUSEXA, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SVCCTL,
+                               &ndr_table_svcctl,
+                               NDR_ENUMSERVICESSTATUSEXA,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(EnumServicesStatusExA, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        memcpy(services, r.out.services, r.in.buf_size);
        *bytes_needed = *r.out.bytes_needed;
@@ -1596,20 +2155,32 @@ NTSTATUS rpccli_EnumServicesStatusExA(struct rpc_pipe_client *cli, TALLOC_CTX *m
                *resume_handle = *r.out.resume_handle;
        }
        *group_name = *r.out.group_name;
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_EnumServicesStatusExW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *scmanager, uint32_t info_level, uint32_t type, uint32_t state, uint8_t *services, uint32_t buf_size, uint32_t *bytes_needed, uint32_t *service_returned, uint32_t *resume_handle, const char **group_name, WERROR *werror)
+NTSTATUS rpccli_EnumServicesStatusExW(struct rpc_pipe_client *cli,
+                                     TALLOC_CTX *mem_ctx,
+                                     struct policy_handle *scmanager,
+                                     uint32_t info_level,
+                                     uint32_t type,
+                                     uint32_t state,
+                                     uint8_t *services,
+                                     uint32_t buf_size,
+                                     uint32_t *bytes_needed,
+                                     uint32_t *service_returned,
+                                     uint32_t *resume_handle,
+                                     const char **group_name,
+                                     WERROR *werror)
 {
        struct EnumServicesStatusExW r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.scmanager = scmanager;
        r.in.info_level = info_level;
@@ -1617,23 +2188,30 @@ NTSTATUS rpccli_EnumServicesStatusExW(struct rpc_pipe_client *cli, TALLOC_CTX *m
        r.in.state = state;
        r.in.buf_size = buf_size;
        r.in.resume_handle = resume_handle;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(EnumServicesStatusExW, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_ENUMSERVICESSTATUSEXW, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SVCCTL,
+                               &ndr_table_svcctl,
+                               NDR_ENUMSERVICESSTATUSEXW,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(EnumServicesStatusExW, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        memcpy(services, r.out.services, r.in.buf_size);
        *bytes_needed = *r.out.bytes_needed;
@@ -1642,45 +2220,54 @@ NTSTATUS rpccli_EnumServicesStatusExW(struct rpc_pipe_client *cli, TALLOC_CTX *m
                *resume_handle = *r.out.resume_handle;
        }
        *group_name = *r.out.group_name;
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_svcctl_SCSendTSMessage(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror)
+NTSTATUS rpccli_svcctl_SCSendTSMessage(struct rpc_pipe_client *cli,
+                                      TALLOC_CTX *mem_ctx,
+                                      WERROR *werror)
 {
        struct svcctl_SCSendTSMessage r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_SCSendTSMessage, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_SCSENDTSMESSAGE, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_SVCCTL,
+                               &ndr_table_svcctl,
+                               NDR_SVCCTL_SCSENDTSMESSAGE,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_SCSendTSMessage, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
index 77e9e8d6da68ad89af9707adfc45c65ac0b99dcf..e9eeb2d9e2b6170e087d9bbf19e49b8fd90e96b6 100644 (file)
 #include "librpc/gen_ndr/ndr_svcctl.h"
 #ifndef __CLI_SVCCTL__
 #define __CLI_SVCCTL__
-NTSTATUS rpccli_svcctl_CloseServiceHandle(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, WERROR *werror);
-NTSTATUS rpccli_svcctl_ControlService(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t control, struct SERVICE_STATUS *service_status, WERROR *werror);
-NTSTATUS rpccli_svcctl_DeleteService(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, WERROR *werror);
-NTSTATUS rpccli_svcctl_LockServiceDatabase(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct policy_handle *lock, WERROR *werror);
-NTSTATUS rpccli_svcctl_QueryServiceObjectSecurity(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror);
-NTSTATUS rpccli_svcctl_SetServiceObjectSecurity(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror);
-NTSTATUS rpccli_svcctl_QueryServiceStatus(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct SERVICE_STATUS *service_status, WERROR *werror);
-NTSTATUS rpccli_svcctl_SetServiceStatus(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror);
-NTSTATUS rpccli_svcctl_UnlockServiceDatabase(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *lock, WERROR *werror);
-NTSTATUS rpccli_svcctl_NotifyBootConfigStatus(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror);
-NTSTATUS rpccli_svcctl_SCSetServiceBitsW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t bits, uint32_t bitson, uint32_t immediate, WERROR *werror);
-NTSTATUS rpccli_svcctl_ChangeServiceConfigW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t type, uint32_t start, uint32_t error, const char *binary_path, const char *load_order_group, uint32_t *tag_id, const char *dependencies, const char *service_start_name, const char *password, const char *display_name, WERROR *werror);
-NTSTATUS rpccli_svcctl_CreateServiceW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *scmanager_handle, const char *ServiceName, const char *DisplayName, uint32_t desired_access, uint32_t type, uint32_t start_type, uint32_t error_control, const char *binary_path, const char *LoadOrderGroupKey, uint32_t *TagId, uint8_t *dependencies, uint32_t dependencies_size, const char *service_start_name, uint8_t *password, uint32_t password_size, struct policy_handle *handle, WERROR *werror);
-NTSTATUS rpccli_svcctl_EnumDependentServicesW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *service, uint32_t state, struct ENUM_SERVICE_STATUS *service_status, uint32_t buf_size, uint32_t *bytes_needed, uint32_t *services_returned, WERROR *werror);
-NTSTATUS rpccli_svcctl_EnumServicesStatusW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t type, uint32_t state, uint32_t buf_size, uint8_t *service, uint32_t *bytes_needed, uint32_t *services_returned, uint32_t *resume_handle, WERROR *werror);
-NTSTATUS rpccli_svcctl_OpenSCManagerW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *MachineName, const char *DatabaseName, uint32_t access_mask, struct policy_handle *handle, WERROR *werror);
-NTSTATUS rpccli_svcctl_OpenServiceW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *scmanager_handle, const char *ServiceName, uint32_t access_mask, struct policy_handle *handle, WERROR *werror);
-NTSTATUS rpccli_svcctl_QueryServiceConfigW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint8_t *query, uint32_t buf_size, uint32_t *bytes_needed, WERROR *werror);
-NTSTATUS rpccli_svcctl_QueryServiceLockStatusW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t buf_size, struct SERVICE_LOCK_STATUS *lock_status, uint32_t *required_buf_size, WERROR *werror);
-NTSTATUS rpccli_svcctl_StartServiceW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t NumArgs, const char *Arguments, WERROR *werror);
-NTSTATUS rpccli_svcctl_GetServiceDisplayNameW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, const char *service_name, const char **display_name, uint32_t *display_name_length, WERROR *werror);
-NTSTATUS rpccli_svcctl_GetServiceKeyNameW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, const char *service_name, const char **key_name, uint32_t *display_name_length, WERROR *werror);
-NTSTATUS rpccli_svcctl_SCSetServiceBitsA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t bits, uint32_t bitson, uint32_t immediate, WERROR *werror);
-NTSTATUS rpccli_svcctl_ChangeServiceConfigA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t type, uint32_t start, uint32_t error, const char *binary_path, const char *load_order_group, uint32_t *tag_id, const char *dependencies, const char *service_start_name, const char *password, const char *display_name, WERROR *werror);
-NTSTATUS rpccli_svcctl_CreateServiceA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, const char *ServiceName, const char *DisplayName, uint32_t desired_access, uint32_t type, uint32_t start_type, uint32_t error_control, const char *binary_path, const char *LoadOrderGroupKey, uint32_t *TagId, const char *dependencies, const char *service_start_name, const char *password, WERROR *werror);
-NTSTATUS rpccli_svcctl_EnumDependentServicesA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *service, uint32_t state, struct ENUM_SERVICE_STATUS *service_status, uint32_t buf_size, uint32_t *bytes_needed, uint32_t *services_returned, WERROR *werror);
-NTSTATUS rpccli_svcctl_EnumServicesStatusA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t type, uint32_t state, uint32_t buf_size, uint8_t *service, uint32_t *bytes_needed, uint32_t *services_returned, uint32_t *resume_handle, WERROR *werror);
-NTSTATUS rpccli_svcctl_OpenSCManagerA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *MachineName, const char *DatabaseName, uint32_t access_mask, struct policy_handle *handle, WERROR *werror);
-NTSTATUS rpccli_svcctl_OpenServiceA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *scmanager_handle, const char *ServiceName, uint32_t access_mask, WERROR *werror);
-NTSTATUS rpccli_svcctl_QueryServiceConfigA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint8_t *query, uint32_t buf_size, uint32_t *bytes_needed, WERROR *werror);
-NTSTATUS rpccli_svcctl_QueryServiceLockStatusA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t buf_size, struct SERVICE_LOCK_STATUS *lock_status, uint32_t *required_buf_size, WERROR *werror);
-NTSTATUS rpccli_svcctl_StartServiceA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t NumArgs, const char *Arguments, WERROR *werror);
-NTSTATUS rpccli_svcctl_GetServiceDisplayNameA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, const char *service_name, const char **display_name, uint32_t *display_name_length, WERROR *werror);
-NTSTATUS rpccli_svcctl_GetServiceKeyNameA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, const char *service_name, const char **key_name, uint32_t *display_name_length, WERROR *werror);
-NTSTATUS rpccli_svcctl_GetCurrentGroupeStateW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror);
-NTSTATUS rpccli_svcctl_EnumServiceGroupW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror);
-NTSTATUS rpccli_svcctl_ChangeServiceConfig2A(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t info_level, uint8_t *info, WERROR *werror);
-NTSTATUS rpccli_svcctl_ChangeServiceConfig2W(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t info_level, uint8_t *info, WERROR *werror);
-NTSTATUS rpccli_svcctl_QueryServiceConfig2A(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t info_level, uint8_t *buffer, uint32_t buf_size, uint32_t *bytes_needed, WERROR *werror);
-NTSTATUS rpccli_svcctl_QueryServiceConfig2W(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t info_level, uint8_t *buffer, uint32_t buf_size, uint32_t *bytes_needed, WERROR *werror);
-NTSTATUS rpccli_svcctl_QueryServiceStatusEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t info_level, uint8_t *buffer, uint32_t buf_size, uint32_t *bytes_needed, WERROR *werror);
-NTSTATUS rpccli_EnumServicesStatusExA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *scmanager, uint32_t info_level, uint32_t type, uint32_t state, uint8_t *services, uint32_t buf_size, uint32_t *bytes_needed, uint32_t *service_returned, uint32_t *resume_handle, const char **group_name, WERROR *werror);
-NTSTATUS rpccli_EnumServicesStatusExW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *scmanager, uint32_t info_level, uint32_t type, uint32_t state, uint8_t *services, uint32_t buf_size, uint32_t *bytes_needed, uint32_t *service_returned, uint32_t *resume_handle, const char **group_name, WERROR *werror);
-NTSTATUS rpccli_svcctl_SCSendTSMessage(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror);
+NTSTATUS rpccli_svcctl_CloseServiceHandle(struct rpc_pipe_client *cli,
+                                         TALLOC_CTX *mem_ctx,
+                                         struct policy_handle *handle,
+                                         WERROR *werror);
+NTSTATUS rpccli_svcctl_ControlService(struct rpc_pipe_client *cli,
+                                     TALLOC_CTX *mem_ctx,
+                                     struct policy_handle *handle,
+                                     uint32_t control,
+                                     struct SERVICE_STATUS *service_status,
+                                     WERROR *werror);
+NTSTATUS rpccli_svcctl_DeleteService(struct rpc_pipe_client *cli,
+                                    TALLOC_CTX *mem_ctx,
+                                    struct policy_handle *handle,
+                                    WERROR *werror);
+NTSTATUS rpccli_svcctl_LockServiceDatabase(struct rpc_pipe_client *cli,
+                                          TALLOC_CTX *mem_ctx,
+                                          struct policy_handle *handle,
+                                          struct policy_handle *lock,
+                                          WERROR *werror);
+NTSTATUS rpccli_svcctl_QueryServiceObjectSecurity(struct rpc_pipe_client *cli,
+                                                 TALLOC_CTX *mem_ctx,
+                                                 WERROR *werror);
+NTSTATUS rpccli_svcctl_SetServiceObjectSecurity(struct rpc_pipe_client *cli,
+                                               TALLOC_CTX *mem_ctx,
+                                               WERROR *werror);
+NTSTATUS rpccli_svcctl_QueryServiceStatus(struct rpc_pipe_client *cli,
+                                         TALLOC_CTX *mem_ctx,
+                                         struct policy_handle *handle,
+                                         struct SERVICE_STATUS *service_status,
+                                         WERROR *werror);
+NTSTATUS rpccli_svcctl_SetServiceStatus(struct rpc_pipe_client *cli,
+                                       TALLOC_CTX *mem_ctx,
+                                       WERROR *werror);
+NTSTATUS rpccli_svcctl_UnlockServiceDatabase(struct rpc_pipe_client *cli,
+                                            TALLOC_CTX *mem_ctx,
+                                            struct policy_handle *lock,
+                                            WERROR *werror);
+NTSTATUS rpccli_svcctl_NotifyBootConfigStatus(struct rpc_pipe_client *cli,
+                                             TALLOC_CTX *mem_ctx,
+                                             WERROR *werror);
+NTSTATUS rpccli_svcctl_SCSetServiceBitsW(struct rpc_pipe_client *cli,
+                                        TALLOC_CTX *mem_ctx,
+                                        struct policy_handle *handle,
+                                        uint32_t bits,
+                                        uint32_t bitson,
+                                        uint32_t immediate,
+                                        WERROR *werror);
+NTSTATUS rpccli_svcctl_ChangeServiceConfigW(struct rpc_pipe_client *cli,
+                                           TALLOC_CTX *mem_ctx,
+                                           struct policy_handle *handle,
+                                           uint32_t type,
+                                           uint32_t start,
+                                           uint32_t error,
+                                           const char *binary_path,
+                                           const char *load_order_group,
+                                           uint32_t *tag_id,
+                                           const char *dependencies,
+                                           const char *service_start_name,
+                                           const char *password,
+                                           const char *display_name,
+                                           WERROR *werror);
+NTSTATUS rpccli_svcctl_CreateServiceW(struct rpc_pipe_client *cli,
+                                     TALLOC_CTX *mem_ctx,
+                                     struct policy_handle *scmanager_handle,
+                                     const char *ServiceName,
+                                     const char *DisplayName,
+                                     uint32_t desired_access,
+                                     uint32_t type,
+                                     uint32_t start_type,
+                                     uint32_t error_control,
+                                     const char *binary_path,
+                                     const char *LoadOrderGroupKey,
+                                     uint32_t *TagId,
+                                     uint8_t *dependencies,
+                                     uint32_t dependencies_size,
+                                     const char *service_start_name,
+                                     uint8_t *password,
+                                     uint32_t password_size,
+                                     struct policy_handle *handle,
+                                     WERROR *werror);
+NTSTATUS rpccli_svcctl_EnumDependentServicesW(struct rpc_pipe_client *cli,
+                                             TALLOC_CTX *mem_ctx,
+                                             struct policy_handle *service,
+                                             uint32_t state,
+                                             struct ENUM_SERVICE_STATUS *service_status,
+                                             uint32_t buf_size,
+                                             uint32_t *bytes_needed,
+                                             uint32_t *services_returned,
+                                             WERROR *werror);
+NTSTATUS rpccli_svcctl_EnumServicesStatusW(struct rpc_pipe_client *cli,
+                                          TALLOC_CTX *mem_ctx,
+                                          struct policy_handle *handle,
+                                          uint32_t type,
+                                          uint32_t state,
+                                          uint32_t buf_size,
+                                          uint8_t *service,
+                                          uint32_t *bytes_needed,
+                                          uint32_t *services_returned,
+                                          uint32_t *resume_handle,
+                                          WERROR *werror);
+NTSTATUS rpccli_svcctl_OpenSCManagerW(struct rpc_pipe_client *cli,
+                                     TALLOC_CTX *mem_ctx,
+                                     const char *MachineName,
+                                     const char *DatabaseName,
+                                     uint32_t access_mask,
+                                     struct policy_handle *handle,
+                                     WERROR *werror);
+NTSTATUS rpccli_svcctl_OpenServiceW(struct rpc_pipe_client *cli,
+                                   TALLOC_CTX *mem_ctx,
+                                   struct policy_handle *scmanager_handle,
+                                   const char *ServiceName,
+                                   uint32_t access_mask,
+                                   struct policy_handle *handle,
+                                   WERROR *werror);
+NTSTATUS rpccli_svcctl_QueryServiceConfigW(struct rpc_pipe_client *cli,
+                                          TALLOC_CTX *mem_ctx,
+                                          struct policy_handle *handle,
+                                          uint8_t *query,
+                                          uint32_t buf_size,
+                                          uint32_t *bytes_needed,
+                                          WERROR *werror);
+NTSTATUS rpccli_svcctl_QueryServiceLockStatusW(struct rpc_pipe_client *cli,
+                                              TALLOC_CTX *mem_ctx,
+                                              struct policy_handle *handle,
+                                              uint32_t buf_size,
+                                              struct SERVICE_LOCK_STATUS *lock_status,
+                                              uint32_t *required_buf_size,
+                                              WERROR *werror);
+NTSTATUS rpccli_svcctl_StartServiceW(struct rpc_pipe_client *cli,
+                                    TALLOC_CTX *mem_ctx,
+                                    struct policy_handle *handle,
+                                    uint32_t NumArgs,
+                                    const char *Arguments,
+                                    WERROR *werror);
+NTSTATUS rpccli_svcctl_GetServiceDisplayNameW(struct rpc_pipe_client *cli,
+                                             TALLOC_CTX *mem_ctx,
+                                             struct policy_handle *handle,
+                                             const char *service_name,
+                                             const char **display_name,
+                                             uint32_t *display_name_length,
+                                             WERROR *werror);
+NTSTATUS rpccli_svcctl_GetServiceKeyNameW(struct rpc_pipe_client *cli,
+                                         TALLOC_CTX *mem_ctx,
+                                         struct policy_handle *handle,
+                                         const char *service_name,
+                                         const char **key_name,
+                                         uint32_t *display_name_length,
+                                         WERROR *werror);
+NTSTATUS rpccli_svcctl_SCSetServiceBitsA(struct rpc_pipe_client *cli,
+                                        TALLOC_CTX *mem_ctx,
+                                        struct policy_handle *handle,
+                                        uint32_t bits,
+                                        uint32_t bitson,
+                                        uint32_t immediate,
+                                        WERROR *werror);
+NTSTATUS rpccli_svcctl_ChangeServiceConfigA(struct rpc_pipe_client *cli,
+                                           TALLOC_CTX *mem_ctx,
+                                           struct policy_handle *handle,
+                                           uint32_t type,
+                                           uint32_t start,
+                                           uint32_t error,
+                                           const char *binary_path,
+                                           const char *load_order_group,
+                                           uint32_t *tag_id,
+                                           const char *dependencies,
+                                           const char *service_start_name,
+                                           const char *password,
+                                           const char *display_name,
+                                           WERROR *werror);
+NTSTATUS rpccli_svcctl_CreateServiceA(struct rpc_pipe_client *cli,
+                                     TALLOC_CTX *mem_ctx,
+                                     struct policy_handle *handle,
+                                     const char *ServiceName,
+                                     const char *DisplayName,
+                                     uint32_t desired_access,
+                                     uint32_t type,
+                                     uint32_t start_type,
+                                     uint32_t error_control,
+                                     const char *binary_path,
+                                     const char *LoadOrderGroupKey,
+                                     uint32_t *TagId,
+                                     const char *dependencies,
+                                     const char *service_start_name,
+                                     const char *password,
+                                     WERROR *werror);
+NTSTATUS rpccli_svcctl_EnumDependentServicesA(struct rpc_pipe_client *cli,
+                                             TALLOC_CTX *mem_ctx,
+                                             struct policy_handle *service,
+                                             uint32_t state,
+                                             struct ENUM_SERVICE_STATUS *service_status,
+                                             uint32_t buf_size,
+                                             uint32_t *bytes_needed,
+                                             uint32_t *services_returned,
+                                             WERROR *werror);
+NTSTATUS rpccli_svcctl_EnumServicesStatusA(struct rpc_pipe_client *cli,
+                                          TALLOC_CTX *mem_ctx,
+                                          struct policy_handle *handle,
+                                          uint32_t type,
+                                          uint32_t state,
+                                          uint32_t buf_size,
+                                          uint8_t *service,
+                                          uint32_t *bytes_needed,
+                                          uint32_t *services_returned,
+                                          uint32_t *resume_handle,
+                                          WERROR *werror);
+NTSTATUS rpccli_svcctl_OpenSCManagerA(struct rpc_pipe_client *cli,
+                                     TALLOC_CTX *mem_ctx,
+                                     const char *MachineName,
+                                     const char *DatabaseName,
+                                     uint32_t access_mask,
+                                     struct policy_handle *handle,
+                                     WERROR *werror);
+NTSTATUS rpccli_svcctl_OpenServiceA(struct rpc_pipe_client *cli,
+                                   TALLOC_CTX *mem_ctx,
+                                   struct policy_handle *scmanager_handle,
+                                   const char *ServiceName,
+                                   uint32_t access_mask,
+                                   WERROR *werror);
+NTSTATUS rpccli_svcctl_QueryServiceConfigA(struct rpc_pipe_client *cli,
+                                          TALLOC_CTX *mem_ctx,
+                                          struct policy_handle *handle,
+                                          uint8_t *query,
+                                          uint32_t buf_size,
+                                          uint32_t *bytes_needed,
+                                          WERROR *werror);
+NTSTATUS rpccli_svcctl_QueryServiceLockStatusA(struct rpc_pipe_client *cli,
+                                              TALLOC_CTX *mem_ctx,
+                                              struct policy_handle *handle,
+                                              uint32_t buf_size,
+                                              struct SERVICE_LOCK_STATUS *lock_status,
+                                              uint32_t *required_buf_size,
+                                              WERROR *werror);
+NTSTATUS rpccli_svcctl_StartServiceA(struct rpc_pipe_client *cli,
+                                    TALLOC_CTX *mem_ctx,
+                                    struct policy_handle *handle,
+                                    uint32_t NumArgs,
+                                    const char *Arguments,
+                                    WERROR *werror);
+NTSTATUS rpccli_svcctl_GetServiceDisplayNameA(struct rpc_pipe_client *cli,
+                                             TALLOC_CTX *mem_ctx,
+                                             struct policy_handle *handle,
+                                             const char *service_name,
+                                             const char **display_name,
+                                             uint32_t *display_name_length,
+                                             WERROR *werror);
+NTSTATUS rpccli_svcctl_GetServiceKeyNameA(struct rpc_pipe_client *cli,
+                                         TALLOC_CTX *mem_ctx,
+                                         struct policy_handle *handle,
+                                         const char *service_name,
+                                         const char **key_name,
+                                         uint32_t *display_name_length,
+                                         WERROR *werror);
+NTSTATUS rpccli_svcctl_GetCurrentGroupeStateW(struct rpc_pipe_client *cli,
+                                             TALLOC_CTX *mem_ctx,
+                                             WERROR *werror);
+NTSTATUS rpccli_svcctl_EnumServiceGroupW(struct rpc_pipe_client *cli,
+                                        TALLOC_CTX *mem_ctx,
+                                        WERROR *werror);
+NTSTATUS rpccli_svcctl_ChangeServiceConfig2A(struct rpc_pipe_client *cli,
+                                            TALLOC_CTX *mem_ctx,
+                                            struct policy_handle *handle,
+                                            uint32_t info_level,
+                                            uint8_t *info,
+                                            WERROR *werror);
+NTSTATUS rpccli_svcctl_ChangeServiceConfig2W(struct rpc_pipe_client *cli,
+                                            TALLOC_CTX *mem_ctx,
+                                            struct policy_handle *handle,
+                                            uint32_t info_level,
+                                            uint8_t *info,
+                                            WERROR *werror);
+NTSTATUS rpccli_svcctl_QueryServiceConfig2A(struct rpc_pipe_client *cli,
+                                           TALLOC_CTX *mem_ctx,
+                                           struct policy_handle *handle,
+                                           uint32_t info_level,
+                                           uint8_t *buffer,
+                                           uint32_t buf_size,
+                                           uint32_t *bytes_needed,
+                                           WERROR *werror);
+NTSTATUS rpccli_svcctl_QueryServiceConfig2W(struct rpc_pipe_client *cli,
+                                           TALLOC_CTX *mem_ctx,
+                                           struct policy_handle *handle,
+                                           uint32_t info_level,
+                                           uint8_t *buffer,
+                                           uint32_t buf_size,
+                                           uint32_t *bytes_needed,
+                                           WERROR *werror);
+NTSTATUS rpccli_svcctl_QueryServiceStatusEx(struct rpc_pipe_client *cli,
+                                           TALLOC_CTX *mem_ctx,
+                                           struct policy_handle *handle,
+                                           uint32_t info_level,
+                                           uint8_t *buffer,
+                                           uint32_t buf_size,
+                                           uint32_t *bytes_needed,
+                                           WERROR *werror);
+NTSTATUS rpccli_EnumServicesStatusExA(struct rpc_pipe_client *cli,
+                                     TALLOC_CTX *mem_ctx,
+                                     struct policy_handle *scmanager,
+                                     uint32_t info_level,
+                                     uint32_t type,
+                                     uint32_t state,
+                                     uint8_t *services,
+                                     uint32_t buf_size,
+                                     uint32_t *bytes_needed,
+                                     uint32_t *service_returned,
+                                     uint32_t *resume_handle,
+                                     const char **group_name,
+                                     WERROR *werror);
+NTSTATUS rpccli_EnumServicesStatusExW(struct rpc_pipe_client *cli,
+                                     TALLOC_CTX *mem_ctx,
+                                     struct policy_handle *scmanager,
+                                     uint32_t info_level,
+                                     uint32_t type,
+                                     uint32_t state,
+                                     uint8_t *services,
+                                     uint32_t buf_size,
+                                     uint32_t *bytes_needed,
+                                     uint32_t *service_returned,
+                                     uint32_t *resume_handle,
+                                     const char **group_name,
+                                     WERROR *werror);
+NTSTATUS rpccli_svcctl_SCSendTSMessage(struct rpc_pipe_client *cli,
+                                      TALLOC_CTX *mem_ctx,
+                                      WERROR *werror);
 #endif /* __CLI_SVCCTL__ */
index 4a48ac2c43bae3f680562c0f2731f897ee98450d..c8a6c926ef2480cfb732ed7b1f81705e452fbef2 100644 (file)
 #include "includes.h"
 #include "librpc/gen_ndr/cli_unixinfo.h"
 
-NTSTATUS rpccli_unixinfo_SidToUid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct dom_sid sid, uint64_t *uid)
+NTSTATUS rpccli_unixinfo_SidToUid(struct rpc_pipe_client *cli,
+                                 TALLOC_CTX *mem_ctx,
+                                 struct dom_sid sid,
+                                 uint64_t *uid)
 {
        struct unixinfo_SidToUid r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.sid = sid;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(unixinfo_SidToUid, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_UNIXINFO, &ndr_table_unixinfo, NDR_UNIXINFO_SIDTOUID, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_UNIXINFO,
+                               &ndr_table_unixinfo,
+                               NDR_UNIXINFO_SIDTOUID,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(unixinfo_SidToUid, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *uid = *r.out.uid;
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_unixinfo_UidToSid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint64_t uid, struct dom_sid *sid)
+NTSTATUS rpccli_unixinfo_UidToSid(struct rpc_pipe_client *cli,
+                                 TALLOC_CTX *mem_ctx,
+                                 uint64_t uid,
+                                 struct dom_sid *sid)
 {
        struct unixinfo_UidToSid r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.uid = uid;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(unixinfo_UidToSid, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_UNIXINFO, &ndr_table_unixinfo, NDR_UNIXINFO_UIDTOSID, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_UNIXINFO,
+                               &ndr_table_unixinfo,
+                               NDR_UNIXINFO_UIDTOSID,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(unixinfo_UidToSid, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *sid = *r.out.sid;
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_unixinfo_SidToGid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct dom_sid sid, uint64_t *gid)
+NTSTATUS rpccli_unixinfo_SidToGid(struct rpc_pipe_client *cli,
+                                 TALLOC_CTX *mem_ctx,
+                                 struct dom_sid sid,
+                                 uint64_t *gid)
 {
        struct unixinfo_SidToGid r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.sid = sid;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(unixinfo_SidToGid, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_UNIXINFO, &ndr_table_unixinfo, NDR_UNIXINFO_SIDTOGID, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_UNIXINFO,
+                               &ndr_table_unixinfo,
+                               NDR_UNIXINFO_SIDTOGID,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(unixinfo_SidToGid, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *gid = *r.out.gid;
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_unixinfo_GidToSid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint64_t gid, struct dom_sid *sid)
+NTSTATUS rpccli_unixinfo_GidToSid(struct rpc_pipe_client *cli,
+                                 TALLOC_CTX *mem_ctx,
+                                 uint64_t gid,
+                                 struct dom_sid *sid)
 {
        struct unixinfo_GidToSid r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.gid = gid;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(unixinfo_GidToSid, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_UNIXINFO, &ndr_table_unixinfo, NDR_UNIXINFO_GIDTOSID, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_UNIXINFO,
+                               &ndr_table_unixinfo,
+                               NDR_UNIXINFO_GIDTOSID,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(unixinfo_GidToSid, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *sid = *r.out.sid;
-       
+
        /* Return result */
        return r.out.result;
 }
 
-NTSTATUS rpccli_unixinfo_GetPWUid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t *count, uint64_t *uids, struct unixinfo_GetPWUidInfo *infos)
+NTSTATUS rpccli_unixinfo_GetPWUid(struct rpc_pipe_client *cli,
+                                 TALLOC_CTX *mem_ctx,
+                                 uint32_t *count,
+                                 uint64_t *uids,
+                                 struct unixinfo_GetPWUidInfo *infos)
 {
        struct unixinfo_GetPWUid r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.count = count;
        r.in.uids = uids;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(unixinfo_GetPWUid, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_UNIXINFO, &ndr_table_unixinfo, NDR_UNIXINFO_GETPWUID, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_UNIXINFO,
+                               &ndr_table_unixinfo,
+                               NDR_UNIXINFO_GETPWUID,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(unixinfo_GetPWUid, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *count = *r.out.count;
        memcpy(infos, r.out.infos, *r.in.count);
-       
+
        /* Return result */
        return r.out.result;
 }
index f0f2b54626b78b3fae7c64c8963779a0ebbeb75e..fa084cc75db12462aba6b55eee20199687c6478f 100644 (file)
@@ -1,9 +1,25 @@
 #include "librpc/gen_ndr/ndr_unixinfo.h"
 #ifndef __CLI_UNIXINFO__
 #define __CLI_UNIXINFO__
-NTSTATUS rpccli_unixinfo_SidToUid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct dom_sid sid, uint64_t *uid);
-NTSTATUS rpccli_unixinfo_UidToSid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint64_t uid, struct dom_sid *sid);
-NTSTATUS rpccli_unixinfo_SidToGid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct dom_sid sid, uint64_t *gid);
-NTSTATUS rpccli_unixinfo_GidToSid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint64_t gid, struct dom_sid *sid);
-NTSTATUS rpccli_unixinfo_GetPWUid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t *count, uint64_t *uids, struct unixinfo_GetPWUidInfo *infos);
+NTSTATUS rpccli_unixinfo_SidToUid(struct rpc_pipe_client *cli,
+                                 TALLOC_CTX *mem_ctx,
+                                 struct dom_sid sid,
+                                 uint64_t *uid);
+NTSTATUS rpccli_unixinfo_UidToSid(struct rpc_pipe_client *cli,
+                                 TALLOC_CTX *mem_ctx,
+                                 uint64_t uid,
+                                 struct dom_sid *sid);
+NTSTATUS rpccli_unixinfo_SidToGid(struct rpc_pipe_client *cli,
+                                 TALLOC_CTX *mem_ctx,
+                                 struct dom_sid sid,
+                                 uint64_t *gid);
+NTSTATUS rpccli_unixinfo_GidToSid(struct rpc_pipe_client *cli,
+                                 TALLOC_CTX *mem_ctx,
+                                 uint64_t gid,
+                                 struct dom_sid *sid);
+NTSTATUS rpccli_unixinfo_GetPWUid(struct rpc_pipe_client *cli,
+                                 TALLOC_CTX *mem_ctx,
+                                 uint32_t *count,
+                                 uint64_t *uids,
+                                 struct unixinfo_GetPWUidInfo *infos);
 #endif /* __CLI_UNIXINFO__ */
index d89f306b1735c1d89850a8a916f84b4e4e8d7811..1c691e3d32a42acc95ac7a379f03ffaecb40116c 100644 (file)
 #include "includes.h"
 #include "librpc/gen_ndr/cli_winreg.h"
 
-NTSTATUS rpccli_winreg_OpenHKCR(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle, WERROR *werror)
+NTSTATUS rpccli_winreg_OpenHKCR(struct rpc_pipe_client *cli,
+                               TALLOC_CTX *mem_ctx,
+                               uint16_t *system_name,
+                               uint32_t access_mask,
+                               struct policy_handle *handle,
+                               WERROR *werror)
 {
        struct winreg_OpenHKCR r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.system_name = system_name;
        r.in.access_mask = access_mask;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_OpenHKCR, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_OPENHKCR, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_WINREG,
+                               &ndr_table_winreg,
+                               NDR_WINREG_OPENHKCR,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_OpenHKCR, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *handle = *r.out.handle;
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_winreg_OpenHKCU(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle, WERROR *werror)
+NTSTATUS rpccli_winreg_OpenHKCU(struct rpc_pipe_client *cli,
+                               TALLOC_CTX *mem_ctx,
+                               uint16_t *system_name,
+                               uint32_t access_mask,
+                               struct policy_handle *handle,
+                               WERROR *werror)
 {
        struct winreg_OpenHKCU r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.system_name = system_name;
        r.in.access_mask = access_mask;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_OpenHKCU, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_OPENHKCU, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_WINREG,
+                               &ndr_table_winreg,
+                               NDR_WINREG_OPENHKCU,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_OpenHKCU, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *handle = *r.out.handle;
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_winreg_OpenHKLM(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle, WERROR *werror)
+NTSTATUS rpccli_winreg_OpenHKLM(struct rpc_pipe_client *cli,
+                               TALLOC_CTX *mem_ctx,
+                               uint16_t *system_name,
+                               uint32_t access_mask,
+                               struct policy_handle *handle,
+                               WERROR *werror)
 {
        struct winreg_OpenHKLM r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.system_name = system_name;
        r.in.access_mask = access_mask;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_OpenHKLM, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_OPENHKLM, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_WINREG,
+                               &ndr_table_winreg,
+                               NDR_WINREG_OPENHKLM,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_OpenHKLM, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *handle = *r.out.handle;
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_winreg_OpenHKPD(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle, WERROR *werror)
+NTSTATUS rpccli_winreg_OpenHKPD(struct rpc_pipe_client *cli,
+                               TALLOC_CTX *mem_ctx,
+                               uint16_t *system_name,
+                               uint32_t access_mask,
+                               struct policy_handle *handle,
+                               WERROR *werror)
 {
        struct winreg_OpenHKPD r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.system_name = system_name;
        r.in.access_mask = access_mask;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_OpenHKPD, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_OPENHKPD, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_WINREG,
+                               &ndr_table_winreg,
+                               NDR_WINREG_OPENHKPD,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_OpenHKPD, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *handle = *r.out.handle;
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_winreg_OpenHKU(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle, WERROR *werror)
+NTSTATUS rpccli_winreg_OpenHKU(struct rpc_pipe_client *cli,
+                              TALLOC_CTX *mem_ctx,
+                              uint16_t *system_name,
+                              uint32_t access_mask,
+                              struct policy_handle *handle,
+                              WERROR *werror)
 {
        struct winreg_OpenHKU r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.system_name = system_name;
        r.in.access_mask = access_mask;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_OpenHKU, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_OPENHKU, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_WINREG,
+                               &ndr_table_winreg,
+                               NDR_WINREG_OPENHKU,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_OpenHKU, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *handle = *r.out.handle;
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_winreg_CloseKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, WERROR *werror)
+NTSTATUS rpccli_winreg_CloseKey(struct rpc_pipe_client *cli,
+                               TALLOC_CTX *mem_ctx,
+                               struct policy_handle *handle,
+                               WERROR *werror)
 {
        struct winreg_CloseKey r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_CloseKey, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_CLOSEKEY, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_WINREG,
+                               &ndr_table_winreg,
+                               NDR_WINREG_CLOSEKEY,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_CloseKey, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *handle = *r.out.handle;
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_winreg_CreateKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String name, struct winreg_String keyclass, uint32_t options, uint32_t access_mask, struct winreg_SecBuf *secdesc, struct policy_handle *new_handle, enum winreg_CreateAction *action_taken, WERROR *werror)
+NTSTATUS rpccli_winreg_CreateKey(struct rpc_pipe_client *cli,
+                                TALLOC_CTX *mem_ctx,
+                                struct policy_handle *handle,
+                                struct winreg_String name,
+                                struct winreg_String keyclass,
+                                uint32_t options,
+                                uint32_t access_mask,
+                                struct winreg_SecBuf *secdesc,
+                                struct policy_handle *new_handle,
+                                enum winreg_CreateAction *action_taken,
+                                WERROR *werror)
 {
        struct winreg_CreateKey r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.name = name;
@@ -234,135 +314,178 @@ NTSTATUS rpccli_winreg_CreateKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct
        r.in.access_mask = access_mask;
        r.in.secdesc = secdesc;
        r.in.action_taken = action_taken;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_CreateKey, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_CREATEKEY, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_WINREG,
+                               &ndr_table_winreg,
+                               NDR_WINREG_CREATEKEY,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_CreateKey, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *new_handle = *r.out.new_handle;
        if (action_taken && r.out.action_taken) {
                *action_taken = *r.out.action_taken;
        }
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_winreg_DeleteKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String key, WERROR *werror)
+NTSTATUS rpccli_winreg_DeleteKey(struct rpc_pipe_client *cli,
+                                TALLOC_CTX *mem_ctx,
+                                struct policy_handle *handle,
+                                struct winreg_String key,
+                                WERROR *werror)
 {
        struct winreg_DeleteKey r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.key = key;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_DeleteKey, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_DELETEKEY, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_WINREG,
+                               &ndr_table_winreg,
+                               NDR_WINREG_DELETEKEY,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_DeleteKey, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_winreg_DeleteValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String value, WERROR *werror)
+NTSTATUS rpccli_winreg_DeleteValue(struct rpc_pipe_client *cli,
+                                  TALLOC_CTX *mem_ctx,
+                                  struct policy_handle *handle,
+                                  struct winreg_String value,
+                                  WERROR *werror)
 {
        struct winreg_DeleteValue r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.value = value;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_DeleteValue, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_DELETEVALUE, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_WINREG,
+                               &ndr_table_winreg,
+                               NDR_WINREG_DELETEVALUE,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_DeleteValue, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_winreg_EnumKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t enum_index, struct winreg_StringBuf *name, struct winreg_StringBuf *keyclass, NTTIME *last_changed_time, WERROR *werror)
+NTSTATUS rpccli_winreg_EnumKey(struct rpc_pipe_client *cli,
+                              TALLOC_CTX *mem_ctx,
+                              struct policy_handle *handle,
+                              uint32_t enum_index,
+                              struct winreg_StringBuf *name,
+                              struct winreg_StringBuf *keyclass,
+                              NTTIME *last_changed_time,
+                              WERROR *werror)
 {
        struct winreg_EnumKey r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.enum_index = enum_index;
        r.in.name = name;
        r.in.keyclass = keyclass;
        r.in.last_changed_time = last_changed_time;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_EnumKey, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_ENUMKEY, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_WINREG,
+                               &ndr_table_winreg,
+                               NDR_WINREG_ENUMKEY,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_EnumKey, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *name = *r.out.name;
        if (keyclass && r.out.keyclass) {
@@ -371,20 +494,29 @@ NTSTATUS rpccli_winreg_EnumKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
        if (last_changed_time && r.out.last_changed_time) {
                *last_changed_time = *r.out.last_changed_time;
        }
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_winreg_EnumValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t enum_index, struct winreg_ValNameBuf *name, enum winreg_Type *type, uint8_t *value, uint32_t *size, uint32_t *length, WERROR *werror)
+NTSTATUS rpccli_winreg_EnumValue(struct rpc_pipe_client *cli,
+                                TALLOC_CTX *mem_ctx,
+                                struct policy_handle *handle,
+                                uint32_t enum_index,
+                                struct winreg_ValNameBuf *name,
+                                enum winreg_Type *type,
+                                uint8_t *value,
+                                uint32_t *size,
+                                uint32_t *length,
+                                WERROR *werror)
 {
        struct winreg_EnumValue r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.enum_index = enum_index;
@@ -393,23 +525,30 @@ NTSTATUS rpccli_winreg_EnumValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct
        r.in.value = value;
        r.in.size = size;
        r.in.length = length;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_EnumValue, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_ENUMVALUE, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_WINREG,
+                               &ndr_table_winreg,
+                               NDR_WINREG_ENUMVALUE,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_EnumValue, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *name = *r.out.name;
        if (type && r.out.type) {
@@ -424,127 +563,170 @@ NTSTATUS rpccli_winreg_EnumValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct
        if (length && r.out.length) {
                *length = *r.out.length;
        }
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_winreg_FlushKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, WERROR *werror)
+NTSTATUS rpccli_winreg_FlushKey(struct rpc_pipe_client *cli,
+                               TALLOC_CTX *mem_ctx,
+                               struct policy_handle *handle,
+                               WERROR *werror)
 {
        struct winreg_FlushKey r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_FlushKey, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_FLUSHKEY, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_WINREG,
+                               &ndr_table_winreg,
+                               NDR_WINREG_FLUSHKEY,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_FlushKey, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_winreg_GetKeySecurity(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t sec_info, struct KeySecurityData *sd, WERROR *werror)
+NTSTATUS rpccli_winreg_GetKeySecurity(struct rpc_pipe_client *cli,
+                                     TALLOC_CTX *mem_ctx,
+                                     struct policy_handle *handle,
+                                     uint32_t sec_info,
+                                     struct KeySecurityData *sd,
+                                     WERROR *werror)
 {
        struct winreg_GetKeySecurity r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.sec_info = sec_info;
        r.in.sd = sd;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_GetKeySecurity, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_GETKEYSECURITY, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_WINREG,
+                               &ndr_table_winreg,
+                               NDR_WINREG_GETKEYSECURITY,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_GetKeySecurity, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *sd = *r.out.sd;
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_winreg_LoadKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String *keyname, struct winreg_String *filename, WERROR *werror)
+NTSTATUS rpccli_winreg_LoadKey(struct rpc_pipe_client *cli,
+                              TALLOC_CTX *mem_ctx,
+                              struct policy_handle *handle,
+                              struct winreg_String *keyname,
+                              struct winreg_String *filename,
+                              WERROR *werror)
 {
        struct winreg_LoadKey r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.keyname = keyname;
        r.in.filename = filename;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_LoadKey, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_LOADKEY, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_WINREG,
+                               &ndr_table_winreg,
+                               NDR_WINREG_LOADKEY,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_LoadKey, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_winreg_NotifyChangeKeyValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint8_t watch_subtree, uint32_t notify_filter, uint32_t unknown, struct winreg_String string1, struct winreg_String string2, uint32_t unknown2, WERROR *werror)
+NTSTATUS rpccli_winreg_NotifyChangeKeyValue(struct rpc_pipe_client *cli,
+                                           TALLOC_CTX *mem_ctx,
+                                           struct policy_handle *handle,
+                                           uint8_t watch_subtree,
+                                           uint32_t notify_filter,
+                                           uint32_t unknown,
+                                           struct winreg_String string1,
+                                           struct winreg_String string2,
+                                           uint32_t unknown2,
+                                           WERROR *werror)
 {
        struct winreg_NotifyChangeKeyValue r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.watch_subtree = watch_subtree;
@@ -553,96 +735,136 @@ NTSTATUS rpccli_winreg_NotifyChangeKeyValue(struct rpc_pipe_client *cli, TALLOC_
        r.in.string1 = string1;
        r.in.string2 = string2;
        r.in.unknown2 = unknown2;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_NotifyChangeKeyValue, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_NOTIFYCHANGEKEYVALUE, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_WINREG,
+                               &ndr_table_winreg,
+                               NDR_WINREG_NOTIFYCHANGEKEYVALUE,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_NotifyChangeKeyValue, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_winreg_OpenKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *parent_handle, struct winreg_String keyname, uint32_t unknown, uint32_t access_mask, struct policy_handle *handle, WERROR *werror)
+NTSTATUS rpccli_winreg_OpenKey(struct rpc_pipe_client *cli,
+                              TALLOC_CTX *mem_ctx,
+                              struct policy_handle *parent_handle,
+                              struct winreg_String keyname,
+                              uint32_t unknown,
+                              uint32_t access_mask,
+                              struct policy_handle *handle,
+                              WERROR *werror)
 {
        struct winreg_OpenKey r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.parent_handle = parent_handle;
        r.in.keyname = keyname;
        r.in.unknown = unknown;
        r.in.access_mask = access_mask;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_OpenKey, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_OPENKEY, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_WINREG,
+                               &ndr_table_winreg,
+                               NDR_WINREG_OPENKEY,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_OpenKey, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *handle = *r.out.handle;
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_winreg_QueryInfoKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String *classname, uint32_t *num_subkeys, uint32_t *max_subkeylen, uint32_t *max_classlen, uint32_t *num_values, uint32_t *max_valnamelen, uint32_t *max_valbufsize, uint32_t *secdescsize, NTTIME *last_changed_time, WERROR *werror)
+NTSTATUS rpccli_winreg_QueryInfoKey(struct rpc_pipe_client *cli,
+                                   TALLOC_CTX *mem_ctx,
+                                   struct policy_handle *handle,
+                                   struct winreg_String *classname,
+                                   uint32_t *num_subkeys,
+                                   uint32_t *max_subkeylen,
+                                   uint32_t *max_classlen,
+                                   uint32_t *num_values,
+                                   uint32_t *max_valnamelen,
+                                   uint32_t *max_valbufsize,
+                                   uint32_t *secdescsize,
+                                   NTTIME *last_changed_time,
+                                   WERROR *werror)
 {
        struct winreg_QueryInfoKey r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.classname = classname;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_QueryInfoKey, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_QUERYINFOKEY, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_WINREG,
+                               &ndr_table_winreg,
+                               NDR_WINREG_QUERYINFOKEY,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_QueryInfoKey, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *classname = *r.out.classname;
        *num_subkeys = *r.out.num_subkeys;
@@ -653,20 +875,28 @@ NTSTATUS rpccli_winreg_QueryInfoKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem
        *max_valbufsize = *r.out.max_valbufsize;
        *secdescsize = *r.out.secdescsize;
        *last_changed_time = *r.out.last_changed_time;
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_winreg_QueryValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String value_name, enum winreg_Type *type, uint8_t *data, uint32_t *data_size, uint32_t *value_length, WERROR *werror)
+NTSTATUS rpccli_winreg_QueryValue(struct rpc_pipe_client *cli,
+                                 TALLOC_CTX *mem_ctx,
+                                 struct policy_handle *handle,
+                                 struct winreg_String value_name,
+                                 enum winreg_Type *type,
+                                 uint8_t *data,
+                                 uint32_t *data_size,
+                                 uint32_t *value_length,
+                                 WERROR *werror)
 {
        struct winreg_QueryValue r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.value_name = value_name;
@@ -674,23 +904,30 @@ NTSTATUS rpccli_winreg_QueryValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c
        r.in.data = data;
        r.in.data_size = data_size;
        r.in.value_length = value_length;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_QueryValue, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_QUERYVALUE, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_WINREG,
+                               &ndr_table_winreg,
+                               NDR_WINREG_QUERYVALUE,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_QueryValue, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        if (type && r.out.type) {
                *type = *r.out.type;
@@ -704,454 +941,603 @@ NTSTATUS rpccli_winreg_QueryValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c
        if (value_length && r.out.value_length) {
                *value_length = *r.out.value_length;
        }
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_winreg_ReplaceKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror)
+NTSTATUS rpccli_winreg_ReplaceKey(struct rpc_pipe_client *cli,
+                                 TALLOC_CTX *mem_ctx,
+                                 WERROR *werror)
 {
        struct winreg_ReplaceKey r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_ReplaceKey, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_REPLACEKEY, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_WINREG,
+                               &ndr_table_winreg,
+                               NDR_WINREG_REPLACEKEY,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_ReplaceKey, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_winreg_RestoreKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String *filename, uint32_t flags, WERROR *werror)
+NTSTATUS rpccli_winreg_RestoreKey(struct rpc_pipe_client *cli,
+                                 TALLOC_CTX *mem_ctx,
+                                 struct policy_handle *handle,
+                                 struct winreg_String *filename,
+                                 uint32_t flags,
+                                 WERROR *werror)
 {
        struct winreg_RestoreKey r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.filename = filename;
        r.in.flags = flags;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_RestoreKey, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_RESTOREKEY, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_WINREG,
+                               &ndr_table_winreg,
+                               NDR_WINREG_RESTOREKEY,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_RestoreKey, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_winreg_SaveKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String *filename, struct KeySecurityAttribute *sec_attrib, WERROR *werror)
+NTSTATUS rpccli_winreg_SaveKey(struct rpc_pipe_client *cli,
+                              TALLOC_CTX *mem_ctx,
+                              struct policy_handle *handle,
+                              struct winreg_String *filename,
+                              struct KeySecurityAttribute *sec_attrib,
+                              WERROR *werror)
 {
        struct winreg_SaveKey r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.filename = filename;
        r.in.sec_attrib = sec_attrib;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_SaveKey, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_SAVEKEY, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_WINREG,
+                               &ndr_table_winreg,
+                               NDR_WINREG_SAVEKEY,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_SaveKey, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_winreg_SetKeySecurity(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t access_mask, struct KeySecurityData *sd, WERROR *werror)
+NTSTATUS rpccli_winreg_SetKeySecurity(struct rpc_pipe_client *cli,
+                                     TALLOC_CTX *mem_ctx,
+                                     struct policy_handle *handle,
+                                     uint32_t access_mask,
+                                     struct KeySecurityData *sd,
+                                     WERROR *werror)
 {
        struct winreg_SetKeySecurity r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.access_mask = access_mask;
        r.in.sd = sd;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_SetKeySecurity, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_SETKEYSECURITY, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_WINREG,
+                               &ndr_table_winreg,
+                               NDR_WINREG_SETKEYSECURITY,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_SetKeySecurity, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_winreg_SetValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String name, enum winreg_Type type, uint8_t *data, uint32_t size, WERROR *werror)
+NTSTATUS rpccli_winreg_SetValue(struct rpc_pipe_client *cli,
+                               TALLOC_CTX *mem_ctx,
+                               struct policy_handle *handle,
+                               struct winreg_String name,
+                               enum winreg_Type type,
+                               uint8_t *data,
+                               uint32_t size,
+                               WERROR *werror)
 {
        struct winreg_SetValue r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
        r.in.name = name;
        r.in.type = type;
        r.in.data = data;
        r.in.size = size;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_SetValue, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_SETVALUE, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_WINREG,
+                               &ndr_table_winreg,
+                               NDR_WINREG_SETVALUE,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_SetValue, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_winreg_UnLoadKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror)
+NTSTATUS rpccli_winreg_UnLoadKey(struct rpc_pipe_client *cli,
+                                TALLOC_CTX *mem_ctx,
+                                WERROR *werror)
 {
        struct winreg_UnLoadKey r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_UnLoadKey, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_UNLOADKEY, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_WINREG,
+                               &ndr_table_winreg,
+                               NDR_WINREG_UNLOADKEY,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_UnLoadKey, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_winreg_InitiateSystemShutdown(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *hostname, struct initshutdown_String *message, uint32_t timeout, uint8_t force_apps, uint8_t reboot, WERROR *werror)
+NTSTATUS rpccli_winreg_InitiateSystemShutdown(struct rpc_pipe_client *cli,
+                                             TALLOC_CTX *mem_ctx,
+                                             uint16_t *hostname,
+                                             struct initshutdown_String *message,
+                                             uint32_t timeout,
+                                             uint8_t force_apps,
+                                             uint8_t reboot,
+                                             WERROR *werror)
 {
        struct winreg_InitiateSystemShutdown r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.hostname = hostname;
        r.in.message = message;
        r.in.timeout = timeout;
        r.in.force_apps = force_apps;
        r.in.reboot = reboot;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_InitiateSystemShutdown, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_INITIATESYSTEMSHUTDOWN, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_WINREG,
+                               &ndr_table_winreg,
+                               NDR_WINREG_INITIATESYSTEMSHUTDOWN,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_InitiateSystemShutdown, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_winreg_AbortSystemShutdown(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *server, WERROR *werror)
+NTSTATUS rpccli_winreg_AbortSystemShutdown(struct rpc_pipe_client *cli,
+                                          TALLOC_CTX *mem_ctx,
+                                          uint16_t *server,
+                                          WERROR *werror)
 {
        struct winreg_AbortSystemShutdown r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server = server;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_AbortSystemShutdown, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_ABORTSYSTEMSHUTDOWN, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_WINREG,
+                               &ndr_table_winreg,
+                               NDR_WINREG_ABORTSYSTEMSHUTDOWN,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_AbortSystemShutdown, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_winreg_GetVersion(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t *version, WERROR *werror)
+NTSTATUS rpccli_winreg_GetVersion(struct rpc_pipe_client *cli,
+                                 TALLOC_CTX *mem_ctx,
+                                 struct policy_handle *handle,
+                                 uint32_t *version,
+                                 WERROR *werror)
 {
        struct winreg_GetVersion r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.handle = handle;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_GetVersion, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_GETVERSION, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_WINREG,
+                               &ndr_table_winreg,
+                               NDR_WINREG_GETVERSION,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_GetVersion, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *version = *r.out.version;
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_winreg_OpenHKCC(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle, WERROR *werror)
+NTSTATUS rpccli_winreg_OpenHKCC(struct rpc_pipe_client *cli,
+                               TALLOC_CTX *mem_ctx,
+                               uint16_t *system_name,
+                               uint32_t access_mask,
+                               struct policy_handle *handle,
+                               WERROR *werror)
 {
        struct winreg_OpenHKCC r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.system_name = system_name;
        r.in.access_mask = access_mask;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_OpenHKCC, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_OPENHKCC, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_WINREG,
+                               &ndr_table_winreg,
+                               NDR_WINREG_OPENHKCC,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_OpenHKCC, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *handle = *r.out.handle;
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_winreg_OpenHKDD(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle, WERROR *werror)
+NTSTATUS rpccli_winreg_OpenHKDD(struct rpc_pipe_client *cli,
+                               TALLOC_CTX *mem_ctx,
+                               uint16_t *system_name,
+                               uint32_t access_mask,
+                               struct policy_handle *handle,
+                               WERROR *werror)
 {
        struct winreg_OpenHKDD r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.system_name = system_name;
        r.in.access_mask = access_mask;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_OpenHKDD, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_OPENHKDD, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_WINREG,
+                               &ndr_table_winreg,
+                               NDR_WINREG_OPENHKDD,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_OpenHKDD, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *handle = *r.out.handle;
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_winreg_QueryMultipleValues(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *key_handle, struct QueryMultipleValue *values, uint32_t num_values, uint8_t *buffer, uint32_t *buffer_size, WERROR *werror)
+NTSTATUS rpccli_winreg_QueryMultipleValues(struct rpc_pipe_client *cli,
+                                          TALLOC_CTX *mem_ctx,
+                                          struct policy_handle *key_handle,
+                                          struct QueryMultipleValue *values,
+                                          uint32_t num_values,
+                                          uint8_t *buffer,
+                                          uint32_t *buffer_size,
+                                          WERROR *werror)
 {
        struct winreg_QueryMultipleValues r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.key_handle = key_handle;
        r.in.values = values;
        r.in.num_values = num_values;
        r.in.buffer = buffer;
        r.in.buffer_size = buffer_size;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_QueryMultipleValues, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_QUERYMULTIPLEVALUES, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_WINREG,
+                               &ndr_table_winreg,
+                               NDR_WINREG_QUERYMULTIPLEVALUES,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_QueryMultipleValues, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        memcpy(values, r.out.values, r.in.num_values);
        if (buffer && r.out.buffer) {
                memcpy(buffer, r.out.buffer, *r.in.buffer_size);
        }
        *buffer_size = *r.out.buffer_size;
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_winreg_InitiateSystemShutdownEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *hostname, struct initshutdown_String *message, uint32_t timeout, uint8_t force_apps, uint8_t reboot, uint32_t reason, WERROR *werror)
+NTSTATUS rpccli_winreg_InitiateSystemShutdownEx(struct rpc_pipe_client *cli,
+                                               TALLOC_CTX *mem_ctx,
+                                               uint16_t *hostname,
+                                               struct initshutdown_String *message,
+                                               uint32_t timeout,
+                                               uint8_t force_apps,
+                                               uint8_t reboot,
+                                               uint32_t reason,
+                                               WERROR *werror)
 {
        struct winreg_InitiateSystemShutdownEx r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.hostname = hostname;
        r.in.message = message;
@@ -1159,168 +1545,217 @@ NTSTATUS rpccli_winreg_InitiateSystemShutdownEx(struct rpc_pipe_client *cli, TAL
        r.in.force_apps = force_apps;
        r.in.reboot = reboot;
        r.in.reason = reason;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_InitiateSystemShutdownEx, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_INITIATESYSTEMSHUTDOWNEX, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_WINREG,
+                               &ndr_table_winreg,
+                               NDR_WINREG_INITIATESYSTEMSHUTDOWNEX,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_InitiateSystemShutdownEx, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_winreg_SaveKeyEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror)
+NTSTATUS rpccli_winreg_SaveKeyEx(struct rpc_pipe_client *cli,
+                                TALLOC_CTX *mem_ctx,
+                                WERROR *werror)
 {
        struct winreg_SaveKeyEx r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_SaveKeyEx, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_SAVEKEYEX, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_WINREG,
+                               &ndr_table_winreg,
+                               NDR_WINREG_SAVEKEYEX,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_SaveKeyEx, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_winreg_OpenHKPT(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle, WERROR *werror)
+NTSTATUS rpccli_winreg_OpenHKPT(struct rpc_pipe_client *cli,
+                               TALLOC_CTX *mem_ctx,
+                               uint16_t *system_name,
+                               uint32_t access_mask,
+                               struct policy_handle *handle,
+                               WERROR *werror)
 {
        struct winreg_OpenHKPT r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.system_name = system_name;
        r.in.access_mask = access_mask;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_OpenHKPT, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_OPENHKPT, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_WINREG,
+                               &ndr_table_winreg,
+                               NDR_WINREG_OPENHKPT,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_OpenHKPT, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *handle = *r.out.handle;
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_winreg_OpenHKPN(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle, WERROR *werror)
+NTSTATUS rpccli_winreg_OpenHKPN(struct rpc_pipe_client *cli,
+                               TALLOC_CTX *mem_ctx,
+                               uint16_t *system_name,
+                               uint32_t access_mask,
+                               struct policy_handle *handle,
+                               WERROR *werror)
 {
        struct winreg_OpenHKPN r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.system_name = system_name;
        r.in.access_mask = access_mask;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_OpenHKPN, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_OPENHKPN, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_WINREG,
+                               &ndr_table_winreg,
+                               NDR_WINREG_OPENHKPN,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_OpenHKPN, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *handle = *r.out.handle;
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_winreg_QueryMultipleValues2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror)
+NTSTATUS rpccli_winreg_QueryMultipleValues2(struct rpc_pipe_client *cli,
+                                           TALLOC_CTX *mem_ctx,
+                                           WERROR *werror)
 {
        struct winreg_QueryMultipleValues2 r;
        NTSTATUS status;
-       
+
        /* In parameters */
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_QueryMultipleValues2, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_QUERYMULTIPLEVALUES2, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_WINREG,
+                               &ndr_table_winreg,
+                               NDR_WINREG_QUERYMULTIPLEVALUES2,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_QueryMultipleValues2, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
index 48934e1286f75ff7be02d322177a486037872512..9ba46884d504cf9894fcf029787fbead9d250a63 100644 (file)
 #include "librpc/gen_ndr/ndr_winreg.h"
 #ifndef __CLI_WINREG__
 #define __CLI_WINREG__
-NTSTATUS rpccli_winreg_OpenHKCR(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle, WERROR *werror);
-NTSTATUS rpccli_winreg_OpenHKCU(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle, WERROR *werror);
-NTSTATUS rpccli_winreg_OpenHKLM(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle, WERROR *werror);
-NTSTATUS rpccli_winreg_OpenHKPD(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle, WERROR *werror);
-NTSTATUS rpccli_winreg_OpenHKU(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle, WERROR *werror);
-NTSTATUS rpccli_winreg_CloseKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, WERROR *werror);
-NTSTATUS rpccli_winreg_CreateKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String name, struct winreg_String keyclass, uint32_t options, uint32_t access_mask, struct winreg_SecBuf *secdesc, struct policy_handle *new_handle, enum winreg_CreateAction *action_taken, WERROR *werror);
-NTSTATUS rpccli_winreg_DeleteKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String key, WERROR *werror);
-NTSTATUS rpccli_winreg_DeleteValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String value, WERROR *werror);
-NTSTATUS rpccli_winreg_EnumKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t enum_index, struct winreg_StringBuf *name, struct winreg_StringBuf *keyclass, NTTIME *last_changed_time, WERROR *werror);
-NTSTATUS rpccli_winreg_EnumValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t enum_index, struct winreg_ValNameBuf *name, enum winreg_Type *type, uint8_t *value, uint32_t *size, uint32_t *length, WERROR *werror);
-NTSTATUS rpccli_winreg_FlushKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, WERROR *werror);
-NTSTATUS rpccli_winreg_GetKeySecurity(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t sec_info, struct KeySecurityData *sd, WERROR *werror);
-NTSTATUS rpccli_winreg_LoadKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String *keyname, struct winreg_String *filename, WERROR *werror);
-NTSTATUS rpccli_winreg_NotifyChangeKeyValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint8_t watch_subtree, uint32_t notify_filter, uint32_t unknown, struct winreg_String string1, struct winreg_String string2, uint32_t unknown2, WERROR *werror);
-NTSTATUS rpccli_winreg_OpenKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *parent_handle, struct winreg_String keyname, uint32_t unknown, uint32_t access_mask, struct policy_handle *handle, WERROR *werror);
-NTSTATUS rpccli_winreg_QueryInfoKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String *classname, uint32_t *num_subkeys, uint32_t *max_subkeylen, uint32_t *max_classlen, uint32_t *num_values, uint32_t *max_valnamelen, uint32_t *max_valbufsize, uint32_t *secdescsize, NTTIME *last_changed_time, WERROR *werror);
-NTSTATUS rpccli_winreg_QueryValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String value_name, enum winreg_Type *type, uint8_t *data, uint32_t *data_size, uint32_t *value_length, WERROR *werror);
-NTSTATUS rpccli_winreg_ReplaceKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror);
-NTSTATUS rpccli_winreg_RestoreKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String *filename, uint32_t flags, WERROR *werror);
-NTSTATUS rpccli_winreg_SaveKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String *filename, struct KeySecurityAttribute *sec_attrib, WERROR *werror);
-NTSTATUS rpccli_winreg_SetKeySecurity(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t access_mask, struct KeySecurityData *sd, WERROR *werror);
-NTSTATUS rpccli_winreg_SetValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String name, enum winreg_Type type, uint8_t *data, uint32_t size, WERROR *werror);
-NTSTATUS rpccli_winreg_UnLoadKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror);
-NTSTATUS rpccli_winreg_InitiateSystemShutdown(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *hostname, struct initshutdown_String *message, uint32_t timeout, uint8_t force_apps, uint8_t reboot, WERROR *werror);
-NTSTATUS rpccli_winreg_AbortSystemShutdown(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *server, WERROR *werror);
-NTSTATUS rpccli_winreg_GetVersion(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t *version, WERROR *werror);
-NTSTATUS rpccli_winreg_OpenHKCC(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle, WERROR *werror);
-NTSTATUS rpccli_winreg_OpenHKDD(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle, WERROR *werror);
-NTSTATUS rpccli_winreg_QueryMultipleValues(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *key_handle, struct QueryMultipleValue *values, uint32_t num_values, uint8_t *buffer, uint32_t *buffer_size, WERROR *werror);
-NTSTATUS rpccli_winreg_InitiateSystemShutdownEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *hostname, struct initshutdown_String *message, uint32_t timeout, uint8_t force_apps, uint8_t reboot, uint32_t reason, WERROR *werror);
-NTSTATUS rpccli_winreg_SaveKeyEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror);
-NTSTATUS rpccli_winreg_OpenHKPT(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle, WERROR *werror);
-NTSTATUS rpccli_winreg_OpenHKPN(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle, WERROR *werror);
-NTSTATUS rpccli_winreg_QueryMultipleValues2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror);
+NTSTATUS rpccli_winreg_OpenHKCR(struct rpc_pipe_client *cli,
+                               TALLOC_CTX *mem_ctx,
+                               uint16_t *system_name,
+                               uint32_t access_mask,
+                               struct policy_handle *handle,
+                               WERROR *werror);
+NTSTATUS rpccli_winreg_OpenHKCU(struct rpc_pipe_client *cli,
+                               TALLOC_CTX *mem_ctx,
+                               uint16_t *system_name,
+                               uint32_t access_mask,
+                               struct policy_handle *handle,
+                               WERROR *werror);
+NTSTATUS rpccli_winreg_OpenHKLM(struct rpc_pipe_client *cli,
+                               TALLOC_CTX *mem_ctx,
+                               uint16_t *system_name,
+                               uint32_t access_mask,
+                               struct policy_handle *handle,
+                               WERROR *werror);
+NTSTATUS rpccli_winreg_OpenHKPD(struct rpc_pipe_client *cli,
+                               TALLOC_CTX *mem_ctx,
+                               uint16_t *system_name,
+                               uint32_t access_mask,
+                               struct policy_handle *handle,
+                               WERROR *werror);
+NTSTATUS rpccli_winreg_OpenHKU(struct rpc_pipe_client *cli,
+                              TALLOC_CTX *mem_ctx,
+                              uint16_t *system_name,
+                              uint32_t access_mask,
+                              struct policy_handle *handle,
+                              WERROR *werror);
+NTSTATUS rpccli_winreg_CloseKey(struct rpc_pipe_client *cli,
+                               TALLOC_CTX *mem_ctx,
+                               struct policy_handle *handle,
+                               WERROR *werror);
+NTSTATUS rpccli_winreg_CreateKey(struct rpc_pipe_client *cli,
+                                TALLOC_CTX *mem_ctx,
+                                struct policy_handle *handle,
+                                struct winreg_String name,
+                                struct winreg_String keyclass,
+                                uint32_t options,
+                                uint32_t access_mask,
+                                struct winreg_SecBuf *secdesc,
+                                struct policy_handle *new_handle,
+                                enum winreg_CreateAction *action_taken,
+                                WERROR *werror);
+NTSTATUS rpccli_winreg_DeleteKey(struct rpc_pipe_client *cli,
+                                TALLOC_CTX *mem_ctx,
+                                struct policy_handle *handle,
+                                struct winreg_String key,
+                                WERROR *werror);
+NTSTATUS rpccli_winreg_DeleteValue(struct rpc_pipe_client *cli,
+                                  TALLOC_CTX *mem_ctx,
+                                  struct policy_handle *handle,
+                                  struct winreg_String value,
+                                  WERROR *werror);
+NTSTATUS rpccli_winreg_EnumKey(struct rpc_pipe_client *cli,
+                              TALLOC_CTX *mem_ctx,
+                              struct policy_handle *handle,
+                              uint32_t enum_index,
+                              struct winreg_StringBuf *name,
+                              struct winreg_StringBuf *keyclass,
+                              NTTIME *last_changed_time,
+                              WERROR *werror);
+NTSTATUS rpccli_winreg_EnumValue(struct rpc_pipe_client *cli,
+                                TALLOC_CTX *mem_ctx,
+                                struct policy_handle *handle,
+                                uint32_t enum_index,
+                                struct winreg_ValNameBuf *name,
+                                enum winreg_Type *type,
+                                uint8_t *value,
+                                uint32_t *size,
+                                uint32_t *length,
+                                WERROR *werror);
+NTSTATUS rpccli_winreg_FlushKey(struct rpc_pipe_client *cli,
+                               TALLOC_CTX *mem_ctx,
+                               struct policy_handle *handle,
+                               WERROR *werror);
+NTSTATUS rpccli_winreg_GetKeySecurity(struct rpc_pipe_client *cli,
+                                     TALLOC_CTX *mem_ctx,
+                                     struct policy_handle *handle,
+                                     uint32_t sec_info,
+                                     struct KeySecurityData *sd,
+                                     WERROR *werror);
+NTSTATUS rpccli_winreg_LoadKey(struct rpc_pipe_client *cli,
+                              TALLOC_CTX *mem_ctx,
+                              struct policy_handle *handle,
+                              struct winreg_String *keyname,
+                              struct winreg_String *filename,
+                              WERROR *werror);
+NTSTATUS rpccli_winreg_NotifyChangeKeyValue(struct rpc_pipe_client *cli,
+                                           TALLOC_CTX *mem_ctx,
+                                           struct policy_handle *handle,
+                                           uint8_t watch_subtree,
+                                           uint32_t notify_filter,
+                                           uint32_t unknown,
+                                           struct winreg_String string1,
+                                           struct winreg_String string2,
+                                           uint32_t unknown2,
+                                           WERROR *werror);
+NTSTATUS rpccli_winreg_OpenKey(struct rpc_pipe_client *cli,
+                              TALLOC_CTX *mem_ctx,
+                              struct policy_handle *parent_handle,
+                              struct winreg_String keyname,
+                              uint32_t unknown,
+                              uint32_t access_mask,
+                              struct policy_handle *handle,
+                              WERROR *werror);
+NTSTATUS rpccli_winreg_QueryInfoKey(struct rpc_pipe_client *cli,
+                                   TALLOC_CTX *mem_ctx,
+                                   struct policy_handle *handle,
+                                   struct winreg_String *classname,
+                                   uint32_t *num_subkeys,
+                                   uint32_t *max_subkeylen,
+                                   uint32_t *max_classlen,
+                                   uint32_t *num_values,
+                                   uint32_t *max_valnamelen,
+                                   uint32_t *max_valbufsize,
+                                   uint32_t *secdescsize,
+                                   NTTIME *last_changed_time,
+                                   WERROR *werror);
+NTSTATUS rpccli_winreg_QueryValue(struct rpc_pipe_client *cli,
+                                 TALLOC_CTX *mem_ctx,
+                                 struct policy_handle *handle,
+                                 struct winreg_String value_name,
+                                 enum winreg_Type *type,
+                                 uint8_t *data,
+                                 uint32_t *data_size,
+                                 uint32_t *value_length,
+                                 WERROR *werror);
+NTSTATUS rpccli_winreg_ReplaceKey(struct rpc_pipe_client *cli,
+                                 TALLOC_CTX *mem_ctx,
+                                 WERROR *werror);
+NTSTATUS rpccli_winreg_RestoreKey(struct rpc_pipe_client *cli,
+                                 TALLOC_CTX *mem_ctx,
+                                 struct policy_handle *handle,
+                                 struct winreg_String *filename,
+                                 uint32_t flags,
+                                 WERROR *werror);
+NTSTATUS rpccli_winreg_SaveKey(struct rpc_pipe_client *cli,
+                              TALLOC_CTX *mem_ctx,
+                              struct policy_handle *handle,
+                              struct winreg_String *filename,
+                              struct KeySecurityAttribute *sec_attrib,
+                              WERROR *werror);
+NTSTATUS rpccli_winreg_SetKeySecurity(struct rpc_pipe_client *cli,
+                                     TALLOC_CTX *mem_ctx,
+                                     struct policy_handle *handle,
+                                     uint32_t access_mask,
+                                     struct KeySecurityData *sd,
+                                     WERROR *werror);
+NTSTATUS rpccli_winreg_SetValue(struct rpc_pipe_client *cli,
+                               TALLOC_CTX *mem_ctx,
+                               struct policy_handle *handle,
+                               struct winreg_String name,
+                               enum winreg_Type type,
+                               uint8_t *data,
+                               uint32_t size,
+                               WERROR *werror);
+NTSTATUS rpccli_winreg_UnLoadKey(struct rpc_pipe_client *cli,
+                                TALLOC_CTX *mem_ctx,
+                                WERROR *werror);
+NTSTATUS rpccli_winreg_InitiateSystemShutdown(struct rpc_pipe_client *cli,
+                                             TALLOC_CTX *mem_ctx,
+                                             uint16_t *hostname,
+                                             struct initshutdown_String *message,
+                                             uint32_t timeout,
+                                             uint8_t force_apps,
+                                             uint8_t reboot,
+                                             WERROR *werror);
+NTSTATUS rpccli_winreg_AbortSystemShutdown(struct rpc_pipe_client *cli,
+                                          TALLOC_CTX *mem_ctx,
+                                          uint16_t *server,
+                                          WERROR *werror);
+NTSTATUS rpccli_winreg_GetVersion(struct rpc_pipe_client *cli,
+                                 TALLOC_CTX *mem_ctx,
+                                 struct policy_handle *handle,
+                                 uint32_t *version,
+                                 WERROR *werror);
+NTSTATUS rpccli_winreg_OpenHKCC(struct rpc_pipe_client *cli,
+                               TALLOC_CTX *mem_ctx,
+                               uint16_t *system_name,
+                               uint32_t access_mask,
+                               struct policy_handle *handle,
+                               WERROR *werror);
+NTSTATUS rpccli_winreg_OpenHKDD(struct rpc_pipe_client *cli,
+                               TALLOC_CTX *mem_ctx,
+                               uint16_t *system_name,
+                               uint32_t access_mask,
+                               struct policy_handle *handle,
+                               WERROR *werror);
+NTSTATUS rpccli_winreg_QueryMultipleValues(struct rpc_pipe_client *cli,
+                                          TALLOC_CTX *mem_ctx,
+                                          struct policy_handle *key_handle,
+                                          struct QueryMultipleValue *values,
+                                          uint32_t num_values,
+                                          uint8_t *buffer,
+                                          uint32_t *buffer_size,
+                                          WERROR *werror);
+NTSTATUS rpccli_winreg_InitiateSystemShutdownEx(struct rpc_pipe_client *cli,
+                                               TALLOC_CTX *mem_ctx,
+                                               uint16_t *hostname,
+                                               struct initshutdown_String *message,
+                                               uint32_t timeout,
+                                               uint8_t force_apps,
+                                               uint8_t reboot,
+                                               uint32_t reason,
+                                               WERROR *werror);
+NTSTATUS rpccli_winreg_SaveKeyEx(struct rpc_pipe_client *cli,
+                                TALLOC_CTX *mem_ctx,
+                                WERROR *werror);
+NTSTATUS rpccli_winreg_OpenHKPT(struct rpc_pipe_client *cli,
+                               TALLOC_CTX *mem_ctx,
+                               uint16_t *system_name,
+                               uint32_t access_mask,
+                               struct policy_handle *handle,
+                               WERROR *werror);
+NTSTATUS rpccli_winreg_OpenHKPN(struct rpc_pipe_client *cli,
+                               TALLOC_CTX *mem_ctx,
+                               uint16_t *system_name,
+                               uint32_t access_mask,
+                               struct policy_handle *handle,
+                               WERROR *werror);
+NTSTATUS rpccli_winreg_QueryMultipleValues2(struct rpc_pipe_client *cli,
+                                           TALLOC_CTX *mem_ctx,
+                                           WERROR *werror);
 #endif /* __CLI_WINREG__ */
index fbdc93ed2a5b96ac2ddaf6c0a5e5431786d4d6c1..581a49814686a9e2a988f353c11f447146747769 100644 (file)
 #include "includes.h"
 #include "librpc/gen_ndr/cli_wkssvc.h"
 
-NTSTATUS rpccli_wkssvc_NetWkstaGetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, uint32_t level, union wkssvc_NetWkstaInfo *info, WERROR *werror)
+NTSTATUS rpccli_wkssvc_NetWkstaGetInfo(struct rpc_pipe_client *cli,
+                                      TALLOC_CTX *mem_ctx,
+                                      const char *server_name,
+                                      uint32_t level,
+                                      union wkssvc_NetWkstaInfo *info,
+                                      WERROR *werror)
 {
        struct wkssvc_NetWkstaGetInfo r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_name = server_name;
        r.in.level = level;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(wkssvc_NetWkstaGetInfo, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETWKSTAGETINFO, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_WKSSVC,
+                               &ndr_table_wkssvc,
+                               NDR_WKSSVC_NETWKSTAGETINFO,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(wkssvc_NetWkstaGetInfo, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *info = *r.out.info;
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_wkssvc_NetWkstaSetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, uint32_t level, union wkssvc_NetWkstaInfo *info, uint32_t *parm_error, WERROR *werror)
+NTSTATUS rpccli_wkssvc_NetWkstaSetInfo(struct rpc_pipe_client *cli,
+                                      TALLOC_CTX *mem_ctx,
+                                      const char *server_name,
+                                      uint32_t level,
+                                      union wkssvc_NetWkstaInfo *info,
+                                      uint32_t *parm_error,
+                                      WERROR *werror)
 {
        struct wkssvc_NetWkstaSetInfo r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_name = server_name;
        r.in.level = level;
        r.in.info = info;
        r.in.parm_error = parm_error;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(wkssvc_NetWkstaSetInfo, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETWKSTASETINFO, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_WKSSVC,
+                               &ndr_table_wkssvc,
+                               NDR_WKSSVC_NETWKSTASETINFO,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(wkssvc_NetWkstaSetInfo, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *parm_error = *r.out.parm_error;
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_wkssvc_NetWkstaEnumUsers(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, struct wkssvc_NetWkstaEnumUsersInfo *info, uint32_t prefmaxlen, uint32_t *entries_read, uint32_t *resume_handle, WERROR *werror)
+NTSTATUS rpccli_wkssvc_NetWkstaEnumUsers(struct rpc_pipe_client *cli,
+                                        TALLOC_CTX *mem_ctx,
+                                        const char *server_name,
+                                        struct wkssvc_NetWkstaEnumUsersInfo *info,
+                                        uint32_t prefmaxlen,
+                                        uint32_t *entries_read,
+                                        uint32_t *resume_handle,
+                                        WERROR *werror)
 {
        struct wkssvc_NetWkstaEnumUsers r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_name = server_name;
        r.in.info = info;
        r.in.prefmaxlen = prefmaxlen;
        r.in.resume_handle = resume_handle;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(wkssvc_NetWkstaEnumUsers, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETWKSTAENUMUSERS, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_WKSSVC,
+                               &ndr_table_wkssvc,
+                               NDR_WKSSVC_NETWKSTAENUMUSERS,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(wkssvc_NetWkstaEnumUsers, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *info = *r.out.info;
        *entries_read = *r.out.entries_read;
        if (resume_handle && r.out.resume_handle) {
                *resume_handle = *r.out.resume_handle;
        }
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_wkssvc_NetrWkstaUserGetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *unknown, uint32_t level, union wkssvc_NetrWkstaUserInfo *info, WERROR *werror)
+NTSTATUS rpccli_wkssvc_NetrWkstaUserGetInfo(struct rpc_pipe_client *cli,
+                                           TALLOC_CTX *mem_ctx,
+                                           const char *unknown,
+                                           uint32_t level,
+                                           union wkssvc_NetrWkstaUserInfo *info,
+                                           WERROR *werror)
 {
        struct wkssvc_NetrWkstaUserGetInfo r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.unknown = unknown;
        r.in.level = level;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(wkssvc_NetrWkstaUserGetInfo, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRWKSTAUSERGETINFO, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_WKSSVC,
+                               &ndr_table_wkssvc,
+                               NDR_WKSSVC_NETRWKSTAUSERGETINFO,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(wkssvc_NetrWkstaUserGetInfo, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *info = *r.out.info;
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_wkssvc_NetrWkstaUserSetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *unknown, uint32_t level, union wkssvc_NetrWkstaUserInfo *info, uint32_t *parm_err, WERROR *werror)
+NTSTATUS rpccli_wkssvc_NetrWkstaUserSetInfo(struct rpc_pipe_client *cli,
+                                           TALLOC_CTX *mem_ctx,
+                                           const char *unknown,
+                                           uint32_t level,
+                                           union wkssvc_NetrWkstaUserInfo *info,
+                                           uint32_t *parm_err,
+                                           WERROR *werror)
 {
        struct wkssvc_NetrWkstaUserSetInfo r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.unknown = unknown;
        r.in.level = level;
        r.in.info = info;
        r.in.parm_err = parm_err;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(wkssvc_NetrWkstaUserSetInfo, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRWKSTAUSERSETINFO, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_WKSSVC,
+                               &ndr_table_wkssvc,
+                               NDR_WKSSVC_NETRWKSTAUSERSETINFO,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(wkssvc_NetrWkstaUserSetInfo, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        if (parm_err && r.out.parm_err) {
                *parm_err = *r.out.parm_err;
        }
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_wkssvc_NetWkstaTransportEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, struct wkssvc_NetWkstaTransportInfo *info, uint32_t max_buffer, uint32_t *total_entries, uint32_t *resume_handle, WERROR *werror)
+NTSTATUS rpccli_wkssvc_NetWkstaTransportEnum(struct rpc_pipe_client *cli,
+                                            TALLOC_CTX *mem_ctx,
+                                            const char *server_name,
+                                            struct wkssvc_NetWkstaTransportInfo *info,
+                                            uint32_t max_buffer,
+                                            uint32_t *total_entries,
+                                            uint32_t *resume_handle,
+                                            WERROR *werror)
 {
        struct wkssvc_NetWkstaTransportEnum r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_name = server_name;
        r.in.info = info;
        r.in.max_buffer = max_buffer;
        r.in.resume_handle = resume_handle;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(wkssvc_NetWkstaTransportEnum, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETWKSTATRANSPORTENUM, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_WKSSVC,
+                               &ndr_table_wkssvc,
+                               NDR_WKSSVC_NETWKSTATRANSPORTENUM,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(wkssvc_NetWkstaTransportEnum, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *info = *r.out.info;
        *total_entries = *r.out.total_entries;
        if (resume_handle && r.out.resume_handle) {
                *resume_handle = *r.out.resume_handle;
        }
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_wkssvc_NetrWkstaTransportAdd(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, uint32_t level, struct wkssvc_NetWkstaTransportInfo0 *info0, uint32_t *parm_err, WERROR *werror)
+NTSTATUS rpccli_wkssvc_NetrWkstaTransportAdd(struct rpc_pipe_client *cli,
+                                            TALLOC_CTX *mem_ctx,
+                                            const char *server_name,
+                                            uint32_t level,
+                                            struct wkssvc_NetWkstaTransportInfo0 *info0,
+                                            uint32_t *parm_err,
+                                            WERROR *werror)
 {
        struct wkssvc_NetrWkstaTransportAdd r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_name = server_name;
        r.in.level = level;
        r.in.info0 = info0;
        r.in.parm_err = parm_err;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(wkssvc_NetrWkstaTransportAdd, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRWKSTATRANSPORTADD, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_WKSSVC,
+                               &ndr_table_wkssvc,
+                               NDR_WKSSVC_NETRWKSTATRANSPORTADD,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(wkssvc_NetrWkstaTransportAdd, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        if (parm_err && r.out.parm_err) {
                *parm_err = *r.out.parm_err;
        }
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_wkssvc_NetrWkstaTransportDel(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *transport_name, uint32_t unknown3, WERROR *werror)
+NTSTATUS rpccli_wkssvc_NetrWkstaTransportDel(struct rpc_pipe_client *cli,
+                                            TALLOC_CTX *mem_ctx,
+                                            const char *server_name,
+                                            const char *transport_name,
+                                            uint32_t unknown3,
+                                            WERROR *werror)
 {
        struct wkssvc_NetrWkstaTransportDel r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_name = server_name;
        r.in.transport_name = transport_name;
        r.in.unknown3 = unknown3;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(wkssvc_NetrWkstaTransportDel, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRWKSTATRANSPORTDEL, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_WKSSVC,
+                               &ndr_table_wkssvc,
+                               NDR_WKSSVC_NETRWKSTATRANSPORTDEL,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(wkssvc_NetrWkstaTransportDel, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_wkssvc_NetrUseAdd(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, uint32_t level, union wkssvc_NetrUseGetInfoCtr *ctr, uint32_t *parm_err, WERROR *werror)
+NTSTATUS rpccli_wkssvc_NetrUseAdd(struct rpc_pipe_client *cli,
+                                 TALLOC_CTX *mem_ctx,
+                                 const char *server_name,
+                                 uint32_t level,
+                                 union wkssvc_NetrUseGetInfoCtr *ctr,
+                                 uint32_t *parm_err,
+                                 WERROR *werror)
 {
        struct wkssvc_NetrUseAdd r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_name = server_name;
        r.in.level = level;
        r.in.ctr = ctr;
        r.in.parm_err = parm_err;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(wkssvc_NetrUseAdd, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRUSEADD, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_WKSSVC,
+                               &ndr_table_wkssvc,
+                               NDR_WKSSVC_NETRUSEADD,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(wkssvc_NetrUseAdd, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        if (parm_err && r.out.parm_err) {
                *parm_err = *r.out.parm_err;
        }
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_wkssvc_NetrUseGetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *use_name, uint32_t level, union wkssvc_NetrUseGetInfoCtr *ctr, WERROR *werror)
+NTSTATUS rpccli_wkssvc_NetrUseGetInfo(struct rpc_pipe_client *cli,
+                                     TALLOC_CTX *mem_ctx,
+                                     const char *server_name,
+                                     const char *use_name,
+                                     uint32_t level,
+                                     union wkssvc_NetrUseGetInfoCtr *ctr,
+                                     WERROR *werror)
 {
        struct wkssvc_NetrUseGetInfo r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_name = server_name;
        r.in.use_name = use_name;
        r.in.level = level;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(wkssvc_NetrUseGetInfo, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRUSEGETINFO, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_WKSSVC,
+                               &ndr_table_wkssvc,
+                               NDR_WKSSVC_NETRUSEGETINFO,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(wkssvc_NetrUseGetInfo, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *ctr = *r.out.ctr;
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_wkssvc_NetrUseDel(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *use_name, uint32_t force_cond, WERROR *werror)
+NTSTATUS rpccli_wkssvc_NetrUseDel(struct rpc_pipe_client *cli,
+                                 TALLOC_CTX *mem_ctx,
+                                 const char *server_name,
+                                 const char *use_name,
+                                 uint32_t force_cond,
+                                 WERROR *werror)
 {
        struct wkssvc_NetrUseDel r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_name = server_name;
        r.in.use_name = use_name;
        r.in.force_cond = force_cond;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(wkssvc_NetrUseDel, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRUSEDEL, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_WKSSVC,
+                               &ndr_table_wkssvc,
+                               NDR_WKSSVC_NETRUSEDEL,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(wkssvc_NetrUseDel, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_wkssvc_NetrUseEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, struct wkssvc_NetrUseEnumInfo *info, uint32_t prefmaxlen, uint32_t *entries_read, uint32_t *resume_handle, WERROR *werror)
+NTSTATUS rpccli_wkssvc_NetrUseEnum(struct rpc_pipe_client *cli,
+                                  TALLOC_CTX *mem_ctx,
+                                  const char *server_name,
+                                  struct wkssvc_NetrUseEnumInfo *info,
+                                  uint32_t prefmaxlen,
+                                  uint32_t *entries_read,
+                                  uint32_t *resume_handle,
+                                  WERROR *werror)
 {
        struct wkssvc_NetrUseEnum r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_name = server_name;
        r.in.info = info;
        r.in.prefmaxlen = prefmaxlen;
        r.in.resume_handle = resume_handle;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(wkssvc_NetrUseEnum, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRUSEENUM, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_WKSSVC,
+                               &ndr_table_wkssvc,
+                               NDR_WKSSVC_NETRUSEENUM,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(wkssvc_NetrUseEnum, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *info = *r.out.info;
        *entries_read = *r.out.entries_read;
        if (resume_handle && r.out.resume_handle) {
                *resume_handle = *r.out.resume_handle;
        }
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_wkssvc_NetrMessageBufferSend(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *message_name, const char *message_sender_name, uint8_t *message_buffer, uint32_t message_size, WERROR *werror)
+NTSTATUS rpccli_wkssvc_NetrMessageBufferSend(struct rpc_pipe_client *cli,
+                                            TALLOC_CTX *mem_ctx,
+                                            const char *server_name,
+                                            const char *message_name,
+                                            const char *message_sender_name,
+                                            uint8_t *message_buffer,
+                                            uint32_t message_size,
+                                            WERROR *werror)
 {
        struct wkssvc_NetrMessageBufferSend r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_name = server_name;
        r.in.message_name = message_name;
        r.in.message_sender_name = message_sender_name;
        r.in.message_buffer = message_buffer;
        r.in.message_size = message_size;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(wkssvc_NetrMessageBufferSend, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRMESSAGEBUFFERSEND, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_WKSSVC,
+                               &ndr_table_wkssvc,
+                               NDR_WKSSVC_NETRMESSAGEBUFFERSEND,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(wkssvc_NetrMessageBufferSend, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_wkssvc_NetrWorkstationStatisticsGet(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *unknown2, uint32_t unknown3, uint32_t unknown4, struct wkssvc_NetrWorkstationStatistics **info, WERROR *werror)
+NTSTATUS rpccli_wkssvc_NetrWorkstationStatisticsGet(struct rpc_pipe_client *cli,
+                                                   TALLOC_CTX *mem_ctx,
+                                                   const char *server_name,
+                                                   const char *unknown2,
+                                                   uint32_t unknown3,
+                                                   uint32_t unknown4,
+                                                   struct wkssvc_NetrWorkstationStatistics **info,
+                                                   WERROR *werror)
 {
        struct wkssvc_NetrWorkstationStatisticsGet r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_name = server_name;
        r.in.unknown2 = unknown2;
        r.in.unknown3 = unknown3;
        r.in.unknown4 = unknown4;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(wkssvc_NetrWorkstationStatisticsGet, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRWORKSTATIONSTATISTICSGET, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_WKSSVC,
+                               &ndr_table_wkssvc,
+                               NDR_WKSSVC_NETRWORKSTATIONSTATISTICSGET,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(wkssvc_NetrWorkstationStatisticsGet, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *info = *r.out.info;
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_wkssvc_NetrLogonDomainNameAdd(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *domain_name, WERROR *werror)
+NTSTATUS rpccli_wkssvc_NetrLogonDomainNameAdd(struct rpc_pipe_client *cli,
+                                             TALLOC_CTX *mem_ctx,
+                                             const char *domain_name,
+                                             WERROR *werror)
 {
        struct wkssvc_NetrLogonDomainNameAdd r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.domain_name = domain_name;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(wkssvc_NetrLogonDomainNameAdd, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRLOGONDOMAINNAMEADD, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_WKSSVC,
+                               &ndr_table_wkssvc,
+                               NDR_WKSSVC_NETRLOGONDOMAINNAMEADD,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(wkssvc_NetrLogonDomainNameAdd, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_wkssvc_NetrLogonDomainNameDel(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *domain_name, WERROR *werror)
+NTSTATUS rpccli_wkssvc_NetrLogonDomainNameDel(struct rpc_pipe_client *cli,
+                                             TALLOC_CTX *mem_ctx,
+                                             const char *domain_name,
+                                             WERROR *werror)
 {
        struct wkssvc_NetrLogonDomainNameDel r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.domain_name = domain_name;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(wkssvc_NetrLogonDomainNameDel, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRLOGONDOMAINNAMEDEL, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_WKSSVC,
+                               &ndr_table_wkssvc,
+                               NDR_WKSSVC_NETRLOGONDOMAINNAMEDEL,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(wkssvc_NetrLogonDomainNameDel, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_wkssvc_NetrJoinDomain(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *domain_name, const char *account_ou, const char *Account, const char *password, uint32_t join_flags, WERROR *werror)
+NTSTATUS rpccli_wkssvc_NetrJoinDomain(struct rpc_pipe_client *cli,
+                                     TALLOC_CTX *mem_ctx,
+                                     const char *server_name,
+                                     const char *domain_name,
+                                     const char *account_ou,
+                                     const char *Account,
+                                     const char *password,
+                                     uint32_t join_flags,
+                                     WERROR *werror)
 {
        struct wkssvc_NetrJoinDomain r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_name = server_name;
        r.in.domain_name = domain_name;
@@ -627,228 +838,311 @@ NTSTATUS rpccli_wkssvc_NetrJoinDomain(struct rpc_pipe_client *cli, TALLOC_CTX *m
        r.in.Account = Account;
        r.in.password = password;
        r.in.join_flags = join_flags;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(wkssvc_NetrJoinDomain, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRJOINDOMAIN, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_WKSSVC,
+                               &ndr_table_wkssvc,
+                               NDR_WKSSVC_NETRJOINDOMAIN,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(wkssvc_NetrJoinDomain, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_wkssvc_NetrUnjoinDomain(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *Account, const char *password, uint32_t unjoin_flags, WERROR *werror)
+NTSTATUS rpccli_wkssvc_NetrUnjoinDomain(struct rpc_pipe_client *cli,
+                                       TALLOC_CTX *mem_ctx,
+                                       const char *server_name,
+                                       const char *Account,
+                                       const char *password,
+                                       uint32_t unjoin_flags,
+                                       WERROR *werror)
 {
        struct wkssvc_NetrUnjoinDomain r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_name = server_name;
        r.in.Account = Account;
        r.in.password = password;
        r.in.unjoin_flags = unjoin_flags;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(wkssvc_NetrUnjoinDomain, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRUNJOINDOMAIN, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_WKSSVC,
+                               &ndr_table_wkssvc,
+                               NDR_WKSSVC_NETRUNJOINDOMAIN,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(wkssvc_NetrUnjoinDomain, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_wkssvc_NetrRenameMachineInDomain(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *NewMachineName, const char *Account, const char *password, uint32_t RenameOptions, WERROR *werror)
+NTSTATUS rpccli_wkssvc_NetrRenameMachineInDomain(struct rpc_pipe_client *cli,
+                                                TALLOC_CTX *mem_ctx,
+                                                const char *server_name,
+                                                const char *NewMachineName,
+                                                const char *Account,
+                                                const char *password,
+                                                uint32_t RenameOptions,
+                                                WERROR *werror)
 {
        struct wkssvc_NetrRenameMachineInDomain r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_name = server_name;
        r.in.NewMachineName = NewMachineName;
        r.in.Account = Account;
        r.in.password = password;
        r.in.RenameOptions = RenameOptions;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(wkssvc_NetrRenameMachineInDomain, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRRENAMEMACHINEINDOMAIN, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_WKSSVC,
+                               &ndr_table_wkssvc,
+                               NDR_WKSSVC_NETRRENAMEMACHINEINDOMAIN,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(wkssvc_NetrRenameMachineInDomain, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_wkssvc_NetrValidateName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *name, const char *Account, const char *Password, enum wkssvc_NetValidateNameType name_type, WERROR *werror)
+NTSTATUS rpccli_wkssvc_NetrValidateName(struct rpc_pipe_client *cli,
+                                       TALLOC_CTX *mem_ctx,
+                                       const char *server_name,
+                                       const char *name,
+                                       const char *Account,
+                                       const char *Password,
+                                       enum wkssvc_NetValidateNameType name_type,
+                                       WERROR *werror)
 {
        struct wkssvc_NetrValidateName r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_name = server_name;
        r.in.name = name;
        r.in.Account = Account;
        r.in.Password = Password;
        r.in.name_type = name_type;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(wkssvc_NetrValidateName, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRVALIDATENAME, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_WKSSVC,
+                               &ndr_table_wkssvc,
+                               NDR_WKSSVC_NETRVALIDATENAME,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(wkssvc_NetrValidateName, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_wkssvc_NetrGetJoinInformation(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char **name_buffer, enum wkssvc_NetJoinStatus *name_type, WERROR *werror)
+NTSTATUS rpccli_wkssvc_NetrGetJoinInformation(struct rpc_pipe_client *cli,
+                                             TALLOC_CTX *mem_ctx,
+                                             const char *server_name,
+                                             const char **name_buffer,
+                                             enum wkssvc_NetJoinStatus *name_type,
+                                             WERROR *werror)
 {
        struct wkssvc_NetrGetJoinInformation r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_name = server_name;
        r.in.name_buffer = name_buffer;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(wkssvc_NetrGetJoinInformation, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRGETJOININFORMATION, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_WKSSVC,
+                               &ndr_table_wkssvc,
+                               NDR_WKSSVC_NETRGETJOININFORMATION,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(wkssvc_NetrGetJoinInformation, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *name_buffer = *r.out.name_buffer;
        *name_type = *r.out.name_type;
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_wkssvc_NetrGetJoinableOus(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *domain_name, const char *Account, const char *unknown, uint32_t *num_ous, const char ***ous, WERROR *werror)
+NTSTATUS rpccli_wkssvc_NetrGetJoinableOus(struct rpc_pipe_client *cli,
+                                         TALLOC_CTX *mem_ctx,
+                                         const char *server_name,
+                                         const char *domain_name,
+                                         const char *Account,
+                                         const char *unknown,
+                                         uint32_t *num_ous,
+                                         const char ***ous,
+                                         WERROR *werror)
 {
        struct wkssvc_NetrGetJoinableOus r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_name = server_name;
        r.in.domain_name = domain_name;
        r.in.Account = Account;
        r.in.unknown = unknown;
        r.in.num_ous = num_ous;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(wkssvc_NetrGetJoinableOus, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRGETJOINABLEOUS, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_WKSSVC,
+                               &ndr_table_wkssvc,
+                               NDR_WKSSVC_NETRGETJOINABLEOUS,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(wkssvc_NetrGetJoinableOus, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *num_ous = *r.out.num_ous;
        memcpy(ous, r.out.ous, *r.in.num_ous);
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_wkssvc_NetrJoinDomain2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *domain_name, const char *account_ou, const char *admin_account, struct wkssvc_PasswordBuffer *encrypted_password, uint32_t join_flags, WERROR *werror)
+NTSTATUS rpccli_wkssvc_NetrJoinDomain2(struct rpc_pipe_client *cli,
+                                      TALLOC_CTX *mem_ctx,
+                                      const char *server_name,
+                                      const char *domain_name,
+                                      const char *account_ou,
+                                      const char *admin_account,
+                                      struct wkssvc_PasswordBuffer *encrypted_password,
+                                      uint32_t join_flags,
+                                      WERROR *werror)
 {
        struct wkssvc_NetrJoinDomain2 r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_name = server_name;
        r.in.domain_name = domain_name;
@@ -856,334 +1150,452 @@ NTSTATUS rpccli_wkssvc_NetrJoinDomain2(struct rpc_pipe_client *cli, TALLOC_CTX *
        r.in.admin_account = admin_account;
        r.in.encrypted_password = encrypted_password;
        r.in.join_flags = join_flags;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(wkssvc_NetrJoinDomain2, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRJOINDOMAIN2, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_WKSSVC,
+                               &ndr_table_wkssvc,
+                               NDR_WKSSVC_NETRJOINDOMAIN2,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(wkssvc_NetrJoinDomain2, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_wkssvc_NetrUnjoinDomain2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *account, struct wkssvc_PasswordBuffer *encrypted_password, uint32_t unjoin_flags, WERROR *werror)
+NTSTATUS rpccli_wkssvc_NetrUnjoinDomain2(struct rpc_pipe_client *cli,
+                                        TALLOC_CTX *mem_ctx,
+                                        const char *server_name,
+                                        const char *account,
+                                        struct wkssvc_PasswordBuffer *encrypted_password,
+                                        uint32_t unjoin_flags,
+                                        WERROR *werror)
 {
        struct wkssvc_NetrUnjoinDomain2 r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_name = server_name;
        r.in.account = account;
        r.in.encrypted_password = encrypted_password;
        r.in.unjoin_flags = unjoin_flags;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(wkssvc_NetrUnjoinDomain2, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRUNJOINDOMAIN2, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_WKSSVC,
+                               &ndr_table_wkssvc,
+                               NDR_WKSSVC_NETRUNJOINDOMAIN2,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(wkssvc_NetrUnjoinDomain2, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_wkssvc_NetrRenameMachineInDomain2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *NewMachineName, const char *Account, struct wkssvc_PasswordBuffer *EncryptedPassword, uint32_t RenameOptions, WERROR *werror)
+NTSTATUS rpccli_wkssvc_NetrRenameMachineInDomain2(struct rpc_pipe_client *cli,
+                                                 TALLOC_CTX *mem_ctx,
+                                                 const char *server_name,
+                                                 const char *NewMachineName,
+                                                 const char *Account,
+                                                 struct wkssvc_PasswordBuffer *EncryptedPassword,
+                                                 uint32_t RenameOptions,
+                                                 WERROR *werror)
 {
        struct wkssvc_NetrRenameMachineInDomain2 r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_name = server_name;
        r.in.NewMachineName = NewMachineName;
        r.in.Account = Account;
        r.in.EncryptedPassword = EncryptedPassword;
        r.in.RenameOptions = RenameOptions;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(wkssvc_NetrRenameMachineInDomain2, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRRENAMEMACHINEINDOMAIN2, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_WKSSVC,
+                               &ndr_table_wkssvc,
+                               NDR_WKSSVC_NETRRENAMEMACHINEINDOMAIN2,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(wkssvc_NetrRenameMachineInDomain2, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_wkssvc_NetrValidateName2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *name, const char *Account, struct wkssvc_PasswordBuffer *EncryptedPassword, enum wkssvc_NetValidateNameType name_type, WERROR *werror)
+NTSTATUS rpccli_wkssvc_NetrValidateName2(struct rpc_pipe_client *cli,
+                                        TALLOC_CTX *mem_ctx,
+                                        const char *server_name,
+                                        const char *name,
+                                        const char *Account,
+                                        struct wkssvc_PasswordBuffer *EncryptedPassword,
+                                        enum wkssvc_NetValidateNameType name_type,
+                                        WERROR *werror)
 {
        struct wkssvc_NetrValidateName2 r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_name = server_name;
        r.in.name = name;
        r.in.Account = Account;
        r.in.EncryptedPassword = EncryptedPassword;
        r.in.name_type = name_type;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(wkssvc_NetrValidateName2, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRVALIDATENAME2, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_WKSSVC,
+                               &ndr_table_wkssvc,
+                               NDR_WKSSVC_NETRVALIDATENAME2,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(wkssvc_NetrValidateName2, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_wkssvc_NetrGetJoinableOus2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *domain_name, const char *Account, struct wkssvc_PasswordBuffer *EncryptedPassword, uint32_t *num_ous, const char ***ous, WERROR *werror)
+NTSTATUS rpccli_wkssvc_NetrGetJoinableOus2(struct rpc_pipe_client *cli,
+                                          TALLOC_CTX *mem_ctx,
+                                          const char *server_name,
+                                          const char *domain_name,
+                                          const char *Account,
+                                          struct wkssvc_PasswordBuffer *EncryptedPassword,
+                                          uint32_t *num_ous,
+                                          const char ***ous,
+                                          WERROR *werror)
 {
        struct wkssvc_NetrGetJoinableOus2 r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_name = server_name;
        r.in.domain_name = domain_name;
        r.in.Account = Account;
        r.in.EncryptedPassword = EncryptedPassword;
        r.in.num_ous = num_ous;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(wkssvc_NetrGetJoinableOus2, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRGETJOINABLEOUS2, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_WKSSVC,
+                               &ndr_table_wkssvc,
+                               NDR_WKSSVC_NETRGETJOINABLEOUS2,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(wkssvc_NetrGetJoinableOus2, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *num_ous = *r.out.num_ous;
        memcpy(ous, r.out.ous, *r.in.num_ous);
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_wkssvc_NetrAddAlternateComputerName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *NewAlternateMachineName, const char *Account, struct wkssvc_PasswordBuffer *EncryptedPassword, uint32_t Reserved, WERROR *werror)
+NTSTATUS rpccli_wkssvc_NetrAddAlternateComputerName(struct rpc_pipe_client *cli,
+                                                   TALLOC_CTX *mem_ctx,
+                                                   const char *server_name,
+                                                   const char *NewAlternateMachineName,
+                                                   const char *Account,
+                                                   struct wkssvc_PasswordBuffer *EncryptedPassword,
+                                                   uint32_t Reserved,
+                                                   WERROR *werror)
 {
        struct wkssvc_NetrAddAlternateComputerName r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_name = server_name;
        r.in.NewAlternateMachineName = NewAlternateMachineName;
        r.in.Account = Account;
        r.in.EncryptedPassword = EncryptedPassword;
        r.in.Reserved = Reserved;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(wkssvc_NetrAddAlternateComputerName, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRADDALTERNATECOMPUTERNAME, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_WKSSVC,
+                               &ndr_table_wkssvc,
+                               NDR_WKSSVC_NETRADDALTERNATECOMPUTERNAME,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(wkssvc_NetrAddAlternateComputerName, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_wkssvc_NetrRemoveAlternateComputerName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *AlternateMachineNameToRemove, const char *Account, struct wkssvc_PasswordBuffer *EncryptedPassword, uint32_t Reserved, WERROR *werror)
+NTSTATUS rpccli_wkssvc_NetrRemoveAlternateComputerName(struct rpc_pipe_client *cli,
+                                                      TALLOC_CTX *mem_ctx,
+                                                      const char *server_name,
+                                                      const char *AlternateMachineNameToRemove,
+                                                      const char *Account,
+                                                      struct wkssvc_PasswordBuffer *EncryptedPassword,
+                                                      uint32_t Reserved,
+                                                      WERROR *werror)
 {
        struct wkssvc_NetrRemoveAlternateComputerName r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_name = server_name;
        r.in.AlternateMachineNameToRemove = AlternateMachineNameToRemove;
        r.in.Account = Account;
        r.in.EncryptedPassword = EncryptedPassword;
        r.in.Reserved = Reserved;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(wkssvc_NetrRemoveAlternateComputerName, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRREMOVEALTERNATECOMPUTERNAME, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_WKSSVC,
+                               &ndr_table_wkssvc,
+                               NDR_WKSSVC_NETRREMOVEALTERNATECOMPUTERNAME,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(wkssvc_NetrRemoveAlternateComputerName, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_wkssvc_NetrSetPrimaryComputername(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *primary_name, const char *Account, struct wkssvc_PasswordBuffer *EncryptedPassword, uint32_t Reserved, WERROR *werror)
+NTSTATUS rpccli_wkssvc_NetrSetPrimaryComputername(struct rpc_pipe_client *cli,
+                                                 TALLOC_CTX *mem_ctx,
+                                                 const char *server_name,
+                                                 const char *primary_name,
+                                                 const char *Account,
+                                                 struct wkssvc_PasswordBuffer *EncryptedPassword,
+                                                 uint32_t Reserved,
+                                                 WERROR *werror)
 {
        struct wkssvc_NetrSetPrimaryComputername r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_name = server_name;
        r.in.primary_name = primary_name;
        r.in.Account = Account;
        r.in.EncryptedPassword = EncryptedPassword;
        r.in.Reserved = Reserved;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(wkssvc_NetrSetPrimaryComputername, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRSETPRIMARYCOMPUTERNAME, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_WKSSVC,
+                               &ndr_table_wkssvc,
+                               NDR_WKSSVC_NETRSETPRIMARYCOMPUTERNAME,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(wkssvc_NetrSetPrimaryComputername, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
-NTSTATUS rpccli_wkssvc_NetrEnumerateComputerNames(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, enum wkssvc_ComputerNameType name_type, uint32_t Reserved, struct wkssvc_ComputerNamesCtr **ctr, WERROR *werror)
+NTSTATUS rpccli_wkssvc_NetrEnumerateComputerNames(struct rpc_pipe_client *cli,
+                                                 TALLOC_CTX *mem_ctx,
+                                                 const char *server_name,
+                                                 enum wkssvc_ComputerNameType name_type,
+                                                 uint32_t Reserved,
+                                                 struct wkssvc_ComputerNamesCtr **ctr,
+                                                 WERROR *werror)
 {
        struct wkssvc_NetrEnumerateComputerNames r;
        NTSTATUS status;
-       
+
        /* In parameters */
        r.in.server_name = server_name;
        r.in.name_type = name_type;
        r.in.Reserved = Reserved;
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(wkssvc_NetrEnumerateComputerNames, &r);
-       
-       status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRENUMERATECOMPUTERNAMES, &r);
-       
+       }
+
+       status = cli_do_rpc_ndr(cli,
+                               mem_ctx,
+                               PI_WKSSVC,
+                               &ndr_table_wkssvc,
+                               NDR_WKSSVC_NETRENUMERATECOMPUTERNAMES,
+                               &r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(wkssvc_NetrEnumerateComputerNames, &r);
-       
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       
+
        /* Return variables */
        *ctr = *r.out.ctr;
-       
+
        /* Return result */
        if (werror) {
                *werror = r.out.result;
        }
-       
+
        return werror_to_ntstatus(r.out.result);
 }
 
index 4ead050d56afab62c649efc63ef5da3d862de3db..89012daf21f2a45cff358fe3b128381ac7898f82 100644 (file)
 #include "librpc/gen_ndr/ndr_wkssvc.h"
 #ifndef __CLI_WKSSVC__
 #define __CLI_WKSSVC__
-NTSTATUS rpccli_wkssvc_NetWkstaGetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, uint32_t level, union wkssvc_NetWkstaInfo *info, WERROR *werror);
-NTSTATUS rpccli_wkssvc_NetWkstaSetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, uint32_t level, union wkssvc_NetWkstaInfo *info, uint32_t *parm_error, WERROR *werror);
-NTSTATUS rpccli_wkssvc_NetWkstaEnumUsers(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, struct wkssvc_NetWkstaEnumUsersInfo *info, uint32_t prefmaxlen, uint32_t *entries_read, uint32_t *resume_handle, WERROR *werror);
-NTSTATUS rpccli_wkssvc_NetrWkstaUserGetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *unknown, uint32_t level, union wkssvc_NetrWkstaUserInfo *info, WERROR *werror);
-NTSTATUS rpccli_wkssvc_NetrWkstaUserSetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *unknown, uint32_t level, union wkssvc_NetrWkstaUserInfo *info, uint32_t *parm_err, WERROR *werror);
-NTSTATUS rpccli_wkssvc_NetWkstaTransportEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, struct wkssvc_NetWkstaTransportInfo *info, uint32_t max_buffer, uint32_t *total_entries, uint32_t *resume_handle, WERROR *werror);
-NTSTATUS rpccli_wkssvc_NetrWkstaTransportAdd(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, uint32_t level, struct wkssvc_NetWkstaTransportInfo0 *info0, uint32_t *parm_err, WERROR *werror);
-NTSTATUS rpccli_wkssvc_NetrWkstaTransportDel(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *transport_name, uint32_t unknown3, WERROR *werror);
-NTSTATUS rpccli_wkssvc_NetrUseAdd(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, uint32_t level, union wkssvc_NetrUseGetInfoCtr *ctr, uint32_t *parm_err, WERROR *werror);
-NTSTATUS rpccli_wkssvc_NetrUseGetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *use_name, uint32_t level, union wkssvc_NetrUseGetInfoCtr *ctr, WERROR *werror);
-NTSTATUS rpccli_wkssvc_NetrUseDel(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *use_name, uint32_t force_cond, WERROR *werror);
-NTSTATUS rpccli_wkssvc_NetrUseEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, struct wkssvc_NetrUseEnumInfo *info, uint32_t prefmaxlen, uint32_t *entries_read, uint32_t *resume_handle, WERROR *werror);
-NTSTATUS rpccli_wkssvc_NetrMessageBufferSend(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *message_name, const char *message_sender_name, uint8_t *message_buffer, uint32_t message_size, WERROR *werror);
-NTSTATUS rpccli_wkssvc_NetrWorkstationStatisticsGet(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *unknown2, uint32_t unknown3, uint32_t unknown4, struct wkssvc_NetrWorkstationStatistics **info, WERROR *werror);
-NTSTATUS rpccli_wkssvc_NetrLogonDomainNameAdd(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *domain_name, WERROR *werror);
-NTSTATUS rpccli_wkssvc_NetrLogonDomainNameDel(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *domain_name, WERROR *werror);
-NTSTATUS rpccli_wkssvc_NetrJoinDomain(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *domain_name, const char *account_ou, const char *Account, const char *password, uint32_t join_flags, WERROR *werror);
-NTSTATUS rpccli_wkssvc_NetrUnjoinDomain(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *Account, const char *password, uint32_t unjoin_flags, WERROR *werror);
-NTSTATUS rpccli_wkssvc_NetrRenameMachineInDomain(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *NewMachineName, const char *Account, const char *password, uint32_t RenameOptions, WERROR *werror);
-NTSTATUS rpccli_wkssvc_NetrValidateName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *name, const char *Account, const char *Password, enum wkssvc_NetValidateNameType name_type, WERROR *werror);
-NTSTATUS rpccli_wkssvc_NetrGetJoinInformation(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char **name_buffer, enum wkssvc_NetJoinStatus *name_type, WERROR *werror);
-NTSTATUS rpccli_wkssvc_NetrGetJoinableOus(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *domain_name, const char *Account, const char *unknown, uint32_t *num_ous, const char ***ous, WERROR *werror);
-NTSTATUS rpccli_wkssvc_NetrJoinDomain2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *domain_name, const char *account_ou, const char *admin_account, struct wkssvc_PasswordBuffer *encrypted_password, uint32_t join_flags, WERROR *werror);
-NTSTATUS rpccli_wkssvc_NetrUnjoinDomain2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *account, struct wkssvc_PasswordBuffer *encrypted_password, uint32_t unjoin_flags, WERROR *werror);
-NTSTATUS rpccli_wkssvc_NetrRenameMachineInDomain2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *NewMachineName, const char *Account, struct wkssvc_PasswordBuffer *EncryptedPassword, uint32_t RenameOptions, WERROR *werror);
-NTSTATUS rpccli_wkssvc_NetrValidateName2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *name, const char *Account, struct wkssvc_PasswordBuffer *EncryptedPassword, enum wkssvc_NetValidateNameType name_type, WERROR *werror);
-NTSTATUS rpccli_wkssvc_NetrGetJoinableOus2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *domain_name, const char *Account, struct wkssvc_PasswordBuffer *EncryptedPassword, uint32_t *num_ous, const char ***ous, WERROR *werror);
-NTSTATUS rpccli_wkssvc_NetrAddAlternateComputerName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *NewAlternateMachineName, const char *Account, struct wkssvc_PasswordBuffer *EncryptedPassword, uint32_t Reserved, WERROR *werror);
-NTSTATUS rpccli_wkssvc_NetrRemoveAlternateComputerName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *AlternateMachineNameToRemove, const char *Account, struct wkssvc_PasswordBuffer *EncryptedPassword, uint32_t Reserved, WERROR *werror);
-NTSTATUS rpccli_wkssvc_NetrSetPrimaryComputername(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *primary_name, const char *Account, struct wkssvc_PasswordBuffer *EncryptedPassword, uint32_t Reserved, WERROR *werror);
-NTSTATUS rpccli_wkssvc_NetrEnumerateComputerNames(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, enum wkssvc_ComputerNameType name_type, uint32_t Reserved, struct wkssvc_ComputerNamesCtr **ctr, WERROR *werror);
+NTSTATUS rpccli_wkssvc_NetWkstaGetInfo(struct rpc_pipe_client *cli,
+                                      TALLOC_CTX *mem_ctx,
+                                      const char *server_name,
+                                      uint32_t level,
+                                      union wkssvc_NetWkstaInfo *info,
+                                      WERROR *werror);
+NTSTATUS rpccli_wkssvc_NetWkstaSetInfo(struct rpc_pipe_client *cli,
+                                      TALLOC_CTX *mem_ctx,
+                                      const char *server_name,
+                                      uint32_t level,
+                                      union wkssvc_NetWkstaInfo *info,
+                                      uint32_t *parm_error,
+                                      WERROR *werror);
+NTSTATUS rpccli_wkssvc_NetWkstaEnumUsers(struct rpc_pipe_client *cli,
+                                        TALLOC_CTX *mem_ctx,
+                                        const char *server_name,
+                                        struct wkssvc_NetWkstaEnumUsersInfo *info,
+                                        uint32_t prefmaxlen,
+                                        uint32_t *entries_read,
+                                        uint32_t *resume_handle,
+                                        WERROR *werror);
+NTSTATUS rpccli_wkssvc_NetrWkstaUserGetInfo(struct rpc_pipe_client *cli,
+                                           TALLOC_CTX *mem_ctx,
+                                           const char *unknown,
+                                           uint32_t level,
+                                           union wkssvc_NetrWkstaUserInfo *info,
+                                           WERROR *werror);
+NTSTATUS rpccli_wkssvc_NetrWkstaUserSetInfo(struct rpc_pipe_client *cli,
+                                           TALLOC_CTX *mem_ctx,
+                                           const char *unknown,
+                                           uint32_t level,
+                                           union wkssvc_NetrWkstaUserInfo *info,
+                                           uint32_t *parm_err,
+                                           WERROR *werror);
+NTSTATUS rpccli_wkssvc_NetWkstaTransportEnum(struct rpc_pipe_client *cli,
+                                            TALLOC_CTX *mem_ctx,
+                                            const char *server_name,
+                                            struct wkssvc_NetWkstaTransportInfo *info,
+                                            uint32_t max_buffer,
+                                            uint32_t *total_entries,
+                                            uint32_t *resume_handle,
+                                            WERROR *werror);
+NTSTATUS rpccli_wkssvc_NetrWkstaTransportAdd(struct rpc_pipe_client *cli,
+                                            TALLOC_CTX *mem_ctx,
+                                            const char *server_name,
+                                            uint32_t level,
+                                            struct wkssvc_NetWkstaTransportInfo0 *info0,
+                                            uint32_t *parm_err,
+                                            WERROR *werror);
+NTSTATUS rpccli_wkssvc_NetrWkstaTransportDel(struct rpc_pipe_client *cli,
+                                            TALLOC_CTX *mem_ctx,
+                                            const char *server_name,
+                                            const char *transport_name,
+                                            uint32_t unknown3,
+                                            WERROR *werror);
+NTSTATUS rpccli_wkssvc_NetrUseAdd(struct rpc_pipe_client *cli,
+                                 TALLOC_CTX *mem_ctx,
+                                 const char *server_name,
+                                 uint32_t level,
+                                 union wkssvc_NetrUseGetInfoCtr *ctr,
+                                 uint32_t *parm_err,
+                                 WERROR *werror);
+NTSTATUS rpccli_wkssvc_NetrUseGetInfo(struct rpc_pipe_client *cli,
+                                     TALLOC_CTX *mem_ctx,
+                                     const char *server_name,
+                                     const char *use_name,
+                                     uint32_t level,
+                                     union wkssvc_NetrUseGetInfoCtr *ctr,
+                                     WERROR *werror);
+NTSTATUS rpccli_wkssvc_NetrUseDel(struct rpc_pipe_client *cli,
+                                 TALLOC_CTX *mem_ctx,
+                                 const char *server_name,
+                                 const char *use_name,
+                                 uint32_t force_cond,
+                                 WERROR *werror);
+NTSTATUS rpccli_wkssvc_NetrUseEnum(struct rpc_pipe_client *cli,
+                                  TALLOC_CTX *mem_ctx,
+                                  const char *server_name,
+                                  struct wkssvc_NetrUseEnumInfo *info,
+                                  uint32_t prefmaxlen,
+                                  uint32_t *entries_read,
+                                  uint32_t *resume_handle,
+                                  WERROR *werror);
+NTSTATUS rpccli_wkssvc_NetrMessageBufferSend(struct rpc_pipe_client *cli,
+                                            TALLOC_CTX *mem_ctx,
+                                            const char *server_name,
+                                            const char *message_name,
+                                            const char *message_sender_name,
+                                            uint8_t *message_buffer,
+                                            uint32_t message_size,
+                                            WERROR *werror);
+NTSTATUS rpccli_wkssvc_NetrWorkstationStatisticsGet(struct rpc_pipe_client *cli,
+                                                   TALLOC_CTX *mem_ctx,
+                                                   const char *server_name,
+                                                   const char *unknown2,
+                                                   uint32_t unknown3,
+                                                   uint32_t unknown4,
+                                                   struct wkssvc_NetrWorkstationStatistics **info,
+                                                   WERROR *werror);
+NTSTATUS rpccli_wkssvc_NetrLogonDomainNameAdd(struct rpc_pipe_client *cli,
+                                             TALLOC_CTX *mem_ctx,
+                                             const char *domain_name,
+                                             WERROR *werror);
+NTSTATUS rpccli_wkssvc_NetrLogonDomainNameDel(struct rpc_pipe_client *cli,
+                                             TALLOC_CTX *mem_ctx,
+                                             const char *domain_name,
+                                             WERROR *werror);
+NTSTATUS rpccli_wkssvc_NetrJoinDomain(struct rpc_pipe_client *cli,
+                                     TALLOC_CTX *mem_ctx,
+                                     const char *server_name,
+                                     const char *domain_name,
+                                     const char *account_ou,
+                                     const char *Account,
+                                     const char *password,
+                                     uint32_t join_flags,
+                                     WERROR *werror);
+NTSTATUS rpccli_wkssvc_NetrUnjoinDomain(struct rpc_pipe_client *cli,
+                                       TALLOC_CTX *mem_ctx,
+                                       const char *server_name,
+                                       const char *Account,
+                                       const char *password,
+                                       uint32_t unjoin_flags,
+                                       WERROR *werror);
+NTSTATUS rpccli_wkssvc_NetrRenameMachineInDomain(struct rpc_pipe_client *cli,
+                                                TALLOC_CTX *mem_ctx,
+                                                const char *server_name,
+                                                const char *NewMachineName,
+                                                const char *Account,
+                                                const char *password,
+                                                uint32_t RenameOptions,
+                                                WERROR *werror);
+NTSTATUS rpccli_wkssvc_NetrValidateName(struct rpc_pipe_client *cli,
+                                       TALLOC_CTX *mem_ctx,
+                                       const char *server_name,
+                                       const char *name,
+                                       const char *Account,
+                                       const char *Password,
+                                       enum wkssvc_NetValidateNameType name_type,
+                                       WERROR *werror);
+NTSTATUS rpccli_wkssvc_NetrGetJoinInformation(struct rpc_pipe_client *cli,
+                                             TALLOC_CTX *mem_ctx,
+                                             const char *server_name,
+                                             const char **name_buffer,
+                                             enum wkssvc_NetJoinStatus *name_type,
+                                             WERROR *werror);
+NTSTATUS rpccli_wkssvc_NetrGetJoinableOus(struct rpc_pipe_client *cli,
+                                         TALLOC_CTX *mem_ctx,
+                                         const char *server_name,
+                                         const char *domain_name,
+                                         const char *Account,
+                                         const char *unknown,
+                                         uint32_t *num_ous,
+                                         const char ***ous,
+                                         WERROR *werror);
+NTSTATUS rpccli_wkssvc_NetrJoinDomain2(struct rpc_pipe_client *cli,
+                                      TALLOC_CTX *mem_ctx,
+                                      const char *server_name,
+                                      const char *domain_name,
+                                      const char *account_ou,
+                                      const char *admin_account,
+                                      struct wkssvc_PasswordBuffer *encrypted_password,
+                                      uint32_t join_flags,
+                                      WERROR *werror);
+NTSTATUS rpccli_wkssvc_NetrUnjoinDomain2(struct rpc_pipe_client *cli,
+                                        TALLOC_CTX *mem_ctx,
+                                        const char *server_name,
+                                        const char *account,
+                                        struct wkssvc_PasswordBuffer *encrypted_password,
+                                        uint32_t unjoin_flags,
+                                        WERROR *werror);
+NTSTATUS rpccli_wkssvc_NetrRenameMachineInDomain2(struct rpc_pipe_client *cli,
+                                                 TALLOC_CTX *mem_ctx,
+                                                 const char *server_name,
+                                                 const char *NewMachineName,
+                                                 const char *Account,
+                                                 struct wkssvc_PasswordBuffer *EncryptedPassword,
+                                                 uint32_t RenameOptions,
+                                                 WERROR *werror);
+NTSTATUS rpccli_wkssvc_NetrValidateName2(struct rpc_pipe_client *cli,
+                                        TALLOC_CTX *mem_ctx,
+                                        const char *server_name,
+                                        const char *name,
+                                        const char *Account,
+                                        struct wkssvc_PasswordBuffer *EncryptedPassword,
+                                        enum wkssvc_NetValidateNameType name_type,
+                                        WERROR *werror);
+NTSTATUS rpccli_wkssvc_NetrGetJoinableOus2(struct rpc_pipe_client *cli,
+                                          TALLOC_CTX *mem_ctx,
+                                          const char *server_name,
+                                          const char *domain_name,
+                                          const char *Account,
+                                          struct wkssvc_PasswordBuffer *EncryptedPassword,
+                                          uint32_t *num_ous,
+                                          const char ***ous,
+                                          WERROR *werror);
+NTSTATUS rpccli_wkssvc_NetrAddAlternateComputerName(struct rpc_pipe_client *cli,
+                                                   TALLOC_CTX *mem_ctx,
+                                                   const char *server_name,
+                                                   const char *NewAlternateMachineName,
+                                                   const char *Account,
+                                                   struct wkssvc_PasswordBuffer *EncryptedPassword,
+                                                   uint32_t Reserved,
+                                                   WERROR *werror);
+NTSTATUS rpccli_wkssvc_NetrRemoveAlternateComputerName(struct rpc_pipe_client *cli,
+                                                      TALLOC_CTX *mem_ctx,
+                                                      const char *server_name,
+                                                      const char *AlternateMachineNameToRemove,
+                                                      const char *Account,
+                                                      struct wkssvc_PasswordBuffer *EncryptedPassword,
+                                                      uint32_t Reserved,
+                                                      WERROR *werror);
+NTSTATUS rpccli_wkssvc_NetrSetPrimaryComputername(struct rpc_pipe_client *cli,
+                                                 TALLOC_CTX *mem_ctx,
+                                                 const char *server_name,
+                                                 const char *primary_name,
+                                                 const char *Account,
+                                                 struct wkssvc_PasswordBuffer *EncryptedPassword,
+                                                 uint32_t Reserved,
+                                                 WERROR *werror);
+NTSTATUS rpccli_wkssvc_NetrEnumerateComputerNames(struct rpc_pipe_client *cli,
+                                                 TALLOC_CTX *mem_ctx,
+                                                 const char *server_name,
+                                                 enum wkssvc_ComputerNameType name_type,
+                                                 uint32_t Reserved,
+                                                 struct wkssvc_ComputerNamesCtr **ctr,
+                                                 WERROR *werror);
 #endif /* __CLI_WKSSVC__ */
index 58eb34f0deae143a590724c82dcff27d59e26682..dc11e70b599c6453698ed8568935fb4b08a4cd95 100644 (file)
@@ -6,14 +6,15 @@
 #define _HEADER_netdfs
 
 #define DFS_STORAGE_STATES     ( 0xf )
+enum dfs_ManagerVersion
 #ifndef USE_UINT_ENUMS
-enum dfs_ManagerVersion {
+ {
        DFS_MANAGER_VERSION_NT4=1,
        DFS_MANAGER_VERSION_W2K=2,
        DFS_MANAGER_VERSION_W2K3=4
 }
 #else
-enum dfs_ManagerVersion { __donnot_use_enum_dfs_ManagerVersion=0x7FFFFFFF}
+ { __donnot_use_enum_dfs_ManagerVersion=0x7FFFFFFF}
 #define DFS_MANAGER_VERSION_NT4 ( 1 )
 #define DFS_MANAGER_VERSION_W2K ( 2 )
 #define DFS_MANAGER_VERSION_W2K3 ( 4 )
@@ -31,13 +32,11 @@ struct dfs_Info1 {
 /* bitmap dfs_VolumeState */
 #define DFS_VOLUME_STATE_OK ( 0x1 )
 #define DFS_VOLUME_STATE_INCONSISTENT ( 0x2 )
-#define DFS_VOLUME_STATE_OFFLINE ( 0x4 )
-#define DFS_VOLUME_STATE_ONLINE ( 0x8 )
+#define DFS_VOLUME_STATE_OFFLINE ( 0x3 )
+#define DFS_VOLUME_STATE_ONLINE ( 0x4 )
 #define DFS_VOLUME_STATE_STANDALONE ( DFS_VOLUME_FLAVOR_STANDALONE )
 #define DFS_VOLUME_STATE_AD_BLOB ( DFS_VOLUME_FLAVOR_AD_BLOB )
 
-;
-
 struct dfs_Info2 {
        const char *path;/* [unique,charset(UTF16)] */
        const char *comment;/* [unique,charset(UTF16)] */
@@ -50,8 +49,6 @@ struct dfs_Info2 {
 #define DFS_STORAGE_STATE_ONLINE ( 2 )
 #define DFS_STORAGE_STATE_ACTIVE ( 4 )
 
-;
-
 struct dfs_StorageInfo {
        uint32_t state;
        const char *server;/* [unique,charset(UTF16)] */
@@ -83,8 +80,6 @@ struct dfs_Info4 {
 #define DFS_PROPERTY_FLAG_TARGET_FAILBACK ( 0x08 )
 #define DFS_PROPERTY_FLAG_CLUSTER_ENABLED ( 0x10 )
 
-;
-
 struct dfs_Info5 {
        const char *path;/* [unique,charset(UTF16)] */
        const char *comment;/* [unique,charset(UTF16)] */
@@ -96,8 +91,9 @@ struct dfs_Info5 {
        uint32_t num_stores;
 };
 
+enum dfs_Target_PriorityClass
 #ifndef USE_UINT_ENUMS
-enum dfs_Target_PriorityClass {
+ {
        DFS_INVALID_PRIORITY_CLASS=-1,
        DFS_SITE_COST_NORMAL_PRIORITY_CLASS=0,
        DFS_GLOBAL_HIGH_PRIORITY_CLASS=1,
@@ -106,7 +102,7 @@ enum dfs_Target_PriorityClass {
        DFS_GLOBAL_LOW_PRIORITY_CLASS=4
 }
 #else
-enum dfs_Target_PriorityClass { __donnot_use_enum_dfs_Target_PriorityClass=0x7FFFFFFF}
+ { __donnot_use_enum_dfs_Target_PriorityClass=0x7FFFFFFF}
 #define DFS_INVALID_PRIORITY_CLASS ( -1 )
 #define DFS_SITE_COST_NORMAL_PRIORITY_CLASS ( 0 )
 #define DFS_GLOBAL_HIGH_PRIORITY_CLASS ( 1 )
@@ -180,13 +176,14 @@ struct dfs_Info200 {
        const char *dom_root;/* [unique,charset(UTF16)] */
 };
 
+enum dfs_VolumeFlavor
 #ifndef USE_UINT_ENUMS
-enum dfs_VolumeFlavor {
+ {
        DFS_VOLUME_FLAVOR_STANDALONE=0x100,
        DFS_VOLUME_FLAVOR_AD_BLOB=0x200
 }
 #else
-enum dfs_VolumeFlavor { __donnot_use_enum_dfs_VolumeFlavor=0x7FFFFFFF}
+ { __donnot_use_enum_dfs_VolumeFlavor=0x7FFFFFFF}
 #define DFS_VOLUME_FLAVOR_STANDALONE ( 0x100 )
 #define DFS_VOLUME_FLAVOR_AD_BLOB ( 0x200 )
 #endif
@@ -235,6 +232,16 @@ struct dfs_EnumArray4 {
        struct dfs_Info4 *s;/* [unique,size_is(count)] */
 };
 
+struct dfs_EnumArray5 {
+       uint32_t count;
+       struct dfs_Info5 *s;/* [unique,size_is(count)] */
+};
+
+struct dfs_EnumArray6 {
+       uint32_t count;
+       struct dfs_Info6 *s;/* [unique,size_is(count)] */
+};
+
 struct dfs_EnumArray200 {
        uint32_t count;
        struct dfs_Info200 *s;/* [unique,size_is(count)] */
@@ -250,6 +257,8 @@ union dfs_EnumInfo {
        struct dfs_EnumArray2 *info2;/* [unique,case(2)] */
        struct dfs_EnumArray3 *info3;/* [unique,case(3)] */
        struct dfs_EnumArray4 *info4;/* [unique,case(4)] */
+       struct dfs_EnumArray5 *info5;/* [unique,case(5)] */
+       struct dfs_EnumArray6 *info6;/* [unique,case(6)] */
        struct dfs_EnumArray200 *info200;/* [unique,case(200)] */
        struct dfs_EnumArray300 *info300;/* [unique,case(300)] */
 };
@@ -482,6 +491,16 @@ struct dfs_AddStdRootForced {
 
 struct dfs_GetDcAddress {
        struct {
+               const char *servername;/* [charset(UTF16)] */
+               const char **server_fullname;/* [ref,charset(UTF16)] */
+               uint8_t *is_root;/* [ref] */
+               uint32_t *ttl;/* [ref] */
+       } in;
+
+       struct {
+               const char **server_fullname;/* [ref,charset(UTF16)] */
+               uint8_t *is_root;/* [ref] */
+               uint32_t *ttl;/* [ref] */
                WERROR result;
        } out;
 
@@ -489,6 +508,13 @@ struct dfs_GetDcAddress {
 
 
 struct dfs_SetDcAddress {
+       struct {
+               const char *servername;/* [charset(UTF16)] */
+               const char *server_fullname;/* [charset(UTF16)] */
+               uint32_t flags;
+               uint32_t ttl;
+       } in;
+
        struct {
                WERROR result;
        } out;
diff --git a/source/librpc/gen_ndr/dssetup.h b/source/librpc/gen_ndr/dssetup.h
new file mode 100644 (file)
index 0000000..d284a63
--- /dev/null
@@ -0,0 +1,211 @@
+/* header auto-generated by pidl */
+
+#include <stdint.h>
+
+#include "librpc/gen_ndr/misc.h"
+#ifndef _HEADER_dssetup
+#define _HEADER_dssetup
+
+enum dssetup_DsRole
+#ifndef USE_UINT_ENUMS
+ {
+       DS_ROLE_STANDALONE_WORKSTATION=0,
+       DS_ROLE_MEMBER_WORKSTATION=1,
+       DS_ROLE_STANDALONE_SERVER=2,
+       DS_ROLE_MEMBER_SERVER=3,
+       DS_ROLE_BACKUP_DC=4,
+       DS_ROLE_PRIMARY_DC=5
+}
+#else
+ { __donnot_use_enum_dssetup_DsRole=0x7FFFFFFF}
+#define DS_ROLE_STANDALONE_WORKSTATION ( 0 )
+#define DS_ROLE_MEMBER_WORKSTATION ( 1 )
+#define DS_ROLE_STANDALONE_SERVER ( 2 )
+#define DS_ROLE_MEMBER_SERVER ( 3 )
+#define DS_ROLE_BACKUP_DC ( 4 )
+#define DS_ROLE_PRIMARY_DC ( 5 )
+#endif
+;
+
+/* bitmap dssetup_DsRoleFlags */
+#define DS_ROLE_PRIMARY_DS_RUNNING ( 0x00000001 )
+#define DS_ROLE_PRIMARY_DS_MIXED_MODE ( 0x00000002 )
+#define DS_ROLE_UPGRADE_IN_PROGRESS ( 0x00000004 )
+#define DS_ROLE_PRIMARY_DOMAIN_GUID_PRESENT ( 0x01000000 )
+
+struct dssetup_DsRolePrimaryDomInfoBasic {
+       enum dssetup_DsRole role;
+       uint32_t flags;
+       const char *domain;/* [unique,charset(UTF16)] */
+       const char *dns_domain;/* [unique,charset(UTF16)] */
+       const char *forest;/* [unique,charset(UTF16)] */
+       struct GUID domain_guid;
+};
+
+enum dssetup_DsUpgrade
+#ifndef USE_UINT_ENUMS
+ {
+       DS_ROLE_NOT_UPGRADING=0,
+       DS_ROLE_UPGRADING=1
+}
+#else
+ { __donnot_use_enum_dssetup_DsUpgrade=0x7FFFFFFF}
+#define DS_ROLE_NOT_UPGRADING ( 0 )
+#define DS_ROLE_UPGRADING ( 1 )
+#endif
+;
+
+enum dssetup_DsPrevious
+#ifndef USE_UINT_ENUMS
+ {
+       DS_ROLE_PREVIOUS_UNKNOWN=0,
+       DS_ROLE_PREVIOUS_PRIMARY=1,
+       DS_ROLE_PREVIOUS_BACKUP=2
+}
+#else
+ { __donnot_use_enum_dssetup_DsPrevious=0x7FFFFFFF}
+#define DS_ROLE_PREVIOUS_UNKNOWN ( 0 )
+#define DS_ROLE_PREVIOUS_PRIMARY ( 1 )
+#define DS_ROLE_PREVIOUS_BACKUP ( 2 )
+#endif
+;
+
+struct dssetup_DsRoleUpgradeStatus {
+       enum dssetup_DsUpgrade upgrading;
+       enum dssetup_DsPrevious previous_role;
+};
+
+enum dssetup_DsRoleOp
+#ifndef USE_UINT_ENUMS
+ {
+       DS_ROLE_OP_IDLE=0,
+       DS_ROLE_OP_ACTIVE=1,
+       DS_ROLE_OP_NEEDS_REBOOT=2
+}
+#else
+ { __donnot_use_enum_dssetup_DsRoleOp=0x7FFFFFFF}
+#define DS_ROLE_OP_IDLE ( 0 )
+#define DS_ROLE_OP_ACTIVE ( 1 )
+#define DS_ROLE_OP_NEEDS_REBOOT ( 2 )
+#endif
+;
+
+struct dssetup_DsRoleOpStatus {
+       enum dssetup_DsRoleOp status;
+};
+
+enum dssetup_DsRoleInfoLevel
+#ifndef USE_UINT_ENUMS
+ {
+       DS_ROLE_BASIC_INFORMATION=1,
+       DS_ROLE_UPGRADE_STATUS=2,
+       DS_ROLE_OP_STATUS=3
+}
+#else
+ { __donnot_use_enum_dssetup_DsRoleInfoLevel=0x7FFFFFFF}
+#define DS_ROLE_BASIC_INFORMATION ( 1 )
+#define DS_ROLE_UPGRADE_STATUS ( 2 )
+#define DS_ROLE_OP_STATUS ( 3 )
+#endif
+;
+
+union dssetup_DsRoleInfo {
+       struct dssetup_DsRolePrimaryDomInfoBasic basic;/* [case(DS_ROLE_BASIC_INFORMATION)] */
+       struct dssetup_DsRoleUpgradeStatus upgrade;/* [case(DS_ROLE_UPGRADE_STATUS)] */
+       struct dssetup_DsRoleOpStatus opstatus;/* [case(DS_ROLE_OP_STATUS)] */
+}/* [switch_type(dssetup_DsRoleInfoLevel)] */;
+
+
+struct dssetup_DsRoleGetPrimaryDomainInformation {
+       struct {
+               enum dssetup_DsRoleInfoLevel level;
+       } in;
+
+       struct {
+               union dssetup_DsRoleInfo *info;/* [unique,switch_is(level)] */
+               WERROR result;
+       } out;
+
+};
+
+
+struct dssetup_DsRoleDnsNameToFlatName {
+       struct {
+               WERROR result;
+       } out;
+
+};
+
+
+struct dssetup_DsRoleDcAsDc {
+       struct {
+               WERROR result;
+       } out;
+
+};
+
+
+struct dssetup_DsRoleDcAsReplica {
+       struct {
+               WERROR result;
+       } out;
+
+};
+
+
+struct dssetup_DsRoleDemoteDc {
+       struct {
+               WERROR result;
+       } out;
+
+};
+
+
+struct dssetup_DsRoleGetDcOperationProgress {
+       struct {
+               WERROR result;
+       } out;
+
+};
+
+
+struct dssetup_DsRoleGetDcOperationResults {
+       struct {
+               WERROR result;
+       } out;
+
+};
+
+
+struct dssetup_DsRoleCancel {
+       struct {
+               WERROR result;
+       } out;
+
+};
+
+
+struct dssetup_DsRoleServerSaveStateForUpgrade {
+       struct {
+               WERROR result;
+       } out;
+
+};
+
+
+struct dssetup_DsRoleUpgradeDownlevelServer {
+       struct {
+               WERROR result;
+       } out;
+
+};
+
+
+struct dssetup_DsRoleAbortDownlevelServerUpgrade {
+       struct {
+               WERROR result;
+       } out;
+
+};
+
+#endif /* _HEADER_dssetup */
index 4b03578cdc10cbb4468c750d937793d41805aa16..c8b5b864224d882772eb8c08be8009112b38228c 100644 (file)
@@ -46,25 +46,27 @@ union echo_Info {
        struct echo_info7 info7;/* [case(7)] */
 }/* [switch_type(uint16)] */;
 
+enum echo_Enum1
 #ifndef USE_UINT_ENUMS
-enum echo_Enum1 {
+ {
        ECHO_ENUM1=1,
        ECHO_ENUM2=2
 }
 #else
-enum echo_Enum1 { __donnot_use_enum_echo_Enum1=0x7FFFFFFF}
+ { __donnot_use_enum_echo_Enum1=0x7FFFFFFF}
 #define ECHO_ENUM1 ( 1 )
 #define ECHO_ENUM2 ( 2 )
 #endif
 ;
 
+enum echo_Enum1_32
 #ifndef USE_UINT_ENUMS
-enum echo_Enum1_32 {
+ {
        ECHO_ENUM1_32=1,
        ECHO_ENUM2_32=2
 }
 #else
-enum echo_Enum1_32 { __donnot_use_enum_echo_Enum1_32=0x7FFFFFFF}
+ { __donnot_use_enum_echo_Enum1_32=0x7FFFFFFF}
 #define ECHO_ENUM1_32 ( 1 )
 #define ECHO_ENUM2_32 ( 2 )
 #endif
index 0fb5ed048e51602969d571e3e231991a15bc727b..d39269b32b2e66f03356891a06a76f6ab25d50d9 100644 (file)
@@ -8,8 +8,9 @@
 #define EPMAPPER_STATUS_NO_MORE_ENTRIES        ( 0x16c9a0d6 )
 #define EPMAPPER_STATUS_NO_MEMORY      ( 0x16C9A012 )
 #define EPMAPPER_STATUS_OK     ( 0 )
+enum epm_protocol
 #ifndef USE_UINT_ENUMS
-enum epm_protocol {
+ {
        EPM_PROTOCOL_DNET_NSP=0x04,
        EPM_PROTOCOL_OSI_TP4=0x05,
        EPM_PROTOCOL_OSI_CLNS=0x06,
@@ -38,7 +39,7 @@ enum epm_protocol {
        EPM_PROTOCOL_NULL=0x21
 }
 #else
-enum epm_protocol { __donnot_use_enum_epm_protocol=0x7FFFFFFF}
+ { __donnot_use_enum_epm_protocol=0x7FFFFFFF}
 #define EPM_PROTOCOL_DNET_NSP ( 0x04 )
 #define EPM_PROTOCOL_OSI_TP4 ( 0x05 )
 #define EPM_PROTOCOL_OSI_CLNS ( 0x06 )
index e13fb50a5d67fd34933524e3ae62fd6208de037c..656dadcc6cab5e916fd3becd60dbeabb718d5255 100644 (file)
@@ -13,8 +13,6 @@
 #define EVENTLOG_FORWARDS_READ ( 0x0004 )
 #define EVENTLOG_BACKWARDS_READ ( 0x0008 )
 
-;
-
 /* bitmap eventlogEventTypes */
 #define EVENTLOG_SUCCESS ( 0x0000 )
 #define EVENTLOG_ERROR_TYPE ( 0x0001 )
@@ -23,8 +21,6 @@
 #define EVENTLOG_AUDIT_SUCCESS ( 0x0008 )
 #define EVENTLOG_AUDIT_FAILURE ( 0x0010 )
 
-;
-
 struct eventlog_OpenUnknown0 {
        uint16_t unknown0;
        uint16_t unknown1;
index 665d435919b5518b1a047835185893146cc3393f..acfe98846fd6d2574c6c06b23e11a5d6c3a45a6e 100644 (file)
@@ -11,8 +11,8 @@ struct initshutdown_String_sub {
 };
 
 struct initshutdown_String {
-       uint16_t name_len;/* [value(strlen_m(r->name->name)*2)] */
-       uint16_t name_size;/* [value(strlen_m_term(r->name->name)*2)] */
+       uint16_t name_len;/* [value(strlen_m(name->name)*2)] */
+       uint16_t name_size;/* [value(strlen_m_term(name->name)*2)] */
        struct initshutdown_String_sub *name;/* [unique] */
 }/* [public] */;
 
diff --git a/source/librpc/gen_ndr/libnet_join.h b/source/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 */
index e356b9fc78d7bfa3f8d6f667e51ab377e12a039b..2657557d9072370b8837922107515e72d3f88624 100644 (file)
@@ -73,9 +73,55 @@ struct lsa_AuditLogInfo {
        uint32_t unknown;
 };
 
+enum lsa_PolicyAuditPolicy
+#ifndef USE_UINT_ENUMS
+ {
+       LSA_AUDIT_POLICY_NONE=0,
+       LSA_AUDIT_POLICY_SUCCESS=1,
+       LSA_AUDIT_POLICY_FAILURE=2,
+       LSA_AUDIT_POLICY_ALL=(LSA_AUDIT_POLICY_SUCCESS|LSA_AUDIT_POLICY_FAILURE),
+       LSA_AUDIT_POLICY_CLEAR=4
+}
+#else
+ { __donnot_use_enum_lsa_PolicyAuditPolicy=0x7FFFFFFF}
+#define LSA_AUDIT_POLICY_NONE ( 0 )
+#define LSA_AUDIT_POLICY_SUCCESS ( 1 )
+#define LSA_AUDIT_POLICY_FAILURE ( 2 )
+#define LSA_AUDIT_POLICY_ALL ( (LSA_AUDIT_POLICY_SUCCESS|LSA_AUDIT_POLICY_FAILURE) )
+#define LSA_AUDIT_POLICY_CLEAR ( 4 )
+#endif
+;
+
+enum lsa_PolicyAuditEventType
+#ifndef USE_UINT_ENUMS
+ {
+       LSA_AUDIT_CATEGORY_SYSTEM=0,
+       LSA_AUDIT_CATEGORY_LOGON=1,
+       LSA_AUDIT_CATEGORY_FILE_AND_OBJECT_ACCESS=2,
+       LSA_AUDIT_CATEGORY_USE_OF_USER_RIGHTS=3,
+       LSA_AUDIT_CATEGORY_PROCCESS_TRACKING=4,
+       LSA_AUDIT_CATEGORY_SECURITY_POLICY_CHANGES=5,
+       LSA_AUDIT_CATEGORY_ACCOUNT_MANAGEMENT=6,
+       LSA_AUDIT_CATEGORY_DIRECTORY_SERVICE_ACCESS=7,
+       LSA_AUDIT_CATEGORY_ACCOUNT_LOGON=8
+}
+#else
+ { __donnot_use_enum_lsa_PolicyAuditEventType=0x7FFFFFFF}
+#define LSA_AUDIT_CATEGORY_SYSTEM ( 0 )
+#define LSA_AUDIT_CATEGORY_LOGON ( 1 )
+#define LSA_AUDIT_CATEGORY_FILE_AND_OBJECT_ACCESS ( 2 )
+#define LSA_AUDIT_CATEGORY_USE_OF_USER_RIGHTS ( 3 )
+#define LSA_AUDIT_CATEGORY_PROCCESS_TRACKING ( 4 )
+#define LSA_AUDIT_CATEGORY_SECURITY_POLICY_CHANGES ( 5 )
+#define LSA_AUDIT_CATEGORY_ACCOUNT_MANAGEMENT ( 6 )
+#define LSA_AUDIT_CATEGORY_DIRECTORY_SERVICE_ACCESS ( 7 )
+#define LSA_AUDIT_CATEGORY_ACCOUNT_LOGON ( 8 )
+#endif
+;
+
 struct lsa_AuditEventsInfo {
        uint32_t auditing_mode;
-       uint32_t *settings;/* [unique,size_is(count)] */
+       enum lsa_PolicyAuditPolicy *settings;/* [unique,size_is(count)] */
        uint32_t count;
 };
 
@@ -130,8 +176,9 @@ struct lsa_DnsDomainInfo {
        struct dom_sid2 *sid;/* [unique] */
 };
 
+enum lsa_PolicyInfo
 #ifndef USE_UINT_ENUMS
-enum lsaPolicyInfo {
+ {
        LSA_POLICY_INFO_AUDIT_LOG=1,
        LSA_POLICY_INFO_AUDIT_EVENTS=2,
        LSA_POLICY_INFO_DOMAIN=3,
@@ -146,7 +193,7 @@ enum lsaPolicyInfo {
        LSA_POLICY_INFO_DNS=12
 }
 #else
-enum lsaPolicyInfo { __donnot_use_enum_lsaPolicyInfo=0x7FFFFFFF}
+ { __donnot_use_enum_lsa_PolicyInfo=0x7FFFFFFF}
 #define LSA_POLICY_INFO_AUDIT_LOG ( 1 )
 #define LSA_POLICY_INFO_AUDIT_EVENTS ( 2 )
 #define LSA_POLICY_INFO_DOMAIN ( 3 )
@@ -191,8 +238,9 @@ struct lsa_DomainList {
        struct lsa_DomainInfo *domains;/* [unique,size_is(count)] */
 };
 
+enum lsa_SidType
 #ifndef USE_UINT_ENUMS
-enum lsa_SidType {
+ {
        SID_NAME_USE_NONE=0,
        SID_NAME_USER=1,
        SID_NAME_DOM_GRP=2,
@@ -205,7 +253,7 @@ enum lsa_SidType {
        SID_NAME_COMPUTER=9
 }
 #else
-enum lsa_SidType { __donnot_use_enum_lsa_SidType=0x7FFFFFFF}
+ { __donnot_use_enum_lsa_SidType=0x7FFFFFFF}
 #define SID_NAME_USE_NONE ( 0 )
 #define SID_NAME_USER ( 1 )
 #define SID_NAME_DOM_GRP ( 2 )
@@ -236,6 +284,27 @@ struct lsa_RefDomainList {
        uint32_t max_size;
 };
 
+enum lsa_LookupNamesLevel
+#ifndef USE_UINT_ENUMS
+ {
+       LSA_LOOKUP_NAMES_ALL=1,
+       LSA_LOOKUP_NAMES_DOMAINS_ONLY=2,
+       LSA_LOOKUP_NAMES_PRIMARY_DOMAIN_ONLY=3,
+       LSA_LOOKUP_NAMES_UPLEVEL_TRUSTS_ONLY=4,
+       LSA_LOOKUP_NAMES_FOREST_TRUSTS_ONLY=5,
+       LSA_LOOKUP_NAMES_UPLEVEL_TRUSTS_ONLY2=6
+}
+#else
+ { __donnot_use_enum_lsa_LookupNamesLevel=0x7FFFFFFF}
+#define LSA_LOOKUP_NAMES_ALL ( 1 )
+#define LSA_LOOKUP_NAMES_DOMAINS_ONLY ( 2 )
+#define LSA_LOOKUP_NAMES_PRIMARY_DOMAIN_ONLY ( 3 )
+#define LSA_LOOKUP_NAMES_UPLEVEL_TRUSTS_ONLY ( 4 )
+#define LSA_LOOKUP_NAMES_FOREST_TRUSTS_ONLY ( 5 )
+#define LSA_LOOKUP_NAMES_UPLEVEL_TRUSTS_ONLY2 ( 6 )
+#endif
+;
+
 struct lsa_TranslatedName {
        enum lsa_SidType sid_type;
        struct lsa_String name;
@@ -269,8 +338,9 @@ struct lsa_DATA_BUF2 {
        uint8_t *data;/* [unique,size_is(size)] */
 }/* [flag(LIBNDR_PRINT_ARRAY_HEX)] */;
 
+enum lsa_TrustDomInfoEnum
 #ifndef USE_UINT_ENUMS
-enum lsa_TrustDomInfoEnum {
+ {
        LSA_TRUSTED_DOMAIN_INFO_NAME=1,
        LSA_TRUSTED_DOMAIN_INFO_CONTROLLERS_INFO=2,
        LSA_TRUSTED_DOMAIN_INFO_POSIX_OFFSET=3,
@@ -283,7 +353,7 @@ enum lsa_TrustDomInfoEnum {
        LSA_TRUSTED_DOMAIN_INFO_INFO_ALL=12
 }
 #else
-enum lsa_TrustDomInfoEnum { __donnot_use_enum_lsa_TrustDomInfoEnum=0x7FFFFFFF}
+ { __donnot_use_enum_lsa_TrustDomInfoEnum=0x7FFFFFFF}
 #define LSA_TRUSTED_DOMAIN_INFO_NAME ( 1 )
 #define LSA_TRUSTED_DOMAIN_INFO_CONTROLLERS_INFO ( 2 )
 #define LSA_TRUSTED_DOMAIN_INFO_POSIX_OFFSET ( 3 )
@@ -405,13 +475,14 @@ struct lsa_DomainInfoEfs {
        uint8_t *efs_blob;/* [unique,size_is(blob_size)] */
 };
 
+enum lsa_DomainInfoEnum
 #ifndef USE_UINT_ENUMS
-enum lsa_DomainInfoEnum {
+ {
        LSA_DOMAIN_INFO_POLICY_EFS=2,
        LSA_DOMAIN_INFO_POLICY_KERBEROS=3
 }
 #else
-enum lsa_DomainInfoEnum { __donnot_use_enum_lsa_DomainInfoEnum=0x7FFFFFFF}
+ { __donnot_use_enum_lsa_DomainInfoEnum=0x7FFFFFFF}
 #define LSA_DOMAIN_INFO_POLICY_EFS ( 2 )
 #define LSA_DOMAIN_INFO_POLICY_KERBEROS ( 3 )
 #endif
@@ -458,6 +529,53 @@ struct lsa_TransSidArray3 {
        struct lsa_TranslatedSid3 *sids;/* [unique,size_is(count)] */
 };
 
+struct lsa_ForestTrustBinaryData {
+       uint32_t length;/* [range(0 131072)] */
+       uint8_t *data;/* [unique,size_is(length)] */
+};
+
+struct lsa_ForestTrustDomainInfo {
+       struct dom_sid2 *domain_sid;/* [unique] */
+       struct lsa_StringLarge dns_domain_name;
+       struct lsa_StringLarge netbios_domain_name;
+};
+
+union lsa_ForestTrustData {
+       struct lsa_String top_level_name;/* [case(LSA_FOREST_TRUST_TOP_LEVEL_NAME)] */
+       struct lsa_StringLarge top_level_name_ex;/* [case(LSA_FOREST_TRUST_TOP_LEVEL_NAME_EX)] */
+       struct lsa_ForestTrustDomainInfo domain_info;/* [case(LSA_FOREST_TRUST_DOMAIN_INFO)] */
+       struct lsa_ForestTrustBinaryData data;/* [default] */
+}/* [switch_type(uint32)] */;
+
+enum lsa_ForestTrustRecordType
+#ifndef USE_UINT_ENUMS
+ {
+       LSA_FOREST_TRUST_TOP_LEVEL_NAME=0,
+       LSA_FOREST_TRUST_TOP_LEVEL_NAME_EX=1,
+       LSA_FOREST_TRUST_DOMAIN_INFO=2,
+       LSA_FOREST_TRUST_RECORD_TYPE_LAST=3
+}
+#else
+ { __donnot_use_enum_lsa_ForestTrustRecordType=0x7FFFFFFF}
+#define LSA_FOREST_TRUST_TOP_LEVEL_NAME ( 0 )
+#define LSA_FOREST_TRUST_TOP_LEVEL_NAME_EX ( 1 )
+#define LSA_FOREST_TRUST_DOMAIN_INFO ( 2 )
+#define LSA_FOREST_TRUST_RECORD_TYPE_LAST ( 3 )
+#endif
+;
+
+struct lsa_ForestTrustRecord {
+       uint32_t flags;
+       enum lsa_ForestTrustRecordType level;
+       uint64_t unknown;
+       union lsa_ForestTrustData forest_trust_data;/* [switch_is(level)] */
+};
+
+struct lsa_ForestTrustInformation {
+       uint32_t count;/* [range(0 4000)] */
+       struct lsa_ForestTrustRecord **entries;/* [unique,size_is(count)] */
+}/* [public] */;
+
 
 struct lsa_Close {
        struct {
@@ -548,7 +666,7 @@ struct lsa_OpenPolicy {
 struct lsa_QueryInfoPolicy {
        struct {
                struct policy_handle *handle;/* [ref] */
-               uint16_t level;
+               enum lsa_PolicyInfo level;
        } in;
 
        struct {
@@ -560,6 +678,12 @@ struct lsa_QueryInfoPolicy {
 
 
 struct lsa_SetInfoPolicy {
+       struct {
+               struct policy_handle *handle;/* [ref] */
+               enum lsa_PolicyInfo level;
+               union lsa_PolicyInformation *info;/* [ref,switch_is(level)] */
+       } in;
+
        struct {
                NTSTATUS result;
        } out;
@@ -624,7 +748,7 @@ struct lsa_CreateTrustedDomain {
 struct lsa_EnumTrustDom {
        struct {
                struct policy_handle *handle;/* [ref] */
-               uint32_t max_size;/* [range(0 1000)] */
+               uint32_t max_size;
                uint32_t *resume_handle;/* [ref] */
        } in;
 
@@ -642,7 +766,7 @@ struct lsa_LookupNames {
                struct policy_handle *handle;/* [ref] */
                uint32_t num_names;/* [range(0 1000)] */
                struct lsa_String *names;/* [size_is(num_names)] */
-               uint16_t level;
+               enum lsa_LookupNamesLevel level;
                struct lsa_TransSidArray *sids;/* [ref] */
                uint32_t *count;/* [ref] */
        } in;
@@ -1060,7 +1184,7 @@ struct lsa_GetUserName {
 struct lsa_QueryInfoPolicy2 {
        struct {
                struct policy_handle *handle;/* [ref] */
-               uint16_t level;
+               enum lsa_PolicyInfo level;
        } in;
 
        struct {
@@ -1072,6 +1196,12 @@ struct lsa_QueryInfoPolicy2 {
 
 
 struct lsa_SetInfoPolicy2 {
+       struct {
+               struct policy_handle *handle;/* [ref] */
+               enum lsa_PolicyInfo level;
+               union lsa_PolicyInformation *info;/* [ref,switch_is(level)] */
+       } in;
+
        struct {
                NTSTATUS result;
        } out;
@@ -1223,7 +1353,7 @@ struct lsa_LookupNames2 {
                struct policy_handle *handle;/* [ref] */
                uint32_t num_names;/* [range(0 1000)] */
                struct lsa_String *names;/* [size_is(num_names)] */
-               uint16_t level;
+               enum lsa_LookupNamesLevel level;
                uint32_t unknown1;
                uint32_t unknown2;
                struct lsa_TransSidArray2 *sids;/* [ref] */
@@ -1317,7 +1447,7 @@ struct lsa_LookupNames3 {
                struct policy_handle *handle;/* [ref] */
                uint32_t num_names;/* [range(0 1000)] */
                struct lsa_String *names;/* [size_is(num_names)] */
-               uint16_t level;
+               enum lsa_LookupNamesLevel level;
                uint32_t unknown1;
                uint32_t unknown2;
                struct lsa_TransSidArray3 *sids;/* [ref] */
@@ -1366,8 +1496,15 @@ struct lsa_LSARUNREGISTERAUDITEVENT {
 };
 
 
-struct lsa_LSARQUERYFORESTTRUSTINFORMATION {
+struct lsa_lsaRQueryForestTrustInformation {
        struct {
+               struct policy_handle *handle;/* [ref] */
+               struct lsa_String *trusted_domain_name;/* [ref] */
+               uint16_t unknown;
+       } in;
+
+       struct {
+               struct lsa_ForestTrustInformation **forest_trust_info;/* [ref] */
                NTSTATUS result;
        } out;
 
@@ -1414,7 +1551,7 @@ struct lsa_LookupNames4 {
        struct {
                uint32_t num_names;/* [range(0 1000)] */
                struct lsa_String *names;/* [size_is(num_names)] */
-               uint16_t level;
+               enum lsa_LookupNamesLevel level;
                uint32_t unknown1;
                uint32_t unknown2;
                struct lsa_TransSidArray3 *sids;/* [ref] */
diff --git a/source/librpc/gen_ndr/misc.h b/source/librpc/gen_ndr/misc.h
new file mode 100644 (file)
index 0000000..4fa7415
--- /dev/null
@@ -0,0 +1,73 @@
+/* header auto-generated by pidl */
+
+#include <stdint.h>
+
+#ifndef _HEADER_misc
+#define _HEADER_misc
+
+struct GUID {
+       uint32_t time_low;
+       uint16_t time_mid;
+       uint16_t time_hi_and_version;
+       uint8_t clock_seq[2];
+       uint8_t node[6];
+}/* [noprint,gensize,public,noejs] */;
+
+struct ndr_syntax_id {
+       struct GUID uuid;
+       uint32_t if_version;
+}/* [public] */;
+
+struct policy_handle {
+       uint32_t handle_type;
+       struct GUID uuid;
+}/* [public] */;
+
+enum netr_SchannelType
+#ifndef USE_UINT_ENUMS
+ {
+       SEC_CHAN_WKSTA=2,
+       SEC_CHAN_DOMAIN=4,
+       SEC_CHAN_BDC=6
+}
+#else
+ { __donnot_use_enum_netr_SchannelType=0x7FFFFFFF}
+#define SEC_CHAN_WKSTA ( 2 )
+#define SEC_CHAN_DOMAIN ( 4 )
+#define SEC_CHAN_BDC ( 6 )
+#endif
+;
+
+enum netr_SamDatabaseID
+#ifndef USE_UINT_ENUMS
+ {
+       SAM_DATABASE_DOMAIN=0,
+       SAM_DATABASE_BUILTIN=1,
+       SAM_DATABASE_PRIVS=2
+}
+#else
+ { __donnot_use_enum_netr_SamDatabaseID=0x7FFFFFFF}
+#define SAM_DATABASE_DOMAIN ( 0 )
+#define SAM_DATABASE_BUILTIN ( 1 )
+#define SAM_DATABASE_PRIVS ( 2 )
+#endif
+;
+
+enum samr_RejectReason
+#ifndef USE_UINT_ENUMS
+ {
+       SAMR_REJECT_OTHER=0,
+       SAMR_REJECT_TOO_SHORT=1,
+       SAMR_REJECT_IN_HISTORY=2,
+       SAMR_REJECT_COMPLEXITY=5
+}
+#else
+ { __donnot_use_enum_samr_RejectReason=0x7FFFFFFF}
+#define SAMR_REJECT_OTHER ( 0 )
+#define SAMR_REJECT_TOO_SHORT ( 1 )
+#define SAMR_REJECT_IN_HISTORY ( 2 )
+#define SAMR_REJECT_COMPLEXITY ( 5 )
+#endif
+;
+
+#endif /* _HEADER_misc */
index 4b26487a0d1e3c0721b7ab07eb812b54b1e95671..dee32485bee43fd4ba3af9d5a245c7904b6373c5 100644 (file)
@@ -2544,6 +2544,180 @@ _PUBLIC_ void ndr_print_dfs_EnumArray4(struct ndr_print *ndr, const char *name,
        ndr->depth--;
 }
 
+static enum ndr_err_code ndr_push_dfs_EnumArray5(struct ndr_push *ndr, int ndr_flags, const struct dfs_EnumArray5 *r)
+{
+       uint32_t cntr_s_1;
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count));
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->s));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               if (r->s) {
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count));
+                       for (cntr_s_1 = 0; cntr_s_1 < r->count; cntr_s_1++) {
+                               NDR_CHECK(ndr_push_dfs_Info5(ndr, NDR_SCALARS, &r->s[cntr_s_1]));
+                       }
+                       for (cntr_s_1 = 0; cntr_s_1 < r->count; cntr_s_1++) {
+                               NDR_CHECK(ndr_push_dfs_Info5(ndr, NDR_BUFFERS, &r->s[cntr_s_1]));
+                       }
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_dfs_EnumArray5(struct ndr_pull *ndr, int ndr_flags, struct dfs_EnumArray5 *r)
+{
+       uint32_t _ptr_s;
+       uint32_t cntr_s_1;
+       TALLOC_CTX *_mem_save_s_0;
+       TALLOC_CTX *_mem_save_s_1;
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->count));
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_s));
+               if (_ptr_s) {
+                       NDR_PULL_ALLOC(ndr, r->s);
+               } else {
+                       r->s = NULL;
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               if (r->s) {
+                       _mem_save_s_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->s, 0);
+                       NDR_CHECK(ndr_pull_array_size(ndr, &r->s));
+                       NDR_PULL_ALLOC_N(ndr, r->s, ndr_get_array_size(ndr, &r->s));
+                       _mem_save_s_1 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->s, 0);
+                       for (cntr_s_1 = 0; cntr_s_1 < r->count; cntr_s_1++) {
+                               NDR_CHECK(ndr_pull_dfs_Info5(ndr, NDR_SCALARS, &r->s[cntr_s_1]));
+                       }
+                       for (cntr_s_1 = 0; cntr_s_1 < r->count; cntr_s_1++) {
+                               NDR_CHECK(ndr_pull_dfs_Info5(ndr, NDR_BUFFERS, &r->s[cntr_s_1]));
+                       }
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_s_1, 0);
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_s_0, 0);
+               }
+               if (r->s) {
+                       NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->s, r->count));
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_dfs_EnumArray5(struct ndr_print *ndr, const char *name, const struct dfs_EnumArray5 *r)
+{
+       uint32_t cntr_s_1;
+       ndr_print_struct(ndr, name, "dfs_EnumArray5");
+       ndr->depth++;
+       ndr_print_uint32(ndr, "count", r->count);
+       ndr_print_ptr(ndr, "s", r->s);
+       ndr->depth++;
+       if (r->s) {
+               ndr->print(ndr, "%s: ARRAY(%d)", "s", r->count);
+               ndr->depth++;
+               for (cntr_s_1=0;cntr_s_1<r->count;cntr_s_1++) {
+                       char *idx_1=NULL;
+                       asprintf(&idx_1, "[%d]", cntr_s_1);
+                       if (idx_1) {
+                               ndr_print_dfs_Info5(ndr, "s", &r->s[cntr_s_1]);
+                               free(idx_1);
+                       }
+               }
+               ndr->depth--;
+       }
+       ndr->depth--;
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_dfs_EnumArray6(struct ndr_push *ndr, int ndr_flags, const struct dfs_EnumArray6 *r)
+{
+       uint32_t cntr_s_1;
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count));
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->s));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               if (r->s) {
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count));
+                       for (cntr_s_1 = 0; cntr_s_1 < r->count; cntr_s_1++) {
+                               NDR_CHECK(ndr_push_dfs_Info6(ndr, NDR_SCALARS, &r->s[cntr_s_1]));
+                       }
+                       for (cntr_s_1 = 0; cntr_s_1 < r->count; cntr_s_1++) {
+                               NDR_CHECK(ndr_push_dfs_Info6(ndr, NDR_BUFFERS, &r->s[cntr_s_1]));
+                       }
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_dfs_EnumArray6(struct ndr_pull *ndr, int ndr_flags, struct dfs_EnumArray6 *r)
+{
+       uint32_t _ptr_s;
+       uint32_t cntr_s_1;
+       TALLOC_CTX *_mem_save_s_0;
+       TALLOC_CTX *_mem_save_s_1;
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->count));
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_s));
+               if (_ptr_s) {
+                       NDR_PULL_ALLOC(ndr, r->s);
+               } else {
+                       r->s = NULL;
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               if (r->s) {
+                       _mem_save_s_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->s, 0);
+                       NDR_CHECK(ndr_pull_array_size(ndr, &r->s));
+                       NDR_PULL_ALLOC_N(ndr, r->s, ndr_get_array_size(ndr, &r->s));
+                       _mem_save_s_1 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->s, 0);
+                       for (cntr_s_1 = 0; cntr_s_1 < r->count; cntr_s_1++) {
+                               NDR_CHECK(ndr_pull_dfs_Info6(ndr, NDR_SCALARS, &r->s[cntr_s_1]));
+                       }
+                       for (cntr_s_1 = 0; cntr_s_1 < r->count; cntr_s_1++) {
+                               NDR_CHECK(ndr_pull_dfs_Info6(ndr, NDR_BUFFERS, &r->s[cntr_s_1]));
+                       }
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_s_1, 0);
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_s_0, 0);
+               }
+               if (r->s) {
+                       NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->s, r->count));
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_dfs_EnumArray6(struct ndr_print *ndr, const char *name, const struct dfs_EnumArray6 *r)
+{
+       uint32_t cntr_s_1;
+       ndr_print_struct(ndr, name, "dfs_EnumArray6");
+       ndr->depth++;
+       ndr_print_uint32(ndr, "count", r->count);
+       ndr_print_ptr(ndr, "s", r->s);
+       ndr->depth++;
+       if (r->s) {
+               ndr->print(ndr, "%s: ARRAY(%d)", "s", r->count);
+               ndr->depth++;
+               for (cntr_s_1=0;cntr_s_1<r->count;cntr_s_1++) {
+                       char *idx_1=NULL;
+                       asprintf(&idx_1, "[%d]", cntr_s_1);
+                       if (idx_1) {
+                               ndr_print_dfs_Info6(ndr, "s", &r->s[cntr_s_1]);
+                               free(idx_1);
+                       }
+               }
+               ndr->depth--;
+       }
+       ndr->depth--;
+       ndr->depth--;
+}
+
 static enum ndr_err_code ndr_push_dfs_EnumArray200(struct ndr_push *ndr, int ndr_flags, const struct dfs_EnumArray200 *r)
 {
        uint32_t cntr_s_1;
@@ -2740,6 +2914,14 @@ static enum ndr_err_code ndr_push_dfs_EnumInfo(struct ndr_push *ndr, int ndr_fla
                                NDR_CHECK(ndr_push_unique_ptr(ndr, r->info4));
                        break;
 
+                       case 5:
+                               NDR_CHECK(ndr_push_unique_ptr(ndr, r->info5));
+                       break;
+
+                       case 6:
+                               NDR_CHECK(ndr_push_unique_ptr(ndr, r->info6));
+                       break;
+
                        case 200:
                                NDR_CHECK(ndr_push_unique_ptr(ndr, r->info200));
                        break;
@@ -2779,6 +2961,18 @@ static enum ndr_err_code ndr_push_dfs_EnumInfo(struct ndr_push *ndr, int ndr_fla
                                }
                        break;
 
+                       case 5:
+                               if (r->info5) {
+                                       NDR_CHECK(ndr_push_dfs_EnumArray5(ndr, NDR_SCALARS|NDR_BUFFERS, r->info5));
+                               }
+                       break;
+
+                       case 6:
+                               if (r->info6) {
+                                       NDR_CHECK(ndr_push_dfs_EnumArray6(ndr, NDR_SCALARS|NDR_BUFFERS, r->info6));
+                               }
+                       break;
+
                        case 200:
                                if (r->info200) {
                                        NDR_CHECK(ndr_push_dfs_EnumArray200(ndr, NDR_SCALARS|NDR_BUFFERS, r->info200));
@@ -2806,6 +3000,8 @@ static enum ndr_err_code ndr_pull_dfs_EnumInfo(struct ndr_pull *ndr, int ndr_fla
        TALLOC_CTX *_mem_save_info2_0;
        TALLOC_CTX *_mem_save_info3_0;
        TALLOC_CTX *_mem_save_info4_0;
+       TALLOC_CTX *_mem_save_info5_0;
+       TALLOC_CTX *_mem_save_info6_0;
        TALLOC_CTX *_mem_save_info200_0;
        TALLOC_CTX *_mem_save_info300_0;
        level = ndr_pull_get_switch_value(ndr, r);
@@ -2855,6 +3051,26 @@ static enum ndr_err_code ndr_pull_dfs_EnumInfo(struct ndr_pull *ndr, int ndr_fla
                                }
                        break; }
 
+                       case 5: {
+                               uint32_t _ptr_info5;
+                               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_info5));
+                               if (_ptr_info5) {
+                                       NDR_PULL_ALLOC(ndr, r->info5);
+                               } else {
+                                       r->info5 = NULL;
+                               }
+                       break; }
+
+                       case 6: {
+                               uint32_t _ptr_info6;
+                               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_info6));
+                               if (_ptr_info6) {
+                                       NDR_PULL_ALLOC(ndr, r->info6);
+                               } else {
+                                       r->info6 = NULL;
+                               }
+                       break; }
+
                        case 200: {
                                uint32_t _ptr_info200;
                                NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_info200));
@@ -2917,6 +3133,24 @@ static enum ndr_err_code ndr_pull_dfs_EnumInfo(struct ndr_pull *ndr, int ndr_fla
                                }
                        break;
 
+                       case 5:
+                               if (r->info5) {
+                                       _mem_save_info5_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                                       NDR_PULL_SET_MEM_CTX(ndr, r->info5, 0);
+                                       NDR_CHECK(ndr_pull_dfs_EnumArray5(ndr, NDR_SCALARS|NDR_BUFFERS, r->info5));
+                                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info5_0, 0);
+                               }
+                       break;
+
+                       case 6:
+                               if (r->info6) {
+                                       _mem_save_info6_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                                       NDR_PULL_SET_MEM_CTX(ndr, r->info6, 0);
+                                       NDR_CHECK(ndr_pull_dfs_EnumArray6(ndr, NDR_SCALARS|NDR_BUFFERS, r->info6));
+                                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info6_0, 0);
+                               }
+                       break;
+
                        case 200:
                                if (r->info200) {
                                        _mem_save_info200_0 = NDR_PULL_GET_MEM_CTX(ndr);
@@ -2984,6 +3218,24 @@ _PUBLIC_ void ndr_print_dfs_EnumInfo(struct ndr_print *ndr, const char *name, co
                        ndr->depth--;
                break;
 
+               case 5:
+                       ndr_print_ptr(ndr, "info5", r->info5);
+                       ndr->depth++;
+                       if (r->info5) {
+                               ndr_print_dfs_EnumArray5(ndr, "info5", r->info5);
+                       }
+                       ndr->depth--;
+               break;
+
+               case 6:
+                       ndr_print_ptr(ndr, "info6", r->info6);
+                       ndr->depth++;
+                       if (r->info6) {
+                               ndr_print_dfs_EnumArray6(ndr, "info6", r->info6);
+                       }
+                       ndr->depth--;
+               break;
+
                case 200:
                        ndr_print_ptr(ndr, "info200", r->info200);
                        ndr->depth++;
@@ -4715,8 +4967,50 @@ _PUBLIC_ void ndr_print_dfs_AddStdRootForced(struct ndr_print *ndr, const char *
 static enum ndr_err_code ndr_push_dfs_GetDcAddress(struct ndr_push *ndr, int flags, const struct dfs_GetDcAddress *r)
 {
        if (flags & NDR_IN) {
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.servername, CH_UTF16)));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.servername, CH_UTF16)));
+               NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.servername, ndr_charset_length(r->in.servername, CH_UTF16), sizeof(uint16_t), CH_UTF16));
+               if (r->in.server_fullname == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               if (*r->in.server_fullname == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_ref_ptr(ndr));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->in.server_fullname, CH_UTF16)));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->in.server_fullname, CH_UTF16)));
+               NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, *r->in.server_fullname, ndr_charset_length(*r->in.server_fullname, CH_UTF16), sizeof(uint16_t), CH_UTF16));
+               if (r->in.is_root == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, *r->in.is_root));
+               if (r->in.ttl == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.ttl));
        }
        if (flags & NDR_OUT) {
+               if (r->out.server_fullname == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               if (*r->out.server_fullname == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_ref_ptr(ndr));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->out.server_fullname, CH_UTF16)));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->out.server_fullname, CH_UTF16)));
+               NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, *r->out.server_fullname, ndr_charset_length(*r->out.server_fullname, CH_UTF16), sizeof(uint16_t), CH_UTF16));
+               if (r->out.is_root == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, *r->out.is_root));
+               if (r->out.ttl == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.ttl));
                NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
        }
        return NDR_ERR_SUCCESS;
@@ -4724,9 +5018,84 @@ static enum ndr_err_code ndr_push_dfs_GetDcAddress(struct ndr_push *ndr, int fla
 
 static enum ndr_err_code ndr_pull_dfs_GetDcAddress(struct ndr_pull *ndr, int flags, struct dfs_GetDcAddress *r)
 {
+       uint32_t _ptr_server_fullname;
+       TALLOC_CTX *_mem_save_server_fullname_0;
+       TALLOC_CTX *_mem_save_is_root_0;
+       TALLOC_CTX *_mem_save_ttl_0;
        if (flags & NDR_IN) {
+               ZERO_STRUCT(r->out);
+
+               NDR_CHECK(ndr_pull_array_size(ndr, &r->in.servername));
+               NDR_CHECK(ndr_pull_array_length(ndr, &r->in.servername));
+               if (ndr_get_array_length(ndr, &r->in.servername) > ndr_get_array_size(ndr, &r->in.servername)) {
+                       return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.servername), ndr_get_array_length(ndr, &r->in.servername));
+               }
+               NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.servername), sizeof(uint16_t)));
+               NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.servername, ndr_get_array_length(ndr, &r->in.servername), sizeof(uint16_t), CH_UTF16));
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.server_fullname);
+               }
+               _mem_save_server_fullname_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.server_fullname, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_ref_ptr(ndr, &_ptr_server_fullname));
+               NDR_CHECK(ndr_pull_array_size(ndr, r->in.server_fullname));
+               NDR_CHECK(ndr_pull_array_length(ndr, r->in.server_fullname));
+               if (ndr_get_array_length(ndr, r->in.server_fullname) > ndr_get_array_size(ndr, r->in.server_fullname)) {
+                       return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, r->in.server_fullname), ndr_get_array_length(ndr, r->in.server_fullname));
+               }
+               NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, r->in.server_fullname), sizeof(uint16_t)));
+               NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, r->in.server_fullname, ndr_get_array_length(ndr, r->in.server_fullname), sizeof(uint16_t), CH_UTF16));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_server_fullname_0, LIBNDR_FLAG_REF_ALLOC);
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.is_root);
+               }
+               _mem_save_is_root_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.is_root, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, r->in.is_root));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_is_root_0, LIBNDR_FLAG_REF_ALLOC);
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.ttl);
+               }
+               _mem_save_ttl_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.ttl, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->in.ttl));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_ttl_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_PULL_ALLOC(ndr, r->out.server_fullname);
+               *r->out.server_fullname = *r->in.server_fullname;
+               NDR_PULL_ALLOC(ndr, r->out.is_root);
+               *r->out.is_root = *r->in.is_root;
+               NDR_PULL_ALLOC(ndr, r->out.ttl);
+               *r->out.ttl = *r->in.ttl;
        }
        if (flags & NDR_OUT) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.server_fullname);
+               }
+               _mem_save_server_fullname_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.server_fullname, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_ref_ptr(ndr, &_ptr_server_fullname));
+               NDR_CHECK(ndr_pull_array_size(ndr, r->out.server_fullname));
+               NDR_CHECK(ndr_pull_array_length(ndr, r->out.server_fullname));
+               if (ndr_get_array_length(ndr, r->out.server_fullname) > ndr_get_array_size(ndr, r->out.server_fullname)) {
+                       return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, r->out.server_fullname), ndr_get_array_length(ndr, r->out.server_fullname));
+               }
+               NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, r->out.server_fullname), sizeof(uint16_t)));
+               NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, r->out.server_fullname, ndr_get_array_length(ndr, r->out.server_fullname), sizeof(uint16_t), CH_UTF16));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_server_fullname_0, LIBNDR_FLAG_REF_ALLOC);
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.is_root);
+               }
+               _mem_save_is_root_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.is_root, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, r->out.is_root));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_is_root_0, LIBNDR_FLAG_REF_ALLOC);
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.ttl);
+               }
+               _mem_save_ttl_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.ttl, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.ttl));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_ttl_0, LIBNDR_FLAG_REF_ALLOC);
                NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
        }
        return NDR_ERR_SUCCESS;
@@ -4742,11 +5111,42 @@ _PUBLIC_ void ndr_print_dfs_GetDcAddress(struct ndr_print *ndr, const char *name
        if (flags & NDR_IN) {
                ndr_print_struct(ndr, "in", "dfs_GetDcAddress");
                ndr->depth++;
+               ndr_print_string(ndr, "servername", r->in.servername);
+               ndr_print_ptr(ndr, "server_fullname", r->in.server_fullname);
+               ndr->depth++;
+               ndr_print_ptr(ndr, "server_fullname", *r->in.server_fullname);
+               ndr->depth++;
+               ndr_print_string(ndr, "server_fullname", *r->in.server_fullname);
+               ndr->depth--;
+               ndr->depth--;
+               ndr_print_ptr(ndr, "is_root", r->in.is_root);
+               ndr->depth++;
+               ndr_print_uint8(ndr, "is_root", *r->in.is_root);
+               ndr->depth--;
+               ndr_print_ptr(ndr, "ttl", r->in.ttl);
+               ndr->depth++;
+               ndr_print_uint32(ndr, "ttl", *r->in.ttl);
+               ndr->depth--;
                ndr->depth--;
        }
        if (flags & NDR_OUT) {
                ndr_print_struct(ndr, "out", "dfs_GetDcAddress");
                ndr->depth++;
+               ndr_print_ptr(ndr, "server_fullname", r->out.server_fullname);
+               ndr->depth++;
+               ndr_print_ptr(ndr, "server_fullname", *r->out.server_fullname);
+               ndr->depth++;
+               ndr_print_string(ndr, "server_fullname", *r->out.server_fullname);
+               ndr->depth--;
+               ndr->depth--;
+               ndr_print_ptr(ndr, "is_root", r->out.is_root);
+               ndr->depth++;
+               ndr_print_uint8(ndr, "is_root", *r->out.is_root);
+               ndr->depth--;
+               ndr_print_ptr(ndr, "ttl", r->out.ttl);
+               ndr->depth++;
+               ndr_print_uint32(ndr, "ttl", *r->out.ttl);
+               ndr->depth--;
                ndr_print_WERROR(ndr, "result", r->out.result);
                ndr->depth--;
        }
@@ -4756,6 +5156,16 @@ _PUBLIC_ void ndr_print_dfs_GetDcAddress(struct ndr_print *ndr, const char *name
 static enum ndr_err_code ndr_push_dfs_SetDcAddress(struct ndr_push *ndr, int flags, const struct dfs_SetDcAddress *r)
 {
        if (flags & NDR_IN) {
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.servername, CH_UTF16)));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.servername, CH_UTF16)));
+               NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.servername, ndr_charset_length(r->in.servername, CH_UTF16), sizeof(uint16_t), CH_UTF16));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.server_fullname, CH_UTF16)));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.server_fullname, CH_UTF16)));
+               NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.server_fullname, ndr_charset_length(r->in.server_fullname, CH_UTF16), sizeof(uint16_t), CH_UTF16));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.flags));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.ttl));
        }
        if (flags & NDR_OUT) {
                NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
@@ -4766,6 +5176,22 @@ static enum ndr_err_code ndr_push_dfs_SetDcAddress(struct ndr_push *ndr, int fla
 static enum ndr_err_code ndr_pull_dfs_SetDcAddress(struct ndr_pull *ndr, int flags, struct dfs_SetDcAddress *r)
 {
        if (flags & NDR_IN) {
+               NDR_CHECK(ndr_pull_array_size(ndr, &r->in.servername));
+               NDR_CHECK(ndr_pull_array_length(ndr, &r->in.servername));
+               if (ndr_get_array_length(ndr, &r->in.servername) > ndr_get_array_size(ndr, &r->in.servername)) {
+                       return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.servername), ndr_get_array_length(ndr, &r->in.servername));
+               }
+               NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.servername), sizeof(uint16_t)));
+               NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.servername, ndr_get_array_length(ndr, &r->in.servername), sizeof(uint16_t), CH_UTF16));
+               NDR_CHECK(ndr_pull_array_size(ndr, &r->in.server_fullname));
+               NDR_CHECK(ndr_pull_array_length(ndr, &r->in.server_fullname));
+               if (ndr_get_array_length(ndr, &r->in.server_fullname) > ndr_get_array_size(ndr, &r->in.server_fullname)) {
+                       return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.server_fullname), ndr_get_array_length(ndr, &r->in.server_fullname));
+               }
+               NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.server_fullname), sizeof(uint16_t)));
+               NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.server_fullname, ndr_get_array_length(ndr, &r->in.server_fullname), sizeof(uint16_t), CH_UTF16));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.flags));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.ttl));
        }
        if (flags & NDR_OUT) {
                NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
@@ -4783,6 +5209,10 @@ _PUBLIC_ void ndr_print_dfs_SetDcAddress(struct ndr_print *ndr, const char *name
        if (flags & NDR_IN) {
                ndr_print_struct(ndr, "in", "dfs_SetDcAddress");
                ndr->depth++;
+               ndr_print_string(ndr, "servername", r->in.servername);
+               ndr_print_string(ndr, "server_fullname", r->in.server_fullname);
+               ndr_print_uint32(ndr, "flags", r->in.flags);
+               ndr_print_uint32(ndr, "ttl", r->in.ttl);
                ndr->depth--;
        }
        if (flags & NDR_OUT) {
@@ -5325,10 +5755,12 @@ static const struct ndr_interface_call netdfs_calls[] = {
 
 static const char * const netdfs_endpoint_strings[] = {
        "ncacn_np:[\\pipe\\netdfs]", 
+       "ncacn_ip_tcp:", 
+       "ncalrpc:", 
 };
 
 static const struct ndr_interface_string_array netdfs_endpoints = {
-       .count  = 1,
+       .count  = 3,
        .names  = netdfs_endpoint_strings
 };
 
@@ -5337,7 +5769,7 @@ static const char * const netdfs_authservice_strings[] = {
 };
 
 static const struct ndr_interface_string_array netdfs_authservices = {
-       .count  = 1,
+       .count  = 3,
        .names  = netdfs_authservice_strings
 };
 
index e4b00f322a89e8e52874c280b74695134c2b65c0..a7c66f96936c848f8ab82d03c040c795a1c77c05 100644 (file)
@@ -95,6 +95,8 @@ void ndr_print_dfs_EnumArray1(struct ndr_print *ndr, const char *name, const str
 void ndr_print_dfs_EnumArray2(struct ndr_print *ndr, const char *name, const struct dfs_EnumArray2 *r);
 void ndr_print_dfs_EnumArray3(struct ndr_print *ndr, const char *name, const struct dfs_EnumArray3 *r);
 void ndr_print_dfs_EnumArray4(struct ndr_print *ndr, const char *name, const struct dfs_EnumArray4 *r);
+void ndr_print_dfs_EnumArray5(struct ndr_print *ndr, const char *name, const struct dfs_EnumArray5 *r);
+void ndr_print_dfs_EnumArray6(struct ndr_print *ndr, const char *name, const struct dfs_EnumArray6 *r);
 void ndr_print_dfs_EnumArray200(struct ndr_print *ndr, const char *name, const struct dfs_EnumArray200 *r);
 void ndr_print_dfs_EnumArray300(struct ndr_print *ndr, const char *name, const struct dfs_EnumArray300 *r);
 void ndr_print_dfs_EnumInfo(struct ndr_print *ndr, const char *name, const union dfs_EnumInfo *r);
diff --git a/source/librpc/gen_ndr/ndr_dssetup.c b/source/librpc/gen_ndr/ndr_dssetup.c
new file mode 100644 (file)
index 0000000..f089b71
--- /dev/null
@@ -0,0 +1,1084 @@
+/* parser auto-generated by pidl */
+
+#include "includes.h"
+#include "librpc/gen_ndr/ndr_dssetup.h"
+
+#include "librpc/gen_ndr/ndr_misc.h"
+static enum ndr_err_code ndr_push_dssetup_DsRole(struct ndr_push *ndr, int ndr_flags, enum dssetup_DsRole r)
+{
+       NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r));
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_dssetup_DsRole(struct ndr_pull *ndr, int ndr_flags, enum dssetup_DsRole *r)
+{
+       uint16_t v;
+       NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v));
+       *r = v;
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_dssetup_DsRole(struct ndr_print *ndr, const char *name, enum dssetup_DsRole r)
+{
+       const char *val = NULL;
+
+       switch (r) {
+               case DS_ROLE_STANDALONE_WORKSTATION: val = "DS_ROLE_STANDALONE_WORKSTATION"; break;
+               case DS_ROLE_MEMBER_WORKSTATION: val = "DS_ROLE_MEMBER_WORKSTATION"; break;
+               case DS_ROLE_STANDALONE_SERVER: val = "DS_ROLE_STANDALONE_SERVER"; break;
+               case DS_ROLE_MEMBER_SERVER: val = "DS_ROLE_MEMBER_SERVER"; break;
+               case DS_ROLE_BACKUP_DC: val = "DS_ROLE_BACKUP_DC"; break;
+               case DS_ROLE_PRIMARY_DC: val = "DS_ROLE_PRIMARY_DC"; break;
+       }
+       ndr_print_enum(ndr, name, "ENUM", val, r);
+}
+
+static enum ndr_err_code ndr_push_dssetup_DsRoleFlags(struct ndr_push *ndr, int ndr_flags, uint32_t r)
+{
+       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_dssetup_DsRoleFlags(struct ndr_pull *ndr, int ndr_flags, uint32_t *r)
+{
+       uint32_t v;
+       NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
+       *r = v;
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_dssetup_DsRoleFlags(struct ndr_print *ndr, const char *name, uint32_t r)
+{
+       ndr_print_uint32(ndr, name, r);
+       ndr->depth++;
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_ROLE_PRIMARY_DS_RUNNING", DS_ROLE_PRIMARY_DS_RUNNING, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_ROLE_PRIMARY_DS_MIXED_MODE", DS_ROLE_PRIMARY_DS_MIXED_MODE, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_ROLE_UPGRADE_IN_PROGRESS", DS_ROLE_UPGRADE_IN_PROGRESS, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_ROLE_PRIMARY_DOMAIN_GUID_PRESENT", DS_ROLE_PRIMARY_DOMAIN_GUID_PRESENT, r);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_dssetup_DsRolePrimaryDomInfoBasic(struct ndr_push *ndr, int ndr_flags, const struct dssetup_DsRolePrimaryDomInfoBasic *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_dssetup_DsRole(ndr, NDR_SCALARS, r->role));
+               NDR_CHECK(ndr_push_dssetup_DsRoleFlags(ndr, NDR_SCALARS, r->flags));
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->domain));
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->dns_domain));
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->forest));
+               NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &r->domain_guid));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               if (r->domain) {
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->domain, CH_UTF16)));
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->domain, CH_UTF16)));
+                       NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->domain, ndr_charset_length(r->domain, CH_UTF16), sizeof(uint16_t), CH_UTF16));
+               }
+               if (r->dns_domain) {
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->dns_domain, CH_UTF16)));
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->dns_domain, CH_UTF16)));
+                       NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->dns_domain, ndr_charset_length(r->dns_domain, CH_UTF16), sizeof(uint16_t), CH_UTF16));
+               }
+               if (r->forest) {
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->forest, CH_UTF16)));
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->forest, CH_UTF16)));
+                       NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->forest, ndr_charset_length(r->forest, CH_UTF16), sizeof(uint16_t), CH_UTF16));
+               }
+               NDR_CHECK(ndr_push_GUID(ndr, NDR_BUFFERS, &r->domain_guid));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_dssetup_DsRolePrimaryDomInfoBasic(struct ndr_pull *ndr, int ndr_flags, struct dssetup_DsRolePrimaryDomInfoBasic *r)
+{
+       uint32_t _ptr_domain;
+       TALLOC_CTX *_mem_save_domain_0;
+       uint32_t _ptr_dns_domain;
+       TALLOC_CTX *_mem_save_dns_domain_0;
+       uint32_t _ptr_forest;
+       TALLOC_CTX *_mem_save_forest_0;
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_dssetup_DsRole(ndr, NDR_SCALARS, &r->role));
+               NDR_CHECK(ndr_pull_dssetup_DsRoleFlags(ndr, NDR_SCALARS, &r->flags));
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_domain));
+               if (_ptr_domain) {
+                       NDR_PULL_ALLOC(ndr, r->domain);
+               } else {
+                       r->domain = NULL;
+               }
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_dns_domain));
+               if (_ptr_dns_domain) {
+                       NDR_PULL_ALLOC(ndr, r->dns_domain);
+               } else {
+                       r->dns_domain = NULL;
+               }
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_forest));
+               if (_ptr_forest) {
+                       NDR_PULL_ALLOC(ndr, r->forest);
+               } else {
+                       r->forest = NULL;
+               }
+               NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, &r->domain_guid));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               if (r->domain) {
+                       _mem_save_domain_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->domain, 0);
+                       NDR_CHECK(ndr_pull_array_size(ndr, &r->domain));
+                       NDR_CHECK(ndr_pull_array_length(ndr, &r->domain));
+                       if (ndr_get_array_length(ndr, &r->domain) > ndr_get_array_size(ndr, &r->domain)) {
+                               return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->domain), ndr_get_array_length(ndr, &r->domain));
+                       }
+                       NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->domain), sizeof(uint16_t)));
+                       NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->domain, ndr_get_array_length(ndr, &r->domain), sizeof(uint16_t), CH_UTF16));
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_0, 0);
+               }
+               if (r->dns_domain) {
+                       _mem_save_dns_domain_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->dns_domain, 0);
+                       NDR_CHECK(ndr_pull_array_size(ndr, &r->dns_domain));
+                       NDR_CHECK(ndr_pull_array_length(ndr, &r->dns_domain));
+                       if (ndr_get_array_length(ndr, &r->dns_domain) > ndr_get_array_size(ndr, &r->dns_domain)) {
+                               return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->dns_domain), ndr_get_array_length(ndr, &r->dns_domain));
+                       }
+                       NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->dns_domain), sizeof(uint16_t)));
+                       NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->dns_domain, ndr_get_array_length(ndr, &r->dns_domain), sizeof(uint16_t), CH_UTF16));
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_dns_domain_0, 0);
+               }
+               if (r->forest) {
+                       _mem_save_forest_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->forest, 0);
+                       NDR_CHECK(ndr_pull_array_size(ndr, &r->forest));
+                       NDR_CHECK(ndr_pull_array_length(ndr, &r->forest));
+                       if (ndr_get_array_length(ndr, &r->forest) > ndr_get_array_size(ndr, &r->forest)) {
+                               return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->forest), ndr_get_array_length(ndr, &r->forest));
+                       }
+                       NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->forest), sizeof(uint16_t)));
+                       NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->forest, ndr_get_array_length(ndr, &r->forest), sizeof(uint16_t), CH_UTF16));
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_forest_0, 0);
+               }
+               NDR_CHECK(ndr_pull_GUID(ndr, NDR_BUFFERS, &r->domain_guid));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_dssetup_DsRolePrimaryDomInfoBasic(struct ndr_print *ndr, const char *name, const struct dssetup_DsRolePrimaryDomInfoBasic *r)
+{
+       ndr_print_struct(ndr, name, "dssetup_DsRolePrimaryDomInfoBasic");
+       ndr->depth++;
+       ndr_print_dssetup_DsRole(ndr, "role", r->role);
+       ndr_print_dssetup_DsRoleFlags(ndr, "flags", r->flags);
+       ndr_print_ptr(ndr, "domain", r->domain);
+       ndr->depth++;
+       if (r->domain) {
+               ndr_print_string(ndr, "domain", r->domain);
+       }
+       ndr->depth--;
+       ndr_print_ptr(ndr, "dns_domain", r->dns_domain);
+       ndr->depth++;
+       if (r->dns_domain) {
+               ndr_print_string(ndr, "dns_domain", r->dns_domain);
+       }
+       ndr->depth--;
+       ndr_print_ptr(ndr, "forest", r->forest);
+       ndr->depth++;
+       if (r->forest) {
+               ndr_print_string(ndr, "forest", r->forest);
+       }
+       ndr->depth--;
+       ndr_print_GUID(ndr, "domain_guid", &r->domain_guid);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_dssetup_DsUpgrade(struct ndr_push *ndr, int ndr_flags, enum dssetup_DsUpgrade r)
+{
+       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_dssetup_DsUpgrade(struct ndr_pull *ndr, int ndr_flags, enum dssetup_DsUpgrade *r)
+{
+       uint32_t v;
+       NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
+       *r = v;
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_dssetup_DsUpgrade(struct ndr_print *ndr, const char *name, enum dssetup_DsUpgrade r)
+{
+       const char *val = NULL;
+
+       switch (r) {
+               case DS_ROLE_NOT_UPGRADING: val = "DS_ROLE_NOT_UPGRADING"; break;
+               case DS_ROLE_UPGRADING: val = "DS_ROLE_UPGRADING"; break;
+       }
+       ndr_print_enum(ndr, name, "ENUM", val, r);
+}
+
+static enum ndr_err_code ndr_push_dssetup_DsPrevious(struct ndr_push *ndr, int ndr_flags, enum dssetup_DsPrevious r)
+{
+       NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r));
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_dssetup_DsPrevious(struct ndr_pull *ndr, int ndr_flags, enum dssetup_DsPrevious *r)
+{
+       uint16_t v;
+       NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v));
+       *r = v;
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_dssetup_DsPrevious(struct ndr_print *ndr, const char *name, enum dssetup_DsPrevious r)
+{
+       const char *val = NULL;
+
+       switch (r) {
+               case DS_ROLE_PREVIOUS_UNKNOWN: val = "DS_ROLE_PREVIOUS_UNKNOWN"; break;
+               case DS_ROLE_PREVIOUS_PRIMARY: val = "DS_ROLE_PREVIOUS_PRIMARY"; break;
+               case DS_ROLE_PREVIOUS_BACKUP: val = "DS_ROLE_PREVIOUS_BACKUP"; break;
+       }
+       ndr_print_enum(ndr, name, "ENUM", val, r);
+}
+
+static enum ndr_err_code ndr_push_dssetup_DsRoleUpgradeStatus(struct ndr_push *ndr, int ndr_flags, const struct dssetup_DsRoleUpgradeStatus *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_dssetup_DsUpgrade(ndr, NDR_SCALARS, r->upgrading));
+               NDR_CHECK(ndr_push_dssetup_DsPrevious(ndr, NDR_SCALARS, r->previous_role));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_dssetup_DsRoleUpgradeStatus(struct ndr_pull *ndr, int ndr_flags, struct dssetup_DsRoleUpgradeStatus *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_dssetup_DsUpgrade(ndr, NDR_SCALARS, &r->upgrading));
+               NDR_CHECK(ndr_pull_dssetup_DsPrevious(ndr, NDR_SCALARS, &r->previous_role));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_dssetup_DsRoleUpgradeStatus(struct ndr_print *ndr, const char *name, const struct dssetup_DsRoleUpgradeStatus *r)
+{
+       ndr_print_struct(ndr, name, "dssetup_DsRoleUpgradeStatus");
+       ndr->depth++;
+       ndr_print_dssetup_DsUpgrade(ndr, "upgrading", r->upgrading);
+       ndr_print_dssetup_DsPrevious(ndr, "previous_role", r->previous_role);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_dssetup_DsRoleOp(struct ndr_push *ndr, int ndr_flags, enum dssetup_DsRoleOp r)
+{
+       NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r));
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_dssetup_DsRoleOp(struct ndr_pull *ndr, int ndr_flags, enum dssetup_DsRoleOp *r)
+{
+       uint16_t v;
+       NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v));
+       *r = v;
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_dssetup_DsRoleOp(struct ndr_print *ndr, const char *name, enum dssetup_DsRoleOp r)
+{
+       const char *val = NULL;
+
+       switch (r) {
+               case DS_ROLE_OP_IDLE: val = "DS_ROLE_OP_IDLE"; break;
+               case DS_ROLE_OP_ACTIVE: val = "DS_ROLE_OP_ACTIVE"; break;
+               case DS_ROLE_OP_NEEDS_REBOOT: val = "DS_ROLE_OP_NEEDS_REBOOT"; break;
+       }
+       ndr_print_enum(ndr, name, "ENUM", val, r);
+}
+
+static enum ndr_err_code ndr_push_dssetup_DsRoleOpStatus(struct ndr_push *ndr, int ndr_flags, const struct dssetup_DsRoleOpStatus *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 2));
+               NDR_CHECK(ndr_push_dssetup_DsRoleOp(ndr, NDR_SCALARS, r->status));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_dssetup_DsRoleOpStatus(struct ndr_pull *ndr, int ndr_flags, struct dssetup_DsRoleOpStatus *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 2));
+               NDR_CHECK(ndr_pull_dssetup_DsRoleOp(ndr, NDR_SCALARS, &r->status));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_dssetup_DsRoleOpStatus(struct ndr_print *ndr, const char *name, const struct dssetup_DsRoleOpStatus *r)
+{
+       ndr_print_struct(ndr, name, "dssetup_DsRoleOpStatus");
+       ndr->depth++;
+       ndr_print_dssetup_DsRoleOp(ndr, "status", r->status);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_dssetup_DsRoleInfoLevel(struct ndr_push *ndr, int ndr_flags, enum dssetup_DsRoleInfoLevel r)
+{
+       NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r));
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_dssetup_DsRoleInfoLevel(struct ndr_pull *ndr, int ndr_flags, enum dssetup_DsRoleInfoLevel *r)
+{
+       uint16_t v;
+       NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v));
+       *r = v;
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_dssetup_DsRoleInfoLevel(struct ndr_print *ndr, const char *name, enum dssetup_DsRoleInfoLevel r)
+{
+       const char *val = NULL;
+
+       switch (r) {
+               case DS_ROLE_BASIC_INFORMATION: val = "DS_ROLE_BASIC_INFORMATION"; break;
+               case DS_ROLE_UPGRADE_STATUS: val = "DS_ROLE_UPGRADE_STATUS"; break;
+               case DS_ROLE_OP_STATUS: val = "DS_ROLE_OP_STATUS"; break;
+       }
+       ndr_print_enum(ndr, name, "ENUM", val, r);
+}
+
+static enum ndr_err_code ndr_push_dssetup_DsRoleInfo(struct ndr_push *ndr, int ndr_flags, const union dssetup_DsRoleInfo *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               int level = ndr_push_get_switch_value(ndr, r);
+               NDR_CHECK(ndr_push_dssetup_DsRoleInfoLevel(ndr, NDR_SCALARS, level));
+               switch (level) {
+                       case DS_ROLE_BASIC_INFORMATION:
+                               NDR_CHECK(ndr_push_dssetup_DsRolePrimaryDomInfoBasic(ndr, NDR_SCALARS, &r->basic));
+                       break;
+
+                       case DS_ROLE_UPGRADE_STATUS:
+                               NDR_CHECK(ndr_push_dssetup_DsRoleUpgradeStatus(ndr, NDR_SCALARS, &r->upgrade));
+                       break;
+
+                       case DS_ROLE_OP_STATUS:
+                               NDR_CHECK(ndr_push_dssetup_DsRoleOpStatus(ndr, NDR_SCALARS, &r->opstatus));
+                       break;
+
+                       default:
+                               return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               int level = ndr_push_get_switch_value(ndr, r);
+               switch (level) {
+                       case DS_ROLE_BASIC_INFORMATION:
+                               NDR_CHECK(ndr_push_dssetup_DsRolePrimaryDomInfoBasic(ndr, NDR_BUFFERS, &r->basic));
+                       break;
+
+                       case DS_ROLE_UPGRADE_STATUS:
+                       break;
+
+                       case DS_ROLE_OP_STATUS:
+                       break;
+
+                       default:
+                               return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_dssetup_DsRoleInfo(struct ndr_pull *ndr, int ndr_flags, union dssetup_DsRoleInfo *r)
+{
+       int level;
+       uint16_t _level;
+       level = ndr_pull_get_switch_value(ndr, r);
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &_level));
+               if (_level != level) {
+                       return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u for r", _level);
+               }
+               switch (level) {
+                       case DS_ROLE_BASIC_INFORMATION: {
+                               NDR_CHECK(ndr_pull_dssetup_DsRolePrimaryDomInfoBasic(ndr, NDR_SCALARS, &r->basic));
+                       break; }
+
+                       case DS_ROLE_UPGRADE_STATUS: {
+                               NDR_CHECK(ndr_pull_dssetup_DsRoleUpgradeStatus(ndr, NDR_SCALARS, &r->upgrade));
+                       break; }
+
+                       case DS_ROLE_OP_STATUS: {
+                               NDR_CHECK(ndr_pull_dssetup_DsRoleOpStatus(ndr, NDR_SCALARS, &r->opstatus));
+                       break; }
+
+                       default:
+                               return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               switch (level) {
+                       case DS_ROLE_BASIC_INFORMATION:
+                               NDR_CHECK(ndr_pull_dssetup_DsRolePrimaryDomInfoBasic(ndr, NDR_BUFFERS, &r->basic));
+                       break;
+
+                       case DS_ROLE_UPGRADE_STATUS:
+                       break;
+
+                       case DS_ROLE_OP_STATUS:
+                       break;
+
+                       default:
+                               return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_dssetup_DsRoleInfo(struct ndr_print *ndr, const char *name, const union dssetup_DsRoleInfo *r)
+{
+       int level;
+       level = ndr_print_get_switch_value(ndr, r);
+       ndr_print_union(ndr, name, level, "dssetup_DsRoleInfo");
+       switch (level) {
+               case DS_ROLE_BASIC_INFORMATION:
+                       ndr_print_dssetup_DsRolePrimaryDomInfoBasic(ndr, "basic", &r->basic);
+               break;
+
+               case DS_ROLE_UPGRADE_STATUS:
+                       ndr_print_dssetup_DsRoleUpgradeStatus(ndr, "upgrade", &r->upgrade);
+               break;
+
+               case DS_ROLE_OP_STATUS:
+                       ndr_print_dssetup_DsRoleOpStatus(ndr, "opstatus", &r->opstatus);
+               break;
+
+               default:
+                       ndr_print_bad_level(ndr, name, level);
+       }
+}
+
+static enum ndr_err_code ndr_push_dssetup_DsRoleGetPrimaryDomainInformation(struct ndr_push *ndr, int flags, const struct dssetup_DsRoleGetPrimaryDomainInformation *r)
+{
+       if (flags & NDR_IN) {
+               NDR_CHECK(ndr_push_dssetup_DsRoleInfoLevel(ndr, NDR_SCALARS, r->in.level));
+       }
+       if (flags & NDR_OUT) {
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.info));
+               if (r->out.info) {
+                       NDR_CHECK(ndr_push_set_switch_value(ndr, r->out.info, r->in.level));
+                       NDR_CHECK(ndr_push_dssetup_DsRoleInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info));
+               }
+               NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_dssetup_DsRoleGetPrimaryDomainInformation(struct ndr_pull *ndr, int flags, struct dssetup_DsRoleGetPrimaryDomainInformation *r)
+{
+       uint32_t _ptr_info;
+       TALLOC_CTX *_mem_save_info_0;
+       if (flags & NDR_IN) {
+               ZERO_STRUCT(r->out);
+
+               NDR_CHECK(ndr_pull_dssetup_DsRoleInfoLevel(ndr, NDR_SCALARS, &r->in.level));
+       }
+       if (flags & NDR_OUT) {
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_info));
+               if (_ptr_info) {
+                       NDR_PULL_ALLOC(ndr, r->out.info);
+               } else {
+                       r->out.info = NULL;
+               }
+               if (r->out.info) {
+                       _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->out.info, 0);
+                       NDR_CHECK(ndr_pull_set_switch_value(ndr, r->out.info, r->in.level));
+                       NDR_CHECK(ndr_pull_dssetup_DsRoleInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info));
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, 0);
+               }
+               NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_dssetup_DsRoleGetPrimaryDomainInformation(struct ndr_print *ndr, const char *name, int flags, const struct dssetup_DsRoleGetPrimaryDomainInformation *r)
+{
+       ndr_print_struct(ndr, name, "dssetup_DsRoleGetPrimaryDomainInformation");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "dssetup_DsRoleGetPrimaryDomainInformation");
+               ndr->depth++;
+               ndr_print_dssetup_DsRoleInfoLevel(ndr, "level", r->in.level);
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "dssetup_DsRoleGetPrimaryDomainInformation");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "info", r->out.info);
+               ndr->depth++;
+               if (r->out.info) {
+                       ndr_print_set_switch_value(ndr, r->out.info, r->in.level);
+                       ndr_print_dssetup_DsRoleInfo(ndr, "info", r->out.info);
+               }
+               ndr->depth--;
+               ndr_print_WERROR(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_dssetup_DsRoleDnsNameToFlatName(struct ndr_push *ndr, int flags, const struct dssetup_DsRoleDnsNameToFlatName *r)
+{
+       if (flags & NDR_IN) {
+       }
+       if (flags & NDR_OUT) {
+               NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_dssetup_DsRoleDnsNameToFlatName(struct ndr_pull *ndr, int flags, struct dssetup_DsRoleDnsNameToFlatName *r)
+{
+       if (flags & NDR_IN) {
+       }
+       if (flags & NDR_OUT) {
+               NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_dssetup_DsRoleDnsNameToFlatName(struct ndr_print *ndr, const char *name, int flags, const struct dssetup_DsRoleDnsNameToFlatName *r)
+{
+       ndr_print_struct(ndr, name, "dssetup_DsRoleDnsNameToFlatName");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "dssetup_DsRoleDnsNameToFlatName");
+               ndr->depth++;
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "dssetup_DsRoleDnsNameToFlatName");
+               ndr->depth++;
+               ndr_print_WERROR(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_dssetup_DsRoleDcAsDc(struct ndr_push *ndr, int flags, const struct dssetup_DsRoleDcAsDc *r)
+{
+       if (flags & NDR_IN) {
+       }
+       if (flags & NDR_OUT) {
+               NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_dssetup_DsRoleDcAsDc(struct ndr_pull *ndr, int flags, struct dssetup_DsRoleDcAsDc *r)
+{
+       if (flags & NDR_IN) {
+       }
+       if (flags & NDR_OUT) {
+               NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_dssetup_DsRoleDcAsDc(struct ndr_print *ndr, const char *name, int flags, const struct dssetup_DsRoleDcAsDc *r)
+{
+       ndr_print_struct(ndr, name, "dssetup_DsRoleDcAsDc");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "dssetup_DsRoleDcAsDc");
+               ndr->depth++;
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "dssetup_DsRoleDcAsDc");
+               ndr->depth++;
+               ndr_print_WERROR(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_dssetup_DsRoleDcAsReplica(struct ndr_push *ndr, int flags, const struct dssetup_DsRoleDcAsReplica *r)
+{
+       if (flags & NDR_IN) {
+       }
+       if (flags & NDR_OUT) {
+               NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_dssetup_DsRoleDcAsReplica(struct ndr_pull *ndr, int flags, struct dssetup_DsRoleDcAsReplica *r)
+{
+       if (flags & NDR_IN) {
+       }
+       if (flags & NDR_OUT) {
+               NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_dssetup_DsRoleDcAsReplica(struct ndr_print *ndr, const char *name, int flags, const struct dssetup_DsRoleDcAsReplica *r)
+{
+       ndr_print_struct(ndr, name, "dssetup_DsRoleDcAsReplica");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "dssetup_DsRoleDcAsReplica");
+               ndr->depth++;
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "dssetup_DsRoleDcAsReplica");
+               ndr->depth++;
+               ndr_print_WERROR(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_dssetup_DsRoleDemoteDc(struct ndr_push *ndr, int flags, const struct dssetup_DsRoleDemoteDc *r)
+{
+       if (flags & NDR_IN) {
+       }
+       if (flags & NDR_OUT) {
+               NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_dssetup_DsRoleDemoteDc(struct ndr_pull *ndr, int flags, struct dssetup_DsRoleDemoteDc *r)
+{
+       if (flags & NDR_IN) {
+       }
+       if (flags & NDR_OUT) {
+               NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_dssetup_DsRoleDemoteDc(struct ndr_print *ndr, const char *name, int flags, const struct dssetup_DsRoleDemoteDc *r)
+{
+       ndr_print_struct(ndr, name, "dssetup_DsRoleDemoteDc");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "dssetup_DsRoleDemoteDc");
+               ndr->depth++;
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "dssetup_DsRoleDemoteDc");
+               ndr->depth++;
+               ndr_print_WERROR(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_dssetup_DsRoleGetDcOperationProgress(struct ndr_push *ndr, int flags, const struct dssetup_DsRoleGetDcOperationProgress *r)
+{
+       if (flags & NDR_IN) {
+       }
+       if (flags & NDR_OUT) {
+               NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_dssetup_DsRoleGetDcOperationProgress(struct ndr_pull *ndr, int flags, struct dssetup_DsRoleGetDcOperationProgress *r)
+{
+       if (flags & NDR_IN) {
+       }
+       if (flags & NDR_OUT) {
+               NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_dssetup_DsRoleGetDcOperationProgress(struct ndr_print *ndr, const char *name, int flags, const struct dssetup_DsRoleGetDcOperationProgress *r)
+{
+       ndr_print_struct(ndr, name, "dssetup_DsRoleGetDcOperationProgress");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "dssetup_DsRoleGetDcOperationProgress");
+               ndr->depth++;
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "dssetup_DsRoleGetDcOperationProgress");
+               ndr->depth++;
+               ndr_print_WERROR(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_dssetup_DsRoleGetDcOperationResults(struct ndr_push *ndr, int flags, const struct dssetup_DsRoleGetDcOperationResults *r)
+{
+       if (flags & NDR_IN) {
+       }
+       if (flags & NDR_OUT) {
+               NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_dssetup_DsRoleGetDcOperationResults(struct ndr_pull *ndr, int flags, struct dssetup_DsRoleGetDcOperationResults *r)
+{
+       if (flags & NDR_IN) {
+       }
+       if (flags & NDR_OUT) {
+               NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_dssetup_DsRoleGetDcOperationResults(struct ndr_print *ndr, const char *name, int flags, const struct dssetup_DsRoleGetDcOperationResults *r)
+{
+       ndr_print_struct(ndr, name, "dssetup_DsRoleGetDcOperationResults");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "dssetup_DsRoleGetDcOperationResults");
+               ndr->depth++;
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "dssetup_DsRoleGetDcOperationResults");
+               ndr->depth++;
+               ndr_print_WERROR(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_dssetup_DsRoleCancel(struct ndr_push *ndr, int flags, const struct dssetup_DsRoleCancel *r)
+{
+       if (flags & NDR_IN) {
+       }
+       if (flags & NDR_OUT) {
+               NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_dssetup_DsRoleCancel(struct ndr_pull *ndr, int flags, struct dssetup_DsRoleCancel *r)
+{
+       if (flags & NDR_IN) {
+       }
+       if (flags & NDR_OUT) {
+               NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_dssetup_DsRoleCancel(struct ndr_print *ndr, const char *name, int flags, const struct dssetup_DsRoleCancel *r)
+{
+       ndr_print_struct(ndr, name, "dssetup_DsRoleCancel");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "dssetup_DsRoleCancel");
+               ndr->depth++;
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "dssetup_DsRoleCancel");
+               ndr->depth++;
+               ndr_print_WERROR(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_dssetup_DsRoleServerSaveStateForUpgrade(struct ndr_push *ndr, int flags, const struct dssetup_DsRoleServerSaveStateForUpgrade *r)
+{
+       if (flags & NDR_IN) {
+       }
+       if (flags & NDR_OUT) {
+               NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_dssetup_DsRoleServerSaveStateForUpgrade(struct ndr_pull *ndr, int flags, struct dssetup_DsRoleServerSaveStateForUpgrade *r)
+{
+       if (flags & NDR_IN) {
+       }
+       if (flags & NDR_OUT) {
+               NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_dssetup_DsRoleServerSaveStateForUpgrade(struct ndr_print *ndr, const char *name, int flags, const struct dssetup_DsRoleServerSaveStateForUpgrade *r)
+{
+       ndr_print_struct(ndr, name, "dssetup_DsRoleServerSaveStateForUpgrade");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "dssetup_DsRoleServerSaveStateForUpgrade");
+               ndr->depth++;
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "dssetup_DsRoleServerSaveStateForUpgrade");
+               ndr->depth++;
+               ndr_print_WERROR(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_dssetup_DsRoleUpgradeDownlevelServer(struct ndr_push *ndr, int flags, const struct dssetup_DsRoleUpgradeDownlevelServer *r)
+{
+       if (flags & NDR_IN) {
+       }
+       if (flags & NDR_OUT) {
+               NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_dssetup_DsRoleUpgradeDownlevelServer(struct ndr_pull *ndr, int flags, struct dssetup_DsRoleUpgradeDownlevelServer *r)
+{
+       if (flags & NDR_IN) {
+       }
+       if (flags & NDR_OUT) {
+               NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_dssetup_DsRoleUpgradeDownlevelServer(struct ndr_print *ndr, const char *name, int flags, const struct dssetup_DsRoleUpgradeDownlevelServer *r)
+{
+       ndr_print_struct(ndr, name, "dssetup_DsRoleUpgradeDownlevelServer");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "dssetup_DsRoleUpgradeDownlevelServer");
+               ndr->depth++;
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "dssetup_DsRoleUpgradeDownlevelServer");
+               ndr->depth++;
+               ndr_print_WERROR(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_dssetup_DsRoleAbortDownlevelServerUpgrade(struct ndr_push *ndr, int flags, const struct dssetup_DsRoleAbortDownlevelServerUpgrade *r)
+{
+       if (flags & NDR_IN) {
+       }
+       if (flags & NDR_OUT) {
+               NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_dssetup_DsRoleAbortDownlevelServerUpgrade(struct ndr_pull *ndr, int flags, struct dssetup_DsRoleAbortDownlevelServerUpgrade *r)
+{
+       if (flags & NDR_IN) {
+       }
+       if (flags & NDR_OUT) {
+               NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_dssetup_DsRoleAbortDownlevelServerUpgrade(struct ndr_print *ndr, const char *name, int flags, const struct dssetup_DsRoleAbortDownlevelServerUpgrade *r)
+{
+       ndr_print_struct(ndr, name, "dssetup_DsRoleAbortDownlevelServerUpgrade");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "dssetup_DsRoleAbortDownlevelServerUpgrade");
+               ndr->depth++;
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "dssetup_DsRoleAbortDownlevelServerUpgrade");
+               ndr->depth++;
+               ndr_print_WERROR(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static const struct ndr_interface_call dssetup_calls[] = {
+       {
+               "dssetup_DsRoleGetPrimaryDomainInformation",
+               sizeof(struct dssetup_DsRoleGetPrimaryDomainInformation),
+               (ndr_push_flags_fn_t) ndr_push_dssetup_DsRoleGetPrimaryDomainInformation,
+               (ndr_pull_flags_fn_t) ndr_pull_dssetup_DsRoleGetPrimaryDomainInformation,
+               (ndr_print_function_t) ndr_print_dssetup_DsRoleGetPrimaryDomainInformation,
+               false,
+       },
+       {
+               "dssetup_DsRoleDnsNameToFlatName",
+               sizeof(struct dssetup_DsRoleDnsNameToFlatName),
+               (ndr_push_flags_fn_t) ndr_push_dssetup_DsRoleDnsNameToFlatName,
+               (ndr_pull_flags_fn_t) ndr_pull_dssetup_DsRoleDnsNameToFlatName,
+               (ndr_print_function_t) ndr_print_dssetup_DsRoleDnsNameToFlatName,
+               false,
+       },
+       {
+               "dssetup_DsRoleDcAsDc",
+               sizeof(struct dssetup_DsRoleDcAsDc),
+               (ndr_push_flags_fn_t) ndr_push_dssetup_DsRoleDcAsDc,
+               (ndr_pull_flags_fn_t) ndr_pull_dssetup_DsRoleDcAsDc,
+               (ndr_print_function_t) ndr_print_dssetup_DsRoleDcAsDc,
+               false,
+       },
+       {
+               "dssetup_DsRoleDcAsReplica",
+               sizeof(struct dssetup_DsRoleDcAsReplica),
+               (ndr_push_flags_fn_t) ndr_push_dssetup_DsRoleDcAsReplica,
+               (ndr_pull_flags_fn_t) ndr_pull_dssetup_DsRoleDcAsReplica,
+               (ndr_print_function_t) ndr_print_dssetup_DsRoleDcAsReplica,
+               false,
+       },
+       {
+               "dssetup_DsRoleDemoteDc",
+               sizeof(struct dssetup_DsRoleDemoteDc),
+               (ndr_push_flags_fn_t) ndr_push_dssetup_DsRoleDemoteDc,
+               (ndr_pull_flags_fn_t) ndr_pull_dssetup_DsRoleDemoteDc,
+               (ndr_print_function_t) ndr_print_dssetup_DsRoleDemoteDc,
+               false,
+       },
+       {
+               "dssetup_DsRoleGetDcOperationProgress",
+               sizeof(struct dssetup_DsRoleGetDcOperationProgress),
+               (ndr_push_flags_fn_t) ndr_push_dssetup_DsRoleGetDcOperationProgress,
+               (ndr_pull_flags_fn_t) ndr_pull_dssetup_DsRoleGetDcOperationProgress,
+               (ndr_print_function_t) ndr_print_dssetup_DsRoleGetDcOperationProgress,
+               false,
+       },
+       {
+               "dssetup_DsRoleGetDcOperationResults",
+               sizeof(struct dssetup_DsRoleGetDcOperationResults),
+               (ndr_push_flags_fn_t) ndr_push_dssetup_DsRoleGetDcOperationResults,
+               (ndr_pull_flags_fn_t) ndr_pull_dssetup_DsRoleGetDcOperationResults,
+               (ndr_print_function_t) ndr_print_dssetup_DsRoleGetDcOperationResults,
+               false,
+       },
+       {
+               "dssetup_DsRoleCancel",
+               sizeof(struct dssetup_DsRoleCancel),
+               (ndr_push_flags_fn_t) ndr_push_dssetup_DsRoleCancel,
+               (ndr_pull_flags_fn_t) ndr_pull_dssetup_DsRoleCancel,
+               (ndr_print_function_t) ndr_print_dssetup_DsRoleCancel,
+               false,
+       },
+       {
+               "dssetup_DsRoleServerSaveStateForUpgrade",
+               sizeof(struct dssetup_DsRoleServerSaveStateForUpgrade),
+               (ndr_push_flags_fn_t) ndr_push_dssetup_DsRoleServerSaveStateForUpgrade,
+               (ndr_pull_flags_fn_t) ndr_pull_dssetup_DsRoleServerSaveStateForUpgrade,
+               (ndr_print_function_t) ndr_print_dssetup_DsRoleServerSaveStateForUpgrade,
+               false,
+       },
+       {
+               "dssetup_DsRoleUpgradeDownlevelServer",
+               sizeof(struct dssetup_DsRoleUpgradeDownlevelServer),
+               (ndr_push_flags_fn_t) ndr_push_dssetup_DsRoleUpgradeDownlevelServer,
+               (ndr_pull_flags_fn_t) ndr_pull_dssetup_DsRoleUpgradeDownlevelServer,
+               (ndr_print_function_t) ndr_print_dssetup_DsRoleUpgradeDownlevelServer,
+               false,
+       },
+       {
+               "dssetup_DsRoleAbortDownlevelServerUpgrade",
+               sizeof(struct dssetup_DsRoleAbortDownlevelServerUpgrade),
+               (ndr_push_flags_fn_t) ndr_push_dssetup_DsRoleAbortDownlevelServerUpgrade,
+               (ndr_pull_flags_fn_t) ndr_pull_dssetup_DsRoleAbortDownlevelServerUpgrade,
+               (ndr_print_function_t) ndr_print_dssetup_DsRoleAbortDownlevelServerUpgrade,
+               false,
+       },
+       { NULL, 0, NULL, NULL, NULL, false }
+};
+
+static const char * const dssetup_endpoint_strings[] = {
+       "ncacn_np:[\\pipe\\lsarpc]", 
+       "ncacn_np:[\\pipe\\lsass]", 
+       "ncacn_ip_tcp:", 
+       "ncalrpc:", 
+};
+
+static const struct ndr_interface_string_array dssetup_endpoints = {
+       .count  = 4,
+       .names  = dssetup_endpoint_strings
+};
+
+static const char * const dssetup_authservice_strings[] = {
+       "host", 
+};
+
+static const struct ndr_interface_string_array dssetup_authservices = {
+       .count  = 4,
+       .names  = dssetup_authservice_strings
+};
+
+
+const struct ndr_interface_table ndr_table_dssetup = {
+       .name           = "dssetup",
+       .syntax_id      = {
+               {0x3919286a,0xb10c,0x11d0,{0x9b,0xa8},{0x00,0xc0,0x4f,0xd9,0x2e,0xf5}},
+               NDR_DSSETUP_VERSION
+       },
+       .helpstring     = NDR_DSSETUP_HELPSTRING,
+       .num_calls      = 11,
+       .calls          = dssetup_calls,
+       .endpoints      = &dssetup_endpoints,
+       .authservices   = &dssetup_authservices
+};
+
diff --git a/source/librpc/gen_ndr/ndr_dssetup.h b/source/librpc/gen_ndr/ndr_dssetup.h
new file mode 100644 (file)
index 0000000..103ad11
--- /dev/null
@@ -0,0 +1,58 @@
+/* header auto-generated by pidl */
+
+#include "librpc/ndr/libndr.h"
+#include "librpc/gen_ndr/dssetup.h"
+
+#ifndef _HEADER_NDR_dssetup
+#define _HEADER_NDR_dssetup
+
+#define NDR_DSSETUP_UUID "3919286a-b10c-11d0-9ba8-00c04fd92ef5"
+#define NDR_DSSETUP_VERSION 0.0
+#define NDR_DSSETUP_NAME "dssetup"
+#define NDR_DSSETUP_HELPSTRING "Active Directory Setup"
+extern const struct ndr_interface_table ndr_table_dssetup;
+#define NDR_DSSETUP_DSROLEGETPRIMARYDOMAININFORMATION (0x00)
+
+#define NDR_DSSETUP_DSROLEDNSNAMETOFLATNAME (0x01)
+
+#define NDR_DSSETUP_DSROLEDCASDC (0x02)
+
+#define NDR_DSSETUP_DSROLEDCASREPLICA (0x03)
+
+#define NDR_DSSETUP_DSROLEDEMOTEDC (0x04)
+
+#define NDR_DSSETUP_DSROLEGETDCOPERATIONPROGRESS (0x05)
+
+#define NDR_DSSETUP_DSROLEGETDCOPERATIONRESULTS (0x06)
+
+#define NDR_DSSETUP_DSROLECANCEL (0x07)
+
+#define NDR_DSSETUP_DSROLESERVERSAVESTATEFORUPGRADE (0x08)
+
+#define NDR_DSSETUP_DSROLEUPGRADEDOWNLEVELSERVER (0x09)
+
+#define NDR_DSSETUP_DSROLEABORTDOWNLEVELSERVERUPGRADE (0x0a)
+
+#define NDR_DSSETUP_CALL_COUNT (11)
+void ndr_print_dssetup_DsRole(struct ndr_print *ndr, const char *name, enum dssetup_DsRole r);
+void ndr_print_dssetup_DsRoleFlags(struct ndr_print *ndr, const char *name, uint32_t r);
+void ndr_print_dssetup_DsRolePrimaryDomInfoBasic(struct ndr_print *ndr, const char *name, const struct dssetup_DsRolePrimaryDomInfoBasic *r);
+void ndr_print_dssetup_DsUpgrade(struct ndr_print *ndr, const char *name, enum dssetup_DsUpgrade r);
+void ndr_print_dssetup_DsPrevious(struct ndr_print *ndr, const char *name, enum dssetup_DsPrevious r);
+void ndr_print_dssetup_DsRoleUpgradeStatus(struct ndr_print *ndr, const char *name, const struct dssetup_DsRoleUpgradeStatus *r);
+void ndr_print_dssetup_DsRoleOp(struct ndr_print *ndr, const char *name, enum dssetup_DsRoleOp r);
+void ndr_print_dssetup_DsRoleOpStatus(struct ndr_print *ndr, const char *name, const struct dssetup_DsRoleOpStatus *r);
+void ndr_print_dssetup_DsRoleInfoLevel(struct ndr_print *ndr, const char *name, enum dssetup_DsRoleInfoLevel r);
+void ndr_print_dssetup_DsRoleInfo(struct ndr_print *ndr, const char *name, const union dssetup_DsRoleInfo *r);
+void ndr_print_dssetup_DsRoleGetPrimaryDomainInformation(struct ndr_print *ndr, const char *name, int flags, const struct dssetup_DsRoleGetPrimaryDomainInformation *r);
+void ndr_print_dssetup_DsRoleDnsNameToFlatName(struct ndr_print *ndr, const char *name, int flags, const struct dssetup_DsRoleDnsNameToFlatName *r);
+void ndr_print_dssetup_DsRoleDcAsDc(struct ndr_print *ndr, const char *name, int flags, const struct dssetup_DsRoleDcAsDc *r);
+void ndr_print_dssetup_DsRoleDcAsReplica(struct ndr_print *ndr, const char *name, int flags, const struct dssetup_DsRoleDcAsReplica *r);
+void ndr_print_dssetup_DsRoleDemoteDc(struct ndr_print *ndr, const char *name, int flags, const struct dssetup_DsRoleDemoteDc *r);
+void ndr_print_dssetup_DsRoleGetDcOperationProgress(struct ndr_print *ndr, const char *name, int flags, const struct dssetup_DsRoleGetDcOperationProgress *r);
+void ndr_print_dssetup_DsRoleGetDcOperationResults(struct ndr_print *ndr, const char *name, int flags, const struct dssetup_DsRoleGetDcOperationResults *r);
+void ndr_print_dssetup_DsRoleCancel(struct ndr_print *ndr, const char *name, int flags, const struct dssetup_DsRoleCancel *r);
+void ndr_print_dssetup_DsRoleServerSaveStateForUpgrade(struct ndr_print *ndr, const char *name, int flags, const struct dssetup_DsRoleServerSaveStateForUpgrade *r);
+void ndr_print_dssetup_DsRoleUpgradeDownlevelServer(struct ndr_print *ndr, const char *name, int flags, const struct dssetup_DsRoleUpgradeDownlevelServer *r);
+void ndr_print_dssetup_DsRoleAbortDownlevelServerUpgrade(struct ndr_print *ndr, const char *name, int flags, const struct dssetup_DsRoleAbortDownlevelServerUpgrade *r);
+#endif /* _HEADER_NDR_dssetup */
index 01b1d10fac00cecf94eda3494e30ef70518d2e19..29a10220e5e1b04f38b76ded017eab6860c88c4b 100644 (file)
@@ -93,7 +93,7 @@ _PUBLIC_ void ndr_print_echo_info3(struct ndr_print *ndr, const char *name, cons
        ndr->depth--;
 }
 
-static enum ndr_err_code ndr_push_echo_info4(struct ndr_push *ndr, int ndr_flags, const struct echo_info4 *r)
+static enum ndr_err_code ndr_push_STRUCT_echo_info4(struct ndr_push *ndr, int ndr_flags, const struct echo_info4 *r)
 {
        if (ndr_flags & NDR_SCALARS) {
                NDR_CHECK(ndr_push_align(ndr, 8));
@@ -104,7 +104,7 @@ static enum ndr_err_code ndr_push_echo_info4(struct ndr_push *ndr, int ndr_flags
        return NDR_ERR_SUCCESS;
 }
 
-static enum ndr_err_code ndr_pull_echo_info4(struct ndr_pull *ndr, int ndr_flags, struct echo_info4 *r)
+static enum ndr_err_code ndr_pull_STRUCT_echo_info4(struct ndr_pull *ndr, int ndr_flags, struct echo_info4 *r)
 {
        if (ndr_flags & NDR_SCALARS) {
                NDR_CHECK(ndr_pull_align(ndr, 8));
@@ -115,7 +115,7 @@ static enum ndr_err_code ndr_pull_echo_info4(struct ndr_pull *ndr, int ndr_flags
        return NDR_ERR_SUCCESS;
 }
 
-_PUBLIC_ void ndr_print_echo_info4(struct ndr_print *ndr, const char *name, const struct echo_info4 *r)
+_PUBLIC_ void ndr_print_STRUCT_echo_info4(struct ndr_print *ndr, const char *name, const struct echo_info4 *r)
 {
        ndr_print_struct(ndr, name, "echo_info4");
        ndr->depth++;
@@ -194,7 +194,7 @@ static enum ndr_err_code ndr_push_echo_info7(struct ndr_push *ndr, int ndr_flags
        if (ndr_flags & NDR_SCALARS) {
                NDR_CHECK(ndr_push_align(ndr, 8));
                NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->v1));
-               NDR_CHECK(ndr_push_echo_info4(ndr, NDR_SCALARS, &r->info4));
+               NDR_CHECK(ndr_push_STRUCT_echo_info4(ndr, NDR_SCALARS, &r->info4));
        }
        if (ndr_flags & NDR_BUFFERS) {
        }
@@ -206,7 +206,7 @@ static enum ndr_err_code ndr_pull_echo_info7(struct ndr_pull *ndr, int ndr_flags
        if (ndr_flags & NDR_SCALARS) {
                NDR_CHECK(ndr_pull_align(ndr, 8));
                NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->v1));
-               NDR_CHECK(ndr_pull_echo_info4(ndr, NDR_SCALARS, &r->info4));
+               NDR_CHECK(ndr_pull_STRUCT_echo_info4(ndr, NDR_SCALARS, &r->info4));
        }
        if (ndr_flags & NDR_BUFFERS) {
        }
@@ -218,7 +218,7 @@ _PUBLIC_ void ndr_print_echo_info7(struct ndr_print *ndr, const char *name, cons
        ndr_print_struct(ndr, name, "echo_info7");
        ndr->depth++;
        ndr_print_uint8(ndr, "v1", r->v1);
-       ndr_print_echo_info4(ndr, "info4", &r->info4);
+       ndr_print_STRUCT_echo_info4(ndr, "info4", &r->info4);
        ndr->depth--;
 }
 
@@ -241,7 +241,7 @@ static enum ndr_err_code ndr_push_echo_Info(struct ndr_push *ndr, int ndr_flags,
                        break;
 
                        case 4:
-                               NDR_CHECK(ndr_push_echo_info4(ndr, NDR_SCALARS, &r->info4));
+                               NDR_CHECK(ndr_push_STRUCT_echo_info4(ndr, NDR_SCALARS, &r->info4));
                        break;
 
                        case 5:
@@ -315,7 +315,7 @@ static enum ndr_err_code ndr_pull_echo_Info(struct ndr_pull *ndr, int ndr_flags,
                        break; }
 
                        case 4: {
-                               NDR_CHECK(ndr_pull_echo_info4(ndr, NDR_SCALARS, &r->info4));
+                               NDR_CHECK(ndr_pull_STRUCT_echo_info4(ndr, NDR_SCALARS, &r->info4));
                        break; }
 
                        case 5: {
@@ -383,7 +383,7 @@ _PUBLIC_ void ndr_print_echo_Info(struct ndr_print *ndr, const char *name, const
                break;
 
                case 4:
-                       ndr_print_echo_info4(ndr, "info4", &r->info4);
+                       ndr_print_STRUCT_echo_info4(ndr, "info4", &r->info4);
                break;
 
                case 5:
index 65989ccd1c386de90f1e452a9e72ec3d1cd8218d..7af1c7446b8fa4b1277addca50032f80847d7812 100644 (file)
@@ -35,7 +35,7 @@ extern const struct ndr_interface_table ndr_table_rpcecho;
 void ndr_print_echo_info1(struct ndr_print *ndr, const char *name, const struct echo_info1 *r);
 void ndr_print_echo_info2(struct ndr_print *ndr, const char *name, const struct echo_info2 *r);
 void ndr_print_echo_info3(struct ndr_print *ndr, const char *name, const struct echo_info3 *r);
-void ndr_print_echo_info4(struct ndr_print *ndr, const char *name, const struct echo_info4 *r);
+void ndr_print_STRUCT_echo_info4(struct ndr_print *ndr, const char *name, const struct echo_info4 *r);
 void ndr_print_echo_info5(struct ndr_print *ndr, const char *name, const struct echo_info5 *r);
 void ndr_print_echo_info6(struct ndr_print *ndr, const char *name, const struct echo_info6 *r);
 void ndr_print_echo_info7(struct ndr_print *ndr, const char *name, const struct echo_info7 *r);
diff --git a/source/librpc/gen_ndr/ndr_libnet_join.c b/source/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/source/librpc/gen_ndr/ndr_libnet_join.h b/source/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 */
index ec22c9be3812eee5a33a78b6ebf1ec6200f3dd94..25fa3d212987d99535558bacf53981484981b2b3 100644 (file)
@@ -690,6 +690,34 @@ _PUBLIC_ void ndr_print_lsa_AuditLogInfo(struct ndr_print *ndr, const char *name
        ndr->depth--;
 }
 
+static enum ndr_err_code ndr_push_lsa_PolicyAuditPolicy(struct ndr_push *ndr, int ndr_flags, enum lsa_PolicyAuditPolicy r)
+{
+       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_lsa_PolicyAuditPolicy(struct ndr_pull *ndr, int ndr_flags, enum lsa_PolicyAuditPolicy *r)
+{
+       uint32_t v;
+       NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
+       *r = v;
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_lsa_PolicyAuditPolicy(struct ndr_print *ndr, const char *name, enum lsa_PolicyAuditPolicy r)
+{
+       const char *val = NULL;
+
+       switch (r) {
+               case LSA_AUDIT_POLICY_NONE: val = "LSA_AUDIT_POLICY_NONE"; break;
+               case LSA_AUDIT_POLICY_SUCCESS: val = "LSA_AUDIT_POLICY_SUCCESS"; break;
+               case LSA_AUDIT_POLICY_FAILURE: val = "LSA_AUDIT_POLICY_FAILURE"; break;
+               case LSA_AUDIT_POLICY_ALL: val = "LSA_AUDIT_POLICY_ALL"; break;
+               case LSA_AUDIT_POLICY_CLEAR: val = "LSA_AUDIT_POLICY_CLEAR"; break;
+       }
+       ndr_print_enum(ndr, name, "ENUM", val, r);
+}
+
 static enum ndr_err_code ndr_push_lsa_AuditEventsInfo(struct ndr_push *ndr, int ndr_flags, const struct lsa_AuditEventsInfo *r)
 {
        uint32_t cntr_settings_1;
@@ -703,7 +731,7 @@ static enum ndr_err_code ndr_push_lsa_AuditEventsInfo(struct ndr_push *ndr, int
                if (r->settings) {
                        NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count));
                        for (cntr_settings_1 = 0; cntr_settings_1 < r->count; cntr_settings_1++) {
-                               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->settings[cntr_settings_1]));
+                               NDR_CHECK(ndr_push_lsa_PolicyAuditPolicy(ndr, NDR_SCALARS, r->settings[cntr_settings_1]));
                        }
                }
        }
@@ -736,7 +764,7 @@ static enum ndr_err_code ndr_pull_lsa_AuditEventsInfo(struct ndr_pull *ndr, int
                        _mem_save_settings_1 = NDR_PULL_GET_MEM_CTX(ndr);
                        NDR_PULL_SET_MEM_CTX(ndr, r->settings, 0);
                        for (cntr_settings_1 = 0; cntr_settings_1 < r->count; cntr_settings_1++) {
-                               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->settings[cntr_settings_1]));
+                               NDR_CHECK(ndr_pull_lsa_PolicyAuditPolicy(ndr, NDR_SCALARS, &r->settings[cntr_settings_1]));
                        }
                        NDR_PULL_SET_MEM_CTX(ndr, _mem_save_settings_1, 0);
                        NDR_PULL_SET_MEM_CTX(ndr, _mem_save_settings_0, 0);
@@ -763,7 +791,7 @@ _PUBLIC_ void ndr_print_lsa_AuditEventsInfo(struct ndr_print *ndr, const char *n
                        char *idx_1=NULL;
                        asprintf(&idx_1, "[%d]", cntr_settings_1);
                        if (idx_1) {
-                               ndr_print_uint32(ndr, "settings", r->settings[cntr_settings_1]);
+                               ndr_print_lsa_PolicyAuditPolicy(ndr, "settings", r->settings[cntr_settings_1]);
                                free(idx_1);
                        }
                }
@@ -1147,6 +1175,41 @@ _PUBLIC_ void ndr_print_lsa_DnsDomainInfo(struct ndr_print *ndr, const char *nam
        ndr->depth--;
 }
 
+static enum ndr_err_code ndr_push_lsa_PolicyInfo(struct ndr_push *ndr, int ndr_flags, enum lsa_PolicyInfo r)
+{
+       NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r));
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_lsa_PolicyInfo(struct ndr_pull *ndr, int ndr_flags, enum lsa_PolicyInfo *r)
+{
+       uint16_t v;
+       NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v));
+       *r = v;
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_lsa_PolicyInfo(struct ndr_print *ndr, const char *name, enum lsa_PolicyInfo r)
+{
+       const char *val = NULL;
+
+       switch (r) {
+               case LSA_POLICY_INFO_AUDIT_LOG: val = "LSA_POLICY_INFO_AUDIT_LOG"; break;
+               case LSA_POLICY_INFO_AUDIT_EVENTS: val = "LSA_POLICY_INFO_AUDIT_EVENTS"; break;
+               case LSA_POLICY_INFO_DOMAIN: val = "LSA_POLICY_INFO_DOMAIN"; break;
+               case LSA_POLICY_INFO_PD: val = "LSA_POLICY_INFO_PD"; break;
+               case LSA_POLICY_INFO_ACCOUNT_DOMAIN: val = "LSA_POLICY_INFO_ACCOUNT_DOMAIN"; break;
+               case LSA_POLICY_INFO_ROLE: val = "LSA_POLICY_INFO_ROLE"; break;
+               case LSA_POLICY_INFO_REPLICA: val = "LSA_POLICY_INFO_REPLICA"; break;
+               case LSA_POLICY_INFO_QUOTA: val = "LSA_POLICY_INFO_QUOTA"; break;
+               case LSA_POLICY_INFO_DB: val = "LSA_POLICY_INFO_DB"; break;
+               case LSA_POLICY_INFO_AUDIT_FULL_SET: val = "LSA_POLICY_INFO_AUDIT_FULL_SET"; break;
+               case LSA_POLICY_INFO_AUDIT_FULL_QUERY: val = "LSA_POLICY_INFO_AUDIT_FULL_QUERY"; break;
+               case LSA_POLICY_INFO_DNS: val = "LSA_POLICY_INFO_DNS"; break;
+       }
+       ndr_print_enum(ndr, name, "ENUM", val, r);
+}
+
 static enum ndr_err_code ndr_push_lsa_PolicyInformation(struct ndr_push *ndr, int ndr_flags, const union lsa_PolicyInformation *r)
 {
        if (ndr_flags & NDR_SCALARS) {
@@ -1904,6 +1967,35 @@ _PUBLIC_ void ndr_print_lsa_RefDomainList(struct ndr_print *ndr, const char *nam
        ndr->depth--;
 }
 
+static enum ndr_err_code ndr_push_lsa_LookupNamesLevel(struct ndr_push *ndr, int ndr_flags, enum lsa_LookupNamesLevel r)
+{
+       NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r));
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_lsa_LookupNamesLevel(struct ndr_pull *ndr, int ndr_flags, enum lsa_LookupNamesLevel *r)
+{
+       uint16_t v;
+       NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v));
+       *r = v;
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_lsa_LookupNamesLevel(struct ndr_print *ndr, const char *name, enum lsa_LookupNamesLevel r)
+{
+       const char *val = NULL;
+
+       switch (r) {
+               case LSA_LOOKUP_NAMES_ALL: val = "LSA_LOOKUP_NAMES_ALL"; break;
+               case LSA_LOOKUP_NAMES_DOMAINS_ONLY: val = "LSA_LOOKUP_NAMES_DOMAINS_ONLY"; break;
+               case LSA_LOOKUP_NAMES_PRIMARY_DOMAIN_ONLY: val = "LSA_LOOKUP_NAMES_PRIMARY_DOMAIN_ONLY"; break;
+               case LSA_LOOKUP_NAMES_UPLEVEL_TRUSTS_ONLY: val = "LSA_LOOKUP_NAMES_UPLEVEL_TRUSTS_ONLY"; break;
+               case LSA_LOOKUP_NAMES_FOREST_TRUSTS_ONLY: val = "LSA_LOOKUP_NAMES_FOREST_TRUSTS_ONLY"; break;
+               case LSA_LOOKUP_NAMES_UPLEVEL_TRUSTS_ONLY2: val = "LSA_LOOKUP_NAMES_UPLEVEL_TRUSTS_ONLY2"; break;
+       }
+       ndr_print_enum(ndr, name, "ENUM", val, r);
+}
+
 static enum ndr_err_code ndr_push_lsa_TranslatedName(struct ndr_push *ndr, int ndr_flags, const struct lsa_TranslatedName *r)
 {
        if (ndr_flags & NDR_SCALARS) {
@@ -3992,6 +4084,434 @@ _PUBLIC_ void ndr_print_lsa_TransSidArray3(struct ndr_print *ndr, const char *na
        ndr->depth--;
 }
 
+static enum ndr_err_code ndr_push_lsa_ForestTrustBinaryData(struct ndr_push *ndr, int ndr_flags, const struct lsa_ForestTrustBinaryData *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->length));
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->data));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               if (r->data) {
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->length));
+                       NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->data, r->length));
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_lsa_ForestTrustBinaryData(struct ndr_pull *ndr, int ndr_flags, struct lsa_ForestTrustBinaryData *r)
+{
+       uint32_t _ptr_data;
+       TALLOC_CTX *_mem_save_data_0;
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->length));
+               if (r->length < 0 || r->length > 131072) {
+                       return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
+               }
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_data));
+               if (_ptr_data) {
+                       NDR_PULL_ALLOC(ndr, r->data);
+               } else {
+                       r->data = NULL;
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               if (r->data) {
+                       _mem_save_data_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->data, 0);
+                       NDR_CHECK(ndr_pull_array_size(ndr, &r->data));
+                       NDR_PULL_ALLOC_N(ndr, r->data, ndr_get_array_size(ndr, &r->data));
+                       NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->data, ndr_get_array_size(ndr, &r->data)));
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_data_0, 0);
+               }
+               if (r->data) {
+                       NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->data, r->length));
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_lsa_ForestTrustBinaryData(struct ndr_print *ndr, const char *name, const struct lsa_ForestTrustBinaryData *r)
+{
+       ndr_print_struct(ndr, name, "lsa_ForestTrustBinaryData");
+       ndr->depth++;
+       ndr_print_uint32(ndr, "length", r->length);
+       ndr_print_ptr(ndr, "data", r->data);
+       ndr->depth++;
+       if (r->data) {
+               ndr_print_array_uint8(ndr, "data", r->data, r->length);
+       }
+       ndr->depth--;
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_lsa_ForestTrustDomainInfo(struct ndr_push *ndr, int ndr_flags, const struct lsa_ForestTrustDomainInfo *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->domain_sid));
+               NDR_CHECK(ndr_push_lsa_StringLarge(ndr, NDR_SCALARS, &r->dns_domain_name));
+               NDR_CHECK(ndr_push_lsa_StringLarge(ndr, NDR_SCALARS, &r->netbios_domain_name));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               if (r->domain_sid) {
+                       NDR_CHECK(ndr_push_dom_sid2(ndr, NDR_SCALARS|NDR_BUFFERS, r->domain_sid));
+               }
+               NDR_CHECK(ndr_push_lsa_StringLarge(ndr, NDR_BUFFERS, &r->dns_domain_name));
+               NDR_CHECK(ndr_push_lsa_StringLarge(ndr, NDR_BUFFERS, &r->netbios_domain_name));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_lsa_ForestTrustDomainInfo(struct ndr_pull *ndr, int ndr_flags, struct lsa_ForestTrustDomainInfo *r)
+{
+       uint32_t _ptr_domain_sid;
+       TALLOC_CTX *_mem_save_domain_sid_0;
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_domain_sid));
+               if (_ptr_domain_sid) {
+                       NDR_PULL_ALLOC(ndr, r->domain_sid);
+               } else {
+                       r->domain_sid = NULL;
+               }
+               NDR_CHECK(ndr_pull_lsa_StringLarge(ndr, NDR_SCALARS, &r->dns_domain_name));
+               NDR_CHECK(ndr_pull_lsa_StringLarge(ndr, NDR_SCALARS, &r->netbios_domain_name));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               if (r->domain_sid) {
+                       _mem_save_domain_sid_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->domain_sid, 0);
+                       NDR_CHECK(ndr_pull_dom_sid2(ndr, NDR_SCALARS|NDR_BUFFERS, r->domain_sid));
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_sid_0, 0);
+               }
+               NDR_CHECK(ndr_pull_lsa_StringLarge(ndr, NDR_BUFFERS, &r->dns_domain_name));
+               NDR_CHECK(ndr_pull_lsa_StringLarge(ndr, NDR_BUFFERS, &r->netbios_domain_name));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_lsa_ForestTrustDomainInfo(struct ndr_print *ndr, const char *name, const struct lsa_ForestTrustDomainInfo *r)
+{
+       ndr_print_struct(ndr, name, "lsa_ForestTrustDomainInfo");
+       ndr->depth++;
+       ndr_print_ptr(ndr, "domain_sid", r->domain_sid);
+       ndr->depth++;
+       if (r->domain_sid) {
+               ndr_print_dom_sid2(ndr, "domain_sid", r->domain_sid);
+       }
+       ndr->depth--;
+       ndr_print_lsa_StringLarge(ndr, "dns_domain_name", &r->dns_domain_name);
+       ndr_print_lsa_StringLarge(ndr, "netbios_domain_name", &r->netbios_domain_name);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_lsa_ForestTrustData(struct ndr_push *ndr, int ndr_flags, const union lsa_ForestTrustData *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               int level = ndr_push_get_switch_value(ndr, r);
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, level));
+               switch (level) {
+                       case LSA_FOREST_TRUST_TOP_LEVEL_NAME:
+                               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->top_level_name));
+                       break;
+
+                       case LSA_FOREST_TRUST_TOP_LEVEL_NAME_EX:
+                               NDR_CHECK(ndr_push_lsa_StringLarge(ndr, NDR_SCALARS, &r->top_level_name_ex));
+                       break;
+
+                       case LSA_FOREST_TRUST_DOMAIN_INFO:
+                               NDR_CHECK(ndr_push_lsa_ForestTrustDomainInfo(ndr, NDR_SCALARS, &r->domain_info));
+                       break;
+
+                       default:
+                               NDR_CHECK(ndr_push_lsa_ForestTrustBinaryData(ndr, NDR_SCALARS, &r->data));
+                       break;
+
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               int level = ndr_push_get_switch_value(ndr, r);
+               switch (level) {
+                       case LSA_FOREST_TRUST_TOP_LEVEL_NAME:
+                               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->top_level_name));
+                       break;
+
+                       case LSA_FOREST_TRUST_TOP_LEVEL_NAME_EX:
+                               NDR_CHECK(ndr_push_lsa_StringLarge(ndr, NDR_BUFFERS, &r->top_level_name_ex));
+                       break;
+
+                       case LSA_FOREST_TRUST_DOMAIN_INFO:
+                               NDR_CHECK(ndr_push_lsa_ForestTrustDomainInfo(ndr, NDR_BUFFERS, &r->domain_info));
+                       break;
+
+                       default:
+                               NDR_CHECK(ndr_push_lsa_ForestTrustBinaryData(ndr, NDR_BUFFERS, &r->data));
+                       break;
+
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_lsa_ForestTrustData(struct ndr_pull *ndr, int ndr_flags, union lsa_ForestTrustData *r)
+{
+       int level;
+       uint32_t _level;
+       level = ndr_pull_get_switch_value(ndr, r);
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &_level));
+               if (_level != level) {
+                       return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u for r", _level);
+               }
+               switch (level) {
+                       case LSA_FOREST_TRUST_TOP_LEVEL_NAME: {
+                               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->top_level_name));
+                       break; }
+
+                       case LSA_FOREST_TRUST_TOP_LEVEL_NAME_EX: {
+                               NDR_CHECK(ndr_pull_lsa_StringLarge(ndr, NDR_SCALARS, &r->top_level_name_ex));
+                       break; }
+
+                       case LSA_FOREST_TRUST_DOMAIN_INFO: {
+                               NDR_CHECK(ndr_pull_lsa_ForestTrustDomainInfo(ndr, NDR_SCALARS, &r->domain_info));
+                       break; }
+
+                       default: {
+                               NDR_CHECK(ndr_pull_lsa_ForestTrustBinaryData(ndr, NDR_SCALARS, &r->data));
+                       break; }
+
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               switch (level) {
+                       case LSA_FOREST_TRUST_TOP_LEVEL_NAME:
+                               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->top_level_name));
+                       break;
+
+                       case LSA_FOREST_TRUST_TOP_LEVEL_NAME_EX:
+                               NDR_CHECK(ndr_pull_lsa_StringLarge(ndr, NDR_BUFFERS, &r->top_level_name_ex));
+                       break;
+
+                       case LSA_FOREST_TRUST_DOMAIN_INFO:
+                               NDR_CHECK(ndr_pull_lsa_ForestTrustDomainInfo(ndr, NDR_BUFFERS, &r->domain_info));
+                       break;
+
+                       default:
+                               NDR_CHECK(ndr_pull_lsa_ForestTrustBinaryData(ndr, NDR_BUFFERS, &r->data));
+                       break;
+
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_lsa_ForestTrustData(struct ndr_print *ndr, const char *name, const union lsa_ForestTrustData *r)
+{
+       int level;
+       level = ndr_print_get_switch_value(ndr, r);
+       ndr_print_union(ndr, name, level, "lsa_ForestTrustData");
+       switch (level) {
+               case LSA_FOREST_TRUST_TOP_LEVEL_NAME:
+                       ndr_print_lsa_String(ndr, "top_level_name", &r->top_level_name);
+               break;
+
+               case LSA_FOREST_TRUST_TOP_LEVEL_NAME_EX:
+                       ndr_print_lsa_StringLarge(ndr, "top_level_name_ex", &r->top_level_name_ex);
+               break;
+
+               case LSA_FOREST_TRUST_DOMAIN_INFO:
+                       ndr_print_lsa_ForestTrustDomainInfo(ndr, "domain_info", &r->domain_info);
+               break;
+
+               default:
+                       ndr_print_lsa_ForestTrustBinaryData(ndr, "data", &r->data);
+               break;
+
+       }
+}
+
+static enum ndr_err_code ndr_push_lsa_ForestTrustRecordType(struct ndr_push *ndr, int ndr_flags, enum lsa_ForestTrustRecordType r)
+{
+       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_lsa_ForestTrustRecordType(struct ndr_pull *ndr, int ndr_flags, enum lsa_ForestTrustRecordType *r)
+{
+       uint32_t v;
+       NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
+       *r = v;
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_lsa_ForestTrustRecordType(struct ndr_print *ndr, const char *name, enum lsa_ForestTrustRecordType r)
+{
+       const char *val = NULL;
+
+       switch (r) {
+               case LSA_FOREST_TRUST_TOP_LEVEL_NAME: val = "LSA_FOREST_TRUST_TOP_LEVEL_NAME"; break;
+               case LSA_FOREST_TRUST_TOP_LEVEL_NAME_EX: val = "LSA_FOREST_TRUST_TOP_LEVEL_NAME_EX"; break;
+               case LSA_FOREST_TRUST_DOMAIN_INFO: val = "LSA_FOREST_TRUST_DOMAIN_INFO"; break;
+               case LSA_FOREST_TRUST_RECORD_TYPE_LAST: val = "LSA_FOREST_TRUST_RECORD_TYPE_LAST"; break;
+       }
+       ndr_print_enum(ndr, name, "ENUM", val, r);
+}
+
+static enum ndr_err_code ndr_push_lsa_ForestTrustRecord(struct ndr_push *ndr, int ndr_flags, const struct lsa_ForestTrustRecord *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 8));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->flags));
+               NDR_CHECK(ndr_push_lsa_ForestTrustRecordType(ndr, NDR_SCALARS, r->level));
+               NDR_CHECK(ndr_push_hyper(ndr, NDR_SCALARS, r->unknown));
+               NDR_CHECK(ndr_push_set_switch_value(ndr, &r->forest_trust_data, r->level));
+               NDR_CHECK(ndr_push_lsa_ForestTrustData(ndr, NDR_SCALARS, &r->forest_trust_data));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_push_lsa_ForestTrustData(ndr, NDR_BUFFERS, &r->forest_trust_data));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_lsa_ForestTrustRecord(struct ndr_pull *ndr, int ndr_flags, struct lsa_ForestTrustRecord *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 8));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->flags));
+               NDR_CHECK(ndr_pull_lsa_ForestTrustRecordType(ndr, NDR_SCALARS, &r->level));
+               NDR_CHECK(ndr_pull_hyper(ndr, NDR_SCALARS, &r->unknown));
+               NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->forest_trust_data, r->level));
+               NDR_CHECK(ndr_pull_lsa_ForestTrustData(ndr, NDR_SCALARS, &r->forest_trust_data));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_pull_lsa_ForestTrustData(ndr, NDR_BUFFERS, &r->forest_trust_data));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_lsa_ForestTrustRecord(struct ndr_print *ndr, const char *name, const struct lsa_ForestTrustRecord *r)
+{
+       ndr_print_struct(ndr, name, "lsa_ForestTrustRecord");
+       ndr->depth++;
+       ndr_print_uint32(ndr, "flags", r->flags);
+       ndr_print_lsa_ForestTrustRecordType(ndr, "level", r->level);
+       ndr_print_hyper(ndr, "unknown", r->unknown);
+       ndr_print_set_switch_value(ndr, &r->forest_trust_data, r->level);
+       ndr_print_lsa_ForestTrustData(ndr, "forest_trust_data", &r->forest_trust_data);
+       ndr->depth--;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_lsa_ForestTrustInformation(struct ndr_push *ndr, int ndr_flags, const struct lsa_ForestTrustInformation *r)
+{
+       uint32_t cntr_entries_1;
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count));
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->entries));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               if (r->entries) {
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count));
+                       for (cntr_entries_1 = 0; cntr_entries_1 < r->count; cntr_entries_1++) {
+                               NDR_CHECK(ndr_push_unique_ptr(ndr, r->entries[cntr_entries_1]));
+                       }
+                       for (cntr_entries_1 = 0; cntr_entries_1 < r->count; cntr_entries_1++) {
+                               if (r->entries[cntr_entries_1]) {
+                                       NDR_CHECK(ndr_push_lsa_ForestTrustRecord(ndr, NDR_SCALARS|NDR_BUFFERS, r->entries[cntr_entries_1]));
+                               }
+                       }
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_lsa_ForestTrustInformation(struct ndr_pull *ndr, int ndr_flags, struct lsa_ForestTrustInformation *r)
+{
+       uint32_t _ptr_entries;
+       uint32_t cntr_entries_1;
+       TALLOC_CTX *_mem_save_entries_0;
+       TALLOC_CTX *_mem_save_entries_1;
+       TALLOC_CTX *_mem_save_entries_2;
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->count));
+               if (r->count < 0 || r->count > 4000) {
+                       return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
+               }
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_entries));
+               if (_ptr_entries) {
+                       NDR_PULL_ALLOC(ndr, r->entries);
+               } else {
+                       r->entries = NULL;
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               if (r->entries) {
+                       _mem_save_entries_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->entries, 0);
+                       NDR_CHECK(ndr_pull_array_size(ndr, &r->entries));
+                       NDR_PULL_ALLOC_N(ndr, r->entries, ndr_get_array_size(ndr, &r->entries));
+                       _mem_save_entries_1 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->entries, 0);
+                       for (cntr_entries_1 = 0; cntr_entries_1 < r->count; cntr_entries_1++) {
+                               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_entries));
+                               if (_ptr_entries) {
+                                       NDR_PULL_ALLOC(ndr, r->entries[cntr_entries_1]);
+                               } else {
+                                       r->entries[cntr_entries_1] = NULL;
+                               }
+                       }
+                       for (cntr_entries_1 = 0; cntr_entries_1 < r->count; cntr_entries_1++) {
+                               if (r->entries[cntr_entries_1]) {
+                                       _mem_save_entries_2 = NDR_PULL_GET_MEM_CTX(ndr);
+                                       NDR_PULL_SET_MEM_CTX(ndr, r->entries[cntr_entries_1], 0);
+                                       NDR_CHECK(ndr_pull_lsa_ForestTrustRecord(ndr, NDR_SCALARS|NDR_BUFFERS, r->entries[cntr_entries_1]));
+                                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_entries_2, 0);
+                               }
+                       }
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_entries_1, 0);
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_entries_0, 0);
+               }
+               if (r->entries) {
+                       NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->entries, r->count));
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_lsa_ForestTrustInformation(struct ndr_print *ndr, const char *name, const struct lsa_ForestTrustInformation *r)
+{
+       uint32_t cntr_entries_1;
+       ndr_print_struct(ndr, name, "lsa_ForestTrustInformation");
+       ndr->depth++;
+       ndr_print_uint32(ndr, "count", r->count);
+       ndr_print_ptr(ndr, "entries", r->entries);
+       ndr->depth++;
+       if (r->entries) {
+               ndr->print(ndr, "%s: ARRAY(%d)", "entries", r->count);
+               ndr->depth++;
+               for (cntr_entries_1=0;cntr_entries_1<r->count;cntr_entries_1++) {
+                       char *idx_1=NULL;
+                       asprintf(&idx_1, "[%d]", cntr_entries_1);
+                       if (idx_1) {
+                               ndr_print_ptr(ndr, "entries", r->entries[cntr_entries_1]);
+                               ndr->depth++;
+                               if (r->entries[cntr_entries_1]) {
+                                       ndr_print_lsa_ForestTrustRecord(ndr, "entries", r->entries[cntr_entries_1]);
+                               }
+                               ndr->depth--;
+                               free(idx_1);
+                       }
+               }
+               ndr->depth--;
+       }
+       ndr->depth--;
+       ndr->depth--;
+}
+
 static enum ndr_err_code ndr_push_lsa_Close(struct ndr_push *ndr, int flags, const struct lsa_Close *r)
 {
        if (flags & NDR_IN) {
@@ -4068,7 +4588,7 @@ _PUBLIC_ void ndr_print_lsa_Close(struct ndr_print *ndr, const char *name, int f
        ndr->depth--;
 }
 
-static enum ndr_err_code ndr_push_lsa_Delete(struct ndr_push *ndr, int flags, const struct lsa_Delete *r)
+_PUBLIC_ enum ndr_err_code ndr_push_lsa_Delete(struct ndr_push *ndr, int flags, const struct lsa_Delete *r)
 {
        if (flags & NDR_IN) {
                if (r->in.handle == NULL) {
@@ -4082,7 +4602,7 @@ static enum ndr_err_code ndr_push_lsa_Delete(struct ndr_push *ndr, int flags, co
        return NDR_ERR_SUCCESS;
 }
 
-static enum ndr_err_code ndr_pull_lsa_Delete(struct ndr_pull *ndr, int flags, struct lsa_Delete *r)
+_PUBLIC_ enum ndr_err_code ndr_pull_lsa_Delete(struct ndr_pull *ndr, int flags, struct lsa_Delete *r)
 {
        TALLOC_CTX *_mem_save_handle_0;
        if (flags & NDR_IN) {
@@ -4125,7 +4645,7 @@ _PUBLIC_ void ndr_print_lsa_Delete(struct ndr_print *ndr, const char *name, int
        ndr->depth--;
 }
 
-static enum ndr_err_code ndr_push_lsa_EnumPrivs(struct ndr_push *ndr, int flags, const struct lsa_EnumPrivs *r)
+_PUBLIC_ enum ndr_err_code ndr_push_lsa_EnumPrivs(struct ndr_push *ndr, int flags, const struct lsa_EnumPrivs *r)
 {
        if (flags & NDR_IN) {
                if (r->in.handle == NULL) {
@@ -4152,7 +4672,7 @@ static enum ndr_err_code ndr_push_lsa_EnumPrivs(struct ndr_push *ndr, int flags,
        return NDR_ERR_SUCCESS;
 }
 
-static enum ndr_err_code ndr_pull_lsa_EnumPrivs(struct ndr_pull *ndr, int flags, struct lsa_EnumPrivs *r)
+_PUBLIC_ enum ndr_err_code ndr_pull_lsa_EnumPrivs(struct ndr_pull *ndr, int flags, struct lsa_EnumPrivs *r)
 {
        TALLOC_CTX *_mem_save_handle_0;
        TALLOC_CTX *_mem_save_resume_handle_0;
@@ -4406,7 +4926,7 @@ _PUBLIC_ void ndr_print_lsa_ChangePassword(struct ndr_print *ndr, const char *na
        ndr->depth--;
 }
 
-static enum ndr_err_code ndr_push_lsa_OpenPolicy(struct ndr_push *ndr, int flags, const struct lsa_OpenPolicy *r)
+_PUBLIC_ enum ndr_err_code ndr_push_lsa_OpenPolicy(struct ndr_push *ndr, int flags, const struct lsa_OpenPolicy *r)
 {
        if (flags & NDR_IN) {
                NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.system_name));
@@ -4429,7 +4949,7 @@ static enum ndr_err_code ndr_push_lsa_OpenPolicy(struct ndr_push *ndr, int flags
        return NDR_ERR_SUCCESS;
 }
 
-static enum ndr_err_code ndr_pull_lsa_OpenPolicy(struct ndr_pull *ndr, int flags, struct lsa_OpenPolicy *r)
+_PUBLIC_ enum ndr_err_code ndr_pull_lsa_OpenPolicy(struct ndr_pull *ndr, int flags, struct lsa_OpenPolicy *r)
 {
        uint32_t _ptr_system_name;
        TALLOC_CTX *_mem_save_system_name_0;
@@ -4517,7 +5037,7 @@ static enum ndr_err_code ndr_push_lsa_QueryInfoPolicy(struct ndr_push *ndr, int
                        return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
                }
                NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle));
-               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->in.level));
+               NDR_CHECK(ndr_push_lsa_PolicyInfo(ndr, NDR_SCALARS, r->in.level));
        }
        if (flags & NDR_OUT) {
                NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.info));
@@ -4545,7 +5065,7 @@ static enum ndr_err_code ndr_pull_lsa_QueryInfoPolicy(struct ndr_pull *ndr, int
                NDR_PULL_SET_MEM_CTX(ndr, r->in.handle, LIBNDR_FLAG_REF_ALLOC);
                NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle));
                NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
-               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->in.level));
+               NDR_CHECK(ndr_pull_lsa_PolicyInfo(ndr, NDR_SCALARS, &r->in.level));
        }
        if (flags & NDR_OUT) {
                NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_info));
@@ -4580,7 +5100,7 @@ _PUBLIC_ void ndr_print_lsa_QueryInfoPolicy(struct ndr_print *ndr, const char *n
                ndr->depth++;
                ndr_print_policy_handle(ndr, "handle", r->in.handle);
                ndr->depth--;
-               ndr_print_uint16(ndr, "level", r->in.level);
+               ndr_print_lsa_PolicyInfo(ndr, "level", r->in.level);
                ndr->depth--;
        }
        if (flags & NDR_OUT) {
@@ -4602,6 +5122,16 @@ _PUBLIC_ void ndr_print_lsa_QueryInfoPolicy(struct ndr_print *ndr, const char *n
 static enum ndr_err_code ndr_push_lsa_SetInfoPolicy(struct ndr_push *ndr, int flags, const struct lsa_SetInfoPolicy *r)
 {
        if (flags & NDR_IN) {
+               if (r->in.handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle));
+               NDR_CHECK(ndr_push_lsa_PolicyInfo(ndr, NDR_SCALARS, r->in.level));
+               if (r->in.info == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_set_switch_value(ndr, r->in.info, r->in.level));
+               NDR_CHECK(ndr_push_lsa_PolicyInformation(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.info));
        }
        if (flags & NDR_OUT) {
                NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
@@ -4611,7 +5141,25 @@ static enum ndr_err_code ndr_push_lsa_SetInfoPolicy(struct ndr_push *ndr, int fl
 
 static enum ndr_err_code ndr_pull_lsa_SetInfoPolicy(struct ndr_pull *ndr, int flags, struct lsa_SetInfoPolicy *r)
 {
+       TALLOC_CTX *_mem_save_handle_0;
+       TALLOC_CTX *_mem_save_info_0;
        if (flags & NDR_IN) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.handle);
+               }
+               _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_lsa_PolicyInfo(ndr, NDR_SCALARS, &r->in.level));
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.info);
+               }
+               _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.info, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_set_switch_value(ndr, r->in.info, r->in.level));
+               NDR_CHECK(ndr_pull_lsa_PolicyInformation(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.info));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, LIBNDR_FLAG_REF_ALLOC);
        }
        if (flags & NDR_OUT) {
                NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
@@ -4629,6 +5177,16 @@ _PUBLIC_ void ndr_print_lsa_SetInfoPolicy(struct ndr_print *ndr, const char *nam
        if (flags & NDR_IN) {
                ndr_print_struct(ndr, "in", "lsa_SetInfoPolicy");
                ndr->depth++;
+               ndr_print_ptr(ndr, "handle", r->in.handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "handle", r->in.handle);
+               ndr->depth--;
+               ndr_print_lsa_PolicyInfo(ndr, "level", r->in.level);
+               ndr_print_ptr(ndr, "info", r->in.info);
+               ndr->depth++;
+               ndr_print_set_switch_value(ndr, r->in.info, r->in.level);
+               ndr_print_lsa_PolicyInformation(ndr, "info", r->in.info);
+               ndr->depth--;
                ndr->depth--;
        }
        if (flags & NDR_OUT) {
@@ -4681,7 +5239,7 @@ _PUBLIC_ void ndr_print_lsa_ClearAuditLog(struct ndr_print *ndr, const char *nam
        ndr->depth--;
 }
 
-static enum ndr_err_code ndr_push_lsa_CreateAccount(struct ndr_push *ndr, int flags, const struct lsa_CreateAccount *r)
+_PUBLIC_ enum ndr_err_code ndr_push_lsa_CreateAccount(struct ndr_push *ndr, int flags, const struct lsa_CreateAccount *r)
 {
        if (flags & NDR_IN) {
                if (r->in.handle == NULL) {
@@ -4704,7 +5262,7 @@ static enum ndr_err_code ndr_push_lsa_CreateAccount(struct ndr_push *ndr, int fl
        return NDR_ERR_SUCCESS;
 }
 
-static enum ndr_err_code ndr_pull_lsa_CreateAccount(struct ndr_pull *ndr, int flags, struct lsa_CreateAccount *r)
+_PUBLIC_ enum ndr_err_code ndr_pull_lsa_CreateAccount(struct ndr_pull *ndr, int flags, struct lsa_CreateAccount *r)
 {
        TALLOC_CTX *_mem_save_handle_0;
        TALLOC_CTX *_mem_save_sid_0;
@@ -4777,7 +5335,7 @@ _PUBLIC_ void ndr_print_lsa_CreateAccount(struct ndr_print *ndr, const char *nam
        ndr->depth--;
 }
 
-static enum ndr_err_code ndr_push_lsa_EnumAccounts(struct ndr_push *ndr, int flags, const struct lsa_EnumAccounts *r)
+_PUBLIC_ enum ndr_err_code ndr_push_lsa_EnumAccounts(struct ndr_push *ndr, int flags, const struct lsa_EnumAccounts *r)
 {
        if (flags & NDR_IN) {
                if (r->in.handle == NULL) {
@@ -4804,7 +5362,7 @@ static enum ndr_err_code ndr_push_lsa_EnumAccounts(struct ndr_push *ndr, int fla
        return NDR_ERR_SUCCESS;
 }
 
-static enum ndr_err_code ndr_pull_lsa_EnumAccounts(struct ndr_pull *ndr, int flags, struct lsa_EnumAccounts *r)
+_PUBLIC_ enum ndr_err_code ndr_pull_lsa_EnumAccounts(struct ndr_pull *ndr, int flags, struct lsa_EnumAccounts *r)
 {
        TALLOC_CTX *_mem_save_handle_0;
        TALLOC_CTX *_mem_save_resume_handle_0;
@@ -4893,7 +5451,7 @@ _PUBLIC_ void ndr_print_lsa_EnumAccounts(struct ndr_print *ndr, const char *name
        ndr->depth--;
 }
 
-static enum ndr_err_code ndr_push_lsa_CreateTrustedDomain(struct ndr_push *ndr, int flags, const struct lsa_CreateTrustedDomain *r)
+_PUBLIC_ enum ndr_err_code ndr_push_lsa_CreateTrustedDomain(struct ndr_push *ndr, int flags, const struct lsa_CreateTrustedDomain *r)
 {
        if (flags & NDR_IN) {
                if (r->in.handle == NULL) {
@@ -4916,7 +5474,7 @@ static enum ndr_err_code ndr_push_lsa_CreateTrustedDomain(struct ndr_push *ndr,
        return NDR_ERR_SUCCESS;
 }
 
-static enum ndr_err_code ndr_pull_lsa_CreateTrustedDomain(struct ndr_pull *ndr, int flags, struct lsa_CreateTrustedDomain *r)
+_PUBLIC_ enum ndr_err_code ndr_pull_lsa_CreateTrustedDomain(struct ndr_pull *ndr, int flags, struct lsa_CreateTrustedDomain *r)
 {
        TALLOC_CTX *_mem_save_handle_0;
        TALLOC_CTX *_mem_save_info_0;
@@ -5039,9 +5597,6 @@ static enum ndr_err_code ndr_pull_lsa_EnumTrustDom(struct ndr_pull *ndr, int fla
                NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->in.resume_handle));
                NDR_PULL_SET_MEM_CTX(ndr, _mem_save_resume_handle_0, LIBNDR_FLAG_REF_ALLOC);
                NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.max_size));
-               if (r->in.max_size < 0 || r->in.max_size > 1000) {
-                       return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
-               }
                NDR_PULL_ALLOC(ndr, r->out.resume_handle);
                *r->out.resume_handle = *r->in.resume_handle;
                NDR_PULL_ALLOC(ndr, r->out.domains);
@@ -5105,7 +5660,7 @@ _PUBLIC_ void ndr_print_lsa_EnumTrustDom(struct ndr_print *ndr, const char *name
        ndr->depth--;
 }
 
-static enum ndr_err_code ndr_push_lsa_LookupNames(struct ndr_push *ndr, int flags, const struct lsa_LookupNames *r)
+_PUBLIC_ enum ndr_err_code ndr_push_lsa_LookupNames(struct ndr_push *ndr, int flags, const struct lsa_LookupNames *r)
 {
        uint32_t cntr_names_0;
        if (flags & NDR_IN) {
@@ -5125,7 +5680,7 @@ static enum ndr_err_code ndr_push_lsa_LookupNames(struct ndr_push *ndr, int flag
                        return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
                }
                NDR_CHECK(ndr_push_lsa_TransSidArray(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.sids));
-               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->in.level));
+               NDR_CHECK(ndr_push_lsa_LookupNamesLevel(ndr, NDR_SCALARS, r->in.level));
                if (r->in.count == NULL) {
                        return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
                }
@@ -5149,7 +5704,7 @@ static enum ndr_err_code ndr_push_lsa_LookupNames(struct ndr_push *ndr, int flag
        return NDR_ERR_SUCCESS;
 }
 
-static enum ndr_err_code ndr_pull_lsa_LookupNames(struct ndr_pull *ndr, int flags, struct lsa_LookupNames *r)
+_PUBLIC_ enum ndr_err_code ndr_pull_lsa_LookupNames(struct ndr_pull *ndr, int flags, struct lsa_LookupNames *r)
 {
        uint32_t cntr_names_0;
        uint32_t _ptr_domains;
@@ -5190,7 +5745,7 @@ static enum ndr_err_code ndr_pull_lsa_LookupNames(struct ndr_pull *ndr, int flag
                NDR_PULL_SET_MEM_CTX(ndr, r->in.sids, LIBNDR_FLAG_REF_ALLOC);
                NDR_CHECK(ndr_pull_lsa_TransSidArray(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.sids));
                NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sids_0, LIBNDR_FLAG_REF_ALLOC);
-               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->in.level));
+               NDR_CHECK(ndr_pull_lsa_LookupNamesLevel(ndr, NDR_SCALARS, &r->in.level));
                if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
                        NDR_PULL_ALLOC(ndr, r->in.count);
                }
@@ -5269,7 +5824,7 @@ _PUBLIC_ void ndr_print_lsa_LookupNames(struct ndr_print *ndr, const char *name,
                ndr->depth++;
                ndr_print_lsa_TransSidArray(ndr, "sids", r->in.sids);
                ndr->depth--;
-               ndr_print_uint16(ndr, "level", r->in.level);
+               ndr_print_lsa_LookupNamesLevel(ndr, "level", r->in.level);
                ndr_print_ptr(ndr, "count", r->in.count);
                ndr->depth++;
                ndr_print_uint32(ndr, "count", *r->in.count);
@@ -5299,7 +5854,7 @@ _PUBLIC_ void ndr_print_lsa_LookupNames(struct ndr_print *ndr, const char *name,
        ndr->depth--;
 }
 
-static enum ndr_err_code ndr_push_lsa_LookupSids(struct ndr_push *ndr, int flags, const struct lsa_LookupSids *r)
+_PUBLIC_ enum ndr_err_code ndr_push_lsa_LookupSids(struct ndr_push *ndr, int flags, const struct lsa_LookupSids *r)
 {
        if (flags & NDR_IN) {
                if (r->in.handle == NULL) {
@@ -5338,7 +5893,7 @@ static enum ndr_err_code ndr_push_lsa_LookupSids(struct ndr_push *ndr, int flags
        return NDR_ERR_SUCCESS;
 }
 
-static enum ndr_err_code ndr_pull_lsa_LookupSids(struct ndr_pull *ndr, int flags, struct lsa_LookupSids *r)
+_PUBLIC_ enum ndr_err_code ndr_pull_lsa_LookupSids(struct ndr_pull *ndr, int flags, struct lsa_LookupSids *r)
 {
        uint32_t _ptr_domains;
        TALLOC_CTX *_mem_save_handle_0;
@@ -5467,7 +6022,7 @@ _PUBLIC_ void ndr_print_lsa_LookupSids(struct ndr_print *ndr, const char *name,
        ndr->depth--;
 }
 
-static enum ndr_err_code ndr_push_lsa_CreateSecret(struct ndr_push *ndr, int flags, const struct lsa_CreateSecret *r)
+_PUBLIC_ enum ndr_err_code ndr_push_lsa_CreateSecret(struct ndr_push *ndr, int flags, const struct lsa_CreateSecret *r)
 {
        if (flags & NDR_IN) {
                if (r->in.handle == NULL) {
@@ -5487,7 +6042,7 @@ static enum ndr_err_code ndr_push_lsa_CreateSecret(struct ndr_push *ndr, int fla
        return NDR_ERR_SUCCESS;
 }
 
-static enum ndr_err_code ndr_pull_lsa_CreateSecret(struct ndr_pull *ndr, int flags, struct lsa_CreateSecret *r)
+_PUBLIC_ enum ndr_err_code ndr_pull_lsa_CreateSecret(struct ndr_pull *ndr, int flags, struct lsa_CreateSecret *r)
 {
        TALLOC_CTX *_mem_save_handle_0;
        TALLOC_CTX *_mem_save_sec_handle_0;
@@ -6276,7 +6831,7 @@ _PUBLIC_ void ndr_print_lsa_SetInformationTrustedDomain(struct ndr_print *ndr, c
        ndr->depth--;
 }
 
-static enum ndr_err_code ndr_push_lsa_OpenSecret(struct ndr_push *ndr, int flags, const struct lsa_OpenSecret *r)
+_PUBLIC_ enum ndr_err_code ndr_push_lsa_OpenSecret(struct ndr_push *ndr, int flags, const struct lsa_OpenSecret *r)
 {
        if (flags & NDR_IN) {
                if (r->in.handle == NULL) {
@@ -6296,7 +6851,7 @@ static enum ndr_err_code ndr_push_lsa_OpenSecret(struct ndr_push *ndr, int flags
        return NDR_ERR_SUCCESS;
 }
 
-static enum ndr_err_code ndr_pull_lsa_OpenSecret(struct ndr_pull *ndr, int flags, struct lsa_OpenSecret *r)
+_PUBLIC_ enum ndr_err_code ndr_pull_lsa_OpenSecret(struct ndr_pull *ndr, int flags, struct lsa_OpenSecret *r)
 {
        TALLOC_CTX *_mem_save_handle_0;
        TALLOC_CTX *_mem_save_sec_handle_0;
@@ -6359,7 +6914,7 @@ _PUBLIC_ void ndr_print_lsa_OpenSecret(struct ndr_print *ndr, const char *name,
        ndr->depth--;
 }
 
-static enum ndr_err_code ndr_push_lsa_SetSecret(struct ndr_push *ndr, int flags, const struct lsa_SetSecret *r)
+_PUBLIC_ enum ndr_err_code ndr_push_lsa_SetSecret(struct ndr_push *ndr, int flags, const struct lsa_SetSecret *r)
 {
        if (flags & NDR_IN) {
                if (r->in.sec_handle == NULL) {
@@ -6381,7 +6936,7 @@ static enum ndr_err_code ndr_push_lsa_SetSecret(struct ndr_push *ndr, int flags,
        return NDR_ERR_SUCCESS;
 }
 
-static enum ndr_err_code ndr_pull_lsa_SetSecret(struct ndr_pull *ndr, int flags, struct lsa_SetSecret *r)
+_PUBLIC_ enum ndr_err_code ndr_pull_lsa_SetSecret(struct ndr_pull *ndr, int flags, struct lsa_SetSecret *r)
 {
        uint32_t _ptr_new_val;
        uint32_t _ptr_old_val;
@@ -6464,7 +7019,7 @@ _PUBLIC_ void ndr_print_lsa_SetSecret(struct ndr_print *ndr, const char *name, i
        ndr->depth--;
 }
 
-static enum ndr_err_code ndr_push_lsa_QuerySecret(struct ndr_push *ndr, int flags, const struct lsa_QuerySecret *r)
+_PUBLIC_ enum ndr_err_code ndr_push_lsa_QuerySecret(struct ndr_push *ndr, int flags, const struct lsa_QuerySecret *r)
 {
        if (flags & NDR_IN) {
                if (r->in.sec_handle == NULL) {
@@ -6510,7 +7065,7 @@ static enum ndr_err_code ndr_push_lsa_QuerySecret(struct ndr_push *ndr, int flag
        return NDR_ERR_SUCCESS;
 }
 
-static enum ndr_err_code ndr_pull_lsa_QuerySecret(struct ndr_pull *ndr, int flags, struct lsa_QuerySecret *r)
+_PUBLIC_ enum ndr_err_code ndr_pull_lsa_QuerySecret(struct ndr_pull *ndr, int flags, struct lsa_QuerySecret *r)
 {
        uint32_t _ptr_new_val;
        uint32_t _ptr_new_mtime;
@@ -7751,7 +8306,7 @@ _PUBLIC_ void ndr_print_lsa_RetrievePrivateData(struct ndr_print *ndr, const cha
        ndr->depth--;
 }
 
-static enum ndr_err_code ndr_push_lsa_OpenPolicy2(struct ndr_push *ndr, int flags, const struct lsa_OpenPolicy2 *r)
+_PUBLIC_ enum ndr_err_code ndr_push_lsa_OpenPolicy2(struct ndr_push *ndr, int flags, const struct lsa_OpenPolicy2 *r)
 {
        if (flags & NDR_IN) {
                NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.system_name));
@@ -7777,7 +8332,7 @@ static enum ndr_err_code ndr_push_lsa_OpenPolicy2(struct ndr_push *ndr, int flag
        return NDR_ERR_SUCCESS;
 }
 
-static enum ndr_err_code ndr_pull_lsa_OpenPolicy2(struct ndr_pull *ndr, int flags, struct lsa_OpenPolicy2 *r)
+_PUBLIC_ enum ndr_err_code ndr_pull_lsa_OpenPolicy2(struct ndr_pull *ndr, int flags, struct lsa_OpenPolicy2 *r)
 {
        uint32_t _ptr_system_name;
        TALLOC_CTX *_mem_save_system_name_0;
@@ -8039,7 +8594,7 @@ static enum ndr_err_code ndr_push_lsa_QueryInfoPolicy2(struct ndr_push *ndr, int
                        return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
                }
                NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle));
-               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->in.level));
+               NDR_CHECK(ndr_push_lsa_PolicyInfo(ndr, NDR_SCALARS, r->in.level));
        }
        if (flags & NDR_OUT) {
                NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.info));
@@ -8067,7 +8622,7 @@ static enum ndr_err_code ndr_pull_lsa_QueryInfoPolicy2(struct ndr_pull *ndr, int
                NDR_PULL_SET_MEM_CTX(ndr, r->in.handle, LIBNDR_FLAG_REF_ALLOC);
                NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle));
                NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
-               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->in.level));
+               NDR_CHECK(ndr_pull_lsa_PolicyInfo(ndr, NDR_SCALARS, &r->in.level));
        }
        if (flags & NDR_OUT) {
                NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_info));
@@ -8102,7 +8657,7 @@ _PUBLIC_ void ndr_print_lsa_QueryInfoPolicy2(struct ndr_print *ndr, const char *
                ndr->depth++;
                ndr_print_policy_handle(ndr, "handle", r->in.handle);
                ndr->depth--;
-               ndr_print_uint16(ndr, "level", r->in.level);
+               ndr_print_lsa_PolicyInfo(ndr, "level", r->in.level);
                ndr->depth--;
        }
        if (flags & NDR_OUT) {
@@ -8124,6 +8679,16 @@ _PUBLIC_ void ndr_print_lsa_QueryInfoPolicy2(struct ndr_print *ndr, const char *
 static enum ndr_err_code ndr_push_lsa_SetInfoPolicy2(struct ndr_push *ndr, int flags, const struct lsa_SetInfoPolicy2 *r)
 {
        if (flags & NDR_IN) {
+               if (r->in.handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle));
+               NDR_CHECK(ndr_push_lsa_PolicyInfo(ndr, NDR_SCALARS, r->in.level));
+               if (r->in.info == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_set_switch_value(ndr, r->in.info, r->in.level));
+               NDR_CHECK(ndr_push_lsa_PolicyInformation(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.info));
        }
        if (flags & NDR_OUT) {
                NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
@@ -8133,7 +8698,25 @@ static enum ndr_err_code ndr_push_lsa_SetInfoPolicy2(struct ndr_push *ndr, int f
 
 static enum ndr_err_code ndr_pull_lsa_SetInfoPolicy2(struct ndr_pull *ndr, int flags, struct lsa_SetInfoPolicy2 *r)
 {
+       TALLOC_CTX *_mem_save_handle_0;
+       TALLOC_CTX *_mem_save_info_0;
        if (flags & NDR_IN) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.handle);
+               }
+               _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_lsa_PolicyInfo(ndr, NDR_SCALARS, &r->in.level));
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.info);
+               }
+               _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.info, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_set_switch_value(ndr, r->in.info, r->in.level));
+               NDR_CHECK(ndr_pull_lsa_PolicyInformation(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.info));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, LIBNDR_FLAG_REF_ALLOC);
        }
        if (flags & NDR_OUT) {
                NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
@@ -8151,6 +8734,16 @@ _PUBLIC_ void ndr_print_lsa_SetInfoPolicy2(struct ndr_print *ndr, const char *na
        if (flags & NDR_IN) {
                ndr_print_struct(ndr, "in", "lsa_SetInfoPolicy2");
                ndr->depth++;
+               ndr_print_ptr(ndr, "handle", r->in.handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "handle", r->in.handle);
+               ndr->depth--;
+               ndr_print_lsa_PolicyInfo(ndr, "level", r->in.level);
+               ndr_print_ptr(ndr, "info", r->in.info);
+               ndr->depth++;
+               ndr_print_set_switch_value(ndr, r->in.info, r->in.level);
+               ndr_print_lsa_PolicyInformation(ndr, "info", r->in.info);
+               ndr->depth--;
                ndr->depth--;
        }
        if (flags & NDR_OUT) {
@@ -8874,7 +9467,7 @@ _PUBLIC_ void ndr_print_lsa_TestCall(struct ndr_print *ndr, const char *name, in
        ndr->depth--;
 }
 
-static enum ndr_err_code ndr_push_lsa_LookupSids2(struct ndr_push *ndr, int flags, const struct lsa_LookupSids2 *r)
+_PUBLIC_ enum ndr_err_code ndr_push_lsa_LookupSids2(struct ndr_push *ndr, int flags, const struct lsa_LookupSids2 *r)
 {
        if (flags & NDR_IN) {
                if (r->in.handle == NULL) {
@@ -8915,7 +9508,7 @@ static enum ndr_err_code ndr_push_lsa_LookupSids2(struct ndr_push *ndr, int flag
        return NDR_ERR_SUCCESS;
 }
 
-static enum ndr_err_code ndr_pull_lsa_LookupSids2(struct ndr_pull *ndr, int flags, struct lsa_LookupSids2 *r)
+_PUBLIC_ enum ndr_err_code ndr_pull_lsa_LookupSids2(struct ndr_pull *ndr, int flags, struct lsa_LookupSids2 *r)
 {
        uint32_t _ptr_domains;
        TALLOC_CTX *_mem_save_handle_0;
@@ -9048,7 +9641,7 @@ _PUBLIC_ void ndr_print_lsa_LookupSids2(struct ndr_print *ndr, const char *name,
        ndr->depth--;
 }
 
-static enum ndr_err_code ndr_push_lsa_LookupNames2(struct ndr_push *ndr, int flags, const struct lsa_LookupNames2 *r)
+_PUBLIC_ enum ndr_err_code ndr_push_lsa_LookupNames2(struct ndr_push *ndr, int flags, const struct lsa_LookupNames2 *r)
 {
        uint32_t cntr_names_0;
        if (flags & NDR_IN) {
@@ -9068,7 +9661,7 @@ static enum ndr_err_code ndr_push_lsa_LookupNames2(struct ndr_push *ndr, int fla
                        return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
                }
                NDR_CHECK(ndr_push_lsa_TransSidArray2(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.sids));
-               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->in.level));
+               NDR_CHECK(ndr_push_lsa_LookupNamesLevel(ndr, NDR_SCALARS, r->in.level));
                if (r->in.count == NULL) {
                        return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
                }
@@ -9094,7 +9687,7 @@ static enum ndr_err_code ndr_push_lsa_LookupNames2(struct ndr_push *ndr, int fla
        return NDR_ERR_SUCCESS;
 }
 
-static enum ndr_err_code ndr_pull_lsa_LookupNames2(struct ndr_pull *ndr, int flags, struct lsa_LookupNames2 *r)
+_PUBLIC_ enum ndr_err_code ndr_pull_lsa_LookupNames2(struct ndr_pull *ndr, int flags, struct lsa_LookupNames2 *r)
 {
        uint32_t cntr_names_0;
        uint32_t _ptr_domains;
@@ -9135,7 +9728,7 @@ static enum ndr_err_code ndr_pull_lsa_LookupNames2(struct ndr_pull *ndr, int fla
                NDR_PULL_SET_MEM_CTX(ndr, r->in.sids, LIBNDR_FLAG_REF_ALLOC);
                NDR_CHECK(ndr_pull_lsa_TransSidArray2(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.sids));
                NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sids_0, LIBNDR_FLAG_REF_ALLOC);
-               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->in.level));
+               NDR_CHECK(ndr_pull_lsa_LookupNamesLevel(ndr, NDR_SCALARS, &r->in.level));
                if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
                        NDR_PULL_ALLOC(ndr, r->in.count);
                }
@@ -9216,7 +9809,7 @@ _PUBLIC_ void ndr_print_lsa_LookupNames2(struct ndr_print *ndr, const char *name
                ndr->depth++;
                ndr_print_lsa_TransSidArray2(ndr, "sids", r->in.sids);
                ndr->depth--;
-               ndr_print_uint16(ndr, "level", r->in.level);
+               ndr_print_lsa_LookupNamesLevel(ndr, "level", r->in.level);
                ndr_print_ptr(ndr, "count", r->in.count);
                ndr->depth++;
                ndr_print_uint32(ndr, "count", *r->in.count);
@@ -9617,7 +10210,7 @@ _PUBLIC_ void ndr_print_lsa_CREDRPROFILELOADED(struct ndr_print *ndr, const char
        ndr->depth--;
 }
 
-static enum ndr_err_code ndr_push_lsa_LookupNames3(struct ndr_push *ndr, int flags, const struct lsa_LookupNames3 *r)
+_PUBLIC_ enum ndr_err_code ndr_push_lsa_LookupNames3(struct ndr_push *ndr, int flags, const struct lsa_LookupNames3 *r)
 {
        uint32_t cntr_names_0;
        if (flags & NDR_IN) {
@@ -9637,7 +10230,7 @@ static enum ndr_err_code ndr_push_lsa_LookupNames3(struct ndr_push *ndr, int fla
                        return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
                }
                NDR_CHECK(ndr_push_lsa_TransSidArray3(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.sids));
-               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->in.level));
+               NDR_CHECK(ndr_push_lsa_LookupNamesLevel(ndr, NDR_SCALARS, r->in.level));
                if (r->in.count == NULL) {
                        return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
                }
@@ -9663,7 +10256,7 @@ static enum ndr_err_code ndr_push_lsa_LookupNames3(struct ndr_push *ndr, int fla
        return NDR_ERR_SUCCESS;
 }
 
-static enum ndr_err_code ndr_pull_lsa_LookupNames3(struct ndr_pull *ndr, int flags, struct lsa_LookupNames3 *r)
+_PUBLIC_ enum ndr_err_code ndr_pull_lsa_LookupNames3(struct ndr_pull *ndr, int flags, struct lsa_LookupNames3 *r)
 {
        uint32_t cntr_names_0;
        uint32_t _ptr_domains;
@@ -9704,7 +10297,7 @@ static enum ndr_err_code ndr_pull_lsa_LookupNames3(struct ndr_pull *ndr, int fla
                NDR_PULL_SET_MEM_CTX(ndr, r->in.sids, LIBNDR_FLAG_REF_ALLOC);
                NDR_CHECK(ndr_pull_lsa_TransSidArray3(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.sids));
                NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sids_0, LIBNDR_FLAG_REF_ALLOC);
-               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->in.level));
+               NDR_CHECK(ndr_pull_lsa_LookupNamesLevel(ndr, NDR_SCALARS, &r->in.level));
                if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
                        NDR_PULL_ALLOC(ndr, r->in.count);
                }
@@ -9785,7 +10378,7 @@ _PUBLIC_ void ndr_print_lsa_LookupNames3(struct ndr_print *ndr, const char *name
                ndr->depth++;
                ndr_print_lsa_TransSidArray3(ndr, "sids", r->in.sids);
                ndr->depth--;
-               ndr_print_uint16(ndr, "level", r->in.level);
+               ndr_print_lsa_LookupNamesLevel(ndr, "level", r->in.level);
                ndr_print_ptr(ndr, "count", r->in.count);
                ndr->depth++;
                ndr_print_uint32(ndr, "count", *r->in.count);
@@ -9981,41 +10574,112 @@ _PUBLIC_ void ndr_print_lsa_LSARUNREGISTERAUDITEVENT(struct ndr_print *ndr, cons
        ndr->depth--;
 }
 
-static enum ndr_err_code ndr_push_lsa_LSARQUERYFORESTTRUSTINFORMATION(struct ndr_push *ndr, int flags, const struct lsa_LSARQUERYFORESTTRUSTINFORMATION *r)
+static enum ndr_err_code ndr_push_lsa_lsaRQueryForestTrustInformation(struct ndr_push *ndr, int flags, const struct lsa_lsaRQueryForestTrustInformation *r)
 {
        if (flags & NDR_IN) {
+               if (r->in.handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle));
+               if (r->in.trusted_domain_name == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.trusted_domain_name));
+               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->in.unknown));
        }
        if (flags & NDR_OUT) {
+               if (r->out.forest_trust_info == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               if (*r->out.forest_trust_info == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_ref_ptr(ndr));
+               NDR_CHECK(ndr_push_lsa_ForestTrustInformation(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.forest_trust_info));
                NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
        }
        return NDR_ERR_SUCCESS;
 }
 
-static enum ndr_err_code ndr_pull_lsa_LSARQUERYFORESTTRUSTINFORMATION(struct ndr_pull *ndr, int flags, struct lsa_LSARQUERYFORESTTRUSTINFORMATION *r)
+static enum ndr_err_code ndr_pull_lsa_lsaRQueryForestTrustInformation(struct ndr_pull *ndr, int flags, struct lsa_lsaRQueryForestTrustInformation *r)
 {
+       uint32_t _ptr_forest_trust_info;
+       TALLOC_CTX *_mem_save_handle_0;
+       TALLOC_CTX *_mem_save_trusted_domain_name_0;
+       TALLOC_CTX *_mem_save_forest_trust_info_0;
+       TALLOC_CTX *_mem_save_forest_trust_info_1;
        if (flags & NDR_IN) {
+               ZERO_STRUCT(r->out);
+
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.handle);
+               }
+               _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.trusted_domain_name);
+               }
+               _mem_save_trusted_domain_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.trusted_domain_name, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.trusted_domain_name));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_trusted_domain_name_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->in.unknown));
+               NDR_PULL_ALLOC(ndr, r->out.forest_trust_info);
+               ZERO_STRUCTP(r->out.forest_trust_info);
        }
        if (flags & NDR_OUT) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.forest_trust_info);
+               }
+               _mem_save_forest_trust_info_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.forest_trust_info, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_ref_ptr(ndr, &_ptr_forest_trust_info));
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, *r->out.forest_trust_info);
+               }
+               _mem_save_forest_trust_info_1 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, *r->out.forest_trust_info, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_lsa_ForestTrustInformation(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.forest_trust_info));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_forest_trust_info_1, LIBNDR_FLAG_REF_ALLOC);
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_forest_trust_info_0, LIBNDR_FLAG_REF_ALLOC);
                NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
        }
        return NDR_ERR_SUCCESS;
 }
 
-_PUBLIC_ void ndr_print_lsa_LSARQUERYFORESTTRUSTINFORMATION(struct ndr_print *ndr, const char *name, int flags, const struct lsa_LSARQUERYFORESTTRUSTINFORMATION *r)
+_PUBLIC_ void ndr_print_lsa_lsaRQueryForestTrustInformation(struct ndr_print *ndr, const char *name, int flags, const struct lsa_lsaRQueryForestTrustInformation *r)
 {
-       ndr_print_struct(ndr, name, "lsa_LSARQUERYFORESTTRUSTINFORMATION");
+       ndr_print_struct(ndr, name, "lsa_lsaRQueryForestTrustInformation");
        ndr->depth++;
        if (flags & NDR_SET_VALUES) {
                ndr->flags |= LIBNDR_PRINT_SET_VALUES;
        }
        if (flags & NDR_IN) {
-               ndr_print_struct(ndr, "in", "lsa_LSARQUERYFORESTTRUSTINFORMATION");
+               ndr_print_struct(ndr, "in", "lsa_lsaRQueryForestTrustInformation");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "handle", r->in.handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "handle", r->in.handle);
+               ndr->depth--;
+               ndr_print_ptr(ndr, "trusted_domain_name", r->in.trusted_domain_name);
                ndr->depth++;
+               ndr_print_lsa_String(ndr, "trusted_domain_name", r->in.trusted_domain_name);
+               ndr->depth--;
+               ndr_print_uint16(ndr, "unknown", r->in.unknown);
                ndr->depth--;
        }
        if (flags & NDR_OUT) {
-               ndr_print_struct(ndr, "out", "lsa_LSARQUERYFORESTTRUSTINFORMATION");
+               ndr_print_struct(ndr, "out", "lsa_lsaRQueryForestTrustInformation");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "forest_trust_info", r->out.forest_trust_info);
                ndr->depth++;
+               ndr_print_ptr(ndr, "forest_trust_info", *r->out.forest_trust_info);
+               ndr->depth++;
+               ndr_print_lsa_ForestTrustInformation(ndr, "forest_trust_info", *r->out.forest_trust_info);
+               ndr->depth--;
+               ndr->depth--;
                ndr_print_NTSTATUS(ndr, "result", r->out.result);
                ndr->depth--;
        }
@@ -10104,7 +10768,7 @@ _PUBLIC_ void ndr_print_lsa_CREDRRENAME(struct ndr_print *ndr, const char *name,
        ndr->depth--;
 }
 
-static enum ndr_err_code ndr_push_lsa_LookupSids3(struct ndr_push *ndr, int flags, const struct lsa_LookupSids3 *r)
+_PUBLIC_ enum ndr_err_code ndr_push_lsa_LookupSids3(struct ndr_push *ndr, int flags, const struct lsa_LookupSids3 *r)
 {
        if (flags & NDR_IN) {
                if (r->in.sids == NULL) {
@@ -10141,7 +10805,7 @@ static enum ndr_err_code ndr_push_lsa_LookupSids3(struct ndr_push *ndr, int flag
        return NDR_ERR_SUCCESS;
 }
 
-static enum ndr_err_code ndr_pull_lsa_LookupSids3(struct ndr_pull *ndr, int flags, struct lsa_LookupSids3 *r)
+_PUBLIC_ enum ndr_err_code ndr_pull_lsa_LookupSids3(struct ndr_pull *ndr, int flags, struct lsa_LookupSids3 *r)
 {
        uint32_t _ptr_domains;
        TALLOC_CTX *_mem_save_sids_0;
@@ -10278,7 +10942,7 @@ static enum ndr_err_code ndr_push_lsa_LookupNames4(struct ndr_push *ndr, int fla
                        return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
                }
                NDR_CHECK(ndr_push_lsa_TransSidArray3(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.sids));
-               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->in.level));
+               NDR_CHECK(ndr_push_lsa_LookupNamesLevel(ndr, NDR_SCALARS, r->in.level));
                if (r->in.count == NULL) {
                        return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
                }
@@ -10337,7 +11001,7 @@ static enum ndr_err_code ndr_pull_lsa_LookupNames4(struct ndr_pull *ndr, int fla
                NDR_PULL_SET_MEM_CTX(ndr, r->in.sids, LIBNDR_FLAG_REF_ALLOC);
                NDR_CHECK(ndr_pull_lsa_TransSidArray3(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.sids));
                NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sids_0, LIBNDR_FLAG_REF_ALLOC);
-               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->in.level));
+               NDR_CHECK(ndr_pull_lsa_LookupNamesLevel(ndr, NDR_SCALARS, &r->in.level));
                if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
                        NDR_PULL_ALLOC(ndr, r->in.count);
                }
@@ -10414,7 +11078,7 @@ _PUBLIC_ void ndr_print_lsa_LookupNames4(struct ndr_print *ndr, const char *name
                ndr->depth++;
                ndr_print_lsa_TransSidArray3(ndr, "sids", r->in.sids);
                ndr->depth--;
-               ndr_print_uint16(ndr, "level", r->in.level);
+               ndr_print_lsa_LookupNamesLevel(ndr, "level", r->in.level);
                ndr_print_ptr(ndr, "count", r->in.count);
                ndr->depth++;
                ndr_print_uint32(ndr, "count", *r->in.count);
@@ -11196,11 +11860,11 @@ static const struct ndr_interface_call lsarpc_calls[] = {
                false,
        },
        {
-               "lsa_LSARQUERYFORESTTRUSTINFORMATION",
-               sizeof(struct lsa_LSARQUERYFORESTTRUSTINFORMATION),
-               (ndr_push_flags_fn_t) ndr_push_lsa_LSARQUERYFORESTTRUSTINFORMATION,
-               (ndr_pull_flags_fn_t) ndr_pull_lsa_LSARQUERYFORESTTRUSTINFORMATION,
-               (ndr_print_function_t) ndr_print_lsa_LSARQUERYFORESTTRUSTINFORMATION,
+               "lsa_lsaRQueryForestTrustInformation",
+               sizeof(struct lsa_lsaRQueryForestTrustInformation),
+               (ndr_push_flags_fn_t) ndr_push_lsa_lsaRQueryForestTrustInformation,
+               (ndr_pull_flags_fn_t) ndr_pull_lsa_lsaRQueryForestTrustInformation,
+               (ndr_print_function_t) ndr_print_lsa_lsaRQueryForestTrustInformation,
                false,
        },
        {
index e6630d12dfa7f5bb7c9f91fb553874dc52784833..ab4043f2a1c496c6ecc2e83db4b58fc14288c941 100644 (file)
@@ -194,6 +194,7 @@ void ndr_print_lsa_PrivArray(struct ndr_print *ndr, const char *name, const stru
 void ndr_print_lsa_QosInfo(struct ndr_print *ndr, const char *name, const struct lsa_QosInfo *r);
 void ndr_print_lsa_ObjectAttribute(struct ndr_print *ndr, const char *name, const struct lsa_ObjectAttribute *r);
 void ndr_print_lsa_AuditLogInfo(struct ndr_print *ndr, const char *name, const struct lsa_AuditLogInfo *r);
+void ndr_print_lsa_PolicyAuditPolicy(struct ndr_print *ndr, const char *name, enum lsa_PolicyAuditPolicy r);
 void ndr_print_lsa_AuditEventsInfo(struct ndr_print *ndr, const char *name, const struct lsa_AuditEventsInfo *r);
 void ndr_print_lsa_DomainInfo(struct ndr_print *ndr, const char *name, const struct lsa_DomainInfo *r);
 void ndr_print_lsa_PDAccountInfo(struct ndr_print *ndr, const char *name, const struct lsa_PDAccountInfo *r);
@@ -204,6 +205,7 @@ void ndr_print_lsa_ModificationInfo(struct ndr_print *ndr, const char *name, con
 void ndr_print_lsa_AuditFullSetInfo(struct ndr_print *ndr, const char *name, const struct lsa_AuditFullSetInfo *r);
 void ndr_print_lsa_AuditFullQueryInfo(struct ndr_print *ndr, const char *name, const struct lsa_AuditFullQueryInfo *r);
 void ndr_print_lsa_DnsDomainInfo(struct ndr_print *ndr, const char *name, const struct lsa_DnsDomainInfo *r);
+void ndr_print_lsa_PolicyInfo(struct ndr_print *ndr, const char *name, enum lsa_PolicyInfo r);
 void ndr_print_lsa_PolicyInformation(struct ndr_print *ndr, const char *name, const union lsa_PolicyInformation *r);
 void ndr_print_lsa_SidPtr(struct ndr_print *ndr, const char *name, const struct lsa_SidPtr *r);
 enum ndr_err_code ndr_push_lsa_SidArray(struct ndr_push *ndr, int ndr_flags, const struct lsa_SidArray *r);
@@ -214,6 +216,7 @@ void ndr_print_lsa_SidType(struct ndr_print *ndr, const char *name, enum lsa_Sid
 void ndr_print_lsa_TranslatedSid(struct ndr_print *ndr, const char *name, const struct lsa_TranslatedSid *r);
 void ndr_print_lsa_TransSidArray(struct ndr_print *ndr, const char *name, const struct lsa_TransSidArray *r);
 void ndr_print_lsa_RefDomainList(struct ndr_print *ndr, const char *name, const struct lsa_RefDomainList *r);
+void ndr_print_lsa_LookupNamesLevel(struct ndr_print *ndr, const char *name, enum lsa_LookupNamesLevel r);
 void ndr_print_lsa_TranslatedName(struct ndr_print *ndr, const char *name, const struct lsa_TranslatedName *r);
 void ndr_print_lsa_TransNameArray(struct ndr_print *ndr, const char *name, const struct lsa_TransNameArray *r);
 void ndr_print_lsa_LUIDAttribute(struct ndr_print *ndr, const char *name, const struct lsa_LUIDAttribute *r);
@@ -245,22 +248,48 @@ void ndr_print_lsa_TranslatedSid2(struct ndr_print *ndr, const char *name, const
 void ndr_print_lsa_TransSidArray2(struct ndr_print *ndr, const char *name, const struct lsa_TransSidArray2 *r);
 void ndr_print_lsa_TranslatedSid3(struct ndr_print *ndr, const char *name, const struct lsa_TranslatedSid3 *r);
 void ndr_print_lsa_TransSidArray3(struct ndr_print *ndr, const char *name, const struct lsa_TransSidArray3 *r);
+void ndr_print_lsa_ForestTrustBinaryData(struct ndr_print *ndr, const char *name, const struct lsa_ForestTrustBinaryData *r);
+void ndr_print_lsa_ForestTrustDomainInfo(struct ndr_print *ndr, const char *name, const struct lsa_ForestTrustDomainInfo *r);
+void ndr_print_lsa_ForestTrustData(struct ndr_print *ndr, const char *name, const union lsa_ForestTrustData *r);
+void ndr_print_lsa_ForestTrustRecordType(struct ndr_print *ndr, const char *name, enum lsa_ForestTrustRecordType r);
+void ndr_print_lsa_ForestTrustRecord(struct ndr_print *ndr, const char *name, const struct lsa_ForestTrustRecord *r);
+enum ndr_err_code ndr_push_lsa_ForestTrustInformation(struct ndr_push *ndr, int ndr_flags, const struct lsa_ForestTrustInformation *r);
+enum ndr_err_code ndr_pull_lsa_ForestTrustInformation(struct ndr_pull *ndr, int ndr_flags, struct lsa_ForestTrustInformation *r);
+void ndr_print_lsa_ForestTrustInformation(struct ndr_print *ndr, const char *name, const struct lsa_ForestTrustInformation *r);
 void ndr_print_lsa_Close(struct ndr_print *ndr, const char *name, int flags, const struct lsa_Close *r);
+enum ndr_err_code ndr_push_lsa_Delete(struct ndr_push *ndr, int flags, const struct lsa_Delete *r);
+enum ndr_err_code ndr_pull_lsa_Delete(struct ndr_pull *ndr, int flags, struct lsa_Delete *r);
 void ndr_print_lsa_Delete(struct ndr_print *ndr, const char *name, int flags, const struct lsa_Delete *r);
+enum ndr_err_code ndr_push_lsa_EnumPrivs(struct ndr_push *ndr, int flags, const struct lsa_EnumPrivs *r);
+enum ndr_err_code ndr_pull_lsa_EnumPrivs(struct ndr_pull *ndr, int flags, struct lsa_EnumPrivs *r);
 void ndr_print_lsa_EnumPrivs(struct ndr_print *ndr, const char *name, int flags, const struct lsa_EnumPrivs *r);
 void ndr_print_lsa_QuerySecurity(struct ndr_print *ndr, const char *name, int flags, const struct lsa_QuerySecurity *r);
 void ndr_print_lsa_SetSecObj(struct ndr_print *ndr, const char *name, int flags, const struct lsa_SetSecObj *r);
 void ndr_print_lsa_ChangePassword(struct ndr_print *ndr, const char *name, int flags, const struct lsa_ChangePassword *r);
+enum ndr_err_code ndr_push_lsa_OpenPolicy(struct ndr_push *ndr, int flags, const struct lsa_OpenPolicy *r);
+enum ndr_err_code ndr_pull_lsa_OpenPolicy(struct ndr_pull *ndr, int flags, struct lsa_OpenPolicy *r);
 void ndr_print_lsa_OpenPolicy(struct ndr_print *ndr, const char *name, int flags, const struct lsa_OpenPolicy *r);
 void ndr_print_lsa_QueryInfoPolicy(struct ndr_print *ndr, const char *name, int flags, const struct lsa_QueryInfoPolicy *r);
 void ndr_print_lsa_SetInfoPolicy(struct ndr_print *ndr, const char *name, int flags, const struct lsa_SetInfoPolicy *r);
 void ndr_print_lsa_ClearAuditLog(struct ndr_print *ndr, const char *name, int flags, const struct lsa_ClearAuditLog *r);
+enum ndr_err_code ndr_push_lsa_CreateAccount(struct ndr_push *ndr, int flags, const struct lsa_CreateAccount *r);
+enum ndr_err_code ndr_pull_lsa_CreateAccount(struct ndr_pull *ndr, int flags, struct lsa_CreateAccount *r);
 void ndr_print_lsa_CreateAccount(struct ndr_print *ndr, const char *name, int flags, const struct lsa_CreateAccount *r);
+enum ndr_err_code ndr_push_lsa_EnumAccounts(struct ndr_push *ndr, int flags, const struct lsa_EnumAccounts *r);
+enum ndr_err_code ndr_pull_lsa_EnumAccounts(struct ndr_pull *ndr, int flags, struct lsa_EnumAccounts *r);
 void ndr_print_lsa_EnumAccounts(struct ndr_print *ndr, const char *name, int flags, const struct lsa_EnumAccounts *r);
+enum ndr_err_code ndr_push_lsa_CreateTrustedDomain(struct ndr_push *ndr, int flags, const struct lsa_CreateTrustedDomain *r);
+enum ndr_err_code ndr_pull_lsa_CreateTrustedDomain(struct ndr_pull *ndr, int flags, struct lsa_CreateTrustedDomain *r);
 void ndr_print_lsa_CreateTrustedDomain(struct ndr_print *ndr, const char *name, int flags, const struct lsa_CreateTrustedDomain *r);
 void ndr_print_lsa_EnumTrustDom(struct ndr_print *ndr, const char *name, int flags, const struct lsa_EnumTrustDom *r);
+enum ndr_err_code ndr_push_lsa_LookupNames(struct ndr_push *ndr, int flags, const struct lsa_LookupNames *r);
+enum ndr_err_code ndr_pull_lsa_LookupNames(struct ndr_pull *ndr, int flags, struct lsa_LookupNames *r);
 void ndr_print_lsa_LookupNames(struct ndr_print *ndr, const char *name, int flags, const struct lsa_LookupNames *r);
+enum ndr_err_code ndr_push_lsa_LookupSids(struct ndr_push *ndr, int flags, const struct lsa_LookupSids *r);
+enum ndr_err_code ndr_pull_lsa_LookupSids(struct ndr_pull *ndr, int flags, struct lsa_LookupSids *r);
 void ndr_print_lsa_LookupSids(struct ndr_print *ndr, const char *name, int flags, const struct lsa_LookupSids *r);
+enum ndr_err_code ndr_push_lsa_CreateSecret(struct ndr_push *ndr, int flags, const struct lsa_CreateSecret *r);
+enum ndr_err_code ndr_pull_lsa_CreateSecret(struct ndr_pull *ndr, int flags, struct lsa_CreateSecret *r);
 void ndr_print_lsa_CreateSecret(struct ndr_print *ndr, const char *name, int flags, const struct lsa_CreateSecret *r);
 void ndr_print_lsa_OpenAccount(struct ndr_print *ndr, const char *name, int flags, const struct lsa_OpenAccount *r);
 void ndr_print_lsa_EnumPrivsAccount(struct ndr_print *ndr, const char *name, int flags, const struct lsa_EnumPrivsAccount *r);
@@ -273,8 +302,14 @@ void ndr_print_lsa_SetSystemAccessAccount(struct ndr_print *ndr, const char *nam
 void ndr_print_lsa_OpenTrustedDomain(struct ndr_print *ndr, const char *name, int flags, const struct lsa_OpenTrustedDomain *r);
 void ndr_print_lsa_QueryTrustedDomainInfo(struct ndr_print *ndr, const char *name, int flags, const struct lsa_QueryTrustedDomainInfo *r);
 void ndr_print_lsa_SetInformationTrustedDomain(struct ndr_print *ndr, const char *name, int flags, const struct lsa_SetInformationTrustedDomain *r);
+enum ndr_err_code ndr_push_lsa_OpenSecret(struct ndr_push *ndr, int flags, const struct lsa_OpenSecret *r);
+enum ndr_err_code ndr_pull_lsa_OpenSecret(struct ndr_pull *ndr, int flags, struct lsa_OpenSecret *r);
 void ndr_print_lsa_OpenSecret(struct ndr_print *ndr, const char *name, int flags, const struct lsa_OpenSecret *r);
+enum ndr_err_code ndr_push_lsa_SetSecret(struct ndr_push *ndr, int flags, const struct lsa_SetSecret *r);
+enum ndr_err_code ndr_pull_lsa_SetSecret(struct ndr_pull *ndr, int flags, struct lsa_SetSecret *r);
 void ndr_print_lsa_SetSecret(struct ndr_print *ndr, const char *name, int flags, const struct lsa_SetSecret *r);
+enum ndr_err_code ndr_push_lsa_QuerySecret(struct ndr_push *ndr, int flags, const struct lsa_QuerySecret *r);
+enum ndr_err_code ndr_pull_lsa_QuerySecret(struct ndr_pull *ndr, int flags, struct lsa_QuerySecret *r);
 void ndr_print_lsa_QuerySecret(struct ndr_print *ndr, const char *name, int flags, const struct lsa_QuerySecret *r);
 void ndr_print_lsa_LookupPrivValue(struct ndr_print *ndr, const char *name, int flags, const struct lsa_LookupPrivValue *r);
 void ndr_print_lsa_LookupPrivName(struct ndr_print *ndr, const char *name, int flags, const struct lsa_LookupPrivName *r);
@@ -289,6 +324,8 @@ void ndr_print_lsa_SetTrustedDomainInfo(struct ndr_print *ndr, const char *name,
 void ndr_print_lsa_DeleteTrustedDomain(struct ndr_print *ndr, const char *name, int flags, const struct lsa_DeleteTrustedDomain *r);
 void ndr_print_lsa_StorePrivateData(struct ndr_print *ndr, const char *name, int flags, const struct lsa_StorePrivateData *r);
 void ndr_print_lsa_RetrievePrivateData(struct ndr_print *ndr, const char *name, int flags, const struct lsa_RetrievePrivateData *r);
+enum ndr_err_code ndr_push_lsa_OpenPolicy2(struct ndr_push *ndr, int flags, const struct lsa_OpenPolicy2 *r);
+enum ndr_err_code ndr_pull_lsa_OpenPolicy2(struct ndr_pull *ndr, int flags, struct lsa_OpenPolicy2 *r);
 void ndr_print_lsa_OpenPolicy2(struct ndr_print *ndr, const char *name, int flags, const struct lsa_OpenPolicy2 *r);
 void ndr_print_lsa_GetUserName(struct ndr_print *ndr, const char *name, int flags, const struct lsa_GetUserName *r);
 void ndr_print_lsa_QueryInfoPolicy2(struct ndr_print *ndr, const char *name, int flags, const struct lsa_QueryInfoPolicy2 *r);
@@ -302,7 +339,11 @@ void ndr_print_lsa_QueryDomainInformationPolicy(struct ndr_print *ndr, const cha
 void ndr_print_lsa_SetDomainInformationPolicy(struct ndr_print *ndr, const char *name, int flags, const struct lsa_SetDomainInformationPolicy *r);
 void ndr_print_lsa_OpenTrustedDomainByName(struct ndr_print *ndr, const char *name, int flags, const struct lsa_OpenTrustedDomainByName *r);
 void ndr_print_lsa_TestCall(struct ndr_print *ndr, const char *name, int flags, const struct lsa_TestCall *r);
+enum ndr_err_code ndr_push_lsa_LookupSids2(struct ndr_push *ndr, int flags, const struct lsa_LookupSids2 *r);
+enum ndr_err_code ndr_pull_lsa_LookupSids2(struct ndr_pull *ndr, int flags, struct lsa_LookupSids2 *r);
 void ndr_print_lsa_LookupSids2(struct ndr_print *ndr, const char *name, int flags, const struct lsa_LookupSids2 *r);
+enum ndr_err_code ndr_push_lsa_LookupNames2(struct ndr_push *ndr, int flags, const struct lsa_LookupNames2 *r);
+enum ndr_err_code ndr_pull_lsa_LookupNames2(struct ndr_pull *ndr, int flags, struct lsa_LookupNames2 *r);
 void ndr_print_lsa_LookupNames2(struct ndr_print *ndr, const char *name, int flags, const struct lsa_LookupNames2 *r);
 void ndr_print_lsa_CreateTrustedDomainEx2(struct ndr_print *ndr, const char *name, int flags, const struct lsa_CreateTrustedDomainEx2 *r);
 void ndr_print_lsa_CREDRWRITE(struct ndr_print *ndr, const char *name, int flags, const struct lsa_CREDRWRITE *r);
@@ -313,14 +354,18 @@ void ndr_print_lsa_CREDRREADDOMAINCREDENTIALS(struct ndr_print *ndr, const char
 void ndr_print_lsa_CREDRDELETE(struct ndr_print *ndr, const char *name, int flags, const struct lsa_CREDRDELETE *r);
 void ndr_print_lsa_CREDRGETTARGETINFO(struct ndr_print *ndr, const char *name, int flags, const struct lsa_CREDRGETTARGETINFO *r);
 void ndr_print_lsa_CREDRPROFILELOADED(struct ndr_print *ndr, const char *name, int flags, const struct lsa_CREDRPROFILELOADED *r);
+enum ndr_err_code ndr_push_lsa_LookupNames3(struct ndr_push *ndr, int flags, const struct lsa_LookupNames3 *r);
+enum ndr_err_code ndr_pull_lsa_LookupNames3(struct ndr_pull *ndr, int flags, struct lsa_LookupNames3 *r);
 void ndr_print_lsa_LookupNames3(struct ndr_print *ndr, const char *name, int flags, const struct lsa_LookupNames3 *r);
 void ndr_print_lsa_CREDRGETSESSIONTYPES(struct ndr_print *ndr, const char *name, int flags, const struct lsa_CREDRGETSESSIONTYPES *r);
 void ndr_print_lsa_LSARREGISTERAUDITEVENT(struct ndr_print *ndr, const char *name, int flags, const struct lsa_LSARREGISTERAUDITEVENT *r);
 void ndr_print_lsa_LSARGENAUDITEVENT(struct ndr_print *ndr, const char *name, int flags, const struct lsa_LSARGENAUDITEVENT *r);
 void ndr_print_lsa_LSARUNREGISTERAUDITEVENT(struct ndr_print *ndr, const char *name, int flags, const struct lsa_LSARUNREGISTERAUDITEVENT *r);
-void ndr_print_lsa_LSARQUERYFORESTTRUSTINFORMATION(struct ndr_print *ndr, const char *name, int flags, const struct lsa_LSARQUERYFORESTTRUSTINFORMATION *r);
+void ndr_print_lsa_lsaRQueryForestTrustInformation(struct ndr_print *ndr, const char *name, int flags, const struct lsa_lsaRQueryForestTrustInformation *r);
 void ndr_print_lsa_LSARSETFORESTTRUSTINFORMATION(struct ndr_print *ndr, const char *name, int flags, const struct lsa_LSARSETFORESTTRUSTINFORMATION *r);
 void ndr_print_lsa_CREDRRENAME(struct ndr_print *ndr, const char *name, int flags, const struct lsa_CREDRRENAME *r);
+enum ndr_err_code ndr_push_lsa_LookupSids3(struct ndr_push *ndr, int flags, const struct lsa_LookupSids3 *r);
+enum ndr_err_code ndr_pull_lsa_LookupSids3(struct ndr_pull *ndr, int flags, struct lsa_LookupSids3 *r);
 void ndr_print_lsa_LookupSids3(struct ndr_print *ndr, const char *name, int flags, const struct lsa_LookupSids3 *r);
 void ndr_print_lsa_LookupNames4(struct ndr_print *ndr, const char *name, int flags, const struct lsa_LookupNames4 *r);
 void ndr_print_lsa_LSAROPENPOLICYSCE(struct ndr_print *ndr, const char *name, int flags, const struct lsa_LSAROPENPOLICYSCE *r);
diff --git a/source/librpc/gen_ndr/ndr_misc.c b/source/librpc/gen_ndr/ndr_misc.c
new file mode 100644 (file)
index 0000000..56105d4
--- /dev/null
@@ -0,0 +1,185 @@
+/* parser auto-generated by pidl */
+
+#include "includes.h"
+#include "librpc/gen_ndr/ndr_misc.h"
+
+_PUBLIC_ enum ndr_err_code ndr_push_GUID(struct ndr_push *ndr, int ndr_flags, const struct GUID *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->time_low));
+               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->time_mid));
+               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->time_hi_and_version));
+               NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->clock_seq, 2));
+               NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->node, 6));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_GUID(struct ndr_pull *ndr, int ndr_flags, struct GUID *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->time_low));
+               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->time_mid));
+               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->time_hi_and_version));
+               NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->clock_seq, 2));
+               NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->node, 6));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ size_t ndr_size_GUID(const struct GUID *r, int flags)
+{
+       return ndr_size_struct(r, flags, (ndr_push_flags_fn_t)ndr_push_GUID);
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_ndr_syntax_id(struct ndr_push *ndr, int ndr_flags, const struct ndr_syntax_id *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &r->uuid));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->if_version));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_ndr_syntax_id(struct ndr_pull *ndr, int ndr_flags, struct ndr_syntax_id *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, &r->uuid));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->if_version));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_ndr_syntax_id(struct ndr_print *ndr, const char *name, const struct ndr_syntax_id *r)
+{
+       ndr_print_struct(ndr, name, "ndr_syntax_id");
+       ndr->depth++;
+       ndr_print_GUID(ndr, "uuid", &r->uuid);
+       ndr_print_uint32(ndr, "if_version", r->if_version);
+       ndr->depth--;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_policy_handle(struct ndr_push *ndr, int ndr_flags, const struct policy_handle *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->handle_type));
+               NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &r->uuid));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_policy_handle(struct ndr_pull *ndr, int ndr_flags, struct policy_handle *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->handle_type));
+               NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, &r->uuid));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_policy_handle(struct ndr_print *ndr, const char *name, const struct policy_handle *r)
+{
+       ndr_print_struct(ndr, name, "policy_handle");
+       ndr->depth++;
+       ndr_print_uint32(ndr, "handle_type", r->handle_type);
+       ndr_print_GUID(ndr, "uuid", &r->uuid);
+       ndr->depth--;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_netr_SchannelType(struct ndr_push *ndr, int ndr_flags, enum netr_SchannelType r)
+{
+       NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r));
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_netr_SchannelType(struct ndr_pull *ndr, int ndr_flags, enum netr_SchannelType *r)
+{
+       uint16_t v;
+       NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v));
+       *r = v;
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_netr_SchannelType(struct ndr_print *ndr, const char *name, enum netr_SchannelType r)
+{
+       const char *val = NULL;
+
+       switch (r) {
+               case SEC_CHAN_WKSTA: val = "SEC_CHAN_WKSTA"; break;
+               case SEC_CHAN_DOMAIN: val = "SEC_CHAN_DOMAIN"; break;
+               case SEC_CHAN_BDC: val = "SEC_CHAN_BDC"; break;
+       }
+       ndr_print_enum(ndr, name, "ENUM", val, r);
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_netr_SamDatabaseID(struct ndr_push *ndr, int ndr_flags, enum netr_SamDatabaseID r)
+{
+       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_netr_SamDatabaseID(struct ndr_pull *ndr, int ndr_flags, enum netr_SamDatabaseID *r)
+{
+       uint32_t v;
+       NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
+       *r = v;
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_netr_SamDatabaseID(struct ndr_print *ndr, const char *name, enum netr_SamDatabaseID r)
+{
+       const char *val = NULL;
+
+       switch (r) {
+               case SAM_DATABASE_DOMAIN: val = "SAM_DATABASE_DOMAIN"; break;
+               case SAM_DATABASE_BUILTIN: val = "SAM_DATABASE_BUILTIN"; break;
+               case SAM_DATABASE_PRIVS: val = "SAM_DATABASE_PRIVS"; break;
+       }
+       ndr_print_enum(ndr, name, "ENUM", val, r);
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_samr_RejectReason(struct ndr_push *ndr, int ndr_flags, enum samr_RejectReason r)
+{
+       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_samr_RejectReason(struct ndr_pull *ndr, int ndr_flags, enum samr_RejectReason *r)
+{
+       uint32_t v;
+       NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
+       *r = v;
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_RejectReason(struct ndr_print *ndr, const char *name, enum samr_RejectReason r)
+{
+       const char *val = NULL;
+
+       switch (r) {
+               case SAMR_REJECT_OTHER: val = "SAMR_REJECT_OTHER"; break;
+               case SAMR_REJECT_TOO_SHORT: val = "SAMR_REJECT_TOO_SHORT"; break;
+               case SAMR_REJECT_IN_HISTORY: val = "SAMR_REJECT_IN_HISTORY"; break;
+               case SAMR_REJECT_COMPLEXITY: val = "SAMR_REJECT_COMPLEXITY"; break;
+       }
+       ndr_print_enum(ndr, name, "ENUM", val, r);
+}
+
index d43a7d8b4a7cd1d7739744acb5e645719a0674c1..a15a7813678ea58d8437d9f0f93eb61506934724 100644 (file)
@@ -1 +1,29 @@
-#include "ndr/ndr_misc.h"
+/* header auto-generated by pidl */
+
+#include "librpc/ndr/libndr.h"
+#include "librpc/gen_ndr/misc.h"
+
+#ifndef _HEADER_NDR_misc
+#define _HEADER_NDR_misc
+
+#define NDR_MISC_CALL_COUNT (0)
+enum ndr_err_code ndr_push_GUID(struct ndr_push *ndr, int ndr_flags, const struct GUID *r);
+enum ndr_err_code ndr_pull_GUID(struct ndr_pull *ndr, int ndr_flags, struct GUID *r);
+void ndr_print_GUID(struct ndr_print *ndr, const char *name, const struct GUID *r);
+size_t ndr_size_GUID(const struct GUID *r, int flags);
+enum ndr_err_code ndr_push_ndr_syntax_id(struct ndr_push *ndr, int ndr_flags, const struct ndr_syntax_id *r);
+enum ndr_err_code ndr_pull_ndr_syntax_id(struct ndr_pull *ndr, int ndr_flags, struct ndr_syntax_id *r);
+void ndr_print_ndr_syntax_id(struct ndr_print *ndr, const char *name, const struct ndr_syntax_id *r);
+enum ndr_err_code ndr_push_policy_handle(struct ndr_push *ndr, int ndr_flags, const struct policy_handle *r);
+enum ndr_err_code ndr_pull_policy_handle(struct ndr_pull *ndr, int ndr_flags, struct policy_handle *r);
+void ndr_print_policy_handle(struct ndr_print *ndr, const char *name, const struct policy_handle *r);
+enum ndr_err_code ndr_push_netr_SchannelType(struct ndr_push *ndr, int ndr_flags, enum netr_SchannelType r);
+enum ndr_err_code ndr_pull_netr_SchannelType(struct ndr_pull *ndr, int ndr_flags, enum netr_SchannelType *r);
+void ndr_print_netr_SchannelType(struct ndr_print *ndr, const char *name, enum netr_SchannelType r);
+enum ndr_err_code ndr_push_netr_SamDatabaseID(struct ndr_push *ndr, int ndr_flags, enum netr_SamDatabaseID r);
+enum ndr_err_code ndr_pull_netr_SamDatabaseID(struct ndr_pull *ndr, int ndr_flags, enum netr_SamDatabaseID *r);
+void ndr_print_netr_SamDatabaseID(struct ndr_print *ndr, const char *name, enum netr_SamDatabaseID r);
+enum ndr_err_code ndr_push_samr_RejectReason(struct ndr_push *ndr, int ndr_flags, enum samr_RejectReason r);
+enum ndr_err_code ndr_pull_samr_RejectReason(struct ndr_pull *ndr, int ndr_flags, enum samr_RejectReason *r);
+void ndr_print_samr_RejectReason(struct ndr_print *ndr, const char *name, enum samr_RejectReason r);
+#endif /* _HEADER_NDR_misc */
index 081c87fb12c8cb52d7dbf23931f41042be83bb72..2d41a2675e11d75d71a5a873f9b82eb919ef9d31 100644 (file)
@@ -327,12 +327,39 @@ _PUBLIC_ void ndr_print_netr_AcctLockStr(struct ndr_print *ndr, const char *name
        ndr->depth--;
 }
 
+_PUBLIC_ enum ndr_err_code ndr_push_netr_LogonParameterControl(struct ndr_push *ndr, int ndr_flags, uint32_t r)
+{
+       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_netr_LogonParameterControl(struct ndr_pull *ndr, int ndr_flags, uint32_t *r)
+{
+       uint32_t v;
+       NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
+       *r = v;
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_netr_LogonParameterControl(struct ndr_print *ndr, const char *name, uint32_t r)
+{
+       ndr_print_uint32(ndr, name, r);
+       ndr->depth++;
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "MSV1_0_CLEARTEXT_PASSWORD_ALLOWED", MSV1_0_CLEARTEXT_PASSWORD_ALLOWED, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "MSV1_0_UPDATE_LOGON_STATISTICS", MSV1_0_UPDATE_LOGON_STATISTICS, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "MSV1_0_RETURN_USER_PARAMETERS", MSV1_0_RETURN_USER_PARAMETERS, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "MSV1_0_ALLOW_SERVER_TRUST_ACCOUNT", MSV1_0_ALLOW_SERVER_TRUST_ACCOUNT, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "MSV1_0_RETURN_PROFILE_PATH", MSV1_0_RETURN_PROFILE_PATH, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "MSV1_0_ALLOW_WORKSTATION_TRUST_ACCOUNT", MSV1_0_ALLOW_WORKSTATION_TRUST_ACCOUNT, r);
+       ndr->depth--;
+}
+
 static enum ndr_err_code ndr_push_netr_IdentityInfo(struct ndr_push *ndr, int ndr_flags, const struct netr_IdentityInfo *r)
 {
        if (ndr_flags & NDR_SCALARS) {
                NDR_CHECK(ndr_push_align(ndr, 4));
                NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->domain_name));
-               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->parameter_control));
+               NDR_CHECK(ndr_push_netr_LogonParameterControl(ndr, NDR_SCALARS, r->parameter_control));
                NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->logon_id_low));
                NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->logon_id_high));
                NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->account_name));
@@ -351,7 +378,7 @@ static enum ndr_err_code ndr_pull_netr_IdentityInfo(struct ndr_pull *ndr, int nd
        if (ndr_flags & NDR_SCALARS) {
                NDR_CHECK(ndr_pull_align(ndr, 4));
                NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->domain_name));
-               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->parameter_control));
+               NDR_CHECK(ndr_pull_netr_LogonParameterControl(ndr, NDR_SCALARS, &r->parameter_control));
                NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->logon_id_low));
                NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->logon_id_high));
                NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->account_name));
@@ -370,7 +397,7 @@ _PUBLIC_ void ndr_print_netr_IdentityInfo(struct ndr_print *ndr, const char *nam
        ndr_print_struct(ndr, name, "netr_IdentityInfo");
        ndr->depth++;
        ndr_print_lsa_String(ndr, "domain_name", &r->domain_name);
-       ndr_print_uint32(ndr, "parameter_control", r->parameter_control);
+       ndr_print_netr_LogonParameterControl(ndr, "parameter_control", r->parameter_control);
        ndr_print_uint32(ndr, "logon_id_low", r->logon_id_low);
        ndr_print_uint32(ndr, "logon_id_high", r->logon_id_high);
        ndr_print_lsa_String(ndr, "account_name", &r->account_name);
@@ -814,39 +841,6 @@ _PUBLIC_ void ndr_print_netr_LogonLevel(struct ndr_print *ndr, const char *name,
        }
 }
 
-_PUBLIC_ enum ndr_err_code ndr_push_netr_GroupMembership(struct ndr_push *ndr, int ndr_flags, const struct netr_GroupMembership *r)
-{
-       if (ndr_flags & NDR_SCALARS) {
-               NDR_CHECK(ndr_push_align(ndr, 4));
-               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->rid));
-               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->attributes));
-       }
-       if (ndr_flags & NDR_BUFFERS) {
-       }
-       return NDR_ERR_SUCCESS;
-}
-
-_PUBLIC_ enum ndr_err_code ndr_pull_netr_GroupMembership(struct ndr_pull *ndr, int ndr_flags, struct netr_GroupMembership *r)
-{
-       if (ndr_flags & NDR_SCALARS) {
-               NDR_CHECK(ndr_pull_align(ndr, 4));
-               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->rid));
-               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->attributes));
-       }
-       if (ndr_flags & NDR_BUFFERS) {
-       }
-       return NDR_ERR_SUCCESS;
-}
-
-_PUBLIC_ void ndr_print_netr_GroupMembership(struct ndr_print *ndr, const char *name, const struct netr_GroupMembership *r)
-{
-       ndr_print_struct(ndr, name, "netr_GroupMembership");
-       ndr->depth++;
-       ndr_print_uint32(ndr, "rid", r->rid);
-       ndr_print_uint32(ndr, "attributes", r->attributes);
-       ndr->depth--;
-}
-
 _PUBLIC_ enum ndr_err_code ndr_push_netr_UserSessionKey(struct ndr_push *ndr, int ndr_flags, const struct netr_UserSessionKey *r)
 {
        {
@@ -965,6 +959,7 @@ _PUBLIC_ void ndr_print_netr_UserFlags(struct ndr_print *ndr, const char *name,
        ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NETLOGON_NTLMV2_ENABLED", NETLOGON_NTLMV2_ENABLED, r);
        ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NETLOGON_RESOURCE_GROUPS", NETLOGON_RESOURCE_GROUPS, r);
        ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NETLOGON_PROFILE_PATH_RETURNED", NETLOGON_PROFILE_PATH_RETURNED, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NETLOGON_GRACE_LOGON", NETLOGON_GRACE_LOGON, r);
        ndr->depth--;
 }
 
@@ -1163,7 +1158,7 @@ static enum ndr_err_code ndr_push_netr_SidAttr(struct ndr_push *ndr, int ndr_fla
        if (ndr_flags & NDR_SCALARS) {
                NDR_CHECK(ndr_push_align(ndr, 4));
                NDR_CHECK(ndr_push_unique_ptr(ndr, r->sid));
-               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->attribute));
+               NDR_CHECK(ndr_push_samr_GroupAttrs(ndr, NDR_SCALARS, r->attributes));
        }
        if (ndr_flags & NDR_BUFFERS) {
                if (r->sid) {
@@ -1185,7 +1180,7 @@ static enum ndr_err_code ndr_pull_netr_SidAttr(struct ndr_pull *ndr, int ndr_fla
                } else {
                        r->sid = NULL;
                }
-               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->attribute));
+               NDR_CHECK(ndr_pull_samr_GroupAttrs(ndr, NDR_SCALARS, &r->attributes));
        }
        if (ndr_flags & NDR_BUFFERS) {
                if (r->sid) {
@@ -1208,7 +1203,7 @@ _PUBLIC_ void ndr_print_netr_SidAttr(struct ndr_print *ndr, const char *name, co
                ndr_print_dom_sid2(ndr, "sid", r->sid);
        }
        ndr->depth--;
-       ndr_print_uint32(ndr, "attribute", r->attribute);
+       ndr_print_samr_GroupAttrs(ndr, "attributes", r->attributes);
        ndr->depth--;
 }
 
@@ -2042,10 +2037,10 @@ static enum ndr_err_code ndr_push_netr_PasswordHistory(struct ndr_push *ndr, int
        if (ndr_flags & NDR_SCALARS) {
                NDR_CHECK(ndr_push_align(ndr, 4));
                NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->nt_length));
-               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->nt_size));
+               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->nt_length));
                NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->nt_flags));
                NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lm_length));
-               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lm_size));
+               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lm_length));
                NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->lm_flags));
                NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->nt_history, r->nt_length));
                NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->lm_history, r->lm_length));
@@ -2080,10 +2075,10 @@ _PUBLIC_ void ndr_print_netr_PasswordHistory(struct ndr_print *ndr, const char *
        ndr_print_struct(ndr, name, "netr_PasswordHistory");
        ndr->depth++;
        ndr_print_uint16(ndr, "nt_length", r->nt_length);
-       ndr_print_uint16(ndr, "nt_size", r->nt_size);
+       ndr_print_uint16(ndr, "nt_size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?r->nt_length:r->nt_size);
        ndr_print_uint32(ndr, "nt_flags", r->nt_flags);
        ndr_print_uint16(ndr, "lm_length", r->lm_length);
-       ndr_print_uint16(ndr, "lm_size", r->lm_size);
+       ndr_print_uint16(ndr, "lm_size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?r->lm_length:r->lm_size);
        ndr_print_uint32(ndr, "lm_flags", r->lm_flags);
        ndr_print_array_uint8(ndr, "nt_history", r->nt_history, r->nt_length);
        ndr_print_array_uint8(ndr, "lm_history", r->lm_history, r->lm_length);
@@ -2096,7 +2091,7 @@ static enum ndr_err_code ndr_push_netr_USER_KEYS2(struct ndr_push *ndr, int ndr_
                NDR_CHECK(ndr_push_align(ndr, 4));
                NDR_CHECK(ndr_push_netr_USER_KEY16(ndr, NDR_SCALARS, &r->lmpassword));
                NDR_CHECK(ndr_push_netr_USER_KEY16(ndr, NDR_SCALARS, &r->ntpassword));
-               NDR_CHECK(ndr_push_netr_PasswordHistory(ndr, NDR_SCALARS, &r->lmhistory));
+               NDR_CHECK(ndr_push_netr_PasswordHistory(ndr, NDR_SCALARS, &r->history));
        }
        if (ndr_flags & NDR_BUFFERS) {
                NDR_CHECK(ndr_push_netr_USER_KEY16(ndr, NDR_BUFFERS, &r->lmpassword));
@@ -2111,7 +2106,7 @@ static enum ndr_err_code ndr_pull_netr_USER_KEYS2(struct ndr_pull *ndr, int ndr_
                NDR_CHECK(ndr_pull_align(ndr, 4));
                NDR_CHECK(ndr_pull_netr_USER_KEY16(ndr, NDR_SCALARS, &r->lmpassword));
                NDR_CHECK(ndr_pull_netr_USER_KEY16(ndr, NDR_SCALARS, &r->ntpassword));
-               NDR_CHECK(ndr_pull_netr_PasswordHistory(ndr, NDR_SCALARS, &r->lmhistory));
+               NDR_CHECK(ndr_pull_netr_PasswordHistory(ndr, NDR_SCALARS, &r->history));
        }
        if (ndr_flags & NDR_BUFFERS) {
                NDR_CHECK(ndr_pull_netr_USER_KEY16(ndr, NDR_BUFFERS, &r->lmpassword));
@@ -2126,7 +2121,7 @@ _PUBLIC_ void ndr_print_netr_USER_KEYS2(struct ndr_print *ndr, const char *name,
        ndr->depth++;
        ndr_print_netr_USER_KEY16(ndr, "lmpassword", &r->lmpassword);
        ndr_print_netr_USER_KEY16(ndr, "ntpassword", &r->ntpassword);
-       ndr_print_netr_PasswordHistory(ndr, "lmhistory", &r->lmhistory);
+       ndr_print_netr_PasswordHistory(ndr, "history", &r->history);
        ndr->depth--;
 }
 
@@ -5942,17 +5937,178 @@ _PUBLIC_ void ndr_print_netr_CONTROL_DATA_INFORMATION(struct ndr_print *ndr, con
        }
 }
 
+static enum ndr_err_code ndr_push_netr_Blob(struct ndr_push *ndr, int ndr_flags, const struct netr_Blob *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->length));
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->data));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               if (r->data) {
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->length));
+                       NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->data, r->length));
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_netr_Blob(struct ndr_pull *ndr, int ndr_flags, struct netr_Blob *r)
+{
+       uint32_t _ptr_data;
+       TALLOC_CTX *_mem_save_data_0;
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->length));
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_data));
+               if (_ptr_data) {
+                       NDR_PULL_ALLOC(ndr, r->data);
+               } else {
+                       r->data = NULL;
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               if (r->data) {
+                       _mem_save_data_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->data, 0);
+                       NDR_CHECK(ndr_pull_array_size(ndr, &r->data));
+                       NDR_PULL_ALLOC_N(ndr, r->data, ndr_get_array_size(ndr, &r->data));
+                       NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->data, ndr_get_array_size(ndr, &r->data)));
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_data_0, 0);
+               }
+               if (r->data) {
+                       NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->data, r->length));
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_netr_Blob(struct ndr_print *ndr, const char *name, const struct netr_Blob *r)
+{
+       ndr_print_struct(ndr, name, "netr_Blob");
+       ndr->depth++;
+       ndr_print_uint32(ndr, "length", r->length);
+       ndr_print_ptr(ndr, "data", r->data);
+       ndr->depth++;
+       if (r->data) {
+               ndr_print_array_uint8(ndr, "data", r->data, r->length);
+       }
+       ndr->depth--;
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_netr_DsRGetDCName_flags(struct ndr_push *ndr, int ndr_flags, uint32_t r)
+{
+       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_netr_DsRGetDCName_flags(struct ndr_pull *ndr, int ndr_flags, uint32_t *r)
+{
+       uint32_t v;
+       NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
+       *r = v;
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_netr_DsRGetDCName_flags(struct ndr_print *ndr, const char *name, uint32_t r)
+{
+       ndr_print_uint32(ndr, name, r);
+       ndr->depth++;
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_FORCE_REDISCOVERY", DS_FORCE_REDISCOVERY, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_DIRECTORY_SERVICE_REQUIRED", DS_DIRECTORY_SERVICE_REQUIRED, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_DIRECTORY_SERVICE_PREFERRED", DS_DIRECTORY_SERVICE_PREFERRED, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_GC_SERVER_REQUIRED", DS_GC_SERVER_REQUIRED, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_PDC_REQUIRED", DS_PDC_REQUIRED, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_BACKGROUND_ONLY", DS_BACKGROUND_ONLY, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_IP_REQUIRED", DS_IP_REQUIRED, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_KDC_REQUIRED", DS_KDC_REQUIRED, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_TIMESERV_REQUIRED", DS_TIMESERV_REQUIRED, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_WRITABLE_REQUIRED", DS_WRITABLE_REQUIRED, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_GOOD_TIMESERV_PREFERRED", DS_GOOD_TIMESERV_PREFERRED, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_AVOID_SELF", DS_AVOID_SELF, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_ONLY_LDAP_NEEDED", DS_ONLY_LDAP_NEEDED, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_IS_FLAT_NAME", DS_IS_FLAT_NAME, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_IS_DNS_NAME", DS_IS_DNS_NAME, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_TRY_NEXTCLOSEST_SITE", DS_TRY_NEXTCLOSEST_SITE, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_DIRECTORY_SERVICE_6_REQUIRED", DS_DIRECTORY_SERVICE_6_REQUIRED, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_RETURN_DNS_NAME", DS_RETURN_DNS_NAME, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_RETURN_FLAT_NAME", DS_RETURN_FLAT_NAME, r);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_netr_DsRGetDCNameInfo_AddressType(struct ndr_push *ndr, int ndr_flags, enum netr_DsRGetDCNameInfo_AddressType r)
+{
+       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_netr_DsRGetDCNameInfo_AddressType(struct ndr_pull *ndr, int ndr_flags, enum netr_DsRGetDCNameInfo_AddressType *r)
+{
+       uint32_t v;
+       NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
+       *r = v;
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_netr_DsRGetDCNameInfo_AddressType(struct ndr_print *ndr, const char *name, enum netr_DsRGetDCNameInfo_AddressType r)
+{
+       const char *val = NULL;
+
+       switch (r) {
+               case DS_ADDRESS_TYPE_INET: val = "DS_ADDRESS_TYPE_INET"; break;
+               case DS_ADDRESS_TYPE_NETBIOS: val = "DS_ADDRESS_TYPE_NETBIOS"; break;
+       }
+       ndr_print_enum(ndr, name, "ENUM", val, r);
+}
+
+static enum ndr_err_code ndr_push_netr_DsR_DcFlags(struct ndr_push *ndr, int ndr_flags, uint32_t r)
+{
+       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_netr_DsR_DcFlags(struct ndr_pull *ndr, int ndr_flags, uint32_t *r)
+{
+       uint32_t v;
+       NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
+       *r = v;
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_netr_DsR_DcFlags(struct ndr_print *ndr, const char *name, uint32_t r)
+{
+       ndr_print_uint32(ndr, name, r);
+       ndr->depth++;
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_SERVER_PDC", DS_SERVER_PDC, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_SERVER_GC", DS_SERVER_GC, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_SERVER_LDAP", DS_SERVER_LDAP, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_SERVER_DS", DS_SERVER_DS, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_SERVER_KDC", DS_SERVER_KDC, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_SERVER_TIMESERV", DS_SERVER_TIMESERV, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_SERVER_CLOSEST", DS_SERVER_CLOSEST, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_SERVER_WRITABLE", DS_SERVER_WRITABLE, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_SERVER_GOOD_TIMESERV", DS_SERVER_GOOD_TIMESERV, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_SERVER_NDNC", DS_SERVER_NDNC, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_SERVER_SELECT_SECRET_DOMAIN_6", DS_SERVER_SELECT_SECRET_DOMAIN_6, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_SERVER_FULL_SECRET_DOMAIN_6", DS_SERVER_FULL_SECRET_DOMAIN_6, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_DNS_CONTROLLER", DS_DNS_CONTROLLER, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_DNS_DOMAIN", DS_DNS_DOMAIN, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_DNS_FOREST", DS_DNS_FOREST, r);
+       ndr->depth--;
+}
+
 static enum ndr_err_code ndr_push_netr_DsRGetDCNameInfo(struct ndr_push *ndr, int ndr_flags, const struct netr_DsRGetDCNameInfo *r)
 {
        if (ndr_flags & NDR_SCALARS) {
                NDR_CHECK(ndr_push_align(ndr, 4));
                NDR_CHECK(ndr_push_unique_ptr(ndr, r->dc_unc));
                NDR_CHECK(ndr_push_unique_ptr(ndr, r->dc_address));
-               NDR_CHECK(ndr_push_int32(ndr, NDR_SCALARS, r->dc_address_type));
+               NDR_CHECK(ndr_push_netr_DsRGetDCNameInfo_AddressType(ndr, NDR_SCALARS, r->dc_address_type));
                NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &r->domain_guid));
                NDR_CHECK(ndr_push_unique_ptr(ndr, r->domain_name));
                NDR_CHECK(ndr_push_unique_ptr(ndr, r->forest_name));
-               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->dc_flags));
+               NDR_CHECK(ndr_push_netr_DsR_DcFlags(ndr, NDR_SCALARS, r->dc_flags));
                NDR_CHECK(ndr_push_unique_ptr(ndr, r->dc_site_name));
                NDR_CHECK(ndr_push_unique_ptr(ndr, r->client_site_name));
        }
@@ -6026,7 +6182,7 @@ static enum ndr_err_code ndr_pull_netr_DsRGetDCNameInfo(struct ndr_pull *ndr, in
                } else {
                        r->dc_address = NULL;
                }
-               NDR_CHECK(ndr_pull_int32(ndr, NDR_SCALARS, &r->dc_address_type));
+               NDR_CHECK(ndr_pull_netr_DsRGetDCNameInfo_AddressType(ndr, NDR_SCALARS, &r->dc_address_type));
                NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, &r->domain_guid));
                NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_domain_name));
                if (_ptr_domain_name) {
@@ -6040,7 +6196,7 @@ static enum ndr_err_code ndr_pull_netr_DsRGetDCNameInfo(struct ndr_pull *ndr, in
                } else {
                        r->forest_name = NULL;
                }
-               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->dc_flags));
+               NDR_CHECK(ndr_pull_netr_DsR_DcFlags(ndr, NDR_SCALARS, &r->dc_flags));
                NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_dc_site_name));
                if (_ptr_dc_site_name) {
                        NDR_PULL_ALLOC(ndr, r->dc_site_name);
@@ -6148,7 +6304,7 @@ _PUBLIC_ void ndr_print_netr_DsRGetDCNameInfo(struct ndr_print *ndr, const char
                ndr_print_string(ndr, "dc_address", r->dc_address);
        }
        ndr->depth--;
-       ndr_print_int32(ndr, "dc_address_type", r->dc_address_type);
+       ndr_print_netr_DsRGetDCNameInfo_AddressType(ndr, "dc_address_type", r->dc_address_type);
        ndr_print_GUID(ndr, "domain_guid", &r->domain_guid);
        ndr_print_ptr(ndr, "domain_name", r->domain_name);
        ndr->depth++;
@@ -6162,7 +6318,7 @@ _PUBLIC_ void ndr_print_netr_DsRGetDCNameInfo(struct ndr_print *ndr, const char
                ndr_print_string(ndr, "forest_name", r->forest_name);
        }
        ndr->depth--;
-       ndr_print_uint32(ndr, "dc_flags", r->dc_flags);
+       ndr_print_netr_DsR_DcFlags(ndr, "dc_flags", r->dc_flags);
        ndr_print_ptr(ndr, "dc_site_name", r->dc_site_name);
        ndr->depth++;
        if (r->dc_site_name) {
@@ -6178,66 +6334,6 @@ _PUBLIC_ void ndr_print_netr_DsRGetDCNameInfo(struct ndr_print *ndr, const char
        ndr->depth--;
 }
 
-static enum ndr_err_code ndr_push_netr_Blob(struct ndr_push *ndr, int ndr_flags, const struct netr_Blob *r)
-{
-       if (ndr_flags & NDR_SCALARS) {
-               NDR_CHECK(ndr_push_align(ndr, 4));
-               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->length));
-               NDR_CHECK(ndr_push_unique_ptr(ndr, r->data));
-       }
-       if (ndr_flags & NDR_BUFFERS) {
-               if (r->data) {
-                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->length));
-                       NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->data, r->length));
-               }
-       }
-       return NDR_ERR_SUCCESS;
-}
-
-static enum ndr_err_code ndr_pull_netr_Blob(struct ndr_pull *ndr, int ndr_flags, struct netr_Blob *r)
-{
-       uint32_t _ptr_data;
-       TALLOC_CTX *_mem_save_data_0;
-       if (ndr_flags & NDR_SCALARS) {
-               NDR_CHECK(ndr_pull_align(ndr, 4));
-               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->length));
-               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_data));
-               if (_ptr_data) {
-                       NDR_PULL_ALLOC(ndr, r->data);
-               } else {
-                       r->data = NULL;
-               }
-       }
-       if (ndr_flags & NDR_BUFFERS) {
-               if (r->data) {
-                       _mem_save_data_0 = NDR_PULL_GET_MEM_CTX(ndr);
-                       NDR_PULL_SET_MEM_CTX(ndr, r->data, 0);
-                       NDR_CHECK(ndr_pull_array_size(ndr, &r->data));
-                       NDR_PULL_ALLOC_N(ndr, r->data, ndr_get_array_size(ndr, &r->data));
-                       NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->data, ndr_get_array_size(ndr, &r->data)));
-                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_data_0, 0);
-               }
-               if (r->data) {
-                       NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->data, r->length));
-               }
-       }
-       return NDR_ERR_SUCCESS;
-}
-
-_PUBLIC_ void ndr_print_netr_Blob(struct ndr_print *ndr, const char *name, const struct netr_Blob *r)
-{
-       ndr_print_struct(ndr, name, "netr_Blob");
-       ndr->depth++;
-       ndr_print_uint32(ndr, "length", r->length);
-       ndr_print_ptr(ndr, "data", r->data);
-       ndr->depth++;
-       if (r->data) {
-               ndr_print_array_uint8(ndr, "data", r->data, r->length);
-       }
-       ndr->depth--;
-       ndr->depth--;
-}
-
 static enum ndr_err_code ndr_push_netr_BinaryString(struct ndr_push *ndr, int ndr_flags, const struct netr_BinaryString *r)
 {
        uint32_t cntr_data_1;
@@ -7157,31 +7253,178 @@ _PUBLIC_ void ndr_print_netr_CryptPassword(struct ndr_print *ndr, const char *na
        }
 }
 
-static enum ndr_err_code ndr_push_netr_TrustFlags(struct ndr_push *ndr, int ndr_flags, uint32_t r)
+static enum ndr_err_code ndr_push_netr_DsRAddressToSitenamesWCtr(struct ndr_push *ndr, int ndr_flags, const struct netr_DsRAddressToSitenamesWCtr *r)
 {
-       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
+       uint32_t cntr_sitename_1;
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count));
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->sitename));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               if (r->sitename) {
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count));
+                       for (cntr_sitename_1 = 0; cntr_sitename_1 < r->count; cntr_sitename_1++) {
+                               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->sitename[cntr_sitename_1]));
+                       }
+                       for (cntr_sitename_1 = 0; cntr_sitename_1 < r->count; cntr_sitename_1++) {
+                               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->sitename[cntr_sitename_1]));
+                       }
+               }
+       }
        return NDR_ERR_SUCCESS;
 }
 
-static enum ndr_err_code ndr_pull_netr_TrustFlags(struct ndr_pull *ndr, int ndr_flags, uint32_t *r)
+static enum ndr_err_code ndr_pull_netr_DsRAddressToSitenamesWCtr(struct ndr_pull *ndr, int ndr_flags, struct netr_DsRAddressToSitenamesWCtr *r)
 {
-       uint32_t v;
-       NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
-       *r = v;
+       uint32_t _ptr_sitename;
+       uint32_t cntr_sitename_1;
+       TALLOC_CTX *_mem_save_sitename_0;
+       TALLOC_CTX *_mem_save_sitename_1;
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->count));
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_sitename));
+               if (_ptr_sitename) {
+                       NDR_PULL_ALLOC(ndr, r->sitename);
+               } else {
+                       r->sitename = NULL;
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               if (r->sitename) {
+                       _mem_save_sitename_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->sitename, 0);
+                       NDR_CHECK(ndr_pull_array_size(ndr, &r->sitename));
+                       NDR_PULL_ALLOC_N(ndr, r->sitename, ndr_get_array_size(ndr, &r->sitename));
+                       _mem_save_sitename_1 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->sitename, 0);
+                       for (cntr_sitename_1 = 0; cntr_sitename_1 < r->count; cntr_sitename_1++) {
+                               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->sitename[cntr_sitename_1]));
+                       }
+                       for (cntr_sitename_1 = 0; cntr_sitename_1 < r->count; cntr_sitename_1++) {
+                               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->sitename[cntr_sitename_1]));
+                       }
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sitename_1, 0);
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sitename_0, 0);
+               }
+               if (r->sitename) {
+                       NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->sitename, r->count));
+               }
+       }
        return NDR_ERR_SUCCESS;
 }
 
-_PUBLIC_ void ndr_print_netr_TrustFlags(struct ndr_print *ndr, const char *name, uint32_t r)
+_PUBLIC_ void ndr_print_netr_DsRAddressToSitenamesWCtr(struct ndr_print *ndr, const char *name, const struct netr_DsRAddressToSitenamesWCtr *r)
 {
-       ndr_print_uint32(ndr, name, r);
+       uint32_t cntr_sitename_1;
+       ndr_print_struct(ndr, name, "netr_DsRAddressToSitenamesWCtr");
        ndr->depth++;
-       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NETR_TRUST_FLAG_IN_FOREST", NETR_TRUST_FLAG_IN_FOREST, r);
-       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NETR_TRUST_FLAG_OUTBOUND", NETR_TRUST_FLAG_OUTBOUND, r);
-       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NETR_TRUST_FLAG_TREEROOT", NETR_TRUST_FLAG_TREEROOT, r);
-       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NETR_TRUST_FLAG_PRIMARY", NETR_TRUST_FLAG_PRIMARY, r);
-       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NETR_TRUST_FLAG_NATIVE", NETR_TRUST_FLAG_NATIVE, r);
-       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NETR_TRUST_FLAG_INBOUND", NETR_TRUST_FLAG_INBOUND, r);
-       ndr->depth--;
+       ndr_print_uint32(ndr, "count", r->count);
+       ndr_print_ptr(ndr, "sitename", r->sitename);
+       ndr->depth++;
+       if (r->sitename) {
+               ndr->print(ndr, "%s: ARRAY(%d)", "sitename", r->count);
+               ndr->depth++;
+               for (cntr_sitename_1=0;cntr_sitename_1<r->count;cntr_sitename_1++) {
+                       char *idx_1=NULL;
+                       asprintf(&idx_1, "[%d]", cntr_sitename_1);
+                       if (idx_1) {
+                               ndr_print_lsa_String(ndr, "sitename", &r->sitename[cntr_sitename_1]);
+                               free(idx_1);
+                       }
+               }
+               ndr->depth--;
+       }
+       ndr->depth--;
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_netr_DsRAddress(struct ndr_push *ndr, int ndr_flags, const struct netr_DsRAddress *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->buffer));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->size));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               if (r->buffer) {
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->size));
+                       NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->buffer, r->size));
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_netr_DsRAddress(struct ndr_pull *ndr, int ndr_flags, struct netr_DsRAddress *r)
+{
+       uint32_t _ptr_buffer;
+       TALLOC_CTX *_mem_save_buffer_0;
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_buffer));
+               if (_ptr_buffer) {
+                       NDR_PULL_ALLOC(ndr, r->buffer);
+               } else {
+                       r->buffer = NULL;
+               }
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->size));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               if (r->buffer) {
+                       _mem_save_buffer_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->buffer, 0);
+                       NDR_CHECK(ndr_pull_array_size(ndr, &r->buffer));
+                       NDR_PULL_ALLOC_N(ndr, r->buffer, ndr_get_array_size(ndr, &r->buffer));
+                       NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->buffer, ndr_get_array_size(ndr, &r->buffer)));
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_buffer_0, 0);
+               }
+               if (r->buffer) {
+                       NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->buffer, r->size));
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_netr_DsRAddress(struct ndr_print *ndr, const char *name, const struct netr_DsRAddress *r)
+{
+       ndr_print_struct(ndr, name, "netr_DsRAddress");
+       ndr->depth++;
+       ndr_print_ptr(ndr, "buffer", r->buffer);
+       ndr->depth++;
+       if (r->buffer) {
+               ndr_print_array_uint8(ndr, "buffer", r->buffer, r->size);
+       }
+       ndr->depth--;
+       ndr_print_uint32(ndr, "size", r->size);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_netr_TrustFlags(struct ndr_push *ndr, int ndr_flags, uint32_t r)
+{
+       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_netr_TrustFlags(struct ndr_pull *ndr, int ndr_flags, uint32_t *r)
+{
+       uint32_t v;
+       NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
+       *r = v;
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_netr_TrustFlags(struct ndr_print *ndr, const char *name, uint32_t r)
+{
+       ndr_print_uint32(ndr, name, r);
+       ndr->depth++;
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NETR_TRUST_FLAG_IN_FOREST", NETR_TRUST_FLAG_IN_FOREST, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NETR_TRUST_FLAG_OUTBOUND", NETR_TRUST_FLAG_OUTBOUND, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NETR_TRUST_FLAG_TREEROOT", NETR_TRUST_FLAG_TREEROOT, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NETR_TRUST_FLAG_PRIMARY", NETR_TRUST_FLAG_PRIMARY, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NETR_TRUST_FLAG_NATIVE", NETR_TRUST_FLAG_NATIVE, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NETR_TRUST_FLAG_INBOUND", NETR_TRUST_FLAG_INBOUND, r);
+       ndr->depth--;
 }
 
 static enum ndr_err_code ndr_push_netr_TrustType(struct ndr_push *ndr, int ndr_flags, enum netr_TrustType r)
@@ -7373,6 +7616,324 @@ _PUBLIC_ void ndr_print_netr_DomainTrust(struct ndr_print *ndr, const char *name
        ndr->depth--;
 }
 
+static enum ndr_err_code ndr_push_netr_DomainTrustList(struct ndr_push *ndr, int ndr_flags, const struct netr_DomainTrustList *r)
+{
+       uint32_t cntr_array_1;
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count));
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->array));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               if (r->array) {
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count));
+                       for (cntr_array_1 = 0; cntr_array_1 < r->count; cntr_array_1++) {
+                               NDR_CHECK(ndr_push_netr_DomainTrust(ndr, NDR_SCALARS, &r->array[cntr_array_1]));
+                       }
+                       for (cntr_array_1 = 0; cntr_array_1 < r->count; cntr_array_1++) {
+                               NDR_CHECK(ndr_push_netr_DomainTrust(ndr, NDR_BUFFERS, &r->array[cntr_array_1]));
+                       }
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_netr_DomainTrustList(struct ndr_pull *ndr, int ndr_flags, struct netr_DomainTrustList *r)
+{
+       uint32_t _ptr_array;
+       uint32_t cntr_array_1;
+       TALLOC_CTX *_mem_save_array_0;
+       TALLOC_CTX *_mem_save_array_1;
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->count));
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_array));
+               if (_ptr_array) {
+                       NDR_PULL_ALLOC(ndr, r->array);
+               } else {
+                       r->array = NULL;
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               if (r->array) {
+                       _mem_save_array_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->array, 0);
+                       NDR_CHECK(ndr_pull_array_size(ndr, &r->array));
+                       NDR_PULL_ALLOC_N(ndr, r->array, ndr_get_array_size(ndr, &r->array));
+                       _mem_save_array_1 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->array, 0);
+                       for (cntr_array_1 = 0; cntr_array_1 < r->count; cntr_array_1++) {
+                               NDR_CHECK(ndr_pull_netr_DomainTrust(ndr, NDR_SCALARS, &r->array[cntr_array_1]));
+                       }
+                       for (cntr_array_1 = 0; cntr_array_1 < r->count; cntr_array_1++) {
+                               NDR_CHECK(ndr_pull_netr_DomainTrust(ndr, NDR_BUFFERS, &r->array[cntr_array_1]));
+                       }
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_array_1, 0);
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_array_0, 0);
+               }
+               if (r->array) {
+                       NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->array, r->count));
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_netr_DomainTrustList(struct ndr_print *ndr, const char *name, const struct netr_DomainTrustList *r)
+{
+       uint32_t cntr_array_1;
+       ndr_print_struct(ndr, name, "netr_DomainTrustList");
+       ndr->depth++;
+       ndr_print_uint32(ndr, "count", r->count);
+       ndr_print_ptr(ndr, "array", r->array);
+       ndr->depth++;
+       if (r->array) {
+               ndr->print(ndr, "%s: ARRAY(%d)", "array", r->count);
+               ndr->depth++;
+               for (cntr_array_1=0;cntr_array_1<r->count;cntr_array_1++) {
+                       char *idx_1=NULL;
+                       asprintf(&idx_1, "[%d]", cntr_array_1);
+                       if (idx_1) {
+                               ndr_print_netr_DomainTrust(ndr, "array", &r->array[cntr_array_1]);
+                               free(idx_1);
+                       }
+               }
+               ndr->depth--;
+       }
+       ndr->depth--;
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_netr_DsRAddressToSitenamesExWCtr(struct ndr_push *ndr, int ndr_flags, const struct netr_DsRAddressToSitenamesExWCtr *r)
+{
+       uint32_t cntr_sitename_1;
+       uint32_t cntr_subnetname_1;
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count));
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->sitename));
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->subnetname));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               if (r->sitename) {
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count));
+                       for (cntr_sitename_1 = 0; cntr_sitename_1 < r->count; cntr_sitename_1++) {
+                               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->sitename[cntr_sitename_1]));
+                       }
+                       for (cntr_sitename_1 = 0; cntr_sitename_1 < r->count; cntr_sitename_1++) {
+                               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->sitename[cntr_sitename_1]));
+                       }
+               }
+               if (r->subnetname) {
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count));
+                       for (cntr_subnetname_1 = 0; cntr_subnetname_1 < r->count; cntr_subnetname_1++) {
+                               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->subnetname[cntr_subnetname_1]));
+                       }
+                       for (cntr_subnetname_1 = 0; cntr_subnetname_1 < r->count; cntr_subnetname_1++) {
+                               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->subnetname[cntr_subnetname_1]));
+                       }
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_netr_DsRAddressToSitenamesExWCtr(struct ndr_pull *ndr, int ndr_flags, struct netr_DsRAddressToSitenamesExWCtr *r)
+{
+       uint32_t _ptr_sitename;
+       uint32_t cntr_sitename_1;
+       TALLOC_CTX *_mem_save_sitename_0;
+       TALLOC_CTX *_mem_save_sitename_1;
+       uint32_t _ptr_subnetname;
+       uint32_t cntr_subnetname_1;
+       TALLOC_CTX *_mem_save_subnetname_0;
+       TALLOC_CTX *_mem_save_subnetname_1;
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->count));
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_sitename));
+               if (_ptr_sitename) {
+                       NDR_PULL_ALLOC(ndr, r->sitename);
+               } else {
+                       r->sitename = NULL;
+               }
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_subnetname));
+               if (_ptr_subnetname) {
+                       NDR_PULL_ALLOC(ndr, r->subnetname);
+               } else {
+                       r->subnetname = NULL;
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               if (r->sitename) {
+                       _mem_save_sitename_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->sitename, 0);
+                       NDR_CHECK(ndr_pull_array_size(ndr, &r->sitename));
+                       NDR_PULL_ALLOC_N(ndr, r->sitename, ndr_get_array_size(ndr, &r->sitename));
+                       _mem_save_sitename_1 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->sitename, 0);
+                       for (cntr_sitename_1 = 0; cntr_sitename_1 < r->count; cntr_sitename_1++) {
+                               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->sitename[cntr_sitename_1]));
+                       }
+                       for (cntr_sitename_1 = 0; cntr_sitename_1 < r->count; cntr_sitename_1++) {
+                               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->sitename[cntr_sitename_1]));
+                       }
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sitename_1, 0);
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sitename_0, 0);
+               }
+               if (r->subnetname) {
+                       _mem_save_subnetname_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->subnetname, 0);
+                       NDR_CHECK(ndr_pull_array_size(ndr, &r->subnetname));
+                       NDR_PULL_ALLOC_N(ndr, r->subnetname, ndr_get_array_size(ndr, &r->subnetname));
+                       _mem_save_subnetname_1 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->subnetname, 0);
+                       for (cntr_subnetname_1 = 0; cntr_subnetname_1 < r->count; cntr_subnetname_1++) {
+                               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->subnetname[cntr_subnetname_1]));
+                       }
+                       for (cntr_subnetname_1 = 0; cntr_subnetname_1 < r->count; cntr_subnetname_1++) {
+                               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->subnetname[cntr_subnetname_1]));
+                       }
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_subnetname_1, 0);
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_subnetname_0, 0);
+               }
+               if (r->sitename) {
+                       NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->sitename, r->count));
+               }
+               if (r->subnetname) {
+                       NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->subnetname, r->count));
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_netr_DsRAddressToSitenamesExWCtr(struct ndr_print *ndr, const char *name, const struct netr_DsRAddressToSitenamesExWCtr *r)
+{
+       uint32_t cntr_sitename_1;
+       uint32_t cntr_subnetname_1;
+       ndr_print_struct(ndr, name, "netr_DsRAddressToSitenamesExWCtr");
+       ndr->depth++;
+       ndr_print_uint32(ndr, "count", r->count);
+       ndr_print_ptr(ndr, "sitename", r->sitename);
+       ndr->depth++;
+       if (r->sitename) {
+               ndr->print(ndr, "%s: ARRAY(%d)", "sitename", r->count);
+               ndr->depth++;
+               for (cntr_sitename_1=0;cntr_sitename_1<r->count;cntr_sitename_1++) {
+                       char *idx_1=NULL;
+                       asprintf(&idx_1, "[%d]", cntr_sitename_1);
+                       if (idx_1) {
+                               ndr_print_lsa_String(ndr, "sitename", &r->sitename[cntr_sitename_1]);
+                               free(idx_1);
+                       }
+               }
+               ndr->depth--;
+       }
+       ndr->depth--;
+       ndr_print_ptr(ndr, "subnetname", r->subnetname);
+       ndr->depth++;
+       if (r->subnetname) {
+               ndr->print(ndr, "%s: ARRAY(%d)", "subnetname", r->count);
+               ndr->depth++;
+               for (cntr_subnetname_1=0;cntr_subnetname_1<r->count;cntr_subnetname_1++) {
+                       char *idx_1=NULL;
+                       asprintf(&idx_1, "[%d]", cntr_subnetname_1);
+                       if (idx_1) {
+                               ndr_print_lsa_String(ndr, "subnetname", &r->subnetname[cntr_subnetname_1]);
+                               free(idx_1);
+                       }
+               }
+               ndr->depth--;
+       }
+       ndr->depth--;
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_DcSitesCtr(struct ndr_push *ndr, int ndr_flags, const struct DcSitesCtr *r)
+{
+       uint32_t cntr_sites_1;
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num_sites));
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->sites));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               if (r->sites) {
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num_sites));
+                       for (cntr_sites_1 = 0; cntr_sites_1 < r->num_sites; cntr_sites_1++) {
+                               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->sites[cntr_sites_1]));
+                       }
+                       for (cntr_sites_1 = 0; cntr_sites_1 < r->num_sites; cntr_sites_1++) {
+                               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->sites[cntr_sites_1]));
+                       }
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_DcSitesCtr(struct ndr_pull *ndr, int ndr_flags, struct DcSitesCtr *r)
+{
+       uint32_t _ptr_sites;
+       uint32_t cntr_sites_1;
+       TALLOC_CTX *_mem_save_sites_0;
+       TALLOC_CTX *_mem_save_sites_1;
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->num_sites));
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_sites));
+               if (_ptr_sites) {
+                       NDR_PULL_ALLOC(ndr, r->sites);
+               } else {
+                       r->sites = NULL;
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               if (r->sites) {
+                       _mem_save_sites_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->sites, 0);
+                       NDR_CHECK(ndr_pull_array_size(ndr, &r->sites));
+                       NDR_PULL_ALLOC_N(ndr, r->sites, ndr_get_array_size(ndr, &r->sites));
+                       _mem_save_sites_1 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->sites, 0);
+                       for (cntr_sites_1 = 0; cntr_sites_1 < r->num_sites; cntr_sites_1++) {
+                               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->sites[cntr_sites_1]));
+                       }
+                       for (cntr_sites_1 = 0; cntr_sites_1 < r->num_sites; cntr_sites_1++) {
+                               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->sites[cntr_sites_1]));
+                       }
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sites_1, 0);
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sites_0, 0);
+               }
+               if (r->sites) {
+                       NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->sites, r->num_sites));
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_DcSitesCtr(struct ndr_print *ndr, const char *name, const struct DcSitesCtr *r)
+{
+       uint32_t cntr_sites_1;
+       ndr_print_struct(ndr, name, "DcSitesCtr");
+       ndr->depth++;
+       ndr_print_uint32(ndr, "num_sites", r->num_sites);
+       ndr_print_ptr(ndr, "sites", r->sites);
+       ndr->depth++;
+       if (r->sites) {
+               ndr->print(ndr, "%s: ARRAY(%d)", "sites", r->num_sites);
+               ndr->depth++;
+               for (cntr_sites_1=0;cntr_sites_1<r->num_sites;cntr_sites_1++) {
+                       char *idx_1=NULL;
+                       asprintf(&idx_1, "[%d]", cntr_sites_1);
+                       if (idx_1) {
+                               ndr_print_lsa_String(ndr, "sites", &r->sites[cntr_sites_1]);
+                               free(idx_1);
+                       }
+               }
+               ndr->depth--;
+       }
+       ndr->depth--;
+       ndr->depth--;
+}
+
 static enum ndr_err_code ndr_push_netr_LogonUasLogon(struct ndr_push *ndr, int flags, const struct netr_LogonUasLogon *r)
 {
        if (flags & NDR_IN) {
@@ -7393,10 +7954,10 @@ static enum ndr_err_code ndr_push_netr_LogonUasLogon(struct ndr_push *ndr, int f
                NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.workstation, ndr_charset_length(r->in.workstation, CH_UTF16), sizeof(uint16_t), CH_UTF16));
        }
        if (flags & NDR_OUT) {
-               NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.info));
-               if (r->out.info) {
-                       NDR_CHECK(ndr_push_netr_UasInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info));
+               if (r->out.info == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
                }
+               NDR_CHECK(ndr_push_netr_UasInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info));
                NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
        }
        return NDR_ERR_SUCCESS;
@@ -7405,7 +7966,6 @@ static enum ndr_err_code ndr_push_netr_LogonUasLogon(struct ndr_push *ndr, int f
 static enum ndr_err_code ndr_pull_netr_LogonUasLogon(struct ndr_pull *ndr, int flags, struct netr_LogonUasLogon *r)
 {
        uint32_t _ptr_server_name;
-       uint32_t _ptr_info;
        TALLOC_CTX *_mem_save_server_name_0;
        TALLOC_CTX *_mem_save_info_0;
        if (flags & NDR_IN) {
@@ -7443,20 +8003,17 @@ static enum ndr_err_code ndr_pull_netr_LogonUasLogon(struct ndr_pull *ndr, int f
                }
                NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.workstation), sizeof(uint16_t)));
                NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.workstation, ndr_get_array_length(ndr, &r->in.workstation), sizeof(uint16_t), CH_UTF16));
+               NDR_PULL_ALLOC(ndr, r->out.info);
+               ZERO_STRUCTP(r->out.info);
        }
        if (flags & NDR_OUT) {
-               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_info));
-               if (_ptr_info) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
                        NDR_PULL_ALLOC(ndr, r->out.info);
-               } else {
-                       r->out.info = NULL;
-               }
-               if (r->out.info) {
-                       _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr);
-                       NDR_PULL_SET_MEM_CTX(ndr, r->out.info, 0);
-                       NDR_CHECK(ndr_pull_netr_UasInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info));
-                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, 0);
                }
+               _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.info, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_netr_UasInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, LIBNDR_FLAG_REF_ALLOC);
                NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
        }
        return NDR_ERR_SUCCESS;
@@ -7487,9 +8044,7 @@ _PUBLIC_ void ndr_print_netr_LogonUasLogon(struct ndr_print *ndr, const char *na
                ndr->depth++;
                ndr_print_ptr(ndr, "info", r->out.info);
                ndr->depth++;
-               if (r->out.info) {
-                       ndr_print_netr_UasInfo(ndr, "info", r->out.info);
-               }
+               ndr_print_netr_UasInfo(ndr, "info", r->out.info);
                ndr->depth--;
                ndr_print_WERROR(ndr, "result", r->out.result);
                ndr->depth--;
@@ -8449,10 +9004,10 @@ static enum ndr_err_code ndr_push_netr_DatabaseDeltas(struct ndr_push *ndr, int
                        return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
                }
                NDR_CHECK(ndr_push_udlong(ndr, NDR_SCALARS, *r->out.sequence_num));
-               NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.delta_enum_array));
-               if (r->out.delta_enum_array) {
-                       NDR_CHECK(ndr_push_netr_DELTA_ENUM_ARRAY(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.delta_enum_array));
+               if (r->out.delta_enum_array == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
                }
+               NDR_CHECK(ndr_push_netr_DELTA_ENUM_ARRAY(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.delta_enum_array));
                NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
        }
        return NDR_ERR_SUCCESS;
@@ -8460,7 +9015,6 @@ static enum ndr_err_code ndr_push_netr_DatabaseDeltas(struct ndr_push *ndr, int
 
 static enum ndr_err_code ndr_pull_netr_DatabaseDeltas(struct ndr_pull *ndr, int flags, struct netr_DatabaseDeltas *r)
 {
-       uint32_t _ptr_delta_enum_array;
        TALLOC_CTX *_mem_save_return_authenticator_0;
        TALLOC_CTX *_mem_save_sequence_num_0;
        TALLOC_CTX *_mem_save_delta_enum_array_0;
@@ -8502,6 +9056,8 @@ static enum ndr_err_code ndr_pull_netr_DatabaseDeltas(struct ndr_pull *ndr, int
                *r->out.return_authenticator = *r->in.return_authenticator;
                NDR_PULL_ALLOC(ndr, r->out.sequence_num);
                *r->out.sequence_num = *r->in.sequence_num;
+               NDR_PULL_ALLOC(ndr, r->out.delta_enum_array);
+               ZERO_STRUCTP(r->out.delta_enum_array);
        }
        if (flags & NDR_OUT) {
                if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
@@ -8518,18 +9074,13 @@ static enum ndr_err_code ndr_pull_netr_DatabaseDeltas(struct ndr_pull *ndr, int
                NDR_PULL_SET_MEM_CTX(ndr, r->out.sequence_num, LIBNDR_FLAG_REF_ALLOC);
                NDR_CHECK(ndr_pull_udlong(ndr, NDR_SCALARS, r->out.sequence_num));
                NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sequence_num_0, LIBNDR_FLAG_REF_ALLOC);
-               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_delta_enum_array));
-               if (_ptr_delta_enum_array) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
                        NDR_PULL_ALLOC(ndr, r->out.delta_enum_array);
-               } else {
-                       r->out.delta_enum_array = NULL;
-               }
-               if (r->out.delta_enum_array) {
-                       _mem_save_delta_enum_array_0 = NDR_PULL_GET_MEM_CTX(ndr);
-                       NDR_PULL_SET_MEM_CTX(ndr, r->out.delta_enum_array, 0);
-                       NDR_CHECK(ndr_pull_netr_DELTA_ENUM_ARRAY(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.delta_enum_array));
-                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_delta_enum_array_0, 0);
                }
+               _mem_save_delta_enum_array_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.delta_enum_array, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_netr_DELTA_ENUM_ARRAY(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.delta_enum_array));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_delta_enum_array_0, LIBNDR_FLAG_REF_ALLOC);
                NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
        }
        return NDR_ERR_SUCCESS;
@@ -8573,9 +9124,7 @@ _PUBLIC_ void ndr_print_netr_DatabaseDeltas(struct ndr_print *ndr, const char *n
                ndr->depth--;
                ndr_print_ptr(ndr, "delta_enum_array", r->out.delta_enum_array);
                ndr->depth++;
-               if (r->out.delta_enum_array) {
-                       ndr_print_netr_DELTA_ENUM_ARRAY(ndr, "delta_enum_array", r->out.delta_enum_array);
-               }
+               ndr_print_netr_DELTA_ENUM_ARRAY(ndr, "delta_enum_array", r->out.delta_enum_array);
                ndr->depth--;
                ndr_print_NTSTATUS(ndr, "result", r->out.result);
                ndr->depth--;
@@ -8615,10 +9164,10 @@ static enum ndr_err_code ndr_push_netr_DatabaseSync(struct ndr_push *ndr, int fl
                        return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
                }
                NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.sync_context));
-               NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.delta_enum_array));
-               if (r->out.delta_enum_array) {
-                       NDR_CHECK(ndr_push_netr_DELTA_ENUM_ARRAY(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.delta_enum_array));
+               if (r->out.delta_enum_array == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
                }
+               NDR_CHECK(ndr_push_netr_DELTA_ENUM_ARRAY(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.delta_enum_array));
                NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
        }
        return NDR_ERR_SUCCESS;
@@ -8626,7 +9175,6 @@ static enum ndr_err_code ndr_push_netr_DatabaseSync(struct ndr_push *ndr, int fl
 
 static enum ndr_err_code ndr_pull_netr_DatabaseSync(struct ndr_pull *ndr, int flags, struct netr_DatabaseSync *r)
 {
-       uint32_t _ptr_delta_enum_array;
        TALLOC_CTX *_mem_save_return_authenticator_0;
        TALLOC_CTX *_mem_save_sync_context_0;
        TALLOC_CTX *_mem_save_delta_enum_array_0;
@@ -8668,6 +9216,8 @@ static enum ndr_err_code ndr_pull_netr_DatabaseSync(struct ndr_pull *ndr, int fl
                *r->out.return_authenticator = *r->in.return_authenticator;
                NDR_PULL_ALLOC(ndr, r->out.sync_context);
                *r->out.sync_context = *r->in.sync_context;
+               NDR_PULL_ALLOC(ndr, r->out.delta_enum_array);
+               ZERO_STRUCTP(r->out.delta_enum_array);
        }
        if (flags & NDR_OUT) {
                if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
@@ -8684,18 +9234,13 @@ static enum ndr_err_code ndr_pull_netr_DatabaseSync(struct ndr_pull *ndr, int fl
                NDR_PULL_SET_MEM_CTX(ndr, r->out.sync_context, LIBNDR_FLAG_REF_ALLOC);
                NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.sync_context));
                NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sync_context_0, LIBNDR_FLAG_REF_ALLOC);
-               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_delta_enum_array));
-               if (_ptr_delta_enum_array) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
                        NDR_PULL_ALLOC(ndr, r->out.delta_enum_array);
-               } else {
-                       r->out.delta_enum_array = NULL;
-               }
-               if (r->out.delta_enum_array) {
-                       _mem_save_delta_enum_array_0 = NDR_PULL_GET_MEM_CTX(ndr);
-                       NDR_PULL_SET_MEM_CTX(ndr, r->out.delta_enum_array, 0);
-                       NDR_CHECK(ndr_pull_netr_DELTA_ENUM_ARRAY(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.delta_enum_array));
-                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_delta_enum_array_0, 0);
                }
+               _mem_save_delta_enum_array_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.delta_enum_array, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_netr_DELTA_ENUM_ARRAY(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.delta_enum_array));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_delta_enum_array_0, LIBNDR_FLAG_REF_ALLOC);
                NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
        }
        return NDR_ERR_SUCCESS;
@@ -8739,9 +9284,7 @@ _PUBLIC_ void ndr_print_netr_DatabaseSync(struct ndr_print *ndr, const char *nam
                ndr->depth--;
                ndr_print_ptr(ndr, "delta_enum_array", r->out.delta_enum_array);
                ndr->depth++;
-               if (r->out.delta_enum_array) {
-                       ndr_print_netr_DELTA_ENUM_ARRAY(ndr, "delta_enum_array", r->out.delta_enum_array);
-               }
+               ndr_print_netr_DELTA_ENUM_ARRAY(ndr, "delta_enum_array", r->out.delta_enum_array);
                ndr->depth--;
                ndr_print_NTSTATUS(ndr, "result", r->out.result);
                ndr->depth--;
@@ -9242,7 +9785,7 @@ static enum ndr_err_code ndr_push_netr_GetDcName(struct ndr_push *ndr, int flags
                NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
                NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->out.dcname, CH_UTF16)));
                NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, *r->out.dcname, ndr_charset_length(*r->out.dcname, CH_UTF16), sizeof(uint16_t), CH_UTF16));
-               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+               NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
        }
        return NDR_ERR_SUCCESS;
 }
@@ -9299,7 +9842,7 @@ static enum ndr_err_code ndr_pull_netr_GetDcName(struct ndr_pull *ndr, int flags
                NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, r->out.dcname), sizeof(uint16_t)));
                NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, r->out.dcname, ndr_get_array_length(ndr, r->out.dcname), sizeof(uint16_t), CH_UTF16));
                NDR_PULL_SET_MEM_CTX(ndr, _mem_save_dcname_0, LIBNDR_FLAG_REF_ALLOC);
-               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+               NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
        }
        return NDR_ERR_SUCCESS;
 }
@@ -9333,7 +9876,7 @@ _PUBLIC_ void ndr_print_netr_GetDcName(struct ndr_print *ndr, const char *name,
                ndr_print_string(ndr, "dcname", *r->out.dcname);
                ndr->depth--;
                ndr->depth--;
-               ndr_print_NTSTATUS(ndr, "result", r->out.result);
+               ndr_print_WERROR(ndr, "result", r->out.result);
                ndr->depth--;
        }
        ndr->depth--;
@@ -9898,10 +10441,10 @@ static enum ndr_err_code ndr_push_netr_DatabaseSync2(struct ndr_push *ndr, int f
                        return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
                }
                NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.sync_context));
-               NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.delta_enum_array));
-               if (r->out.delta_enum_array) {
-                       NDR_CHECK(ndr_push_netr_DELTA_ENUM_ARRAY(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.delta_enum_array));
+               if (r->out.delta_enum_array == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
                }
+               NDR_CHECK(ndr_push_netr_DELTA_ENUM_ARRAY(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.delta_enum_array));
                NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
        }
        return NDR_ERR_SUCCESS;
@@ -9909,7 +10452,6 @@ static enum ndr_err_code ndr_push_netr_DatabaseSync2(struct ndr_push *ndr, int f
 
 static enum ndr_err_code ndr_pull_netr_DatabaseSync2(struct ndr_pull *ndr, int flags, struct netr_DatabaseSync2 *r)
 {
-       uint32_t _ptr_delta_enum_array;
        TALLOC_CTX *_mem_save_return_authenticator_0;
        TALLOC_CTX *_mem_save_sync_context_0;
        TALLOC_CTX *_mem_save_delta_enum_array_0;
@@ -9952,6 +10494,8 @@ static enum ndr_err_code ndr_pull_netr_DatabaseSync2(struct ndr_pull *ndr, int f
                *r->out.return_authenticator = *r->in.return_authenticator;
                NDR_PULL_ALLOC(ndr, r->out.sync_context);
                *r->out.sync_context = *r->in.sync_context;
+               NDR_PULL_ALLOC(ndr, r->out.delta_enum_array);
+               ZERO_STRUCTP(r->out.delta_enum_array);
        }
        if (flags & NDR_OUT) {
                if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
@@ -9968,18 +10512,13 @@ static enum ndr_err_code ndr_pull_netr_DatabaseSync2(struct ndr_pull *ndr, int f
                NDR_PULL_SET_MEM_CTX(ndr, r->out.sync_context, LIBNDR_FLAG_REF_ALLOC);
                NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.sync_context));
                NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sync_context_0, LIBNDR_FLAG_REF_ALLOC);
-               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_delta_enum_array));
-               if (_ptr_delta_enum_array) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
                        NDR_PULL_ALLOC(ndr, r->out.delta_enum_array);
-               } else {
-                       r->out.delta_enum_array = NULL;
-               }
-               if (r->out.delta_enum_array) {
-                       _mem_save_delta_enum_array_0 = NDR_PULL_GET_MEM_CTX(ndr);
-                       NDR_PULL_SET_MEM_CTX(ndr, r->out.delta_enum_array, 0);
-                       NDR_CHECK(ndr_pull_netr_DELTA_ENUM_ARRAY(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.delta_enum_array));
-                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_delta_enum_array_0, 0);
                }
+               _mem_save_delta_enum_array_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.delta_enum_array, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_netr_DELTA_ENUM_ARRAY(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.delta_enum_array));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_delta_enum_array_0, LIBNDR_FLAG_REF_ALLOC);
                NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
        }
        return NDR_ERR_SUCCESS;
@@ -10024,9 +10563,7 @@ _PUBLIC_ void ndr_print_netr_DatabaseSync2(struct ndr_print *ndr, const char *na
                ndr->depth--;
                ndr_print_ptr(ndr, "delta_enum_array", r->out.delta_enum_array);
                ndr->depth++;
-               if (r->out.delta_enum_array) {
-                       ndr_print_netr_DELTA_ENUM_ARRAY(ndr, "delta_enum_array", r->out.delta_enum_array);
-               }
+               ndr_print_netr_DELTA_ENUM_ARRAY(ndr, "delta_enum_array", r->out.delta_enum_array);
                ndr->depth--;
                ndr_print_NTSTATUS(ndr, "result", r->out.result);
                ndr->depth--;
@@ -10062,10 +10599,10 @@ static enum ndr_err_code ndr_push_netr_DatabaseRedo(struct ndr_push *ndr, int fl
                        return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
                }
                NDR_CHECK(ndr_push_netr_Authenticator(ndr, NDR_SCALARS, r->out.return_authenticator));
-               NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.delta_enum_array));
-               if (r->out.delta_enum_array) {
-                       NDR_CHECK(ndr_push_netr_DELTA_ENUM_ARRAY(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.delta_enum_array));
+               if (r->out.delta_enum_array == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
                }
+               NDR_CHECK(ndr_push_netr_DELTA_ENUM_ARRAY(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.delta_enum_array));
                NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
        }
        return NDR_ERR_SUCCESS;
@@ -10074,7 +10611,6 @@ static enum ndr_err_code ndr_push_netr_DatabaseRedo(struct ndr_push *ndr, int fl
 static enum ndr_err_code ndr_pull_netr_DatabaseRedo(struct ndr_pull *ndr, int flags, struct netr_DatabaseRedo *r)
 {
        uint32_t _ptr_change_log_entry;
-       uint32_t _ptr_delta_enum_array;
        TALLOC_CTX *_mem_save_return_authenticator_0;
        TALLOC_CTX *_mem_save_change_log_entry_0;
        TALLOC_CTX *_mem_save_delta_enum_array_0;
@@ -10120,6 +10656,8 @@ static enum ndr_err_code ndr_pull_netr_DatabaseRedo(struct ndr_pull *ndr, int fl
                NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.change_log_entry_size));
                NDR_PULL_ALLOC(ndr, r->out.return_authenticator);
                *r->out.return_authenticator = *r->in.return_authenticator;
+               NDR_PULL_ALLOC(ndr, r->out.delta_enum_array);
+               ZERO_STRUCTP(r->out.delta_enum_array);
                if (r->in.change_log_entry) {
                        NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->in.change_log_entry, r->in.change_log_entry_size));
                }
@@ -10132,18 +10670,13 @@ static enum ndr_err_code ndr_pull_netr_DatabaseRedo(struct ndr_pull *ndr, int fl
                NDR_PULL_SET_MEM_CTX(ndr, r->out.return_authenticator, LIBNDR_FLAG_REF_ALLOC);
                NDR_CHECK(ndr_pull_netr_Authenticator(ndr, NDR_SCALARS, r->out.return_authenticator));
                NDR_PULL_SET_MEM_CTX(ndr, _mem_save_return_authenticator_0, LIBNDR_FLAG_REF_ALLOC);
-               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_delta_enum_array));
-               if (_ptr_delta_enum_array) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
                        NDR_PULL_ALLOC(ndr, r->out.delta_enum_array);
-               } else {
-                       r->out.delta_enum_array = NULL;
-               }
-               if (r->out.delta_enum_array) {
-                       _mem_save_delta_enum_array_0 = NDR_PULL_GET_MEM_CTX(ndr);
-                       NDR_PULL_SET_MEM_CTX(ndr, r->out.delta_enum_array, 0);
-                       NDR_CHECK(ndr_pull_netr_DELTA_ENUM_ARRAY(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.delta_enum_array));
-                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_delta_enum_array_0, 0);
                }
+               _mem_save_delta_enum_array_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.delta_enum_array, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_netr_DELTA_ENUM_ARRAY(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.delta_enum_array));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_delta_enum_array_0, LIBNDR_FLAG_REF_ALLOC);
                NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
        }
        return NDR_ERR_SUCCESS;
@@ -10184,9 +10717,7 @@ _PUBLIC_ void ndr_print_netr_DatabaseRedo(struct ndr_print *ndr, const char *nam
                ndr->depth--;
                ndr_print_ptr(ndr, "delta_enum_array", r->out.delta_enum_array);
                ndr->depth++;
-               if (r->out.delta_enum_array) {
-                       ndr_print_netr_DELTA_ENUM_ARRAY(ndr, "delta_enum_array", r->out.delta_enum_array);
-               }
+               ndr_print_netr_DELTA_ENUM_ARRAY(ndr, "delta_enum_array", r->out.delta_enum_array);
                ndr->depth--;
                ndr_print_NTSTATUS(ndr, "result", r->out.result);
                ndr->depth--;
@@ -10303,41 +10834,94 @@ _PUBLIC_ void ndr_print_netr_LogonControl2Ex(struct ndr_print *ndr, const char *
        ndr->depth--;
 }
 
-static enum ndr_err_code ndr_push_netr_NETRENUMERATETRUSTEDDOMAINS(struct ndr_push *ndr, int flags, const struct netr_NETRENUMERATETRUSTEDDOMAINS *r)
+static enum ndr_err_code ndr_push_netr_NetrEnumerateTrustedDomains(struct ndr_push *ndr, int flags, const struct netr_NetrEnumerateTrustedDomains *r)
 {
        if (flags & NDR_IN) {
-       }
-       if (flags & NDR_OUT) {
-               NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.server_name));
+               if (r->in.server_name) {
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.server_name, CH_UTF16)));
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.server_name, CH_UTF16)));
+                       NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.server_name, ndr_charset_length(r->in.server_name, CH_UTF16), sizeof(uint16_t), CH_UTF16));
+               }
+       }
+       if (flags & NDR_OUT) {
+               if (r->out.trusted_domains_blob == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_netr_Blob(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.trusted_domains_blob));
+               NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
        }
        return NDR_ERR_SUCCESS;
 }
 
-static enum ndr_err_code ndr_pull_netr_NETRENUMERATETRUSTEDDOMAINS(struct ndr_pull *ndr, int flags, struct netr_NETRENUMERATETRUSTEDDOMAINS *r)
+static enum ndr_err_code ndr_pull_netr_NetrEnumerateTrustedDomains(struct ndr_pull *ndr, int flags, struct netr_NetrEnumerateTrustedDomains *r)
 {
+       uint32_t _ptr_server_name;
+       TALLOC_CTX *_mem_save_server_name_0;
+       TALLOC_CTX *_mem_save_trusted_domains_blob_0;
        if (flags & NDR_IN) {
+               ZERO_STRUCT(r->out);
+
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_server_name));
+               if (_ptr_server_name) {
+                       NDR_PULL_ALLOC(ndr, r->in.server_name);
+               } else {
+                       r->in.server_name = NULL;
+               }
+               if (r->in.server_name) {
+                       _mem_save_server_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->in.server_name, 0);
+                       NDR_CHECK(ndr_pull_array_size(ndr, &r->in.server_name));
+                       NDR_CHECK(ndr_pull_array_length(ndr, &r->in.server_name));
+                       if (ndr_get_array_length(ndr, &r->in.server_name) > ndr_get_array_size(ndr, &r->in.server_name)) {
+                               return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.server_name), ndr_get_array_length(ndr, &r->in.server_name));
+                       }
+                       NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.server_name), sizeof(uint16_t)));
+                       NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.server_name, ndr_get_array_length(ndr, &r->in.server_name), sizeof(uint16_t), CH_UTF16));
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_server_name_0, 0);
+               }
+               NDR_PULL_ALLOC(ndr, r->out.trusted_domains_blob);
+               ZERO_STRUCTP(r->out.trusted_domains_blob);
        }
        if (flags & NDR_OUT) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.trusted_domains_blob);
+               }
+               _mem_save_trusted_domains_blob_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.trusted_domains_blob, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_netr_Blob(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.trusted_domains_blob));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_trusted_domains_blob_0, LIBNDR_FLAG_REF_ALLOC);
                NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
        }
        return NDR_ERR_SUCCESS;
 }
 
-_PUBLIC_ void ndr_print_netr_NETRENUMERATETRUSTEDDOMAINS(struct ndr_print *ndr, const char *name, int flags, const struct netr_NETRENUMERATETRUSTEDDOMAINS *r)
+_PUBLIC_ void ndr_print_netr_NetrEnumerateTrustedDomains(struct ndr_print *ndr, const char *name, int flags, const struct netr_NetrEnumerateTrustedDomains *r)
 {
-       ndr_print_struct(ndr, name, "netr_NETRENUMERATETRUSTEDDOMAINS");
+       ndr_print_struct(ndr, name, "netr_NetrEnumerateTrustedDomains");
        ndr->depth++;
        if (flags & NDR_SET_VALUES) {
                ndr->flags |= LIBNDR_PRINT_SET_VALUES;
        }
        if (flags & NDR_IN) {
-               ndr_print_struct(ndr, "in", "netr_NETRENUMERATETRUSTEDDOMAINS");
+               ndr_print_struct(ndr, "in", "netr_NetrEnumerateTrustedDomains");
                ndr->depth++;
+               ndr_print_ptr(ndr, "server_name", r->in.server_name);
+               ndr->depth++;
+               if (r->in.server_name) {
+                       ndr_print_string(ndr, "server_name", r->in.server_name);
+               }
+               ndr->depth--;
                ndr->depth--;
        }
        if (flags & NDR_OUT) {
-               ndr_print_struct(ndr, "out", "netr_NETRENUMERATETRUSTEDDOMAINS");
+               ndr_print_struct(ndr, "out", "netr_NetrEnumerateTrustedDomains");
                ndr->depth++;
+               ndr_print_ptr(ndr, "trusted_domains_blob", r->out.trusted_domains_blob);
+               ndr->depth++;
+               ndr_print_netr_Blob(ndr, "trusted_domains_blob", r->out.trusted_domains_blob);
+               ndr->depth--;
                ndr_print_WERROR(ndr, "result", r->out.result);
                ndr->depth--;
        }
@@ -10369,13 +10953,13 @@ static enum ndr_err_code ndr_push_netr_DsRGetDCName(struct ndr_push *ndr, int fl
                if (r->in.site_guid) {
                        NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.site_guid));
                }
-               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.flags));
+               NDR_CHECK(ndr_push_netr_DsRGetDCName_flags(ndr, NDR_SCALARS, r->in.flags));
        }
        if (flags & NDR_OUT) {
-               NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.info));
-               if (r->out.info) {
-                       NDR_CHECK(ndr_push_netr_DsRGetDCNameInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info));
+               if (r->out.info == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
                }
+               NDR_CHECK(ndr_push_netr_DsRGetDCNameInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info));
                NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
        }
        return NDR_ERR_SUCCESS;
@@ -10387,7 +10971,6 @@ static enum ndr_err_code ndr_pull_netr_DsRGetDCName(struct ndr_pull *ndr, int fl
        uint32_t _ptr_domain_name;
        uint32_t _ptr_domain_guid;
        uint32_t _ptr_site_guid;
-       uint32_t _ptr_info;
        TALLOC_CTX *_mem_save_server_unc_0;
        TALLOC_CTX *_mem_save_domain_name_0;
        TALLOC_CTX *_mem_save_domain_guid_0;
@@ -10456,21 +11039,18 @@ static enum ndr_err_code ndr_pull_netr_DsRGetDCName(struct ndr_pull *ndr, int fl
                        NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.site_guid));
                        NDR_PULL_SET_MEM_CTX(ndr, _mem_save_site_guid_0, 0);
                }
-               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.flags));
+               NDR_CHECK(ndr_pull_netr_DsRGetDCName_flags(ndr, NDR_SCALARS, &r->in.flags));
+               NDR_PULL_ALLOC(ndr, r->out.info);
+               ZERO_STRUCTP(r->out.info);
        }
        if (flags & NDR_OUT) {
-               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_info));
-               if (_ptr_info) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
                        NDR_PULL_ALLOC(ndr, r->out.info);
-               } else {
-                       r->out.info = NULL;
-               }
-               if (r->out.info) {
-                       _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr);
-                       NDR_PULL_SET_MEM_CTX(ndr, r->out.info, 0);
-                       NDR_CHECK(ndr_pull_netr_DsRGetDCNameInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info));
-                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, 0);
                }
+               _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.info, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_netr_DsRGetDCNameInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, LIBNDR_FLAG_REF_ALLOC);
                NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
        }
        return NDR_ERR_SUCCESS;
@@ -10510,7 +11090,7 @@ _PUBLIC_ void ndr_print_netr_DsRGetDCName(struct ndr_print *ndr, const char *nam
                        ndr_print_GUID(ndr, "site_guid", r->in.site_guid);
                }
                ndr->depth--;
-               ndr_print_uint32(ndr, "flags", r->in.flags);
+               ndr_print_netr_DsRGetDCName_flags(ndr, "flags", r->in.flags);
                ndr->depth--;
        }
        if (flags & NDR_OUT) {
@@ -10518,9 +11098,7 @@ _PUBLIC_ void ndr_print_netr_DsRGetDCName(struct ndr_print *ndr, const char *nam
                ndr->depth++;
                ndr_print_ptr(ndr, "info", r->out.info);
                ndr->depth++;
-               if (r->out.info) {
-                       ndr_print_netr_DsRGetDCNameInfo(ndr, "info", r->out.info);
-               }
+               ndr_print_netr_DsRGetDCNameInfo(ndr, "info", r->out.info);
                ndr->depth--;
                ndr_print_WERROR(ndr, "result", r->out.result);
                ndr->depth--;
@@ -10610,41 +11188,127 @@ _PUBLIC_ void ndr_print_netr_NETRLOGONSETSERVICEBITS(struct ndr_print *ndr, cons
        ndr->depth--;
 }
 
-static enum ndr_err_code ndr_push_netr_NETRLOGONGETTRUSTRID(struct ndr_push *ndr, int flags, const struct netr_NETRLOGONGETTRUSTRID *r)
+static enum ndr_err_code ndr_push_netr_LogonGetTrustRid(struct ndr_push *ndr, int flags, const struct netr_LogonGetTrustRid *r)
 {
        if (flags & NDR_IN) {
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.server_name));
+               if (r->in.server_name) {
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.server_name, CH_UTF16)));
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.server_name, CH_UTF16)));
+                       NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.server_name, ndr_charset_length(r->in.server_name, CH_UTF16), sizeof(uint16_t), CH_UTF16));
+               }
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.domain_name));
+               if (r->in.domain_name) {
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.domain_name, CH_UTF16)));
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.domain_name, CH_UTF16)));
+                       NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.domain_name, ndr_charset_length(r->in.domain_name, CH_UTF16), sizeof(uint16_t), CH_UTF16));
+               }
        }
        if (flags & NDR_OUT) {
+               if (r->out.rid == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.rid));
                NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
        }
        return NDR_ERR_SUCCESS;
 }
 
-static enum ndr_err_code ndr_pull_netr_NETRLOGONGETTRUSTRID(struct ndr_pull *ndr, int flags, struct netr_NETRLOGONGETTRUSTRID *r)
+static enum ndr_err_code ndr_pull_netr_LogonGetTrustRid(struct ndr_pull *ndr, int flags, struct netr_LogonGetTrustRid *r)
 {
+       uint32_t _ptr_server_name;
+       uint32_t _ptr_domain_name;
+       TALLOC_CTX *_mem_save_server_name_0;
+       TALLOC_CTX *_mem_save_domain_name_0;
+       TALLOC_CTX *_mem_save_rid_0;
        if (flags & NDR_IN) {
+               ZERO_STRUCT(r->out);
+
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_server_name));
+               if (_ptr_server_name) {
+                       NDR_PULL_ALLOC(ndr, r->in.server_name);
+               } else {
+                       r->in.server_name = NULL;
+               }
+               if (r->in.server_name) {
+                       _mem_save_server_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->in.server_name, 0);
+                       NDR_CHECK(ndr_pull_array_size(ndr, &r->in.server_name));
+                       NDR_CHECK(ndr_pull_array_length(ndr, &r->in.server_name));
+                       if (ndr_get_array_length(ndr, &r->in.server_name) > ndr_get_array_size(ndr, &r->in.server_name)) {
+                               return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.server_name), ndr_get_array_length(ndr, &r->in.server_name));
+                       }
+                       NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.server_name), sizeof(uint16_t)));
+                       NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.server_name, ndr_get_array_length(ndr, &r->in.server_name), sizeof(uint16_t), CH_UTF16));
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_server_name_0, 0);
+               }
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_domain_name));
+               if (_ptr_domain_name) {
+                       NDR_PULL_ALLOC(ndr, r->in.domain_name);
+               } else {
+                       r->in.domain_name = NULL;
+               }
+               if (r->in.domain_name) {
+                       _mem_save_domain_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->in.domain_name, 0);
+                       NDR_CHECK(ndr_pull_array_size(ndr, &r->in.domain_name));
+                       NDR_CHECK(ndr_pull_array_length(ndr, &r->in.domain_name));
+                       if (ndr_get_array_length(ndr, &r->in.domain_name) > ndr_get_array_size(ndr, &r->in.domain_name)) {
+                               return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.domain_name), ndr_get_array_length(ndr, &r->in.domain_name));
+                       }
+                       NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.domain_name), sizeof(uint16_t)));
+                       NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.domain_name, ndr_get_array_length(ndr, &r->in.domain_name), sizeof(uint16_t), CH_UTF16));
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_name_0, 0);
+               }
+               NDR_PULL_ALLOC(ndr, r->out.rid);
+               ZERO_STRUCTP(r->out.rid);
        }
        if (flags & NDR_OUT) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.rid);
+               }
+               _mem_save_rid_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.rid, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.rid));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_rid_0, LIBNDR_FLAG_REF_ALLOC);
                NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
        }
        return NDR_ERR_SUCCESS;
 }
 
-_PUBLIC_ void ndr_print_netr_NETRLOGONGETTRUSTRID(struct ndr_print *ndr, const char *name, int flags, const struct netr_NETRLOGONGETTRUSTRID *r)
+_PUBLIC_ void ndr_print_netr_LogonGetTrustRid(struct ndr_print *ndr, const char *name, int flags, const struct netr_LogonGetTrustRid *r)
 {
-       ndr_print_struct(ndr, name, "netr_NETRLOGONGETTRUSTRID");
+       ndr_print_struct(ndr, name, "netr_LogonGetTrustRid");
        ndr->depth++;
        if (flags & NDR_SET_VALUES) {
                ndr->flags |= LIBNDR_PRINT_SET_VALUES;
        }
        if (flags & NDR_IN) {
-               ndr_print_struct(ndr, "in", "netr_NETRLOGONGETTRUSTRID");
+               ndr_print_struct(ndr, "in", "netr_LogonGetTrustRid");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "server_name", r->in.server_name);
+               ndr->depth++;
+               if (r->in.server_name) {
+                       ndr_print_string(ndr, "server_name", r->in.server_name);
+               }
+               ndr->depth--;
+               ndr_print_ptr(ndr, "domain_name", r->in.domain_name);
                ndr->depth++;
+               if (r->in.domain_name) {
+                       ndr_print_string(ndr, "domain_name", r->in.domain_name);
+               }
+               ndr->depth--;
                ndr->depth--;
        }
        if (flags & NDR_OUT) {
-               ndr_print_struct(ndr, "out", "netr_NETRLOGONGETTRUSTRID");
+               ndr_print_struct(ndr, "out", "netr_LogonGetTrustRid");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "rid", r->out.rid);
                ndr->depth++;
+               ndr_print_uint32(ndr, "rid", *r->out.rid);
+               ndr->depth--;
                ndr_print_WERROR(ndr, "result", r->out.result);
                ndr->depth--;
        }
@@ -10948,13 +11612,17 @@ static enum ndr_err_code ndr_push_netr_DsRGetDCNameEx(struct ndr_push *ndr, int
                        NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.site_name, CH_UTF16)));
                        NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.site_name, ndr_charset_length(r->in.site_name, CH_UTF16), sizeof(uint16_t), CH_UTF16));
                }
-               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.flags));
+               NDR_CHECK(ndr_push_netr_DsRGetDCName_flags(ndr, NDR_SCALARS, r->in.flags));
        }
        if (flags & NDR_OUT) {
-               NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.info));
-               if (r->out.info) {
-                       NDR_CHECK(ndr_push_netr_DsRGetDCNameInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info));
+               if (r->out.info == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
                }
+               if (*r->out.info == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_ref_ptr(ndr));
+               NDR_CHECK(ndr_push_netr_DsRGetDCNameInfo(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.info));
                NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
        }
        return NDR_ERR_SUCCESS;
@@ -10972,6 +11640,7 @@ static enum ndr_err_code ndr_pull_netr_DsRGetDCNameEx(struct ndr_pull *ndr, int
        TALLOC_CTX *_mem_save_domain_guid_0;
        TALLOC_CTX *_mem_save_site_name_0;
        TALLOC_CTX *_mem_save_info_0;
+       TALLOC_CTX *_mem_save_info_1;
        if (flags & NDR_IN) {
                ZERO_STRUCT(r->out);
 
@@ -11041,21 +11710,25 @@ static enum ndr_err_code ndr_pull_netr_DsRGetDCNameEx(struct ndr_pull *ndr, int
                        NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.site_name, ndr_get_array_length(ndr, &r->in.site_name), sizeof(uint16_t), CH_UTF16));
                        NDR_PULL_SET_MEM_CTX(ndr, _mem_save_site_name_0, 0);
                }
-               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.flags));
+               NDR_CHECK(ndr_pull_netr_DsRGetDCName_flags(ndr, NDR_SCALARS, &r->in.flags));
+               NDR_PULL_ALLOC(ndr, r->out.info);
+               ZERO_STRUCTP(r->out.info);
        }
        if (flags & NDR_OUT) {
-               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_info));
-               if (_ptr_info) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
                        NDR_PULL_ALLOC(ndr, r->out.info);
-               } else {
-                       r->out.info = NULL;
                }
-               if (r->out.info) {
-                       _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr);
-                       NDR_PULL_SET_MEM_CTX(ndr, r->out.info, 0);
-                       NDR_CHECK(ndr_pull_netr_DsRGetDCNameInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info));
-                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, 0);
+               _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.info, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_ref_ptr(ndr, &_ptr_info));
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, *r->out.info);
                }
+               _mem_save_info_1 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, *r->out.info, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_netr_DsRGetDCNameInfo(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.info));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_1, LIBNDR_FLAG_REF_ALLOC);
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, LIBNDR_FLAG_REF_ALLOC);
                NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
        }
        return NDR_ERR_SUCCESS;
@@ -11095,7 +11768,7 @@ _PUBLIC_ void ndr_print_netr_DsRGetDCNameEx(struct ndr_print *ndr, const char *n
                        ndr_print_string(ndr, "site_name", r->in.site_name);
                }
                ndr->depth--;
-               ndr_print_uint32(ndr, "flags", r->in.flags);
+               ndr_print_netr_DsRGetDCName_flags(ndr, "flags", r->in.flags);
                ndr->depth--;
        }
        if (flags & NDR_OUT) {
@@ -11103,9 +11776,10 @@ _PUBLIC_ void ndr_print_netr_DsRGetDCNameEx(struct ndr_print *ndr, const char *n
                ndr->depth++;
                ndr_print_ptr(ndr, "info", r->out.info);
                ndr->depth++;
-               if (r->out.info) {
-                       ndr_print_netr_DsRGetDCNameInfo(ndr, "info", r->out.info);
-               }
+               ndr_print_ptr(ndr, "info", *r->out.info);
+               ndr->depth++;
+               ndr_print_netr_DsRGetDCNameInfo(ndr, "info", *r->out.info);
+               ndr->depth--;
                ndr->depth--;
                ndr_print_WERROR(ndr, "result", r->out.result);
                ndr->depth--;
@@ -11519,42 +12193,156 @@ _PUBLIC_ void ndr_print_netr_ServerPasswordSet2(struct ndr_print *ndr, const cha
        ndr->depth--;
 }
 
-static enum ndr_err_code ndr_push_netr_NETRSERVERPASSWORDGET(struct ndr_push *ndr, int flags, const struct netr_NETRSERVERPASSWORDGET *r)
+static enum ndr_err_code ndr_push_netr_ServerPasswordGet(struct ndr_push *ndr, int flags, const struct netr_ServerPasswordGet *r)
 {
        if (flags & NDR_IN) {
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.server_name));
+               if (r->in.server_name) {
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.server_name, CH_UTF16)));
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.server_name, CH_UTF16)));
+                       NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.server_name, ndr_charset_length(r->in.server_name, CH_UTF16), sizeof(uint16_t), CH_UTF16));
+               }
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.account_name, CH_UTF16)));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.account_name, CH_UTF16)));
+               NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.account_name, ndr_charset_length(r->in.account_name, CH_UTF16), sizeof(uint16_t), CH_UTF16));
+               NDR_CHECK(ndr_push_netr_SchannelType(ndr, NDR_SCALARS, r->in.secure_channel_type));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.computer_name, CH_UTF16)));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.computer_name, CH_UTF16)));
+               NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.computer_name, ndr_charset_length(r->in.computer_name, CH_UTF16), sizeof(uint16_t), CH_UTF16));
+               if (r->in.credential == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_netr_Authenticator(ndr, NDR_SCALARS, r->in.credential));
        }
        if (flags & NDR_OUT) {
+               if (r->out.return_authenticator == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_netr_Authenticator(ndr, NDR_SCALARS, r->out.return_authenticator));
+               if (r->out.password == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_samr_Password(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.password));
                NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
        }
        return NDR_ERR_SUCCESS;
 }
 
-static enum ndr_err_code ndr_pull_netr_NETRSERVERPASSWORDGET(struct ndr_pull *ndr, int flags, struct netr_NETRSERVERPASSWORDGET *r)
+static enum ndr_err_code ndr_pull_netr_ServerPasswordGet(struct ndr_pull *ndr, int flags, struct netr_ServerPasswordGet *r)
 {
+       uint32_t _ptr_server_name;
+       TALLOC_CTX *_mem_save_server_name_0;
+       TALLOC_CTX *_mem_save_credential_0;
+       TALLOC_CTX *_mem_save_return_authenticator_0;
+       TALLOC_CTX *_mem_save_password_0;
        if (flags & NDR_IN) {
+               ZERO_STRUCT(r->out);
+
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_server_name));
+               if (_ptr_server_name) {
+                       NDR_PULL_ALLOC(ndr, r->in.server_name);
+               } else {
+                       r->in.server_name = NULL;
+               }
+               if (r->in.server_name) {
+                       _mem_save_server_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->in.server_name, 0);
+                       NDR_CHECK(ndr_pull_array_size(ndr, &r->in.server_name));
+                       NDR_CHECK(ndr_pull_array_length(ndr, &r->in.server_name));
+                       if (ndr_get_array_length(ndr, &r->in.server_name) > ndr_get_array_size(ndr, &r->in.server_name)) {
+                               return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.server_name), ndr_get_array_length(ndr, &r->in.server_name));
+                       }
+                       NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.server_name), sizeof(uint16_t)));
+                       NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.server_name, ndr_get_array_length(ndr, &r->in.server_name), sizeof(uint16_t), CH_UTF16));
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_server_name_0, 0);
+               }
+               NDR_CHECK(ndr_pull_array_size(ndr, &r->in.account_name));
+               NDR_CHECK(ndr_pull_array_length(ndr, &r->in.account_name));
+               if (ndr_get_array_length(ndr, &r->in.account_name) > ndr_get_array_size(ndr, &r->in.account_name)) {
+                       return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.account_name), ndr_get_array_length(ndr, &r->in.account_name));
+               }
+               NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.account_name), sizeof(uint16_t)));
+               NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.account_name, ndr_get_array_length(ndr, &r->in.account_name), sizeof(uint16_t), CH_UTF16));
+               NDR_CHECK(ndr_pull_netr_SchannelType(ndr, NDR_SCALARS, &r->in.secure_channel_type));
+               NDR_CHECK(ndr_pull_array_size(ndr, &r->in.computer_name));
+               NDR_CHECK(ndr_pull_array_length(ndr, &r->in.computer_name));
+               if (ndr_get_array_length(ndr, &r->in.computer_name) > ndr_get_array_size(ndr, &r->in.computer_name)) {
+                       return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.computer_name), ndr_get_array_length(ndr, &r->in.computer_name));
+               }
+               NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.computer_name), sizeof(uint16_t)));
+               NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.computer_name, ndr_get_array_length(ndr, &r->in.computer_name), sizeof(uint16_t), CH_UTF16));
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.credential);
+               }
+               _mem_save_credential_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.credential, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_netr_Authenticator(ndr, NDR_SCALARS, r->in.credential));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_credential_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_PULL_ALLOC(ndr, r->out.return_authenticator);
+               ZERO_STRUCTP(r->out.return_authenticator);
+               NDR_PULL_ALLOC(ndr, r->out.password);
+               ZERO_STRUCTP(r->out.password);
        }
        if (flags & NDR_OUT) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.return_authenticator);
+               }
+               _mem_save_return_authenticator_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.return_authenticator, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_netr_Authenticator(ndr, NDR_SCALARS, r->out.return_authenticator));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_return_authenticator_0, LIBNDR_FLAG_REF_ALLOC);
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.password);
+               }
+               _mem_save_password_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.password, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_samr_Password(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.password));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_password_0, LIBNDR_FLAG_REF_ALLOC);
                NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
        }
        return NDR_ERR_SUCCESS;
 }
 
-_PUBLIC_ void ndr_print_netr_NETRSERVERPASSWORDGET(struct ndr_print *ndr, const char *name, int flags, const struct netr_NETRSERVERPASSWORDGET *r)
+_PUBLIC_ void ndr_print_netr_ServerPasswordGet(struct ndr_print *ndr, const char *name, int flags, const struct netr_ServerPasswordGet *r)
 {
-       ndr_print_struct(ndr, name, "netr_NETRSERVERPASSWORDGET");
+       ndr_print_struct(ndr, name, "netr_ServerPasswordGet");
        ndr->depth++;
        if (flags & NDR_SET_VALUES) {
                ndr->flags |= LIBNDR_PRINT_SET_VALUES;
        }
        if (flags & NDR_IN) {
-               ndr_print_struct(ndr, "in", "netr_NETRSERVERPASSWORDGET");
+               ndr_print_struct(ndr, "in", "netr_ServerPasswordGet");
                ndr->depth++;
-               ndr->depth--;
-       }
-       if (flags & NDR_OUT) {
-               ndr_print_struct(ndr, "out", "netr_NETRSERVERPASSWORDGET");
+               ndr_print_ptr(ndr, "server_name", r->in.server_name);
                ndr->depth++;
-               ndr_print_WERROR(ndr, "result", r->out.result);
+               if (r->in.server_name) {
+                       ndr_print_string(ndr, "server_name", r->in.server_name);
+               }
+               ndr->depth--;
+               ndr_print_string(ndr, "account_name", r->in.account_name);
+               ndr_print_netr_SchannelType(ndr, "secure_channel_type", r->in.secure_channel_type);
+               ndr_print_string(ndr, "computer_name", r->in.computer_name);
+               ndr_print_ptr(ndr, "credential", r->in.credential);
+               ndr->depth++;
+               ndr_print_netr_Authenticator(ndr, "credential", r->in.credential);
+               ndr->depth--;
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "netr_ServerPasswordGet");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "return_authenticator", r->out.return_authenticator);
+               ndr->depth++;
+               ndr_print_netr_Authenticator(ndr, "return_authenticator", r->out.return_authenticator);
+               ndr->depth--;
+               ndr_print_ptr(ndr, "password", r->out.password);
+               ndr->depth++;
+               ndr_print_samr_Password(ndr, "password", r->out.password);
+               ndr->depth--;
+               ndr_print_WERROR(ndr, "result", r->out.result);
                ndr->depth--;
        }
        ndr->depth--;
@@ -11601,41 +12389,160 @@ _PUBLIC_ void ndr_print_netr_NETRLOGONSENDTOSAM(struct ndr_print *ndr, const cha
        ndr->depth--;
 }
 
-static enum ndr_err_code ndr_push_netr_DSRADDRESSTOSITENAMESW(struct ndr_push *ndr, int flags, const struct netr_DSRADDRESSTOSITENAMESW *r)
+static enum ndr_err_code ndr_push_netr_DsRAddressToSitenamesW(struct ndr_push *ndr, int flags, const struct netr_DsRAddressToSitenamesW *r)
 {
+       uint32_t cntr_addresses_1;
        if (flags & NDR_IN) {
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.server_name));
+               if (r->in.server_name) {
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.server_name, CH_UTF16)));
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.server_name, CH_UTF16)));
+                       NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.server_name, ndr_charset_length(r->in.server_name, CH_UTF16), sizeof(uint16_t), CH_UTF16));
+               }
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.count));
+               if (r->in.addresses == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.count));
+               for (cntr_addresses_1 = 0; cntr_addresses_1 < r->in.count; cntr_addresses_1++) {
+                       NDR_CHECK(ndr_push_netr_DsRAddress(ndr, NDR_SCALARS, &r->in.addresses[cntr_addresses_1]));
+               }
+               for (cntr_addresses_1 = 0; cntr_addresses_1 < r->in.count; cntr_addresses_1++) {
+                       NDR_CHECK(ndr_push_netr_DsRAddress(ndr, NDR_BUFFERS, &r->in.addresses[cntr_addresses_1]));
+               }
        }
        if (flags & NDR_OUT) {
+               if (r->out.ctr == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               if (*r->out.ctr == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_ref_ptr(ndr));
+               NDR_CHECK(ndr_push_netr_DsRAddressToSitenamesWCtr(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.ctr));
                NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
        }
        return NDR_ERR_SUCCESS;
 }
 
-static enum ndr_err_code ndr_pull_netr_DSRADDRESSTOSITENAMESW(struct ndr_pull *ndr, int flags, struct netr_DSRADDRESSTOSITENAMESW *r)
+static enum ndr_err_code ndr_pull_netr_DsRAddressToSitenamesW(struct ndr_pull *ndr, int flags, struct netr_DsRAddressToSitenamesW *r)
 {
+       uint32_t _ptr_server_name;
+       uint32_t cntr_addresses_1;
+       uint32_t _ptr_ctr;
+       TALLOC_CTX *_mem_save_server_name_0;
+       TALLOC_CTX *_mem_save_addresses_1;
+       TALLOC_CTX *_mem_save_ctr_0;
+       TALLOC_CTX *_mem_save_ctr_1;
        if (flags & NDR_IN) {
+               ZERO_STRUCT(r->out);
+
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_server_name));
+               if (_ptr_server_name) {
+                       NDR_PULL_ALLOC(ndr, r->in.server_name);
+               } else {
+                       r->in.server_name = NULL;
+               }
+               if (r->in.server_name) {
+                       _mem_save_server_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->in.server_name, 0);
+                       NDR_CHECK(ndr_pull_array_size(ndr, &r->in.server_name));
+                       NDR_CHECK(ndr_pull_array_length(ndr, &r->in.server_name));
+                       if (ndr_get_array_length(ndr, &r->in.server_name) > ndr_get_array_size(ndr, &r->in.server_name)) {
+                               return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.server_name), ndr_get_array_length(ndr, &r->in.server_name));
+                       }
+                       NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.server_name), sizeof(uint16_t)));
+                       NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.server_name, ndr_get_array_length(ndr, &r->in.server_name), sizeof(uint16_t), CH_UTF16));
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_server_name_0, 0);
+               }
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.count));
+               if (r->in.count < 0 || r->in.count > 32000) {
+                       return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
+               }
+               NDR_CHECK(ndr_pull_array_size(ndr, &r->in.addresses));
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC_N(ndr, r->in.addresses, ndr_get_array_size(ndr, &r->in.addresses));
+               }
+               _mem_save_addresses_1 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.addresses, 0);
+               for (cntr_addresses_1 = 0; cntr_addresses_1 < r->in.count; cntr_addresses_1++) {
+                       NDR_CHECK(ndr_pull_netr_DsRAddress(ndr, NDR_SCALARS, &r->in.addresses[cntr_addresses_1]));
+               }
+               for (cntr_addresses_1 = 0; cntr_addresses_1 < r->in.count; cntr_addresses_1++) {
+                       NDR_CHECK(ndr_pull_netr_DsRAddress(ndr, NDR_BUFFERS, &r->in.addresses[cntr_addresses_1]));
+               }
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_addresses_1, 0);
+               NDR_PULL_ALLOC(ndr, r->out.ctr);
+               ZERO_STRUCTP(r->out.ctr);
+               if (r->in.addresses) {
+                       NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->in.addresses, r->in.count));
+               }
        }
        if (flags & NDR_OUT) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.ctr);
+               }
+               _mem_save_ctr_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.ctr, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_ref_ptr(ndr, &_ptr_ctr));
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, *r->out.ctr);
+               }
+               _mem_save_ctr_1 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, *r->out.ctr, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_netr_DsRAddressToSitenamesWCtr(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.ctr));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_ctr_1, LIBNDR_FLAG_REF_ALLOC);
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_ctr_0, LIBNDR_FLAG_REF_ALLOC);
                NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
        }
        return NDR_ERR_SUCCESS;
 }
 
-_PUBLIC_ void ndr_print_netr_DSRADDRESSTOSITENAMESW(struct ndr_print *ndr, const char *name, int flags, const struct netr_DSRADDRESSTOSITENAMESW *r)
+_PUBLIC_ void ndr_print_netr_DsRAddressToSitenamesW(struct ndr_print *ndr, const char *name, int flags, const struct netr_DsRAddressToSitenamesW *r)
 {
-       ndr_print_struct(ndr, name, "netr_DSRADDRESSTOSITENAMESW");
+       uint32_t cntr_addresses_1;
+       ndr_print_struct(ndr, name, "netr_DsRAddressToSitenamesW");
        ndr->depth++;
        if (flags & NDR_SET_VALUES) {
                ndr->flags |= LIBNDR_PRINT_SET_VALUES;
        }
        if (flags & NDR_IN) {
-               ndr_print_struct(ndr, "in", "netr_DSRADDRESSTOSITENAMESW");
+               ndr_print_struct(ndr, "in", "netr_DsRAddressToSitenamesW");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "server_name", r->in.server_name);
                ndr->depth++;
+               if (r->in.server_name) {
+                       ndr_print_string(ndr, "server_name", r->in.server_name);
+               }
+               ndr->depth--;
+               ndr_print_uint32(ndr, "count", r->in.count);
+               ndr_print_ptr(ndr, "addresses", r->in.addresses);
+               ndr->depth++;
+               ndr->print(ndr, "%s: ARRAY(%d)", "addresses", r->in.count);
+               ndr->depth++;
+               for (cntr_addresses_1=0;cntr_addresses_1<r->in.count;cntr_addresses_1++) {
+                       char *idx_1=NULL;
+                       asprintf(&idx_1, "[%d]", cntr_addresses_1);
+                       if (idx_1) {
+                               ndr_print_netr_DsRAddress(ndr, "addresses", &r->in.addresses[cntr_addresses_1]);
+                               free(idx_1);
+                       }
+               }
+               ndr->depth--;
+               ndr->depth--;
                ndr->depth--;
        }
        if (flags & NDR_OUT) {
-               ndr_print_struct(ndr, "out", "netr_DSRADDRESSTOSITENAMESW");
+               ndr_print_struct(ndr, "out", "netr_DsRAddressToSitenamesW");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "ctr", r->out.ctr);
+               ndr->depth++;
+               ndr_print_ptr(ndr, "ctr", *r->out.ctr);
                ndr->depth++;
+               ndr_print_netr_DsRAddressToSitenamesWCtr(ndr, "ctr", *r->out.ctr);
+               ndr->depth--;
+               ndr->depth--;
                ndr_print_WERROR(ndr, "result", r->out.result);
                ndr->depth--;
        }
@@ -11659,7 +12566,7 @@ static enum ndr_err_code ndr_push_netr_DsRGetDCNameEx2(struct ndr_push *ndr, int
                        NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.client_account, CH_UTF16)));
                        NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.client_account, ndr_charset_length(r->in.client_account, CH_UTF16), sizeof(uint16_t), CH_UTF16));
                }
-               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.mask));
+               NDR_CHECK(ndr_push_samr_AcctFlags(ndr, NDR_SCALARS, r->in.mask));
                NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.domain_name));
                if (r->in.domain_name) {
                        NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.domain_name, CH_UTF16)));
@@ -11678,13 +12585,17 @@ static enum ndr_err_code ndr_push_netr_DsRGetDCNameEx2(struct ndr_push *ndr, int
                        NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.site_name, CH_UTF16)));
                        NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.site_name, ndr_charset_length(r->in.site_name, CH_UTF16), sizeof(uint16_t), CH_UTF16));
                }
-               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.flags));
+               NDR_CHECK(ndr_push_netr_DsRGetDCName_flags(ndr, NDR_SCALARS, r->in.flags));
        }
        if (flags & NDR_OUT) {
-               NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.info));
-               if (r->out.info) {
-                       NDR_CHECK(ndr_push_netr_DsRGetDCNameInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info));
+               if (r->out.info == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               if (*r->out.info == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
                }
+               NDR_CHECK(ndr_push_ref_ptr(ndr));
+               NDR_CHECK(ndr_push_netr_DsRGetDCNameInfo(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.info));
                NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
        }
        return NDR_ERR_SUCCESS;
@@ -11704,6 +12615,7 @@ static enum ndr_err_code ndr_pull_netr_DsRGetDCNameEx2(struct ndr_pull *ndr, int
        TALLOC_CTX *_mem_save_domain_guid_0;
        TALLOC_CTX *_mem_save_site_name_0;
        TALLOC_CTX *_mem_save_info_0;
+       TALLOC_CTX *_mem_save_info_1;
        if (flags & NDR_IN) {
                ZERO_STRUCT(r->out);
 
@@ -11743,7 +12655,7 @@ static enum ndr_err_code ndr_pull_netr_DsRGetDCNameEx2(struct ndr_pull *ndr, int
                        NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.client_account, ndr_get_array_length(ndr, &r->in.client_account), sizeof(uint16_t), CH_UTF16));
                        NDR_PULL_SET_MEM_CTX(ndr, _mem_save_client_account_0, 0);
                }
-               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.mask));
+               NDR_CHECK(ndr_pull_samr_AcctFlags(ndr, NDR_SCALARS, &r->in.mask));
                NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_domain_name));
                if (_ptr_domain_name) {
                        NDR_PULL_ALLOC(ndr, r->in.domain_name);
@@ -11792,21 +12704,25 @@ static enum ndr_err_code ndr_pull_netr_DsRGetDCNameEx2(struct ndr_pull *ndr, int
                        NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.site_name, ndr_get_array_length(ndr, &r->in.site_name), sizeof(uint16_t), CH_UTF16));
                        NDR_PULL_SET_MEM_CTX(ndr, _mem_save_site_name_0, 0);
                }
-               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.flags));
+               NDR_CHECK(ndr_pull_netr_DsRGetDCName_flags(ndr, NDR_SCALARS, &r->in.flags));
+               NDR_PULL_ALLOC(ndr, r->out.info);
+               ZERO_STRUCTP(r->out.info);
        }
        if (flags & NDR_OUT) {
-               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_info));
-               if (_ptr_info) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
                        NDR_PULL_ALLOC(ndr, r->out.info);
-               } else {
-                       r->out.info = NULL;
                }
-               if (r->out.info) {
-                       _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr);
-                       NDR_PULL_SET_MEM_CTX(ndr, r->out.info, 0);
-                       NDR_CHECK(ndr_pull_netr_DsRGetDCNameInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info));
-                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, 0);
+               _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.info, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_ref_ptr(ndr, &_ptr_info));
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, *r->out.info);
                }
+               _mem_save_info_1 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, *r->out.info, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_netr_DsRGetDCNameInfo(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.info));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_1, LIBNDR_FLAG_REF_ALLOC);
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, LIBNDR_FLAG_REF_ALLOC);
                NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
        }
        return NDR_ERR_SUCCESS;
@@ -11834,7 +12750,7 @@ _PUBLIC_ void ndr_print_netr_DsRGetDCNameEx2(struct ndr_print *ndr, const char *
                        ndr_print_string(ndr, "client_account", r->in.client_account);
                }
                ndr->depth--;
-               ndr_print_uint32(ndr, "mask", r->in.mask);
+               ndr_print_samr_AcctFlags(ndr, "mask", r->in.mask);
                ndr_print_ptr(ndr, "domain_name", r->in.domain_name);
                ndr->depth++;
                if (r->in.domain_name) {
@@ -11853,7 +12769,7 @@ _PUBLIC_ void ndr_print_netr_DsRGetDCNameEx2(struct ndr_print *ndr, const char *
                        ndr_print_string(ndr, "site_name", r->in.site_name);
                }
                ndr->depth--;
-               ndr_print_uint32(ndr, "flags", r->in.flags);
+               ndr_print_netr_DsRGetDCName_flags(ndr, "flags", r->in.flags);
                ndr->depth--;
        }
        if (flags & NDR_OUT) {
@@ -11861,9 +12777,10 @@ _PUBLIC_ void ndr_print_netr_DsRGetDCNameEx2(struct ndr_print *ndr, const char *
                ndr->depth++;
                ndr_print_ptr(ndr, "info", r->out.info);
                ndr->depth++;
-               if (r->out.info) {
-                       ndr_print_netr_DsRGetDCNameInfo(ndr, "info", r->out.info);
-               }
+               ndr_print_ptr(ndr, "info", *r->out.info);
+               ndr->depth++;
+               ndr_print_netr_DsRGetDCNameInfo(ndr, "info", *r->out.info);
+               ndr->depth--;
                ndr->depth--;
                ndr_print_WERROR(ndr, "result", r->out.result);
                ndr->depth--;
@@ -11912,123 +12829,348 @@ _PUBLIC_ void ndr_print_netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN(struct ndr_prin
        ndr->depth--;
 }
 
-static enum ndr_err_code ndr_push_netr_NETRENUMERATETRUSTEDDOMAINSEX(struct ndr_push *ndr, int flags, const struct netr_NETRENUMERATETRUSTEDDOMAINSEX *r)
+static enum ndr_err_code ndr_push_netr_NetrEnumerateTrustedDomainsEx(struct ndr_push *ndr, int flags, const struct netr_NetrEnumerateTrustedDomainsEx *r)
 {
        if (flags & NDR_IN) {
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.server_name));
+               if (r->in.server_name) {
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.server_name, CH_UTF16)));
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.server_name, CH_UTF16)));
+                       NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.server_name, ndr_charset_length(r->in.server_name, CH_UTF16), sizeof(uint16_t), CH_UTF16));
+               }
        }
        if (flags & NDR_OUT) {
+               if (r->out.dom_trust_list == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_netr_DomainTrustList(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.dom_trust_list));
                NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
        }
        return NDR_ERR_SUCCESS;
 }
 
-static enum ndr_err_code ndr_pull_netr_NETRENUMERATETRUSTEDDOMAINSEX(struct ndr_pull *ndr, int flags, struct netr_NETRENUMERATETRUSTEDDOMAINSEX *r)
+static enum ndr_err_code ndr_pull_netr_NetrEnumerateTrustedDomainsEx(struct ndr_pull *ndr, int flags, struct netr_NetrEnumerateTrustedDomainsEx *r)
 {
+       uint32_t _ptr_server_name;
+       TALLOC_CTX *_mem_save_server_name_0;
+       TALLOC_CTX *_mem_save_dom_trust_list_0;
        if (flags & NDR_IN) {
+               ZERO_STRUCT(r->out);
+
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_server_name));
+               if (_ptr_server_name) {
+                       NDR_PULL_ALLOC(ndr, r->in.server_name);
+               } else {
+                       r->in.server_name = NULL;
+               }
+               if (r->in.server_name) {
+                       _mem_save_server_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->in.server_name, 0);
+                       NDR_CHECK(ndr_pull_array_size(ndr, &r->in.server_name));
+                       NDR_CHECK(ndr_pull_array_length(ndr, &r->in.server_name));
+                       if (ndr_get_array_length(ndr, &r->in.server_name) > ndr_get_array_size(ndr, &r->in.server_name)) {
+                               return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.server_name), ndr_get_array_length(ndr, &r->in.server_name));
+                       }
+                       NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.server_name), sizeof(uint16_t)));
+                       NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.server_name, ndr_get_array_length(ndr, &r->in.server_name), sizeof(uint16_t), CH_UTF16));
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_server_name_0, 0);
+               }
+               NDR_PULL_ALLOC(ndr, r->out.dom_trust_list);
+               ZERO_STRUCTP(r->out.dom_trust_list);
        }
        if (flags & NDR_OUT) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.dom_trust_list);
+               }
+               _mem_save_dom_trust_list_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.dom_trust_list, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_netr_DomainTrustList(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.dom_trust_list));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_dom_trust_list_0, LIBNDR_FLAG_REF_ALLOC);
                NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
        }
        return NDR_ERR_SUCCESS;
 }
 
-_PUBLIC_ void ndr_print_netr_NETRENUMERATETRUSTEDDOMAINSEX(struct ndr_print *ndr, const char *name, int flags, const struct netr_NETRENUMERATETRUSTEDDOMAINSEX *r)
+_PUBLIC_ void ndr_print_netr_NetrEnumerateTrustedDomainsEx(struct ndr_print *ndr, const char *name, int flags, const struct netr_NetrEnumerateTrustedDomainsEx *r)
 {
-       ndr_print_struct(ndr, name, "netr_NETRENUMERATETRUSTEDDOMAINSEX");
+       ndr_print_struct(ndr, name, "netr_NetrEnumerateTrustedDomainsEx");
        ndr->depth++;
        if (flags & NDR_SET_VALUES) {
                ndr->flags |= LIBNDR_PRINT_SET_VALUES;
        }
        if (flags & NDR_IN) {
-               ndr_print_struct(ndr, "in", "netr_NETRENUMERATETRUSTEDDOMAINSEX");
+               ndr_print_struct(ndr, "in", "netr_NetrEnumerateTrustedDomainsEx");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "server_name", r->in.server_name);
                ndr->depth++;
+               if (r->in.server_name) {
+                       ndr_print_string(ndr, "server_name", r->in.server_name);
+               }
+               ndr->depth--;
                ndr->depth--;
        }
        if (flags & NDR_OUT) {
-               ndr_print_struct(ndr, "out", "netr_NETRENUMERATETRUSTEDDOMAINSEX");
+               ndr_print_struct(ndr, "out", "netr_NetrEnumerateTrustedDomainsEx");
                ndr->depth++;
+               ndr_print_ptr(ndr, "dom_trust_list", r->out.dom_trust_list);
+               ndr->depth++;
+               ndr_print_netr_DomainTrustList(ndr, "dom_trust_list", r->out.dom_trust_list);
+               ndr->depth--;
                ndr_print_WERROR(ndr, "result", r->out.result);
                ndr->depth--;
        }
        ndr->depth--;
 }
 
-static enum ndr_err_code ndr_push_netr_DSRADDRESSTOSITENAMESEXW(struct ndr_push *ndr, int flags, const struct netr_DSRADDRESSTOSITENAMESEXW *r)
+static enum ndr_err_code ndr_push_netr_DsRAddressToSitenamesExW(struct ndr_push *ndr, int flags, const struct netr_DsRAddressToSitenamesExW *r)
 {
+       uint32_t cntr_addresses_1;
        if (flags & NDR_IN) {
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.server_name));
+               if (r->in.server_name) {
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.server_name, CH_UTF16)));
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.server_name, CH_UTF16)));
+                       NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.server_name, ndr_charset_length(r->in.server_name, CH_UTF16), sizeof(uint16_t), CH_UTF16));
+               }
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.count));
+               if (r->in.addresses == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.count));
+               for (cntr_addresses_1 = 0; cntr_addresses_1 < r->in.count; cntr_addresses_1++) {
+                       NDR_CHECK(ndr_push_netr_DsRAddress(ndr, NDR_SCALARS, &r->in.addresses[cntr_addresses_1]));
+               }
+               for (cntr_addresses_1 = 0; cntr_addresses_1 < r->in.count; cntr_addresses_1++) {
+                       NDR_CHECK(ndr_push_netr_DsRAddress(ndr, NDR_BUFFERS, &r->in.addresses[cntr_addresses_1]));
+               }
        }
        if (flags & NDR_OUT) {
+               if (r->out.ctr == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               if (*r->out.ctr == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_ref_ptr(ndr));
+               NDR_CHECK(ndr_push_netr_DsRAddressToSitenamesExWCtr(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.ctr));
                NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
        }
        return NDR_ERR_SUCCESS;
 }
 
-static enum ndr_err_code ndr_pull_netr_DSRADDRESSTOSITENAMESEXW(struct ndr_pull *ndr, int flags, struct netr_DSRADDRESSTOSITENAMESEXW *r)
+static enum ndr_err_code ndr_pull_netr_DsRAddressToSitenamesExW(struct ndr_pull *ndr, int flags, struct netr_DsRAddressToSitenamesExW *r)
 {
+       uint32_t _ptr_server_name;
+       uint32_t cntr_addresses_1;
+       uint32_t _ptr_ctr;
+       TALLOC_CTX *_mem_save_server_name_0;
+       TALLOC_CTX *_mem_save_addresses_1;
+       TALLOC_CTX *_mem_save_ctr_0;
+       TALLOC_CTX *_mem_save_ctr_1;
        if (flags & NDR_IN) {
+               ZERO_STRUCT(r->out);
+
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_server_name));
+               if (_ptr_server_name) {
+                       NDR_PULL_ALLOC(ndr, r->in.server_name);
+               } else {
+                       r->in.server_name = NULL;
+               }
+               if (r->in.server_name) {
+                       _mem_save_server_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->in.server_name, 0);
+                       NDR_CHECK(ndr_pull_array_size(ndr, &r->in.server_name));
+                       NDR_CHECK(ndr_pull_array_length(ndr, &r->in.server_name));
+                       if (ndr_get_array_length(ndr, &r->in.server_name) > ndr_get_array_size(ndr, &r->in.server_name)) {
+                               return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.server_name), ndr_get_array_length(ndr, &r->in.server_name));
+                       }
+                       NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.server_name), sizeof(uint16_t)));
+                       NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.server_name, ndr_get_array_length(ndr, &r->in.server_name), sizeof(uint16_t), CH_UTF16));
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_server_name_0, 0);
+               }
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.count));
+               if (r->in.count < 0 || r->in.count > 32000) {
+                       return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
+               }
+               NDR_CHECK(ndr_pull_array_size(ndr, &r->in.addresses));
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC_N(ndr, r->in.addresses, ndr_get_array_size(ndr, &r->in.addresses));
+               }
+               _mem_save_addresses_1 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.addresses, 0);
+               for (cntr_addresses_1 = 0; cntr_addresses_1 < r->in.count; cntr_addresses_1++) {
+                       NDR_CHECK(ndr_pull_netr_DsRAddress(ndr, NDR_SCALARS, &r->in.addresses[cntr_addresses_1]));
+               }
+               for (cntr_addresses_1 = 0; cntr_addresses_1 < r->in.count; cntr_addresses_1++) {
+                       NDR_CHECK(ndr_pull_netr_DsRAddress(ndr, NDR_BUFFERS, &r->in.addresses[cntr_addresses_1]));
+               }
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_addresses_1, 0);
+               NDR_PULL_ALLOC(ndr, r->out.ctr);
+               ZERO_STRUCTP(r->out.ctr);
+               if (r->in.addresses) {
+                       NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->in.addresses, r->in.count));
+               }
        }
        if (flags & NDR_OUT) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.ctr);
+               }
+               _mem_save_ctr_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.ctr, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_ref_ptr(ndr, &_ptr_ctr));
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, *r->out.ctr);
+               }
+               _mem_save_ctr_1 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, *r->out.ctr, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_netr_DsRAddressToSitenamesExWCtr(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.ctr));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_ctr_1, LIBNDR_FLAG_REF_ALLOC);
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_ctr_0, LIBNDR_FLAG_REF_ALLOC);
                NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
        }
        return NDR_ERR_SUCCESS;
 }
 
-_PUBLIC_ void ndr_print_netr_DSRADDRESSTOSITENAMESEXW(struct ndr_print *ndr, const char *name, int flags, const struct netr_DSRADDRESSTOSITENAMESEXW *r)
+_PUBLIC_ void ndr_print_netr_DsRAddressToSitenamesExW(struct ndr_print *ndr, const char *name, int flags, const struct netr_DsRAddressToSitenamesExW *r)
 {
-       ndr_print_struct(ndr, name, "netr_DSRADDRESSTOSITENAMESEXW");
+       uint32_t cntr_addresses_1;
+       ndr_print_struct(ndr, name, "netr_DsRAddressToSitenamesExW");
        ndr->depth++;
        if (flags & NDR_SET_VALUES) {
                ndr->flags |= LIBNDR_PRINT_SET_VALUES;
        }
        if (flags & NDR_IN) {
-               ndr_print_struct(ndr, "in", "netr_DSRADDRESSTOSITENAMESEXW");
+               ndr_print_struct(ndr, "in", "netr_DsRAddressToSitenamesExW");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "server_name", r->in.server_name);
+               ndr->depth++;
+               if (r->in.server_name) {
+                       ndr_print_string(ndr, "server_name", r->in.server_name);
+               }
+               ndr->depth--;
+               ndr_print_uint32(ndr, "count", r->in.count);
+               ndr_print_ptr(ndr, "addresses", r->in.addresses);
+               ndr->depth++;
+               ndr->print(ndr, "%s: ARRAY(%d)", "addresses", r->in.count);
                ndr->depth++;
+               for (cntr_addresses_1=0;cntr_addresses_1<r->in.count;cntr_addresses_1++) {
+                       char *idx_1=NULL;
+                       asprintf(&idx_1, "[%d]", cntr_addresses_1);
+                       if (idx_1) {
+                               ndr_print_netr_DsRAddress(ndr, "addresses", &r->in.addresses[cntr_addresses_1]);
+                               free(idx_1);
+                       }
+               }
+               ndr->depth--;
+               ndr->depth--;
                ndr->depth--;
        }
        if (flags & NDR_OUT) {
-               ndr_print_struct(ndr, "out", "netr_DSRADDRESSTOSITENAMESEXW");
+               ndr_print_struct(ndr, "out", "netr_DsRAddressToSitenamesExW");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "ctr", r->out.ctr);
                ndr->depth++;
+               ndr_print_ptr(ndr, "ctr", *r->out.ctr);
+               ndr->depth++;
+               ndr_print_netr_DsRAddressToSitenamesExWCtr(ndr, "ctr", *r->out.ctr);
+               ndr->depth--;
+               ndr->depth--;
                ndr_print_WERROR(ndr, "result", r->out.result);
                ndr->depth--;
        }
        ndr->depth--;
 }
 
-static enum ndr_err_code ndr_push_netr_DSRGETDCSITECOVERAGEW(struct ndr_push *ndr, int flags, const struct netr_DSRGETDCSITECOVERAGEW *r)
+static enum ndr_err_code ndr_push_netr_DsrGetDcSiteCoverageW(struct ndr_push *ndr, int flags, const struct netr_DsrGetDcSiteCoverageW *r)
 {
        if (flags & NDR_IN) {
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.server_name));
+               if (r->in.server_name) {
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.server_name, CH_UTF16)));
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.server_name, CH_UTF16)));
+                       NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.server_name, ndr_charset_length(r->in.server_name, CH_UTF16), sizeof(uint16_t), CH_UTF16));
+               }
        }
        if (flags & NDR_OUT) {
+               if (r->out.ctr == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_DcSitesCtr(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.ctr));
                NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
        }
        return NDR_ERR_SUCCESS;
 }
 
-static enum ndr_err_code ndr_pull_netr_DSRGETDCSITECOVERAGEW(struct ndr_pull *ndr, int flags, struct netr_DSRGETDCSITECOVERAGEW *r)
+static enum ndr_err_code ndr_pull_netr_DsrGetDcSiteCoverageW(struct ndr_pull *ndr, int flags, struct netr_DsrGetDcSiteCoverageW *r)
 {
+       uint32_t _ptr_server_name;
+       TALLOC_CTX *_mem_save_server_name_0;
+       TALLOC_CTX *_mem_save_ctr_0;
        if (flags & NDR_IN) {
+               ZERO_STRUCT(r->out);
+
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_server_name));
+               if (_ptr_server_name) {
+                       NDR_PULL_ALLOC(ndr, r->in.server_name);
+               } else {
+                       r->in.server_name = NULL;
+               }
+               if (r->in.server_name) {
+                       _mem_save_server_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->in.server_name, 0);
+                       NDR_CHECK(ndr_pull_array_size(ndr, &r->in.server_name));
+                       NDR_CHECK(ndr_pull_array_length(ndr, &r->in.server_name));
+                       if (ndr_get_array_length(ndr, &r->in.server_name) > ndr_get_array_size(ndr, &r->in.server_name)) {
+                               return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.server_name), ndr_get_array_length(ndr, &r->in.server_name));
+                       }
+                       NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.server_name), sizeof(uint16_t)));
+                       NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.server_name, ndr_get_array_length(ndr, &r->in.server_name), sizeof(uint16_t), CH_UTF16));
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_server_name_0, 0);
+               }
+               NDR_PULL_ALLOC(ndr, r->out.ctr);
+               ZERO_STRUCTP(r->out.ctr);
        }
        if (flags & NDR_OUT) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.ctr);
+               }
+               _mem_save_ctr_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.ctr, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_DcSitesCtr(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.ctr));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_ctr_0, LIBNDR_FLAG_REF_ALLOC);
                NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
        }
        return NDR_ERR_SUCCESS;
 }
 
-_PUBLIC_ void ndr_print_netr_DSRGETDCSITECOVERAGEW(struct ndr_print *ndr, const char *name, int flags, const struct netr_DSRGETDCSITECOVERAGEW *r)
+_PUBLIC_ void ndr_print_netr_DsrGetDcSiteCoverageW(struct ndr_print *ndr, const char *name, int flags, const struct netr_DsrGetDcSiteCoverageW *r)
 {
-       ndr_print_struct(ndr, name, "netr_DSRGETDCSITECOVERAGEW");
+       ndr_print_struct(ndr, name, "netr_DsrGetDcSiteCoverageW");
        ndr->depth++;
        if (flags & NDR_SET_VALUES) {
                ndr->flags |= LIBNDR_PRINT_SET_VALUES;
        }
        if (flags & NDR_IN) {
-               ndr_print_struct(ndr, "in", "netr_DSRGETDCSITECOVERAGEW");
+               ndr_print_struct(ndr, "in", "netr_DsrGetDcSiteCoverageW");
                ndr->depth++;
-               ndr->depth--;
-       }
+               ndr_print_ptr(ndr, "server_name", r->in.server_name);
+               ndr->depth++;
+               if (r->in.server_name) {
+                       ndr_print_string(ndr, "server_name", r->in.server_name);
+               }
+               ndr->depth--;
+               ndr->depth--;
+       }
        if (flags & NDR_OUT) {
-               ndr_print_struct(ndr, "out", "netr_DSRGETDCSITECOVERAGEW");
+               ndr_print_struct(ndr, "out", "netr_DsrGetDcSiteCoverageW");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "ctr", r->out.ctr);
                ndr->depth++;
+               ndr_print_DcSitesCtr(ndr, "ctr", r->out.ctr);
+               ndr->depth--;
                ndr_print_WERROR(ndr, "result", r->out.result);
                ndr->depth--;
        }
@@ -12230,7 +13372,6 @@ _PUBLIC_ void ndr_print_netr_LogonSamLogonEx(struct ndr_print *ndr, const char *
 
 static enum ndr_err_code ndr_push_netr_DsrEnumerateDomainTrusts(struct ndr_push *ndr, int flags, const struct netr_DsrEnumerateDomainTrusts *r)
 {
-       uint32_t cntr_trusts_1;
        if (flags & NDR_IN) {
                NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.server_name));
                if (r->in.server_name) {
@@ -12242,23 +13383,10 @@ static enum ndr_err_code ndr_push_netr_DsrEnumerateDomainTrusts(struct ndr_push
                NDR_CHECK(ndr_push_netr_TrustFlags(ndr, NDR_SCALARS, r->in.trust_flags));
        }
        if (flags & NDR_OUT) {
-               if (r->out.count == NULL) {
-                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
-               }
-               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.count));
                if (r->out.trusts == NULL) {
                        return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
                }
-               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->out.count));
-               for (cntr_trusts_1 = 0; cntr_trusts_1 < r->out.count; cntr_trusts_1++) {
-                       if (r->out.trusts[cntr_trusts_1] == NULL) {
-                               return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
-                       }
-                       NDR_CHECK(ndr_push_ref_ptr(ndr));
-               }
-               for (cntr_trusts_1 = 0; cntr_trusts_1 < r->out.count; cntr_trusts_1++) {
-                       NDR_CHECK(ndr_push_netr_DomainTrust(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.trusts[cntr_trusts_1]));
-               }
+               NDR_CHECK(ndr_push_netr_DomainTrustList(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.trusts));
                NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
        }
        return NDR_ERR_SUCCESS;
@@ -12267,12 +13395,8 @@ static enum ndr_err_code ndr_push_netr_DsrEnumerateDomainTrusts(struct ndr_push
 static enum ndr_err_code ndr_pull_netr_DsrEnumerateDomainTrusts(struct ndr_pull *ndr, int flags, struct netr_DsrEnumerateDomainTrusts *r)
 {
        uint32_t _ptr_server_name;
-       uint32_t _ptr_trusts;
-       uint32_t cntr_trusts_1;
        TALLOC_CTX *_mem_save_server_name_0;
-       TALLOC_CTX *_mem_save_count_0;
-       TALLOC_CTX *_mem_save_trusts_1;
-       TALLOC_CTX *_mem_save_trusts_2;
+       TALLOC_CTX *_mem_save_trusts_0;
        if (flags & NDR_IN) {
                ZERO_STRUCT(r->out);
 
@@ -12295,49 +13419,24 @@ static enum ndr_err_code ndr_pull_netr_DsrEnumerateDomainTrusts(struct ndr_pull
                        NDR_PULL_SET_MEM_CTX(ndr, _mem_save_server_name_0, 0);
                }
                NDR_CHECK(ndr_pull_netr_TrustFlags(ndr, NDR_SCALARS, &r->in.trust_flags));
-               NDR_PULL_ALLOC(ndr, r->out.count);
-               ZERO_STRUCTP(r->out.count);
-               NDR_PULL_ALLOC_N(ndr, r->out.trusts, count);
-               memset(r->out.trusts, 0, count * sizeof(*r->out.trusts));
+               NDR_PULL_ALLOC(ndr, r->out.trusts);
+               ZERO_STRUCTP(r->out.trusts);
        }
        if (flags & NDR_OUT) {
                if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
-                       NDR_PULL_ALLOC(ndr, r->out.count);
-               }
-               _mem_save_count_0 = NDR_PULL_GET_MEM_CTX(ndr);
-               NDR_PULL_SET_MEM_CTX(ndr, r->out.count, LIBNDR_FLAG_REF_ALLOC);
-               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.count));
-               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_count_0, LIBNDR_FLAG_REF_ALLOC);
-               NDR_CHECK(ndr_pull_array_size(ndr, &r->out.trusts));
-               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
-                       NDR_PULL_ALLOC_N(ndr, r->out.trusts, ndr_get_array_size(ndr, &r->out.trusts));
-               }
-               _mem_save_trusts_1 = NDR_PULL_GET_MEM_CTX(ndr);
-               NDR_PULL_SET_MEM_CTX(ndr, r->out.trusts, 0);
-               for (cntr_trusts_1 = 0; cntr_trusts_1 < r->out.count; cntr_trusts_1++) {
-                       NDR_CHECK(ndr_pull_ref_ptr(ndr, &_ptr_trusts));
-                       if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
-                               NDR_PULL_ALLOC(ndr, r->out.trusts[cntr_trusts_1]);
-                       }
-               }
-               for (cntr_trusts_1 = 0; cntr_trusts_1 < r->out.count; cntr_trusts_1++) {
-                       _mem_save_trusts_2 = NDR_PULL_GET_MEM_CTX(ndr);
-                       NDR_PULL_SET_MEM_CTX(ndr, r->out.trusts[cntr_trusts_1], LIBNDR_FLAG_REF_ALLOC);
-                       NDR_CHECK(ndr_pull_netr_DomainTrust(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.trusts[cntr_trusts_1]));
-                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_trusts_2, LIBNDR_FLAG_REF_ALLOC);
+                       NDR_PULL_ALLOC(ndr, r->out.trusts);
                }
-               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_trusts_1, 0);
+               _mem_save_trusts_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.trusts, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_netr_DomainTrustList(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.trusts));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_trusts_0, LIBNDR_FLAG_REF_ALLOC);
                NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
-               if (r->out.trusts) {
-                       NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->out.trusts, r->out.count));
-               }
        }
        return NDR_ERR_SUCCESS;
 }
 
 _PUBLIC_ void ndr_print_netr_DsrEnumerateDomainTrusts(struct ndr_print *ndr, const char *name, int flags, const struct netr_DsrEnumerateDomainTrusts *r)
 {
-       uint32_t cntr_trusts_1;
        ndr_print_struct(ndr, name, "netr_DsrEnumerateDomainTrusts");
        ndr->depth++;
        if (flags & NDR_SET_VALUES) {
@@ -12358,26 +13457,9 @@ _PUBLIC_ void ndr_print_netr_DsrEnumerateDomainTrusts(struct ndr_print *ndr, con
        if (flags & NDR_OUT) {
                ndr_print_struct(ndr, "out", "netr_DsrEnumerateDomainTrusts");
                ndr->depth++;
-               ndr_print_ptr(ndr, "count", r->out.count);
-               ndr->depth++;
-               ndr_print_uint32(ndr, "count", *r->out.count);
-               ndr->depth--;
                ndr_print_ptr(ndr, "trusts", r->out.trusts);
                ndr->depth++;
-               ndr->print(ndr, "%s: ARRAY(%d)", "trusts", r->out.count);
-               ndr->depth++;
-               for (cntr_trusts_1=0;cntr_trusts_1<r->out.count;cntr_trusts_1++) {
-                       char *idx_1=NULL;
-                       asprintf(&idx_1, "[%d]", cntr_trusts_1);
-                       if (idx_1) {
-                               ndr_print_ptr(ndr, "trusts", r->out.trusts[cntr_trusts_1]);
-                               ndr->depth++;
-                               ndr_print_netr_DomainTrust(ndr, "trusts", r->out.trusts[cntr_trusts_1]);
-                               ndr->depth--;
-                               free(idx_1);
-                       }
-               }
-               ndr->depth--;
+               ndr_print_netr_DomainTrustList(ndr, "trusts", r->out.trusts);
                ndr->depth--;
                ndr_print_WERROR(ndr, "result", r->out.result);
                ndr->depth--;
@@ -12385,9 +13467,38 @@ _PUBLIC_ void ndr_print_netr_DsrEnumerateDomainTrusts(struct ndr_print *ndr, con
        ndr->depth--;
 }
 
-static enum ndr_err_code ndr_push_netr_DSRDEREGISTERDNSHOSTRECORDS(struct ndr_push *ndr, int flags, const struct netr_DSRDEREGISTERDNSHOSTRECORDS *r)
+static enum ndr_err_code ndr_push_netr_DsrDeregisterDNSHostRecords(struct ndr_push *ndr, int flags, const struct netr_DsrDeregisterDNSHostRecords *r)
 {
        if (flags & NDR_IN) {
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.server_name));
+               if (r->in.server_name) {
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.server_name, CH_UTF16)));
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.server_name, CH_UTF16)));
+                       NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.server_name, ndr_charset_length(r->in.server_name, CH_UTF16), sizeof(uint16_t), CH_UTF16));
+               }
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.domain));
+               if (r->in.domain) {
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.domain, CH_UTF16)));
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.domain, CH_UTF16)));
+                       NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.domain, ndr_charset_length(r->in.domain, CH_UTF16), sizeof(uint16_t), CH_UTF16));
+               }
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.domain_guid));
+               if (r->in.domain_guid) {
+                       NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.domain_guid));
+               }
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.dsa_guid));
+               if (r->in.dsa_guid) {
+                       NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.dsa_guid));
+               }
+               if (r->in.dns_host == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.dns_host, CH_UTF16)));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.dns_host, CH_UTF16)));
+               NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.dns_host, ndr_charset_length(r->in.dns_host, CH_UTF16), sizeof(uint16_t), CH_UTF16));
        }
        if (flags & NDR_OUT) {
                NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
@@ -12395,9 +13506,84 @@ static enum ndr_err_code ndr_push_netr_DSRDEREGISTERDNSHOSTRECORDS(struct ndr_pu
        return NDR_ERR_SUCCESS;
 }
 
-static enum ndr_err_code ndr_pull_netr_DSRDEREGISTERDNSHOSTRECORDS(struct ndr_pull *ndr, int flags, struct netr_DSRDEREGISTERDNSHOSTRECORDS *r)
+static enum ndr_err_code ndr_pull_netr_DsrDeregisterDNSHostRecords(struct ndr_pull *ndr, int flags, struct netr_DsrDeregisterDNSHostRecords *r)
 {
+       uint32_t _ptr_server_name;
+       uint32_t _ptr_domain;
+       uint32_t _ptr_domain_guid;
+       uint32_t _ptr_dsa_guid;
+       TALLOC_CTX *_mem_save_server_name_0;
+       TALLOC_CTX *_mem_save_domain_0;
+       TALLOC_CTX *_mem_save_domain_guid_0;
+       TALLOC_CTX *_mem_save_dsa_guid_0;
        if (flags & NDR_IN) {
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_server_name));
+               if (_ptr_server_name) {
+                       NDR_PULL_ALLOC(ndr, r->in.server_name);
+               } else {
+                       r->in.server_name = NULL;
+               }
+               if (r->in.server_name) {
+                       _mem_save_server_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->in.server_name, 0);
+                       NDR_CHECK(ndr_pull_array_size(ndr, &r->in.server_name));
+                       NDR_CHECK(ndr_pull_array_length(ndr, &r->in.server_name));
+                       if (ndr_get_array_length(ndr, &r->in.server_name) > ndr_get_array_size(ndr, &r->in.server_name)) {
+                               return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.server_name), ndr_get_array_length(ndr, &r->in.server_name));
+                       }
+                       NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.server_name), sizeof(uint16_t)));
+                       NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.server_name, ndr_get_array_length(ndr, &r->in.server_name), sizeof(uint16_t), CH_UTF16));
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_server_name_0, 0);
+               }
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_domain));
+               if (_ptr_domain) {
+                       NDR_PULL_ALLOC(ndr, r->in.domain);
+               } else {
+                       r->in.domain = NULL;
+               }
+               if (r->in.domain) {
+                       _mem_save_domain_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->in.domain, 0);
+                       NDR_CHECK(ndr_pull_array_size(ndr, &r->in.domain));
+                       NDR_CHECK(ndr_pull_array_length(ndr, &r->in.domain));
+                       if (ndr_get_array_length(ndr, &r->in.domain) > ndr_get_array_size(ndr, &r->in.domain)) {
+                               return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.domain), ndr_get_array_length(ndr, &r->in.domain));
+                       }
+                       NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.domain), sizeof(uint16_t)));
+                       NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.domain, ndr_get_array_length(ndr, &r->in.domain), sizeof(uint16_t), CH_UTF16));
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_0, 0);
+               }
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_domain_guid));
+               if (_ptr_domain_guid) {
+                       NDR_PULL_ALLOC(ndr, r->in.domain_guid);
+               } else {
+                       r->in.domain_guid = NULL;
+               }
+               if (r->in.domain_guid) {
+                       _mem_save_domain_guid_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->in.domain_guid, 0);
+                       NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.domain_guid));
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_guid_0, 0);
+               }
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_dsa_guid));
+               if (_ptr_dsa_guid) {
+                       NDR_PULL_ALLOC(ndr, r->in.dsa_guid);
+               } else {
+                       r->in.dsa_guid = NULL;
+               }
+               if (r->in.dsa_guid) {
+                       _mem_save_dsa_guid_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->in.dsa_guid, 0);
+                       NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.dsa_guid));
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_dsa_guid_0, 0);
+               }
+               NDR_CHECK(ndr_pull_array_size(ndr, &r->in.dns_host));
+               NDR_CHECK(ndr_pull_array_length(ndr, &r->in.dns_host));
+               if (ndr_get_array_length(ndr, &r->in.dns_host) > ndr_get_array_size(ndr, &r->in.dns_host)) {
+                       return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.dns_host), ndr_get_array_length(ndr, &r->in.dns_host));
+               }
+               NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.dns_host), sizeof(uint16_t)));
+               NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.dns_host, ndr_get_array_length(ndr, &r->in.dns_host), sizeof(uint16_t), CH_UTF16));
        }
        if (flags & NDR_OUT) {
                NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
@@ -12405,20 +13591,48 @@ static enum ndr_err_code ndr_pull_netr_DSRDEREGISTERDNSHOSTRECORDS(struct ndr_pu
        return NDR_ERR_SUCCESS;
 }
 
-_PUBLIC_ void ndr_print_netr_DSRDEREGISTERDNSHOSTRECORDS(struct ndr_print *ndr, const char *name, int flags, const struct netr_DSRDEREGISTERDNSHOSTRECORDS *r)
+_PUBLIC_ void ndr_print_netr_DsrDeregisterDNSHostRecords(struct ndr_print *ndr, const char *name, int flags, const struct netr_DsrDeregisterDNSHostRecords *r)
 {
-       ndr_print_struct(ndr, name, "netr_DSRDEREGISTERDNSHOSTRECORDS");
+       ndr_print_struct(ndr, name, "netr_DsrDeregisterDNSHostRecords");
        ndr->depth++;
        if (flags & NDR_SET_VALUES) {
                ndr->flags |= LIBNDR_PRINT_SET_VALUES;
        }
        if (flags & NDR_IN) {
-               ndr_print_struct(ndr, "in", "netr_DSRDEREGISTERDNSHOSTRECORDS");
+               ndr_print_struct(ndr, "in", "netr_DsrDeregisterDNSHostRecords");
                ndr->depth++;
+               ndr_print_ptr(ndr, "server_name", r->in.server_name);
+               ndr->depth++;
+               if (r->in.server_name) {
+                       ndr_print_string(ndr, "server_name", r->in.server_name);
+               }
+               ndr->depth--;
+               ndr_print_ptr(ndr, "domain", r->in.domain);
+               ndr->depth++;
+               if (r->in.domain) {
+                       ndr_print_string(ndr, "domain", r->in.domain);
+               }
+               ndr->depth--;
+               ndr_print_ptr(ndr, "domain_guid", r->in.domain_guid);
+               ndr->depth++;
+               if (r->in.domain_guid) {
+                       ndr_print_GUID(ndr, "domain_guid", r->in.domain_guid);
+               }
+               ndr->depth--;
+               ndr_print_ptr(ndr, "dsa_guid", r->in.dsa_guid);
+               ndr->depth++;
+               if (r->in.dsa_guid) {
+                       ndr_print_GUID(ndr, "dsa_guid", r->in.dsa_guid);
+               }
+               ndr->depth--;
+               ndr_print_ptr(ndr, "dns_host", r->in.dns_host);
+               ndr->depth++;
+               ndr_print_string(ndr, "dns_host", r->in.dns_host);
+               ndr->depth--;
                ndr->depth--;
        }
        if (flags & NDR_OUT) {
-               ndr_print_struct(ndr, "out", "netr_DSRDEREGISTERDNSHOSTRECORDS");
+               ndr_print_struct(ndr, "out", "netr_DsrDeregisterDNSHostRecords");
                ndr->depth++;
                ndr_print_WERROR(ndr, "result", r->out.result);
                ndr->depth--;
@@ -12426,123 +13640,484 @@ _PUBLIC_ void ndr_print_netr_DSRDEREGISTERDNSHOSTRECORDS(struct ndr_print *ndr,
        ndr->depth--;
 }
 
-static enum ndr_err_code ndr_push_netr_NETRSERVERTRUSTPASSWORDSGET(struct ndr_push *ndr, int flags, const struct netr_NETRSERVERTRUSTPASSWORDSGET *r)
+static enum ndr_err_code ndr_push_netr_ServerTrustPasswordsGet(struct ndr_push *ndr, int flags, const struct netr_ServerTrustPasswordsGet *r)
 {
        if (flags & NDR_IN) {
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.server_name));
+               if (r->in.server_name) {
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.server_name, CH_UTF16)));
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.server_name, CH_UTF16)));
+                       NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.server_name, ndr_charset_length(r->in.server_name, CH_UTF16), sizeof(uint16_t), CH_UTF16));
+               }
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.account_name, CH_UTF16)));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.account_name, CH_UTF16)));
+               NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.account_name, ndr_charset_length(r->in.account_name, CH_UTF16), sizeof(uint16_t), CH_UTF16));
+               NDR_CHECK(ndr_push_netr_SchannelType(ndr, NDR_SCALARS, r->in.secure_channel_type));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.computer_name, CH_UTF16)));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.computer_name, CH_UTF16)));
+               NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.computer_name, ndr_charset_length(r->in.computer_name, CH_UTF16), sizeof(uint16_t), CH_UTF16));
+               if (r->in.credential == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_netr_Authenticator(ndr, NDR_SCALARS, r->in.credential));
        }
        if (flags & NDR_OUT) {
-               NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
+               if (r->out.return_authenticator == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_netr_Authenticator(ndr, NDR_SCALARS, r->out.return_authenticator));
+               if (r->out.password == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_samr_Password(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.password));
+               if (r->out.password2 == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_samr_Password(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.password2));
+               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
        }
        return NDR_ERR_SUCCESS;
 }
 
-static enum ndr_err_code ndr_pull_netr_NETRSERVERTRUSTPASSWORDSGET(struct ndr_pull *ndr, int flags, struct netr_NETRSERVERTRUSTPASSWORDSGET *r)
+static enum ndr_err_code ndr_pull_netr_ServerTrustPasswordsGet(struct ndr_pull *ndr, int flags, struct netr_ServerTrustPasswordsGet *r)
 {
+       uint32_t _ptr_server_name;
+       TALLOC_CTX *_mem_save_server_name_0;
+       TALLOC_CTX *_mem_save_credential_0;
+       TALLOC_CTX *_mem_save_return_authenticator_0;
+       TALLOC_CTX *_mem_save_password_0;
+       TALLOC_CTX *_mem_save_password2_0;
        if (flags & NDR_IN) {
+               ZERO_STRUCT(r->out);
+
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_server_name));
+               if (_ptr_server_name) {
+                       NDR_PULL_ALLOC(ndr, r->in.server_name);
+               } else {
+                       r->in.server_name = NULL;
+               }
+               if (r->in.server_name) {
+                       _mem_save_server_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->in.server_name, 0);
+                       NDR_CHECK(ndr_pull_array_size(ndr, &r->in.server_name));
+                       NDR_CHECK(ndr_pull_array_length(ndr, &r->in.server_name));
+                       if (ndr_get_array_length(ndr, &r->in.server_name) > ndr_get_array_size(ndr, &r->in.server_name)) {
+                               return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.server_name), ndr_get_array_length(ndr, &r->in.server_name));
+                       }
+                       NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.server_name), sizeof(uint16_t)));
+                       NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.server_name, ndr_get_array_length(ndr, &r->in.server_name), sizeof(uint16_t), CH_UTF16));
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_server_name_0, 0);
+               }
+               NDR_CHECK(ndr_pull_array_size(ndr, &r->in.account_name));
+               NDR_CHECK(ndr_pull_array_length(ndr, &r->in.account_name));
+               if (ndr_get_array_length(ndr, &r->in.account_name) > ndr_get_array_size(ndr, &r->in.account_name)) {
+                       return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.account_name), ndr_get_array_length(ndr, &r->in.account_name));
+               }
+               NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.account_name), sizeof(uint16_t)));
+               NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.account_name, ndr_get_array_length(ndr, &r->in.account_name), sizeof(uint16_t), CH_UTF16));
+               NDR_CHECK(ndr_pull_netr_SchannelType(ndr, NDR_SCALARS, &r->in.secure_channel_type));
+               NDR_CHECK(ndr_pull_array_size(ndr, &r->in.computer_name));
+               NDR_CHECK(ndr_pull_array_length(ndr, &r->in.computer_name));
+               if (ndr_get_array_length(ndr, &r->in.computer_name) > ndr_get_array_size(ndr, &r->in.computer_name)) {
+                       return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.computer_name), ndr_get_array_length(ndr, &r->in.computer_name));
+               }
+               NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.computer_name), sizeof(uint16_t)));
+               NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.computer_name, ndr_get_array_length(ndr, &r->in.computer_name), sizeof(uint16_t), CH_UTF16));
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.credential);
+               }
+               _mem_save_credential_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.credential, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_netr_Authenticator(ndr, NDR_SCALARS, r->in.credential));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_credential_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_PULL_ALLOC(ndr, r->out.return_authenticator);
+               ZERO_STRUCTP(r->out.return_authenticator);
+               NDR_PULL_ALLOC(ndr, r->out.password);
+               ZERO_STRUCTP(r->out.password);
+               NDR_PULL_ALLOC(ndr, r->out.password2);
+               ZERO_STRUCTP(r->out.password2);
        }
        if (flags & NDR_OUT) {
-               NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.return_authenticator);
+               }
+               _mem_save_return_authenticator_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.return_authenticator, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_netr_Authenticator(ndr, NDR_SCALARS, r->out.return_authenticator));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_return_authenticator_0, LIBNDR_FLAG_REF_ALLOC);
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.password);
+               }
+               _mem_save_password_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.password, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_samr_Password(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.password));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_password_0, LIBNDR_FLAG_REF_ALLOC);
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.password2);
+               }
+               _mem_save_password2_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.password2, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_samr_Password(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.password2));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_password2_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
        }
        return NDR_ERR_SUCCESS;
 }
 
-_PUBLIC_ void ndr_print_netr_NETRSERVERTRUSTPASSWORDSGET(struct ndr_print *ndr, const char *name, int flags, const struct netr_NETRSERVERTRUSTPASSWORDSGET *r)
+_PUBLIC_ void ndr_print_netr_ServerTrustPasswordsGet(struct ndr_print *ndr, const char *name, int flags, const struct netr_ServerTrustPasswordsGet *r)
 {
-       ndr_print_struct(ndr, name, "netr_NETRSERVERTRUSTPASSWORDSGET");
+       ndr_print_struct(ndr, name, "netr_ServerTrustPasswordsGet");
        ndr->depth++;
        if (flags & NDR_SET_VALUES) {
                ndr->flags |= LIBNDR_PRINT_SET_VALUES;
        }
        if (flags & NDR_IN) {
-               ndr_print_struct(ndr, "in", "netr_NETRSERVERTRUSTPASSWORDSGET");
+               ndr_print_struct(ndr, "in", "netr_ServerTrustPasswordsGet");
                ndr->depth++;
+               ndr_print_ptr(ndr, "server_name", r->in.server_name);
+               ndr->depth++;
+               if (r->in.server_name) {
+                       ndr_print_string(ndr, "server_name", r->in.server_name);
+               }
+               ndr->depth--;
+               ndr_print_string(ndr, "account_name", r->in.account_name);
+               ndr_print_netr_SchannelType(ndr, "secure_channel_type", r->in.secure_channel_type);
+               ndr_print_string(ndr, "computer_name", r->in.computer_name);
+               ndr_print_ptr(ndr, "credential", r->in.credential);
+               ndr->depth++;
+               ndr_print_netr_Authenticator(ndr, "credential", r->in.credential);
+               ndr->depth--;
                ndr->depth--;
        }
        if (flags & NDR_OUT) {
-               ndr_print_struct(ndr, "out", "netr_NETRSERVERTRUSTPASSWORDSGET");
+               ndr_print_struct(ndr, "out", "netr_ServerTrustPasswordsGet");
                ndr->depth++;
-               ndr_print_WERROR(ndr, "result", r->out.result);
+               ndr_print_ptr(ndr, "return_authenticator", r->out.return_authenticator);
+               ndr->depth++;
+               ndr_print_netr_Authenticator(ndr, "return_authenticator", r->out.return_authenticator);
+               ndr->depth--;
+               ndr_print_ptr(ndr, "password", r->out.password);
+               ndr->depth++;
+               ndr_print_samr_Password(ndr, "password", r->out.password);
+               ndr->depth--;
+               ndr_print_ptr(ndr, "password2", r->out.password2);
+               ndr->depth++;
+               ndr_print_samr_Password(ndr, "password2", r->out.password2);
+               ndr->depth--;
+               ndr_print_NTSTATUS(ndr, "result", r->out.result);
                ndr->depth--;
        }
        ndr->depth--;
 }
 
-static enum ndr_err_code ndr_push_netr_DSRGETFORESTTRUSTINFORMATION(struct ndr_push *ndr, int flags, const struct netr_DSRGETFORESTTRUSTINFORMATION *r)
+static enum ndr_err_code ndr_push_netr_DsRGetForestTrustInformation(struct ndr_push *ndr, int flags, const struct netr_DsRGetForestTrustInformation *r)
 {
        if (flags & NDR_IN) {
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.server_name));
+               if (r->in.server_name) {
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.server_name, CH_UTF16)));
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.server_name, CH_UTF16)));
+                       NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.server_name, ndr_charset_length(r->in.server_name, CH_UTF16), sizeof(uint16_t), CH_UTF16));
+               }
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.trusted_domain_name));
+               if (r->in.trusted_domain_name) {
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.trusted_domain_name, CH_UTF16)));
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.trusted_domain_name, CH_UTF16)));
+                       NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.trusted_domain_name, ndr_charset_length(r->in.trusted_domain_name, CH_UTF16), sizeof(uint16_t), CH_UTF16));
+               }
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.flags));
        }
        if (flags & NDR_OUT) {
+               if (r->out.forest_trust_info == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               if (*r->out.forest_trust_info == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_ref_ptr(ndr));
+               NDR_CHECK(ndr_push_lsa_ForestTrustInformation(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.forest_trust_info));
                NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
        }
        return NDR_ERR_SUCCESS;
 }
 
-static enum ndr_err_code ndr_pull_netr_DSRGETFORESTTRUSTINFORMATION(struct ndr_pull *ndr, int flags, struct netr_DSRGETFORESTTRUSTINFORMATION *r)
+static enum ndr_err_code ndr_pull_netr_DsRGetForestTrustInformation(struct ndr_pull *ndr, int flags, struct netr_DsRGetForestTrustInformation *r)
 {
+       uint32_t _ptr_server_name;
+       uint32_t _ptr_trusted_domain_name;
+       uint32_t _ptr_forest_trust_info;
+       TALLOC_CTX *_mem_save_server_name_0;
+       TALLOC_CTX *_mem_save_trusted_domain_name_0;
+       TALLOC_CTX *_mem_save_forest_trust_info_0;
+       TALLOC_CTX *_mem_save_forest_trust_info_1;
        if (flags & NDR_IN) {
+               ZERO_STRUCT(r->out);
+
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_server_name));
+               if (_ptr_server_name) {
+                       NDR_PULL_ALLOC(ndr, r->in.server_name);
+               } else {
+                       r->in.server_name = NULL;
+               }
+               if (r->in.server_name) {
+                       _mem_save_server_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->in.server_name, 0);
+                       NDR_CHECK(ndr_pull_array_size(ndr, &r->in.server_name));
+                       NDR_CHECK(ndr_pull_array_length(ndr, &r->in.server_name));
+                       if (ndr_get_array_length(ndr, &r->in.server_name) > ndr_get_array_size(ndr, &r->in.server_name)) {
+                               return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.server_name), ndr_get_array_length(ndr, &r->in.server_name));
+                       }
+                       NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.server_name), sizeof(uint16_t)));
+                       NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.server_name, ndr_get_array_length(ndr, &r->in.server_name), sizeof(uint16_t), CH_UTF16));
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_server_name_0, 0);
+               }
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_trusted_domain_name));
+               if (_ptr_trusted_domain_name) {
+                       NDR_PULL_ALLOC(ndr, r->in.trusted_domain_name);
+               } else {
+                       r->in.trusted_domain_name = NULL;
+               }
+               if (r->in.trusted_domain_name) {
+                       _mem_save_trusted_domain_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->in.trusted_domain_name, 0);
+                       NDR_CHECK(ndr_pull_array_size(ndr, &r->in.trusted_domain_name));
+                       NDR_CHECK(ndr_pull_array_length(ndr, &r->in.trusted_domain_name));
+                       if (ndr_get_array_length(ndr, &r->in.trusted_domain_name) > ndr_get_array_size(ndr, &r->in.trusted_domain_name)) {
+                               return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.trusted_domain_name), ndr_get_array_length(ndr, &r->in.trusted_domain_name));
+                       }
+                       NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.trusted_domain_name), sizeof(uint16_t)));
+                       NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.trusted_domain_name, ndr_get_array_length(ndr, &r->in.trusted_domain_name), sizeof(uint16_t), CH_UTF16));
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_trusted_domain_name_0, 0);
+               }
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.flags));
+               NDR_PULL_ALLOC(ndr, r->out.forest_trust_info);
+               ZERO_STRUCTP(r->out.forest_trust_info);
        }
        if (flags & NDR_OUT) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.forest_trust_info);
+               }
+               _mem_save_forest_trust_info_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.forest_trust_info, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_ref_ptr(ndr, &_ptr_forest_trust_info));
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, *r->out.forest_trust_info);
+               }
+               _mem_save_forest_trust_info_1 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, *r->out.forest_trust_info, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_lsa_ForestTrustInformation(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.forest_trust_info));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_forest_trust_info_1, LIBNDR_FLAG_REF_ALLOC);
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_forest_trust_info_0, LIBNDR_FLAG_REF_ALLOC);
                NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
        }
        return NDR_ERR_SUCCESS;
 }
 
-_PUBLIC_ void ndr_print_netr_DSRGETFORESTTRUSTINFORMATION(struct ndr_print *ndr, const char *name, int flags, const struct netr_DSRGETFORESTTRUSTINFORMATION *r)
+_PUBLIC_ void ndr_print_netr_DsRGetForestTrustInformation(struct ndr_print *ndr, const char *name, int flags, const struct netr_DsRGetForestTrustInformation *r)
 {
-       ndr_print_struct(ndr, name, "netr_DSRGETFORESTTRUSTINFORMATION");
+       ndr_print_struct(ndr, name, "netr_DsRGetForestTrustInformation");
        ndr->depth++;
        if (flags & NDR_SET_VALUES) {
                ndr->flags |= LIBNDR_PRINT_SET_VALUES;
        }
        if (flags & NDR_IN) {
-               ndr_print_struct(ndr, "in", "netr_DSRGETFORESTTRUSTINFORMATION");
+               ndr_print_struct(ndr, "in", "netr_DsRGetForestTrustInformation");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "server_name", r->in.server_name);
+               ndr->depth++;
+               if (r->in.server_name) {
+                       ndr_print_string(ndr, "server_name", r->in.server_name);
+               }
+               ndr->depth--;
+               ndr_print_ptr(ndr, "trusted_domain_name", r->in.trusted_domain_name);
                ndr->depth++;
+               if (r->in.trusted_domain_name) {
+                       ndr_print_string(ndr, "trusted_domain_name", r->in.trusted_domain_name);
+               }
+               ndr->depth--;
+               ndr_print_uint32(ndr, "flags", r->in.flags);
                ndr->depth--;
        }
        if (flags & NDR_OUT) {
-               ndr_print_struct(ndr, "out", "netr_DSRGETFORESTTRUSTINFORMATION");
+               ndr_print_struct(ndr, "out", "netr_DsRGetForestTrustInformation");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "forest_trust_info", r->out.forest_trust_info);
+               ndr->depth++;
+               ndr_print_ptr(ndr, "forest_trust_info", *r->out.forest_trust_info);
                ndr->depth++;
+               ndr_print_lsa_ForestTrustInformation(ndr, "forest_trust_info", *r->out.forest_trust_info);
+               ndr->depth--;
+               ndr->depth--;
                ndr_print_WERROR(ndr, "result", r->out.result);
                ndr->depth--;
        }
        ndr->depth--;
 }
 
-static enum ndr_err_code ndr_push_netr_NETRGETFORESTTRUSTINFORMATION(struct ndr_push *ndr, int flags, const struct netr_NETRGETFORESTTRUSTINFORMATION *r)
+static enum ndr_err_code ndr_push_netr_GetForestTrustInformation(struct ndr_push *ndr, int flags, const struct netr_GetForestTrustInformation *r)
 {
        if (flags & NDR_IN) {
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.server_name));
+               if (r->in.server_name) {
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.server_name, CH_UTF16)));
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.server_name, CH_UTF16)));
+                       NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.server_name, ndr_charset_length(r->in.server_name, CH_UTF16), sizeof(uint16_t), CH_UTF16));
+               }
+               if (r->in.trusted_domain_name == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.trusted_domain_name, CH_UTF16)));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.trusted_domain_name, CH_UTF16)));
+               NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.trusted_domain_name, ndr_charset_length(r->in.trusted_domain_name, CH_UTF16), sizeof(uint16_t), CH_UTF16));
+               if (r->in.credential == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_netr_Authenticator(ndr, NDR_SCALARS, r->in.credential));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.flags));
        }
        if (flags & NDR_OUT) {
+               if (r->out.return_authenticator == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_netr_Authenticator(ndr, NDR_SCALARS, r->out.return_authenticator));
+               if (r->out.forest_trust_info == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               if (*r->out.forest_trust_info == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_ref_ptr(ndr));
+               NDR_CHECK(ndr_push_lsa_ForestTrustInformation(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.forest_trust_info));
                NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
        }
        return NDR_ERR_SUCCESS;
 }
 
-static enum ndr_err_code ndr_pull_netr_NETRGETFORESTTRUSTINFORMATION(struct ndr_pull *ndr, int flags, struct netr_NETRGETFORESTTRUSTINFORMATION *r)
+static enum ndr_err_code ndr_pull_netr_GetForestTrustInformation(struct ndr_pull *ndr, int flags, struct netr_GetForestTrustInformation *r)
 {
+       uint32_t _ptr_server_name;
+       uint32_t _ptr_forest_trust_info;
+       TALLOC_CTX *_mem_save_server_name_0;
+       TALLOC_CTX *_mem_save_credential_0;
+       TALLOC_CTX *_mem_save_return_authenticator_0;
+       TALLOC_CTX *_mem_save_forest_trust_info_0;
+       TALLOC_CTX *_mem_save_forest_trust_info_1;
        if (flags & NDR_IN) {
+               ZERO_STRUCT(r->out);
+
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_server_name));
+               if (_ptr_server_name) {
+                       NDR_PULL_ALLOC(ndr, r->in.server_name);
+               } else {
+                       r->in.server_name = NULL;
+               }
+               if (r->in.server_name) {
+                       _mem_save_server_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->in.server_name, 0);
+                       NDR_CHECK(ndr_pull_array_size(ndr, &r->in.server_name));
+                       NDR_CHECK(ndr_pull_array_length(ndr, &r->in.server_name));
+                       if (ndr_get_array_length(ndr, &r->in.server_name) > ndr_get_array_size(ndr, &r->in.server_name)) {
+                               return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.server_name), ndr_get_array_length(ndr, &r->in.server_name));
+                       }
+                       NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.server_name), sizeof(uint16_t)));
+                       NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.server_name, ndr_get_array_length(ndr, &r->in.server_name), sizeof(uint16_t), CH_UTF16));
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_server_name_0, 0);
+               }
+               NDR_CHECK(ndr_pull_array_size(ndr, &r->in.trusted_domain_name));
+               NDR_CHECK(ndr_pull_array_length(ndr, &r->in.trusted_domain_name));
+               if (ndr_get_array_length(ndr, &r->in.trusted_domain_name) > ndr_get_array_size(ndr, &r->in.trusted_domain_name)) {
+                       return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.trusted_domain_name), ndr_get_array_length(ndr, &r->in.trusted_domain_name));
+               }
+               NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.trusted_domain_name), sizeof(uint16_t)));
+               NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.trusted_domain_name, ndr_get_array_length(ndr, &r->in.trusted_domain_name), sizeof(uint16_t), CH_UTF16));
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.credential);
+               }
+               _mem_save_credential_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.credential, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_netr_Authenticator(ndr, NDR_SCALARS, r->in.credential));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_credential_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.flags));
+               NDR_PULL_ALLOC(ndr, r->out.return_authenticator);
+               ZERO_STRUCTP(r->out.return_authenticator);
+               NDR_PULL_ALLOC(ndr, r->out.forest_trust_info);
+               ZERO_STRUCTP(r->out.forest_trust_info);
        }
        if (flags & NDR_OUT) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.return_authenticator);
+               }
+               _mem_save_return_authenticator_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.return_authenticator, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_netr_Authenticator(ndr, NDR_SCALARS, r->out.return_authenticator));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_return_authenticator_0, LIBNDR_FLAG_REF_ALLOC);
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.forest_trust_info);
+               }
+               _mem_save_forest_trust_info_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.forest_trust_info, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_ref_ptr(ndr, &_ptr_forest_trust_info));
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, *r->out.forest_trust_info);
+               }
+               _mem_save_forest_trust_info_1 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, *r->out.forest_trust_info, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_lsa_ForestTrustInformation(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.forest_trust_info));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_forest_trust_info_1, LIBNDR_FLAG_REF_ALLOC);
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_forest_trust_info_0, LIBNDR_FLAG_REF_ALLOC);
                NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
        }
        return NDR_ERR_SUCCESS;
 }
 
-_PUBLIC_ void ndr_print_netr_NETRGETFORESTTRUSTINFORMATION(struct ndr_print *ndr, const char *name, int flags, const struct netr_NETRGETFORESTTRUSTINFORMATION *r)
+_PUBLIC_ void ndr_print_netr_GetForestTrustInformation(struct ndr_print *ndr, const char *name, int flags, const struct netr_GetForestTrustInformation *r)
 {
-       ndr_print_struct(ndr, name, "netr_NETRGETFORESTTRUSTINFORMATION");
+       ndr_print_struct(ndr, name, "netr_GetForestTrustInformation");
        ndr->depth++;
        if (flags & NDR_SET_VALUES) {
                ndr->flags |= LIBNDR_PRINT_SET_VALUES;
        }
        if (flags & NDR_IN) {
-               ndr_print_struct(ndr, "in", "netr_NETRGETFORESTTRUSTINFORMATION");
+               ndr_print_struct(ndr, "in", "netr_GetForestTrustInformation");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "server_name", r->in.server_name);
+               ndr->depth++;
+               if (r->in.server_name) {
+                       ndr_print_string(ndr, "server_name", r->in.server_name);
+               }
+               ndr->depth--;
+               ndr_print_ptr(ndr, "trusted_domain_name", r->in.trusted_domain_name);
+               ndr->depth++;
+               ndr_print_string(ndr, "trusted_domain_name", r->in.trusted_domain_name);
+               ndr->depth--;
+               ndr_print_ptr(ndr, "credential", r->in.credential);
                ndr->depth++;
+               ndr_print_netr_Authenticator(ndr, "credential", r->in.credential);
+               ndr->depth--;
+               ndr_print_uint32(ndr, "flags", r->in.flags);
                ndr->depth--;
        }
        if (flags & NDR_OUT) {
-               ndr_print_struct(ndr, "out", "netr_NETRGETFORESTTRUSTINFORMATION");
+               ndr_print_struct(ndr, "out", "netr_GetForestTrustInformation");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "return_authenticator", r->out.return_authenticator);
                ndr->depth++;
+               ndr_print_netr_Authenticator(ndr, "return_authenticator", r->out.return_authenticator);
+               ndr->depth--;
+               ndr_print_ptr(ndr, "forest_trust_info", r->out.forest_trust_info);
+               ndr->depth++;
+               ndr_print_ptr(ndr, "forest_trust_info", *r->out.forest_trust_info);
+               ndr->depth++;
+               ndr_print_lsa_ForestTrustInformation(ndr, "forest_trust_info", *r->out.forest_trust_info);
+               ndr->depth--;
+               ndr->depth--;
                ndr_print_WERROR(ndr, "result", r->out.result);
                ndr->depth--;
        }
@@ -13007,11 +14582,11 @@ static const struct ndr_interface_call netlogon_calls[] = {
                false,
        },
        {
-               "netr_NETRENUMERATETRUSTEDDOMAINS",
-               sizeof(struct netr_NETRENUMERATETRUSTEDDOMAINS),
-               (ndr_push_flags_fn_t) ndr_push_netr_NETRENUMERATETRUSTEDDOMAINS,
-               (ndr_pull_flags_fn_t) ndr_pull_netr_NETRENUMERATETRUSTEDDOMAINS,
-               (ndr_print_function_t) ndr_print_netr_NETRENUMERATETRUSTEDDOMAINS,
+               "netr_NetrEnumerateTrustedDomains",
+               sizeof(struct netr_NetrEnumerateTrustedDomains),
+               (ndr_push_flags_fn_t) ndr_push_netr_NetrEnumerateTrustedDomains,
+               (ndr_pull_flags_fn_t) ndr_pull_netr_NetrEnumerateTrustedDomains,
+               (ndr_print_function_t) ndr_print_netr_NetrEnumerateTrustedDomains,
                false,
        },
        {
@@ -13039,11 +14614,11 @@ static const struct ndr_interface_call netlogon_calls[] = {
                false,
        },
        {
-               "netr_NETRLOGONGETTRUSTRID",
-               sizeof(struct netr_NETRLOGONGETTRUSTRID),
-               (ndr_push_flags_fn_t) ndr_push_netr_NETRLOGONGETTRUSTRID,
-               (ndr_pull_flags_fn_t) ndr_pull_netr_NETRLOGONGETTRUSTRID,
-               (ndr_print_function_t) ndr_print_netr_NETRLOGONGETTRUSTRID,
+               "netr_LogonGetTrustRid",
+               sizeof(struct netr_LogonGetTrustRid),
+               (ndr_push_flags_fn_t) ndr_push_netr_LogonGetTrustRid,
+               (ndr_pull_flags_fn_t) ndr_pull_netr_LogonGetTrustRid,
+               (ndr_print_function_t) ndr_print_netr_LogonGetTrustRid,
                false,
        },
        {
@@ -13103,11 +14678,11 @@ static const struct ndr_interface_call netlogon_calls[] = {
                false,
        },
        {
-               "netr_NETRSERVERPASSWORDGET",
-               sizeof(struct netr_NETRSERVERPASSWORDGET),
-               (ndr_push_flags_fn_t) ndr_push_netr_NETRSERVERPASSWORDGET,
-               (ndr_pull_flags_fn_t) ndr_pull_netr_NETRSERVERPASSWORDGET,
-               (ndr_print_function_t) ndr_print_netr_NETRSERVERPASSWORDGET,
+               "netr_ServerPasswordGet",
+               sizeof(struct netr_ServerPasswordGet),
+               (ndr_push_flags_fn_t) ndr_push_netr_ServerPasswordGet,
+               (ndr_pull_flags_fn_t) ndr_pull_netr_ServerPasswordGet,
+               (ndr_print_function_t) ndr_print_netr_ServerPasswordGet,
                false,
        },
        {
@@ -13119,11 +14694,11 @@ static const struct ndr_interface_call netlogon_calls[] = {
                false,
        },
        {
-               "netr_DSRADDRESSTOSITENAMESW",
-               sizeof(struct netr_DSRADDRESSTOSITENAMESW),
-               (ndr_push_flags_fn_t) ndr_push_netr_DSRADDRESSTOSITENAMESW,
-               (ndr_pull_flags_fn_t) ndr_pull_netr_DSRADDRESSTOSITENAMESW,
-               (ndr_print_function_t) ndr_print_netr_DSRADDRESSTOSITENAMESW,
+               "netr_DsRAddressToSitenamesW",
+               sizeof(struct netr_DsRAddressToSitenamesW),
+               (ndr_push_flags_fn_t) ndr_push_netr_DsRAddressToSitenamesW,
+               (ndr_pull_flags_fn_t) ndr_pull_netr_DsRAddressToSitenamesW,
+               (ndr_print_function_t) ndr_print_netr_DsRAddressToSitenamesW,
                false,
        },
        {
@@ -13143,27 +14718,27 @@ static const struct ndr_interface_call netlogon_calls[] = {
                false,
        },
        {
-               "netr_NETRENUMERATETRUSTEDDOMAINSEX",
-               sizeof(struct netr_NETRENUMERATETRUSTEDDOMAINSEX),
-               (ndr_push_flags_fn_t) ndr_push_netr_NETRENUMERATETRUSTEDDOMAINSEX,
-               (ndr_pull_flags_fn_t) ndr_pull_netr_NETRENUMERATETRUSTEDDOMAINSEX,
-               (ndr_print_function_t) ndr_print_netr_NETRENUMERATETRUSTEDDOMAINSEX,
+               "netr_NetrEnumerateTrustedDomainsEx",
+               sizeof(struct netr_NetrEnumerateTrustedDomainsEx),
+               (ndr_push_flags_fn_t) ndr_push_netr_NetrEnumerateTrustedDomainsEx,
+               (ndr_pull_flags_fn_t) ndr_pull_netr_NetrEnumerateTrustedDomainsEx,
+               (ndr_print_function_t) ndr_print_netr_NetrEnumerateTrustedDomainsEx,
                false,
        },
        {
-               "netr_DSRADDRESSTOSITENAMESEXW",
-               sizeof(struct netr_DSRADDRESSTOSITENAMESEXW),
-               (ndr_push_flags_fn_t) ndr_push_netr_DSRADDRESSTOSITENAMESEXW,
-               (ndr_pull_flags_fn_t) ndr_pull_netr_DSRADDRESSTOSITENAMESEXW,
-               (ndr_print_function_t) ndr_print_netr_DSRADDRESSTOSITENAMESEXW,
+               "netr_DsRAddressToSitenamesExW",
+               sizeof(struct netr_DsRAddressToSitenamesExW),
+               (ndr_push_flags_fn_t) ndr_push_netr_DsRAddressToSitenamesExW,
+               (ndr_pull_flags_fn_t) ndr_pull_netr_DsRAddressToSitenamesExW,
+               (ndr_print_function_t) ndr_print_netr_DsRAddressToSitenamesExW,
                false,
        },
        {
-               "netr_DSRGETDCSITECOVERAGEW",
-               sizeof(struct netr_DSRGETDCSITECOVERAGEW),
-               (ndr_push_flags_fn_t) ndr_push_netr_DSRGETDCSITECOVERAGEW,
-               (ndr_pull_flags_fn_t) ndr_pull_netr_DSRGETDCSITECOVERAGEW,
-               (ndr_print_function_t) ndr_print_netr_DSRGETDCSITECOVERAGEW,
+               "netr_DsrGetDcSiteCoverageW",
+               sizeof(struct netr_DsrGetDcSiteCoverageW),
+               (ndr_push_flags_fn_t) ndr_push_netr_DsrGetDcSiteCoverageW,
+               (ndr_pull_flags_fn_t) ndr_pull_netr_DsrGetDcSiteCoverageW,
+               (ndr_print_function_t) ndr_print_netr_DsrGetDcSiteCoverageW,
                false,
        },
        {
@@ -13183,35 +14758,35 @@ static const struct ndr_interface_call netlogon_calls[] = {
                false,
        },
        {
-               "netr_DSRDEREGISTERDNSHOSTRECORDS",
-               sizeof(struct netr_DSRDEREGISTERDNSHOSTRECORDS),
-               (ndr_push_flags_fn_t) ndr_push_netr_DSRDEREGISTERDNSHOSTRECORDS,
-               (ndr_pull_flags_fn_t) ndr_pull_netr_DSRDEREGISTERDNSHOSTRECORDS,
-               (ndr_print_function_t) ndr_print_netr_DSRDEREGISTERDNSHOSTRECORDS,
+               "netr_DsrDeregisterDNSHostRecords",
+               sizeof(struct netr_DsrDeregisterDNSHostRecords),
+               (ndr_push_flags_fn_t) ndr_push_netr_DsrDeregisterDNSHostRecords,
+               (ndr_pull_flags_fn_t) ndr_pull_netr_DsrDeregisterDNSHostRecords,
+               (ndr_print_function_t) ndr_print_netr_DsrDeregisterDNSHostRecords,
                false,
        },
        {
-               "netr_NETRSERVERTRUSTPASSWORDSGET",
-               sizeof(struct netr_NETRSERVERTRUSTPASSWORDSGET),
-               (ndr_push_flags_fn_t) ndr_push_netr_NETRSERVERTRUSTPASSWORDSGET,
-               (ndr_pull_flags_fn_t) ndr_pull_netr_NETRSERVERTRUSTPASSWORDSGET,
-               (ndr_print_function_t) ndr_print_netr_NETRSERVERTRUSTPASSWORDSGET,
+               "netr_ServerTrustPasswordsGet",
+               sizeof(struct netr_ServerTrustPasswordsGet),
+               (ndr_push_flags_fn_t) ndr_push_netr_ServerTrustPasswordsGet,
+               (ndr_pull_flags_fn_t) ndr_pull_netr_ServerTrustPasswordsGet,
+               (ndr_print_function_t) ndr_print_netr_ServerTrustPasswordsGet,
                false,
        },
        {
-               "netr_DSRGETFORESTTRUSTINFORMATION",
-               sizeof(struct netr_DSRGETFORESTTRUSTINFORMATION),
-               (ndr_push_flags_fn_t) ndr_push_netr_DSRGETFORESTTRUSTINFORMATION,
-               (ndr_pull_flags_fn_t) ndr_pull_netr_DSRGETFORESTTRUSTINFORMATION,
-               (ndr_print_function_t) ndr_print_netr_DSRGETFORESTTRUSTINFORMATION,
+               "netr_DsRGetForestTrustInformation",
+               sizeof(struct netr_DsRGetForestTrustInformation),
+               (ndr_push_flags_fn_t) ndr_push_netr_DsRGetForestTrustInformation,
+               (ndr_pull_flags_fn_t) ndr_pull_netr_DsRGetForestTrustInformation,
+               (ndr_print_function_t) ndr_print_netr_DsRGetForestTrustInformation,
                false,
        },
        {
-               "netr_NETRGETFORESTTRUSTINFORMATION",
-               sizeof(struct netr_NETRGETFORESTTRUSTINFORMATION),
-               (ndr_push_flags_fn_t) ndr_push_netr_NETRGETFORESTTRUSTINFORMATION,
-               (ndr_pull_flags_fn_t) ndr_pull_netr_NETRGETFORESTTRUSTINFORMATION,
-               (ndr_print_function_t) ndr_print_netr_NETRGETFORESTTRUSTINFORMATION,
+               "netr_GetForestTrustInformation",
+               sizeof(struct netr_GetForestTrustInformation),
+               (ndr_push_flags_fn_t) ndr_push_netr_GetForestTrustInformation,
+               (ndr_pull_flags_fn_t) ndr_pull_netr_GetForestTrustInformation,
+               (ndr_print_function_t) ndr_print_netr_GetForestTrustInformation,
                false,
        },
        {
index 07c96f8c899e7db20db8ed6112410241dfc419b9..9a2eea8efffd0005f72543b65e74551befedb58f 100644 (file)
@@ -57,7 +57,7 @@ extern const struct ndr_interface_table ndr_table_netlogon;
 
 #define NDR_NETR_NETRLOGONSETSERVICEBITS (0x16)
 
-#define NDR_NETR_NETRLOGONGETTRUSTRID (0x17)
+#define NDR_NETR_LOGONGETTRUSTRID (0x17)
 
 #define NDR_NETR_NETRLOGONCOMPUTESERVERDIGEST (0x18)
 
@@ -73,7 +73,7 @@ extern const struct ndr_interface_table ndr_table_netlogon;
 
 #define NDR_NETR_SERVERPASSWORDSET2 (0x1e)
 
-#define NDR_NETR_NETRSERVERPASSWORDGET (0x1f)
+#define NDR_NETR_SERVERPASSWORDGET (0x1f)
 
 #define NDR_NETR_NETRLOGONSENDTOSAM (0x20)
 
@@ -95,11 +95,11 @@ extern const struct ndr_interface_table ndr_table_netlogon;
 
 #define NDR_NETR_DSRDEREGISTERDNSHOSTRECORDS (0x29)
 
-#define NDR_NETR_NETRSERVERTRUSTPASSWORDSGET (0x2a)
+#define NDR_NETR_SERVERTRUSTPASSWORDSGET (0x2a)
 
 #define NDR_NETR_DSRGETFORESTTRUSTINFORMATION (0x2b)
 
-#define NDR_NETR_NETRGETFORESTTRUSTINFORMATION (0x2c)
+#define NDR_NETR_GETFORESTTRUSTINFORMATION (0x2c)
 
 #define NDR_NETR_LOGONSAMLOGONWITHFLAGS (0x2d)
 
@@ -109,6 +109,9 @@ extern const struct ndr_interface_table ndr_table_netlogon;
 void ndr_print_netr_UasInfo(struct ndr_print *ndr, const char *name, const struct netr_UasInfo *r);
 void ndr_print_netr_UasLogoffInfo(struct ndr_print *ndr, const char *name, const struct netr_UasLogoffInfo *r);
 void ndr_print_netr_AcctLockStr(struct ndr_print *ndr, const char *name, const struct netr_AcctLockStr *r);
+enum ndr_err_code ndr_push_netr_LogonParameterControl(struct ndr_push *ndr, int ndr_flags, uint32_t r);
+enum ndr_err_code ndr_pull_netr_LogonParameterControl(struct ndr_pull *ndr, int ndr_flags, uint32_t *r);
+void ndr_print_netr_LogonParameterControl(struct ndr_print *ndr, const char *name, uint32_t r);
 void ndr_print_netr_IdentityInfo(struct ndr_print *ndr, const char *name, const struct netr_IdentityInfo *r);
 void ndr_print_netr_PasswordInfo(struct ndr_print *ndr, const char *name, const struct netr_PasswordInfo *r);
 void ndr_print_netr_ChallengeResponse(struct ndr_print *ndr, const char *name, const struct netr_ChallengeResponse *r);
@@ -116,9 +119,6 @@ void ndr_print_netr_NetworkInfo(struct ndr_print *ndr, const char *name, const s
 enum ndr_err_code ndr_push_netr_LogonLevel(struct ndr_push *ndr, int ndr_flags, const union netr_LogonLevel *r);
 enum ndr_err_code ndr_pull_netr_LogonLevel(struct ndr_pull *ndr, int ndr_flags, union netr_LogonLevel *r);
 void ndr_print_netr_LogonLevel(struct ndr_print *ndr, const char *name, const union netr_LogonLevel *r);
-enum ndr_err_code ndr_push_netr_GroupMembership(struct ndr_push *ndr, int ndr_flags, const struct netr_GroupMembership *r);
-enum ndr_err_code ndr_pull_netr_GroupMembership(struct ndr_pull *ndr, int ndr_flags, struct netr_GroupMembership *r);
-void ndr_print_netr_GroupMembership(struct ndr_print *ndr, const char *name, const struct netr_GroupMembership *r);
 enum ndr_err_code ndr_push_netr_UserSessionKey(struct ndr_push *ndr, int ndr_flags, const struct netr_UserSessionKey *r);
 enum ndr_err_code ndr_pull_netr_UserSessionKey(struct ndr_pull *ndr, int ndr_flags, struct netr_UserSessionKey *r);
 void ndr_print_netr_UserSessionKey(struct ndr_print *ndr, const char *name, const struct netr_UserSessionKey *r);
@@ -183,8 +183,11 @@ void ndr_print_netr_NETLOGON_INFO_3(struct ndr_print *ndr, const char *name, con
 void ndr_print_netr_CONTROL_QUERY_INFORMATION(struct ndr_print *ndr, const char *name, const union netr_CONTROL_QUERY_INFORMATION *r);
 void ndr_print_netr_LogonControlCode(struct ndr_print *ndr, const char *name, enum netr_LogonControlCode r);
 void ndr_print_netr_CONTROL_DATA_INFORMATION(struct ndr_print *ndr, const char *name, const union netr_CONTROL_DATA_INFORMATION *r);
-void ndr_print_netr_DsRGetDCNameInfo(struct ndr_print *ndr, const char *name, const struct netr_DsRGetDCNameInfo *r);
 void ndr_print_netr_Blob(struct ndr_print *ndr, const char *name, const struct netr_Blob *r);
+void ndr_print_netr_DsRGetDCName_flags(struct ndr_print *ndr, const char *name, uint32_t r);
+void ndr_print_netr_DsRGetDCNameInfo_AddressType(struct ndr_print *ndr, const char *name, enum netr_DsRGetDCNameInfo_AddressType r);
+void ndr_print_netr_DsR_DcFlags(struct ndr_print *ndr, const char *name, uint32_t r);
+void ndr_print_netr_DsRGetDCNameInfo(struct ndr_print *ndr, const char *name, const struct netr_DsRGetDCNameInfo *r);
 void ndr_print_netr_BinaryString(struct ndr_print *ndr, const char *name, const struct netr_BinaryString *r);
 void ndr_print_netr_DomainQuery1(struct ndr_print *ndr, const char *name, const struct netr_DomainQuery1 *r);
 void ndr_print_netr_DomainQuery(struct ndr_print *ndr, const char *name, const union netr_DomainQuery *r);
@@ -192,10 +195,15 @@ void ndr_print_netr_DomainTrustInfo(struct ndr_print *ndr, const char *name, con
 void ndr_print_netr_DomainInfo1(struct ndr_print *ndr, const char *name, const struct netr_DomainInfo1 *r);
 void ndr_print_netr_DomainInfo(struct ndr_print *ndr, const char *name, const union netr_DomainInfo *r);
 void ndr_print_netr_CryptPassword(struct ndr_print *ndr, const char *name, const struct netr_CryptPassword *r);
+void ndr_print_netr_DsRAddressToSitenamesWCtr(struct ndr_print *ndr, const char *name, const struct netr_DsRAddressToSitenamesWCtr *r);
+void ndr_print_netr_DsRAddress(struct ndr_print *ndr, const char *name, const struct netr_DsRAddress *r);
 void ndr_print_netr_TrustFlags(struct ndr_print *ndr, const char *name, uint32_t r);
 void ndr_print_netr_TrustType(struct ndr_print *ndr, const char *name, enum netr_TrustType r);
 void ndr_print_netr_TrustAttributes(struct ndr_print *ndr, const char *name, uint32_t r);
 void ndr_print_netr_DomainTrust(struct ndr_print *ndr, const char *name, const struct netr_DomainTrust *r);
+void ndr_print_netr_DomainTrustList(struct ndr_print *ndr, const char *name, const struct netr_DomainTrustList *r);
+void ndr_print_netr_DsRAddressToSitenamesExWCtr(struct ndr_print *ndr, const char *name, const struct netr_DsRAddressToSitenamesExWCtr *r);
+void ndr_print_DcSitesCtr(struct ndr_print *ndr, const char *name, const struct DcSitesCtr *r);
 void ndr_print_netr_LogonUasLogon(struct ndr_print *ndr, const char *name, int flags, const struct netr_LogonUasLogon *r);
 void ndr_print_netr_LogonUasLogoff(struct ndr_print *ndr, const char *name, int flags, const struct netr_LogonUasLogoff *r);
 void ndr_print_netr_LogonSamLogon(struct ndr_print *ndr, const char *name, int flags, const struct netr_LogonSamLogon *r);
@@ -215,11 +223,11 @@ void ndr_print_netr_ServerAuthenticate2(struct ndr_print *ndr, const char *name,
 void ndr_print_netr_DatabaseSync2(struct ndr_print *ndr, const char *name, int flags, const struct netr_DatabaseSync2 *r);
 void ndr_print_netr_DatabaseRedo(struct ndr_print *ndr, const char *name, int flags, const struct netr_DatabaseRedo *r);
 void ndr_print_netr_LogonControl2Ex(struct ndr_print *ndr, const char *name, int flags, const struct netr_LogonControl2Ex *r);
-void ndr_print_netr_NETRENUMERATETRUSTEDDOMAINS(struct ndr_print *ndr, const char *name, int flags, const struct netr_NETRENUMERATETRUSTEDDOMAINS *r);
+void ndr_print_netr_NetrEnumerateTrustedDomains(struct ndr_print *ndr, const char *name, int flags, const struct netr_NetrEnumerateTrustedDomains *r);
 void ndr_print_netr_DsRGetDCName(struct ndr_print *ndr, const char *name, int flags, const struct netr_DsRGetDCName *r);
 void ndr_print_netr_NETRLOGONDUMMYROUTINE1(struct ndr_print *ndr, const char *name, int flags, const struct netr_NETRLOGONDUMMYROUTINE1 *r);
 void ndr_print_netr_NETRLOGONSETSERVICEBITS(struct ndr_print *ndr, const char *name, int flags, const struct netr_NETRLOGONSETSERVICEBITS *r);
-void ndr_print_netr_NETRLOGONGETTRUSTRID(struct ndr_print *ndr, const char *name, int flags, const struct netr_NETRLOGONGETTRUSTRID *r);
+void ndr_print_netr_LogonGetTrustRid(struct ndr_print *ndr, const char *name, int flags, const struct netr_LogonGetTrustRid *r);
 void ndr_print_netr_NETRLOGONCOMPUTESERVERDIGEST(struct ndr_print *ndr, const char *name, int flags, const struct netr_NETRLOGONCOMPUTESERVERDIGEST *r);
 void ndr_print_netr_NETRLOGONCOMPUTECLIENTDIGEST(struct ndr_print *ndr, const char *name, int flags, const struct netr_NETRLOGONCOMPUTECLIENTDIGEST *r);
 void ndr_print_netr_ServerAuthenticate3(struct ndr_print *ndr, const char *name, int flags, const struct netr_ServerAuthenticate3 *r);
@@ -227,20 +235,20 @@ void ndr_print_netr_DsRGetDCNameEx(struct ndr_print *ndr, const char *name, int
 void ndr_print_netr_DsRGetSiteName(struct ndr_print *ndr, const char *name, int flags, const struct netr_DsRGetSiteName *r);
 void ndr_print_netr_LogonGetDomainInfo(struct ndr_print *ndr, const char *name, int flags, const struct netr_LogonGetDomainInfo *r);
 void ndr_print_netr_ServerPasswordSet2(struct ndr_print *ndr, const char *name, int flags, const struct netr_ServerPasswordSet2 *r);
-void ndr_print_netr_NETRSERVERPASSWORDGET(struct ndr_print *ndr, const char *name, int flags, const struct netr_NETRSERVERPASSWORDGET *r);
+void ndr_print_netr_ServerPasswordGet(struct ndr_print *ndr, const char *name, int flags, const struct netr_ServerPasswordGet *r);
 void ndr_print_netr_NETRLOGONSENDTOSAM(struct ndr_print *ndr, const char *name, int flags, const struct netr_NETRLOGONSENDTOSAM *r);
-void ndr_print_netr_DSRADDRESSTOSITENAMESW(struct ndr_print *ndr, const char *name, int flags, const struct netr_DSRADDRESSTOSITENAMESW *r);
+void ndr_print_netr_DsRAddressToSitenamesW(struct ndr_print *ndr, const char *name, int flags, const struct netr_DsRAddressToSitenamesW *r);
 void ndr_print_netr_DsRGetDCNameEx2(struct ndr_print *ndr, const char *name, int flags, const struct netr_DsRGetDCNameEx2 *r);
 void ndr_print_netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN(struct ndr_print *ndr, const char *name, int flags, const struct netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN *r);
-void ndr_print_netr_NETRENUMERATETRUSTEDDOMAINSEX(struct ndr_print *ndr, const char *name, int flags, const struct netr_NETRENUMERATETRUSTEDDOMAINSEX *r);
-void ndr_print_netr_DSRADDRESSTOSITENAMESEXW(struct ndr_print *ndr, const char *name, int flags, const struct netr_DSRADDRESSTOSITENAMESEXW *r);
-void ndr_print_netr_DSRGETDCSITECOVERAGEW(struct ndr_print *ndr, const char *name, int flags, const struct netr_DSRGETDCSITECOVERAGEW *r);
+void ndr_print_netr_NetrEnumerateTrustedDomainsEx(struct ndr_print *ndr, const char *name, int flags, const struct netr_NetrEnumerateTrustedDomainsEx *r);
+void ndr_print_netr_DsRAddressToSitenamesExW(struct ndr_print *ndr, const char *name, int flags, const struct netr_DsRAddressToSitenamesExW *r);
+void ndr_print_netr_DsrGetDcSiteCoverageW(struct ndr_print *ndr, const char *name, int flags, const struct netr_DsrGetDcSiteCoverageW *r);
 void ndr_print_netr_LogonSamLogonEx(struct ndr_print *ndr, const char *name, int flags, const struct netr_LogonSamLogonEx *r);
 void ndr_print_netr_DsrEnumerateDomainTrusts(struct ndr_print *ndr, const char *name, int flags, const struct netr_DsrEnumerateDomainTrusts *r);
-void ndr_print_netr_DSRDEREGISTERDNSHOSTRECORDS(struct ndr_print *ndr, const char *name, int flags, const struct netr_DSRDEREGISTERDNSHOSTRECORDS *r);
-void ndr_print_netr_NETRSERVERTRUSTPASSWORDSGET(struct ndr_print *ndr, const char *name, int flags, const struct netr_NETRSERVERTRUSTPASSWORDSGET *r);
-void ndr_print_netr_DSRGETFORESTTRUSTINFORMATION(struct ndr_print *ndr, const char *name, int flags, const struct netr_DSRGETFORESTTRUSTINFORMATION *r);
-void ndr_print_netr_NETRGETFORESTTRUSTINFORMATION(struct ndr_print *ndr, const char *name, int flags, const struct netr_NETRGETFORESTTRUSTINFORMATION *r);
+void ndr_print_netr_DsrDeregisterDNSHostRecords(struct ndr_print *ndr, const char *name, int flags, const struct netr_DsrDeregisterDNSHostRecords *r);
+void ndr_print_netr_ServerTrustPasswordsGet(struct ndr_print *ndr, const char *name, int flags, const struct netr_ServerTrustPasswordsGet *r);
+void ndr_print_netr_DsRGetForestTrustInformation(struct ndr_print *ndr, const char *name, int flags, const struct netr_DsRGetForestTrustInformation *r);
+void ndr_print_netr_GetForestTrustInformation(struct ndr_print *ndr, const char *name, int flags, const struct netr_GetForestTrustInformation *r);
 void ndr_print_netr_LogonSamLogonWithFlags(struct ndr_print *ndr, const char *name, int flags, const struct netr_LogonSamLogonWithFlags *r);
 void ndr_print_netr_NETRSERVERGETTRUSTINFO(struct ndr_print *ndr, const char *name, int flags, const struct netr_NETRSERVERGETTRUSTINFO *r);
 #endif /* _HEADER_NDR_netlogon */
diff --git a/source/librpc/gen_ndr/ndr_samr.c b/source/librpc/gen_ndr/ndr_samr.c
new file mode 100644 (file)
index 0000000..adbe549
--- /dev/null
@@ -0,0 +1,12296 @@
+/* parser auto-generated by pidl */
+
+#include "includes.h"
+#include "librpc/gen_ndr/ndr_samr.h"
+
+#include "librpc/gen_ndr/ndr_misc.h"
+#include "librpc/gen_ndr/ndr_lsa.h"
+#include "librpc/gen_ndr/ndr_security.h"
+_PUBLIC_ enum ndr_err_code ndr_push_samr_AcctFlags(struct ndr_push *ndr, int ndr_flags, uint32_t r)
+{
+       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_samr_AcctFlags(struct ndr_pull *ndr, int ndr_flags, uint32_t *r)
+{
+       uint32_t v;
+       NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
+       *r = v;
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_AcctFlags(struct ndr_print *ndr, const char *name, uint32_t r)
+{
+       ndr_print_uint32(ndr, name, r);
+       ndr->depth++;
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ACB_DISABLED", ACB_DISABLED, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ACB_HOMDIRREQ", ACB_HOMDIRREQ, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ACB_PWNOTREQ", ACB_PWNOTREQ, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ACB_TEMPDUP", ACB_TEMPDUP, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ACB_NORMAL", ACB_NORMAL, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ACB_MNS", ACB_MNS, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ACB_DOMTRUST", ACB_DOMTRUST, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ACB_WSTRUST", ACB_WSTRUST, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ACB_SVRTRUST", ACB_SVRTRUST, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ACB_PWNOEXP", ACB_PWNOEXP, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ACB_AUTOLOCK", ACB_AUTOLOCK, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ACB_ENC_TXT_PWD_ALLOWED", ACB_ENC_TXT_PWD_ALLOWED, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ACB_SMARTCARD_REQUIRED", ACB_SMARTCARD_REQUIRED, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ACB_TRUSTED_FOR_DELEGATION", ACB_TRUSTED_FOR_DELEGATION, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ACB_NOT_DELEGATED", ACB_NOT_DELEGATED, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ACB_USE_DES_KEY_ONLY", ACB_USE_DES_KEY_ONLY, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ACB_DONT_REQUIRE_PREAUTH", ACB_DONT_REQUIRE_PREAUTH, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ACB_PW_EXPIRED", ACB_PW_EXPIRED, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ACB_NO_AUTH_DATA_REQD", ACB_NO_AUTH_DATA_REQD, r);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_ConnectAccessMask(struct ndr_push *ndr, int ndr_flags, uint32_t r)
+{
+       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_ConnectAccessMask(struct ndr_pull *ndr, int ndr_flags, uint32_t *r)
+{
+       uint32_t v;
+       NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
+       *r = v;
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_ConnectAccessMask(struct ndr_print *ndr, const char *name, uint32_t r)
+{
+       ndr_print_uint32(ndr, name, r);
+       ndr->depth++;
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_ACCESS_CONNECT_TO_SERVER", SAMR_ACCESS_CONNECT_TO_SERVER, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_ACCESS_SHUTDOWN_SERVER", SAMR_ACCESS_SHUTDOWN_SERVER, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_ACCESS_INITIALIZE_SERVER", SAMR_ACCESS_INITIALIZE_SERVER, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_ACCESS_CREATE_DOMAIN", SAMR_ACCESS_CREATE_DOMAIN, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_ACCESS_ENUM_DOMAINS", SAMR_ACCESS_ENUM_DOMAINS, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_ACCESS_OPEN_DOMAIN", SAMR_ACCESS_OPEN_DOMAIN, r);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_UserAccessMask(struct ndr_push *ndr, int ndr_flags, uint32_t r)
+{
+       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_UserAccessMask(struct ndr_pull *ndr, int ndr_flags, uint32_t *r)
+{
+       uint32_t v;
+       NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
+       *r = v;
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_UserAccessMask(struct ndr_print *ndr, const char *name, uint32_t r)
+{
+       ndr_print_uint32(ndr, name, r);
+       ndr->depth++;
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_USER_ACCESS_GET_NAME_ETC", SAMR_USER_ACCESS_GET_NAME_ETC, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_USER_ACCESS_GET_LOCALE", SAMR_USER_ACCESS_GET_LOCALE, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_USER_ACCESS_SET_LOC_COM", SAMR_USER_ACCESS_SET_LOC_COM, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_USER_ACCESS_GET_LOGONINFO", SAMR_USER_ACCESS_GET_LOGONINFO, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_USER_ACCESS_GET_ATTRIBUTES", SAMR_USER_ACCESS_GET_ATTRIBUTES, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_USER_ACCESS_SET_ATTRIBUTES", SAMR_USER_ACCESS_SET_ATTRIBUTES, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_USER_ACCESS_CHANGE_PASSWORD", SAMR_USER_ACCESS_CHANGE_PASSWORD, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_USER_ACCESS_SET_PASSWORD", SAMR_USER_ACCESS_SET_PASSWORD, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_USER_ACCESS_GET_GROUPS", SAMR_USER_ACCESS_GET_GROUPS, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_USER_ACCESS_GET_GROUP_MEMBERSHIP", SAMR_USER_ACCESS_GET_GROUP_MEMBERSHIP, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_USER_ACCESS_CHANGE_GROUP_MEMBERSHIP", SAMR_USER_ACCESS_CHANGE_GROUP_MEMBERSHIP, r);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_DomainAccessMask(struct ndr_push *ndr, int ndr_flags, uint32_t r)
+{
+       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_DomainAccessMask(struct ndr_pull *ndr, int ndr_flags, uint32_t *r)
+{
+       uint32_t v;
+       NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
+       *r = v;
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_DomainAccessMask(struct ndr_print *ndr, const char *name, uint32_t r)
+{
+       ndr_print_uint32(ndr, name, r);
+       ndr->depth++;
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_DOMAIN_ACCESS_LOOKUP_INFO_1", SAMR_DOMAIN_ACCESS_LOOKUP_INFO_1, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_DOMAIN_ACCESS_SET_INFO_1", SAMR_DOMAIN_ACCESS_SET_INFO_1, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_DOMAIN_ACCESS_LOOKUP_INFO_2", SAMR_DOMAIN_ACCESS_LOOKUP_INFO_2, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_DOMAIN_ACCESS_SET_INFO_2", SAMR_DOMAIN_ACCESS_SET_INFO_2, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_DOMAIN_ACCESS_CREATE_USER", SAMR_DOMAIN_ACCESS_CREATE_USER, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_DOMAIN_ACCESS_CREATE_GROUP", SAMR_DOMAIN_ACCESS_CREATE_GROUP, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_DOMAIN_ACCESS_CREATE_ALIAS", SAMR_DOMAIN_ACCESS_CREATE_ALIAS, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_DOMAIN_ACCESS_LOOKUP_ALIAS", SAMR_DOMAIN_ACCESS_LOOKUP_ALIAS, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_DOMAIN_ACCESS_ENUM_ACCOUNTS", SAMR_DOMAIN_ACCESS_ENUM_ACCOUNTS, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_DOMAIN_ACCESS_OPEN_ACCOUNT", SAMR_DOMAIN_ACCESS_OPEN_ACCOUNT, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_DOMAIN_ACCESS_SET_INFO_3", SAMR_DOMAIN_ACCESS_SET_INFO_3, r);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_GroupAccessMask(struct ndr_push *ndr, int ndr_flags, uint32_t r)
+{
+       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_GroupAccessMask(struct ndr_pull *ndr, int ndr_flags, uint32_t *r)
+{
+       uint32_t v;
+       NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
+       *r = v;
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_GroupAccessMask(struct ndr_print *ndr, const char *name, uint32_t r)
+{
+       ndr_print_uint32(ndr, name, r);
+       ndr->depth++;
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_GROUP_ACCESS_LOOKUP_INFO", SAMR_GROUP_ACCESS_LOOKUP_INFO, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_GROUP_ACCESS_SET_INFO", SAMR_GROUP_ACCESS_SET_INFO, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_GROUP_ACCESS_ADD_MEMBER", SAMR_GROUP_ACCESS_ADD_MEMBER, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_GROUP_ACCESS_REMOVE_MEMBER", SAMR_GROUP_ACCESS_REMOVE_MEMBER, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_GROUP_ACCESS_GET_MEMBERS", SAMR_GROUP_ACCESS_GET_MEMBERS, r);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_AliasAccessMask(struct ndr_push *ndr, int ndr_flags, uint32_t r)
+{
+       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_AliasAccessMask(struct ndr_pull *ndr, int ndr_flags, uint32_t *r)
+{
+       uint32_t v;
+       NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
+       *r = v;
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_AliasAccessMask(struct ndr_print *ndr, const char *name, uint32_t r)
+{
+       ndr_print_uint32(ndr, name, r);
+       ndr->depth++;
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_ALIAS_ACCESS_ADD_MEMBER", SAMR_ALIAS_ACCESS_ADD_MEMBER, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_ALIAS_ACCESS_REMOVE_MEMBER", SAMR_ALIAS_ACCESS_REMOVE_MEMBER, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_ALIAS_ACCESS_GET_MEMBERS", SAMR_ALIAS_ACCESS_GET_MEMBERS, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_ALIAS_ACCESS_LOOKUP_INFO", SAMR_ALIAS_ACCESS_LOOKUP_INFO, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_ALIAS_ACCESS_SET_INFO", SAMR_ALIAS_ACCESS_SET_INFO, r);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_SamEntry(struct ndr_push *ndr, int ndr_flags, const struct samr_SamEntry *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->idx));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->name));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->name));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_SamEntry(struct ndr_pull *ndr, int ndr_flags, struct samr_SamEntry *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->idx));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->name));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->name));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_SamEntry(struct ndr_print *ndr, const char *name, const struct samr_SamEntry *r)
+{
+       ndr_print_struct(ndr, name, "samr_SamEntry");
+       ndr->depth++;
+       ndr_print_uint32(ndr, "idx", r->idx);
+       ndr_print_lsa_String(ndr, "name", &r->name);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_SamArray(struct ndr_push *ndr, int ndr_flags, const struct samr_SamArray *r)
+{
+       uint32_t cntr_entries_1;
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count));
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->entries));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               if (r->entries) {
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count));
+                       for (cntr_entries_1 = 0; cntr_entries_1 < r->count; cntr_entries_1++) {
+                               NDR_CHECK(ndr_push_samr_SamEntry(ndr, NDR_SCALARS, &r->entries[cntr_entries_1]));
+                       }
+                       for (cntr_entries_1 = 0; cntr_entries_1 < r->count; cntr_entries_1++) {
+                               NDR_CHECK(ndr_push_samr_SamEntry(ndr, NDR_BUFFERS, &r->entries[cntr_entries_1]));
+                       }
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_SamArray(struct ndr_pull *ndr, int ndr_flags, struct samr_SamArray *r)
+{
+       uint32_t _ptr_entries;
+       uint32_t cntr_entries_1;
+       TALLOC_CTX *_mem_save_entries_0;
+       TALLOC_CTX *_mem_save_entries_1;
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->count));
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_entries));
+               if (_ptr_entries) {
+                       NDR_PULL_ALLOC(ndr, r->entries);
+               } else {
+                       r->entries = NULL;
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               if (r->entries) {
+                       _mem_save_entries_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->entries, 0);
+                       NDR_CHECK(ndr_pull_array_size(ndr, &r->entries));
+                       NDR_PULL_ALLOC_N(ndr, r->entries, ndr_get_array_size(ndr, &r->entries));
+                       _mem_save_entries_1 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->entries, 0);
+                       for (cntr_entries_1 = 0; cntr_entries_1 < r->count; cntr_entries_1++) {
+                               NDR_CHECK(ndr_pull_samr_SamEntry(ndr, NDR_SCALARS, &r->entries[cntr_entries_1]));
+                       }
+                       for (cntr_entries_1 = 0; cntr_entries_1 < r->count; cntr_entries_1++) {
+                               NDR_CHECK(ndr_pull_samr_SamEntry(ndr, NDR_BUFFERS, &r->entries[cntr_entries_1]));
+                       }
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_entries_1, 0);
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_entries_0, 0);
+               }
+               if (r->entries) {
+                       NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->entries, r->count));
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_SamArray(struct ndr_print *ndr, const char *name, const struct samr_SamArray *r)
+{
+       uint32_t cntr_entries_1;
+       ndr_print_struct(ndr, name, "samr_SamArray");
+       ndr->depth++;
+       ndr_print_uint32(ndr, "count", r->count);
+       ndr_print_ptr(ndr, "entries", r->entries);
+       ndr->depth++;
+       if (r->entries) {
+               ndr->print(ndr, "%s: ARRAY(%d)", "entries", r->count);
+               ndr->depth++;
+               for (cntr_entries_1=0;cntr_entries_1<r->count;cntr_entries_1++) {
+                       char *idx_1=NULL;
+                       asprintf(&idx_1, "[%d]", cntr_entries_1);
+                       if (idx_1) {
+                               ndr_print_samr_SamEntry(ndr, "entries", &r->entries[cntr_entries_1]);
+                               free(idx_1);
+                       }
+               }
+               ndr->depth--;
+       }
+       ndr->depth--;
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_Role(struct ndr_push *ndr, int ndr_flags, enum samr_Role r)
+{
+       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_Role(struct ndr_pull *ndr, int ndr_flags, enum samr_Role *r)
+{
+       uint32_t v;
+       NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
+       *r = v;
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_Role(struct ndr_print *ndr, const char *name, enum samr_Role r)
+{
+       const char *val = NULL;
+
+       switch (r) {
+               case SAMR_ROLE_STANDALONE: val = "SAMR_ROLE_STANDALONE"; break;
+               case SAMR_ROLE_DOMAIN_MEMBER: val = "SAMR_ROLE_DOMAIN_MEMBER"; break;
+               case SAMR_ROLE_DOMAIN_BDC: val = "SAMR_ROLE_DOMAIN_BDC"; break;
+               case SAMR_ROLE_DOMAIN_PDC: val = "SAMR_ROLE_DOMAIN_PDC"; break;
+       }
+       ndr_print_enum(ndr, name, "ENUM", val, r);
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_samr_PasswordProperties(struct ndr_push *ndr, int ndr_flags, uint32_t r)
+{
+       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_samr_PasswordProperties(struct ndr_pull *ndr, int ndr_flags, uint32_t *r)
+{
+       uint32_t v;
+       NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
+       *r = v;
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_PasswordProperties(struct ndr_print *ndr, const char *name, uint32_t r)
+{
+       ndr_print_uint32(ndr, name, r);
+       ndr->depth++;
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DOMAIN_PASSWORD_COMPLEX", DOMAIN_PASSWORD_COMPLEX, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DOMAIN_PASSWORD_NO_ANON_CHANGE", DOMAIN_PASSWORD_NO_ANON_CHANGE, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DOMAIN_PASSWORD_NO_CLEAR_CHANGE", DOMAIN_PASSWORD_NO_CLEAR_CHANGE, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DOMAIN_PASSWORD_LOCKOUT_ADMINS", DOMAIN_PASSWORD_LOCKOUT_ADMINS, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DOMAIN_PASSWORD_STORE_CLEARTEXT", DOMAIN_PASSWORD_STORE_CLEARTEXT, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DOMAIN_REFUSE_PASSWORD_CHANGE", DOMAIN_REFUSE_PASSWORD_CHANGE, r);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_DomInfo1(struct ndr_push *ndr, int ndr_flags, const struct samr_DomInfo1 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->min_password_length));
+               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->password_history_length));
+               NDR_CHECK(ndr_push_samr_PasswordProperties(ndr, NDR_SCALARS, r->password_properties));
+               NDR_CHECK(ndr_push_dlong(ndr, NDR_SCALARS, r->max_password_age));
+               NDR_CHECK(ndr_push_dlong(ndr, NDR_SCALARS, r->min_password_age));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_DomInfo1(struct ndr_pull *ndr, int ndr_flags, struct samr_DomInfo1 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->min_password_length));
+               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->password_history_length));
+               NDR_CHECK(ndr_pull_samr_PasswordProperties(ndr, NDR_SCALARS, &r->password_properties));
+               NDR_CHECK(ndr_pull_dlong(ndr, NDR_SCALARS, &r->max_password_age));
+               NDR_CHECK(ndr_pull_dlong(ndr, NDR_SCALARS, &r->min_password_age));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_DomInfo1(struct ndr_print *ndr, const char *name, const struct samr_DomInfo1 *r)
+{
+       ndr_print_struct(ndr, name, "samr_DomInfo1");
+       ndr->depth++;
+       ndr_print_uint16(ndr, "min_password_length", r->min_password_length);
+       ndr_print_uint16(ndr, "password_history_length", r->password_history_length);
+       ndr_print_samr_PasswordProperties(ndr, "password_properties", r->password_properties);
+       ndr_print_dlong(ndr, "max_password_age", r->max_password_age);
+       ndr_print_dlong(ndr, "min_password_age", r->min_password_age);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_DomInfo2(struct ndr_push *ndr, int ndr_flags, const struct samr_DomInfo2 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->force_logoff_time));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->comment));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->domain_name));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->primary));
+               NDR_CHECK(ndr_push_udlong(ndr, NDR_SCALARS, r->sequence_num));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->unknown2));
+               NDR_CHECK(ndr_push_samr_Role(ndr, NDR_SCALARS, r->role));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->unknown3));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num_users));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num_groups));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num_aliases));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->comment));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->domain_name));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->primary));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_DomInfo2(struct ndr_pull *ndr, int ndr_flags, struct samr_DomInfo2 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->force_logoff_time));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->comment));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->domain_name));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->primary));
+               NDR_CHECK(ndr_pull_udlong(ndr, NDR_SCALARS, &r->sequence_num));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->unknown2));
+               NDR_CHECK(ndr_pull_samr_Role(ndr, NDR_SCALARS, &r->role));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->unknown3));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->num_users));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->num_groups));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->num_aliases));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->comment));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->domain_name));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->primary));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_DomInfo2(struct ndr_print *ndr, const char *name, const struct samr_DomInfo2 *r)
+{
+       ndr_print_struct(ndr, name, "samr_DomInfo2");
+       ndr->depth++;
+       ndr_print_NTTIME(ndr, "force_logoff_time", r->force_logoff_time);
+       ndr_print_lsa_String(ndr, "comment", &r->comment);
+       ndr_print_lsa_String(ndr, "domain_name", &r->domain_name);
+       ndr_print_lsa_String(ndr, "primary", &r->primary);
+       ndr_print_udlong(ndr, "sequence_num", r->sequence_num);
+       ndr_print_uint32(ndr, "unknown2", r->unknown2);
+       ndr_print_samr_Role(ndr, "role", r->role);
+       ndr_print_uint32(ndr, "unknown3", r->unknown3);
+       ndr_print_uint32(ndr, "num_users", r->num_users);
+       ndr_print_uint32(ndr, "num_groups", r->num_groups);
+       ndr_print_uint32(ndr, "num_aliases", r->num_aliases);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_DomInfo3(struct ndr_push *ndr, int ndr_flags, const struct samr_DomInfo3 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->force_logoff_time));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_DomInfo3(struct ndr_pull *ndr, int ndr_flags, struct samr_DomInfo3 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->force_logoff_time));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_DomInfo3(struct ndr_print *ndr, const char *name, const struct samr_DomInfo3 *r)
+{
+       ndr_print_struct(ndr, name, "samr_DomInfo3");
+       ndr->depth++;
+       ndr_print_NTTIME(ndr, "force_logoff_time", r->force_logoff_time);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_DomInfo4(struct ndr_push *ndr, int ndr_flags, const struct samr_DomInfo4 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->comment));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->comment));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_DomInfo4(struct ndr_pull *ndr, int ndr_flags, struct samr_DomInfo4 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->comment));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->comment));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_DomInfo4(struct ndr_print *ndr, const char *name, const struct samr_DomInfo4 *r)
+{
+       ndr_print_struct(ndr, name, "samr_DomInfo4");
+       ndr->depth++;
+       ndr_print_lsa_String(ndr, "comment", &r->comment);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_DomInfo5(struct ndr_push *ndr, int ndr_flags, const struct samr_DomInfo5 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->domain_name));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->domain_name));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_DomInfo5(struct ndr_pull *ndr, int ndr_flags, struct samr_DomInfo5 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->domain_name));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->domain_name));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_DomInfo5(struct ndr_print *ndr, const char *name, const struct samr_DomInfo5 *r)
+{
+       ndr_print_struct(ndr, name, "samr_DomInfo5");
+       ndr->depth++;
+       ndr_print_lsa_String(ndr, "domain_name", &r->domain_name);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_DomInfo6(struct ndr_push *ndr, int ndr_flags, const struct samr_DomInfo6 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->primary));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->primary));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_DomInfo6(struct ndr_pull *ndr, int ndr_flags, struct samr_DomInfo6 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->primary));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->primary));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_DomInfo6(struct ndr_print *ndr, const char *name, const struct samr_DomInfo6 *r)
+{
+       ndr_print_struct(ndr, name, "samr_DomInfo6");
+       ndr->depth++;
+       ndr_print_lsa_String(ndr, "primary", &r->primary);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_DomInfo7(struct ndr_push *ndr, int ndr_flags, const struct samr_DomInfo7 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_samr_Role(ndr, NDR_SCALARS, r->role));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_DomInfo7(struct ndr_pull *ndr, int ndr_flags, struct samr_DomInfo7 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_samr_Role(ndr, NDR_SCALARS, &r->role));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_DomInfo7(struct ndr_print *ndr, const char *name, const struct samr_DomInfo7 *r)
+{
+       ndr_print_struct(ndr, name, "samr_DomInfo7");
+       ndr->depth++;
+       ndr_print_samr_Role(ndr, "role", r->role);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_DomInfo8(struct ndr_push *ndr, int ndr_flags, const struct samr_DomInfo8 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 8));
+               NDR_CHECK(ndr_push_hyper(ndr, NDR_SCALARS, r->sequence_num));
+               NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->domain_create_time));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_DomInfo8(struct ndr_pull *ndr, int ndr_flags, struct samr_DomInfo8 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 8));
+               NDR_CHECK(ndr_pull_hyper(ndr, NDR_SCALARS, &r->sequence_num));
+               NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->domain_create_time));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_DomInfo8(struct ndr_print *ndr, const char *name, const struct samr_DomInfo8 *r)
+{
+       ndr_print_struct(ndr, name, "samr_DomInfo8");
+       ndr->depth++;
+       ndr_print_hyper(ndr, "sequence_num", r->sequence_num);
+       ndr_print_NTTIME(ndr, "domain_create_time", r->domain_create_time);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_DomInfo9(struct ndr_push *ndr, int ndr_flags, const struct samr_DomInfo9 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->unknown));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_DomInfo9(struct ndr_pull *ndr, int ndr_flags, struct samr_DomInfo9 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->unknown));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_DomInfo9(struct ndr_print *ndr, const char *name, const struct samr_DomInfo9 *r)
+{
+       ndr_print_struct(ndr, name, "samr_DomInfo9");
+       ndr->depth++;
+       ndr_print_uint32(ndr, "unknown", r->unknown);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_DomInfo11(struct ndr_push *ndr, int ndr_flags, const struct samr_DomInfo11 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 8));
+               NDR_CHECK(ndr_push_samr_DomInfo2(ndr, NDR_SCALARS, &r->info2));
+               NDR_CHECK(ndr_push_hyper(ndr, NDR_SCALARS, r->lockout_duration));
+               NDR_CHECK(ndr_push_hyper(ndr, NDR_SCALARS, r->lockout_window));
+               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lockout_threshold));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_push_samr_DomInfo2(ndr, NDR_BUFFERS, &r->info2));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_DomInfo11(struct ndr_pull *ndr, int ndr_flags, struct samr_DomInfo11 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 8));
+               NDR_CHECK(ndr_pull_samr_DomInfo2(ndr, NDR_SCALARS, &r->info2));
+               NDR_CHECK(ndr_pull_hyper(ndr, NDR_SCALARS, &r->lockout_duration));
+               NDR_CHECK(ndr_pull_hyper(ndr, NDR_SCALARS, &r->lockout_window));
+               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lockout_threshold));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_pull_samr_DomInfo2(ndr, NDR_BUFFERS, &r->info2));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_DomInfo11(struct ndr_print *ndr, const char *name, const struct samr_DomInfo11 *r)
+{
+       ndr_print_struct(ndr, name, "samr_DomInfo11");
+       ndr->depth++;
+       ndr_print_samr_DomInfo2(ndr, "info2", &r->info2);
+       ndr_print_hyper(ndr, "lockout_duration", r->lockout_duration);
+       ndr_print_hyper(ndr, "lockout_window", r->lockout_window);
+       ndr_print_uint16(ndr, "lockout_threshold", r->lockout_threshold);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_DomInfo12(struct ndr_push *ndr, int ndr_flags, const struct samr_DomInfo12 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 8));
+               NDR_CHECK(ndr_push_hyper(ndr, NDR_SCALARS, r->lockout_duration));
+               NDR_CHECK(ndr_push_hyper(ndr, NDR_SCALARS, r->lockout_window));
+               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lockout_threshold));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_DomInfo12(struct ndr_pull *ndr, int ndr_flags, struct samr_DomInfo12 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 8));
+               NDR_CHECK(ndr_pull_hyper(ndr, NDR_SCALARS, &r->lockout_duration));
+               NDR_CHECK(ndr_pull_hyper(ndr, NDR_SCALARS, &r->lockout_window));
+               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lockout_threshold));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_DomInfo12(struct ndr_print *ndr, const char *name, const struct samr_DomInfo12 *r)
+{
+       ndr_print_struct(ndr, name, "samr_DomInfo12");
+       ndr->depth++;
+       ndr_print_hyper(ndr, "lockout_duration", r->lockout_duration);
+       ndr_print_hyper(ndr, "lockout_window", r->lockout_window);
+       ndr_print_uint16(ndr, "lockout_threshold", r->lockout_threshold);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_DomInfo13(struct ndr_push *ndr, int ndr_flags, const struct samr_DomInfo13 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 8));
+               NDR_CHECK(ndr_push_hyper(ndr, NDR_SCALARS, r->sequence_num));
+               NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->domain_create_time));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->unknown1));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->unknown2));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_DomInfo13(struct ndr_pull *ndr, int ndr_flags, struct samr_DomInfo13 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 8));
+               NDR_CHECK(ndr_pull_hyper(ndr, NDR_SCALARS, &r->sequence_num));
+               NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->domain_create_time));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->unknown1));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->unknown2));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_DomInfo13(struct ndr_print *ndr, const char *name, const struct samr_DomInfo13 *r)
+{
+       ndr_print_struct(ndr, name, "samr_DomInfo13");
+       ndr->depth++;
+       ndr_print_hyper(ndr, "sequence_num", r->sequence_num);
+       ndr_print_NTTIME(ndr, "domain_create_time", r->domain_create_time);
+       ndr_print_uint32(ndr, "unknown1", r->unknown1);
+       ndr_print_uint32(ndr, "unknown2", r->unknown2);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_DomainInfo(struct ndr_push *ndr, int ndr_flags, const union samr_DomainInfo *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               int level = ndr_push_get_switch_value(ndr, r);
+               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, level));
+               switch (level) {
+                       case 1:
+                               NDR_CHECK(ndr_push_samr_DomInfo1(ndr, NDR_SCALARS, &r->info1));
+                       break;
+
+                       case 2:
+                               NDR_CHECK(ndr_push_samr_DomInfo2(ndr, NDR_SCALARS, &r->info2));
+                       break;
+
+                       case 3:
+                               NDR_CHECK(ndr_push_samr_DomInfo3(ndr, NDR_SCALARS, &r->info3));
+                       break;
+
+                       case 4:
+                               NDR_CHECK(ndr_push_samr_DomInfo4(ndr, NDR_SCALARS, &r->info4));
+                       break;
+
+                       case 5:
+                               NDR_CHECK(ndr_push_samr_DomInfo5(ndr, NDR_SCALARS, &r->info5));
+                       break;
+
+                       case 6:
+                               NDR_CHECK(ndr_push_samr_DomInfo6(ndr, NDR_SCALARS, &r->info6));
+                       break;
+
+                       case 7:
+                               NDR_CHECK(ndr_push_samr_DomInfo7(ndr, NDR_SCALARS, &r->info7));
+                       break;
+
+                       case 8:
+                               NDR_CHECK(ndr_push_samr_DomInfo8(ndr, NDR_SCALARS, &r->info8));
+                       break;
+
+                       case 9:
+                               NDR_CHECK(ndr_push_samr_DomInfo9(ndr, NDR_SCALARS, &r->info9));
+                       break;
+
+                       case 11:
+                               NDR_CHECK(ndr_push_samr_DomInfo11(ndr, NDR_SCALARS, &r->info11));
+                       break;
+
+                       case 12:
+                               NDR_CHECK(ndr_push_samr_DomInfo12(ndr, NDR_SCALARS, &r->info12));
+                       break;
+
+                       case 13:
+                               NDR_CHECK(ndr_push_samr_DomInfo13(ndr, NDR_SCALARS, &r->info13));
+                       break;
+
+                       default:
+                               return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               int level = ndr_push_get_switch_value(ndr, r);
+               switch (level) {
+                       case 1:
+                       break;
+
+                       case 2:
+                               NDR_CHECK(ndr_push_samr_DomInfo2(ndr, NDR_BUFFERS, &r->info2));
+                       break;
+
+                       case 3:
+                       break;
+
+                       case 4:
+                               NDR_CHECK(ndr_push_samr_DomInfo4(ndr, NDR_BUFFERS, &r->info4));
+                       break;
+
+                       case 5:
+                               NDR_CHECK(ndr_push_samr_DomInfo5(ndr, NDR_BUFFERS, &r->info5));
+                       break;
+
+                       case 6:
+                               NDR_CHECK(ndr_push_samr_DomInfo6(ndr, NDR_BUFFERS, &r->info6));
+                       break;
+
+                       case 7:
+                       break;
+
+                       case 8:
+                       break;
+
+                       case 9:
+                       break;
+
+                       case 11:
+                               NDR_CHECK(ndr_push_samr_DomInfo11(ndr, NDR_BUFFERS, &r->info11));
+                       break;
+
+                       case 12:
+                       break;
+
+                       case 13:
+                       break;
+
+                       default:
+                               return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_DomainInfo(struct ndr_pull *ndr, int ndr_flags, union samr_DomainInfo *r)
+{
+       int level;
+       uint16_t _level;
+       level = ndr_pull_get_switch_value(ndr, r);
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &_level));
+               if (_level != level) {
+                       return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u for r", _level);
+               }
+               switch (level) {
+                       case 1: {
+                               NDR_CHECK(ndr_pull_samr_DomInfo1(ndr, NDR_SCALARS, &r->info1));
+                       break; }
+
+                       case 2: {
+                               NDR_CHECK(ndr_pull_samr_DomInfo2(ndr, NDR_SCALARS, &r->info2));
+                       break; }
+
+                       case 3: {
+                               NDR_CHECK(ndr_pull_samr_DomInfo3(ndr, NDR_SCALARS, &r->info3));
+                       break; }
+
+                       case 4: {
+                               NDR_CHECK(ndr_pull_samr_DomInfo4(ndr, NDR_SCALARS, &r->info4));
+                       break; }
+
+                       case 5: {
+                               NDR_CHECK(ndr_pull_samr_DomInfo5(ndr, NDR_SCALARS, &r->info5));
+                       break; }
+
+                       case 6: {
+                               NDR_CHECK(ndr_pull_samr_DomInfo6(ndr, NDR_SCALARS, &r->info6));
+                       break; }
+
+                       case 7: {
+                               NDR_CHECK(ndr_pull_samr_DomInfo7(ndr, NDR_SCALARS, &r->info7));
+                       break; }
+
+                       case 8: {
+                               NDR_CHECK(ndr_pull_samr_DomInfo8(ndr, NDR_SCALARS, &r->info8));
+                       break; }
+
+                       case 9: {
+                               NDR_CHECK(ndr_pull_samr_DomInfo9(ndr, NDR_SCALARS, &r->info9));
+                       break; }
+
+                       case 11: {
+                               NDR_CHECK(ndr_pull_samr_DomInfo11(ndr, NDR_SCALARS, &r->info11));
+                       break; }
+
+                       case 12: {
+                               NDR_CHECK(ndr_pull_samr_DomInfo12(ndr, NDR_SCALARS, &r->info12));
+                       break; }
+
+                       case 13: {
+                               NDR_CHECK(ndr_pull_samr_DomInfo13(ndr, NDR_SCALARS, &r->info13));
+                       break; }
+
+                       default:
+                               return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               switch (level) {
+                       case 1:
+                       break;
+
+                       case 2:
+                               NDR_CHECK(ndr_pull_samr_DomInfo2(ndr, NDR_BUFFERS, &r->info2));
+                       break;
+
+                       case 3:
+                       break;
+
+                       case 4:
+                               NDR_CHECK(ndr_pull_samr_DomInfo4(ndr, NDR_BUFFERS, &r->info4));
+                       break;
+
+                       case 5:
+                               NDR_CHECK(ndr_pull_samr_DomInfo5(ndr, NDR_BUFFERS, &r->info5));
+                       break;
+
+                       case 6:
+                               NDR_CHECK(ndr_pull_samr_DomInfo6(ndr, NDR_BUFFERS, &r->info6));
+                       break;
+
+                       case 7:
+                       break;
+
+                       case 8:
+                       break;
+
+                       case 9:
+                       break;
+
+                       case 11:
+                               NDR_CHECK(ndr_pull_samr_DomInfo11(ndr, NDR_BUFFERS, &r->info11));
+                       break;
+
+                       case 12:
+                       break;
+
+                       case 13:
+                       break;
+
+                       default:
+                               return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_DomainInfo(struct ndr_print *ndr, const char *name, const union samr_DomainInfo *r)
+{
+       int level;
+       level = ndr_print_get_switch_value(ndr, r);
+       ndr_print_union(ndr, name, level, "samr_DomainInfo");
+       switch (level) {
+               case 1:
+                       ndr_print_samr_DomInfo1(ndr, "info1", &r->info1);
+               break;
+
+               case 2:
+                       ndr_print_samr_DomInfo2(ndr, "info2", &r->info2);
+               break;
+
+               case 3:
+                       ndr_print_samr_DomInfo3(ndr, "info3", &r->info3);
+               break;
+
+               case 4:
+                       ndr_print_samr_DomInfo4(ndr, "info4", &r->info4);
+               break;
+
+               case 5:
+                       ndr_print_samr_DomInfo5(ndr, "info5", &r->info5);
+               break;
+
+               case 6:
+                       ndr_print_samr_DomInfo6(ndr, "info6", &r->info6);
+               break;
+
+               case 7:
+                       ndr_print_samr_DomInfo7(ndr, "info7", &r->info7);
+               break;
+
+               case 8:
+                       ndr_print_samr_DomInfo8(ndr, "info8", &r->info8);
+               break;
+
+               case 9:
+                       ndr_print_samr_DomInfo9(ndr, "info9", &r->info9);
+               break;
+
+               case 11:
+                       ndr_print_samr_DomInfo11(ndr, "info11", &r->info11);
+               break;
+
+               case 12:
+                       ndr_print_samr_DomInfo12(ndr, "info12", &r->info12);
+               break;
+
+               case 13:
+                       ndr_print_samr_DomInfo13(ndr, "info13", &r->info13);
+               break;
+
+               default:
+                       ndr_print_bad_level(ndr, name, level);
+       }
+}
+
+static enum ndr_err_code ndr_push_samr_Ids(struct ndr_push *ndr, int ndr_flags, const struct samr_Ids *r)
+{
+       uint32_t cntr_ids_1;
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count));
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->ids));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               if (r->ids) {
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count));
+                       for (cntr_ids_1 = 0; cntr_ids_1 < r->count; cntr_ids_1++) {
+                               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->ids[cntr_ids_1]));
+                       }
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_Ids(struct ndr_pull *ndr, int ndr_flags, struct samr_Ids *r)
+{
+       uint32_t _ptr_ids;
+       uint32_t cntr_ids_1;
+       TALLOC_CTX *_mem_save_ids_0;
+       TALLOC_CTX *_mem_save_ids_1;
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->count));
+               if (r->count < 0 || r->count > 1024) {
+                       return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
+               }
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_ids));
+               if (_ptr_ids) {
+                       NDR_PULL_ALLOC(ndr, r->ids);
+               } else {
+                       r->ids = NULL;
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               if (r->ids) {
+                       _mem_save_ids_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->ids, 0);
+                       NDR_CHECK(ndr_pull_array_size(ndr, &r->ids));
+                       NDR_PULL_ALLOC_N(ndr, r->ids, ndr_get_array_size(ndr, &r->ids));
+                       _mem_save_ids_1 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->ids, 0);
+                       for (cntr_ids_1 = 0; cntr_ids_1 < r->count; cntr_ids_1++) {
+                               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->ids[cntr_ids_1]));
+                       }
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_ids_1, 0);
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_ids_0, 0);
+               }
+               if (r->ids) {
+                       NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->ids, r->count));
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_Ids(struct ndr_print *ndr, const char *name, const struct samr_Ids *r)
+{
+       uint32_t cntr_ids_1;
+       ndr_print_struct(ndr, name, "samr_Ids");
+       ndr->depth++;
+       ndr_print_uint32(ndr, "count", r->count);
+       ndr_print_ptr(ndr, "ids", r->ids);
+       ndr->depth++;
+       if (r->ids) {
+               ndr->print(ndr, "%s: ARRAY(%d)", "ids", r->count);
+               ndr->depth++;
+               for (cntr_ids_1=0;cntr_ids_1<r->count;cntr_ids_1++) {
+                       char *idx_1=NULL;
+                       asprintf(&idx_1, "[%d]", cntr_ids_1);
+                       if (idx_1) {
+                               ndr_print_uint32(ndr, "ids", r->ids[cntr_ids_1]);
+                               free(idx_1);
+                       }
+               }
+               ndr->depth--;
+       }
+       ndr->depth--;
+       ndr->depth--;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_samr_GroupAttrs(struct ndr_push *ndr, int ndr_flags, uint32_t r)
+{
+       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_samr_GroupAttrs(struct ndr_pull *ndr, int ndr_flags, uint32_t *r)
+{
+       uint32_t v;
+       NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
+       *r = v;
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_GroupAttrs(struct ndr_print *ndr, const char *name, uint32_t r)
+{
+       ndr_print_uint32(ndr, name, r);
+       ndr->depth++;
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SE_GROUP_MANDATORY", SE_GROUP_MANDATORY, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SE_GROUP_ENABLED_BY_DEFAULT", SE_GROUP_ENABLED_BY_DEFAULT, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SE_GROUP_ENABLED", SE_GROUP_ENABLED, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SE_GROUP_OWNER", SE_GROUP_OWNER, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SE_GROUP_USE_FOR_DENY_ONLY", SE_GROUP_USE_FOR_DENY_ONLY, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SE_GROUP_RESOURCE", SE_GROUP_RESOURCE, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SE_GROUP_LOGON_ID", SE_GROUP_LOGON_ID, r);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_GroupInfoAll(struct ndr_push *ndr, int ndr_flags, const struct samr_GroupInfoAll *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->name));
+               NDR_CHECK(ndr_push_samr_GroupAttrs(ndr, NDR_SCALARS, r->attributes));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num_members));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->description));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->name));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->description));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_GroupInfoAll(struct ndr_pull *ndr, int ndr_flags, struct samr_GroupInfoAll *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->name));
+               NDR_CHECK(ndr_pull_samr_GroupAttrs(ndr, NDR_SCALARS, &r->attributes));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->num_members));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->description));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->name));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->description));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_GroupInfoAll(struct ndr_print *ndr, const char *name, const struct samr_GroupInfoAll *r)
+{
+       ndr_print_struct(ndr, name, "samr_GroupInfoAll");
+       ndr->depth++;
+       ndr_print_lsa_String(ndr, "name", &r->name);
+       ndr_print_samr_GroupAttrs(ndr, "attributes", r->attributes);
+       ndr_print_uint32(ndr, "num_members", r->num_members);
+       ndr_print_lsa_String(ndr, "description", &r->description);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_GroupInfoAttributes(struct ndr_push *ndr, int ndr_flags, const struct samr_GroupInfoAttributes *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_samr_GroupAttrs(ndr, NDR_SCALARS, r->attributes));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_GroupInfoAttributes(struct ndr_pull *ndr, int ndr_flags, struct samr_GroupInfoAttributes *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_samr_GroupAttrs(ndr, NDR_SCALARS, &r->attributes));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_GroupInfoAttributes(struct ndr_print *ndr, const char *name, const struct samr_GroupInfoAttributes *r)
+{
+       ndr_print_struct(ndr, name, "samr_GroupInfoAttributes");
+       ndr->depth++;
+       ndr_print_samr_GroupAttrs(ndr, "attributes", r->attributes);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_GroupInfoEnum(struct ndr_push *ndr, int ndr_flags, enum samr_GroupInfoEnum r)
+{
+       NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r));
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_GroupInfoEnum(struct ndr_pull *ndr, int ndr_flags, enum samr_GroupInfoEnum *r)
+{
+       uint16_t v;
+       NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v));
+       *r = v;
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_GroupInfoEnum(struct ndr_print *ndr, const char *name, enum samr_GroupInfoEnum r)
+{
+       const char *val = NULL;
+
+       switch (r) {
+               case GROUPINFOALL: val = "GROUPINFOALL"; break;
+               case GROUPINFONAME: val = "GROUPINFONAME"; break;
+               case GROUPINFOATTRIBUTES: val = "GROUPINFOATTRIBUTES"; break;
+               case GROUPINFODESCRIPTION: val = "GROUPINFODESCRIPTION"; break;
+               case GROUPINFOALL2: val = "GROUPINFOALL2"; break;
+       }
+       ndr_print_enum(ndr, name, "ENUM", val, r);
+}
+
+static enum ndr_err_code ndr_push_samr_GroupInfo(struct ndr_push *ndr, int ndr_flags, const union samr_GroupInfo *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               int level = ndr_push_get_switch_value(ndr, r);
+               NDR_CHECK(ndr_push_samr_GroupInfoEnum(ndr, NDR_SCALARS, level));
+               switch (level) {
+                       case GROUPINFOALL:
+                               NDR_CHECK(ndr_push_samr_GroupInfoAll(ndr, NDR_SCALARS, &r->all));
+                       break;
+
+                       case GROUPINFONAME:
+                               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->name));
+                       break;
+
+                       case GROUPINFOATTRIBUTES:
+                               NDR_CHECK(ndr_push_samr_GroupInfoAttributes(ndr, NDR_SCALARS, &r->attributes));
+                       break;
+
+                       case GROUPINFODESCRIPTION:
+                               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->description));
+                       break;
+
+                       case GROUPINFOALL2:
+                               NDR_CHECK(ndr_push_samr_GroupInfoAll(ndr, NDR_SCALARS, &r->all2));
+                       break;
+
+                       default:
+                               return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               int level = ndr_push_get_switch_value(ndr, r);
+               switch (level) {
+                       case GROUPINFOALL:
+                               NDR_CHECK(ndr_push_samr_GroupInfoAll(ndr, NDR_BUFFERS, &r->all));
+                       break;
+
+                       case GROUPINFONAME:
+                               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->name));
+                       break;
+
+                       case GROUPINFOATTRIBUTES:
+                       break;
+
+                       case GROUPINFODESCRIPTION:
+                               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->description));
+                       break;
+
+                       case GROUPINFOALL2:
+                               NDR_CHECK(ndr_push_samr_GroupInfoAll(ndr, NDR_BUFFERS, &r->all2));
+                       break;
+
+                       default:
+                               return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_GroupInfo(struct ndr_pull *ndr, int ndr_flags, union samr_GroupInfo *r)
+{
+       int level;
+       uint16_t _level;
+       level = ndr_pull_get_switch_value(ndr, r);
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &_level));
+               if (_level != level) {
+                       return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u for r", _level);
+               }
+               switch (level) {
+                       case GROUPINFOALL: {
+                               NDR_CHECK(ndr_pull_samr_GroupInfoAll(ndr, NDR_SCALARS, &r->all));
+                       break; }
+
+                       case GROUPINFONAME: {
+                               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->name));
+                       break; }
+
+                       case GROUPINFOATTRIBUTES: {
+                               NDR_CHECK(ndr_pull_samr_GroupInfoAttributes(ndr, NDR_SCALARS, &r->attributes));
+                       break; }
+
+                       case GROUPINFODESCRIPTION: {
+                               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->description));
+                       break; }
+
+                       case GROUPINFOALL2: {
+                               NDR_CHECK(ndr_pull_samr_GroupInfoAll(ndr, NDR_SCALARS, &r->all2));
+                       break; }
+
+                       default:
+                               return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               switch (level) {
+                       case GROUPINFOALL:
+                               NDR_CHECK(ndr_pull_samr_GroupInfoAll(ndr, NDR_BUFFERS, &r->all));
+                       break;
+
+                       case GROUPINFONAME:
+                               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->name));
+                       break;
+
+                       case GROUPINFOATTRIBUTES:
+                       break;
+
+                       case GROUPINFODESCRIPTION:
+                               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->description));
+                       break;
+
+                       case GROUPINFOALL2:
+                               NDR_CHECK(ndr_pull_samr_GroupInfoAll(ndr, NDR_BUFFERS, &r->all2));
+                       break;
+
+                       default:
+                               return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_GroupInfo(struct ndr_print *ndr, const char *name, const union samr_GroupInfo *r)
+{
+       int level;
+       level = ndr_print_get_switch_value(ndr, r);
+       ndr_print_union(ndr, name, level, "samr_GroupInfo");
+       switch (level) {
+               case GROUPINFOALL:
+                       ndr_print_samr_GroupInfoAll(ndr, "all", &r->all);
+               break;
+
+               case GROUPINFONAME:
+                       ndr_print_lsa_String(ndr, "name", &r->name);
+               break;
+
+               case GROUPINFOATTRIBUTES:
+                       ndr_print_samr_GroupInfoAttributes(ndr, "attributes", &r->attributes);
+               break;
+
+               case GROUPINFODESCRIPTION:
+                       ndr_print_lsa_String(ndr, "description", &r->description);
+               break;
+
+               case GROUPINFOALL2:
+                       ndr_print_samr_GroupInfoAll(ndr, "all2", &r->all2);
+               break;
+
+               default:
+                       ndr_print_bad_level(ndr, name, level);
+       }
+}
+
+static enum ndr_err_code ndr_push_samr_RidTypeArray(struct ndr_push *ndr, int ndr_flags, const struct samr_RidTypeArray *r)
+{
+       uint32_t cntr_rids_1;
+       uint32_t cntr_types_1;
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count));
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->rids));
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->types));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               if (r->rids) {
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count));
+                       for (cntr_rids_1 = 0; cntr_rids_1 < r->count; cntr_rids_1++) {
+                               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->rids[cntr_rids_1]));
+                       }
+               }
+               if (r->types) {
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count));
+                       for (cntr_types_1 = 0; cntr_types_1 < r->count; cntr_types_1++) {
+                               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->types[cntr_types_1]));
+                       }
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_RidTypeArray(struct ndr_pull *ndr, int ndr_flags, struct samr_RidTypeArray *r)
+{
+       uint32_t _ptr_rids;
+       uint32_t cntr_rids_1;
+       TALLOC_CTX *_mem_save_rids_0;
+       TALLOC_CTX *_mem_save_rids_1;
+       uint32_t _ptr_types;
+       uint32_t cntr_types_1;
+       TALLOC_CTX *_mem_save_types_0;
+       TALLOC_CTX *_mem_save_types_1;
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->count));
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_rids));
+               if (_ptr_rids) {
+                       NDR_PULL_ALLOC(ndr, r->rids);
+               } else {
+                       r->rids = NULL;
+               }
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_types));
+               if (_ptr_types) {
+                       NDR_PULL_ALLOC(ndr, r->types);
+               } else {
+                       r->types = NULL;
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               if (r->rids) {
+                       _mem_save_rids_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->rids, 0);
+                       NDR_CHECK(ndr_pull_array_size(ndr, &r->rids));
+                       NDR_PULL_ALLOC_N(ndr, r->rids, ndr_get_array_size(ndr, &r->rids));
+                       _mem_save_rids_1 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->rids, 0);
+                       for (cntr_rids_1 = 0; cntr_rids_1 < r->count; cntr_rids_1++) {
+                               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->rids[cntr_rids_1]));
+                       }
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_rids_1, 0);
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_rids_0, 0);
+               }
+               if (r->types) {
+                       _mem_save_types_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->types, 0);
+                       NDR_CHECK(ndr_pull_array_size(ndr, &r->types));
+                       NDR_PULL_ALLOC_N(ndr, r->types, ndr_get_array_size(ndr, &r->types));
+                       _mem_save_types_1 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->types, 0);
+                       for (cntr_types_1 = 0; cntr_types_1 < r->count; cntr_types_1++) {
+                               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->types[cntr_types_1]));
+                       }
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_types_1, 0);
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_types_0, 0);
+               }
+               if (r->rids) {
+                       NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->rids, r->count));
+               }
+               if (r->types) {
+                       NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->types, r->count));
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_RidTypeArray(struct ndr_print *ndr, const char *name, const struct samr_RidTypeArray *r)
+{
+       uint32_t cntr_rids_1;
+       uint32_t cntr_types_1;
+       ndr_print_struct(ndr, name, "samr_RidTypeArray");
+       ndr->depth++;
+       ndr_print_uint32(ndr, "count", r->count);
+       ndr_print_ptr(ndr, "rids", r->rids);
+       ndr->depth++;
+       if (r->rids) {
+               ndr->print(ndr, "%s: ARRAY(%d)", "rids", r->count);
+               ndr->depth++;
+               for (cntr_rids_1=0;cntr_rids_1<r->count;cntr_rids_1++) {
+                       char *idx_1=NULL;
+                       asprintf(&idx_1, "[%d]", cntr_rids_1);
+                       if (idx_1) {
+                               ndr_print_uint32(ndr, "rids", r->rids[cntr_rids_1]);
+                               free(idx_1);
+                       }
+               }
+               ndr->depth--;
+       }
+       ndr->depth--;
+       ndr_print_ptr(ndr, "types", r->types);
+       ndr->depth++;
+       if (r->types) {
+               ndr->print(ndr, "%s: ARRAY(%d)", "types", r->count);
+               ndr->depth++;
+               for (cntr_types_1=0;cntr_types_1<r->count;cntr_types_1++) {
+                       char *idx_1=NULL;
+                       asprintf(&idx_1, "[%d]", cntr_types_1);
+                       if (idx_1) {
+                               ndr_print_uint32(ndr, "types", r->types[cntr_types_1]);
+                               free(idx_1);
+                       }
+               }
+               ndr->depth--;
+       }
+       ndr->depth--;
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_AliasInfoAll(struct ndr_push *ndr, int ndr_flags, const struct samr_AliasInfoAll *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->name));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num_members));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->description));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->name));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->description));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_AliasInfoAll(struct ndr_pull *ndr, int ndr_flags, struct samr_AliasInfoAll *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->name));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->num_members));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->description));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->name));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->description));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_AliasInfoAll(struct ndr_print *ndr, const char *name, const struct samr_AliasInfoAll *r)
+{
+       ndr_print_struct(ndr, name, "samr_AliasInfoAll");
+       ndr->depth++;
+       ndr_print_lsa_String(ndr, "name", &r->name);
+       ndr_print_uint32(ndr, "num_members", r->num_members);
+       ndr_print_lsa_String(ndr, "description", &r->description);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_AliasInfoEnum(struct ndr_push *ndr, int ndr_flags, enum samr_AliasInfoEnum r)
+{
+       NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r));
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_AliasInfoEnum(struct ndr_pull *ndr, int ndr_flags, enum samr_AliasInfoEnum *r)
+{
+       uint16_t v;
+       NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v));
+       *r = v;
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_AliasInfoEnum(struct ndr_print *ndr, const char *name, enum samr_AliasInfoEnum r)
+{
+       const char *val = NULL;
+
+       switch (r) {
+               case ALIASINFOALL: val = "ALIASINFOALL"; break;
+               case ALIASINFONAME: val = "ALIASINFONAME"; break;
+               case ALIASINFODESCRIPTION: val = "ALIASINFODESCRIPTION"; break;
+       }
+       ndr_print_enum(ndr, name, "ENUM", val, r);
+}
+
+static enum ndr_err_code ndr_push_samr_AliasInfo(struct ndr_push *ndr, int ndr_flags, const union samr_AliasInfo *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               int level = ndr_push_get_switch_value(ndr, r);
+               NDR_CHECK(ndr_push_samr_AliasInfoEnum(ndr, NDR_SCALARS, level));
+               switch (level) {
+                       case ALIASINFOALL:
+                               NDR_CHECK(ndr_push_samr_AliasInfoAll(ndr, NDR_SCALARS, &r->all));
+                       break;
+
+                       case ALIASINFONAME:
+                               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->name));
+                       break;
+
+                       case ALIASINFODESCRIPTION:
+                               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->description));
+                       break;
+
+                       default:
+                               return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               int level = ndr_push_get_switch_value(ndr, r);
+               switch (level) {
+                       case ALIASINFOALL:
+                               NDR_CHECK(ndr_push_samr_AliasInfoAll(ndr, NDR_BUFFERS, &r->all));
+                       break;
+
+                       case ALIASINFONAME:
+                               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->name));
+                       break;
+
+                       case ALIASINFODESCRIPTION:
+                               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->description));
+                       break;
+
+                       default:
+                               return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_AliasInfo(struct ndr_pull *ndr, int ndr_flags, union samr_AliasInfo *r)
+{
+       int level;
+       uint16_t _level;
+       level = ndr_pull_get_switch_value(ndr, r);
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &_level));
+               if (_level != level) {
+                       return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u for r", _level);
+               }
+               switch (level) {
+                       case ALIASINFOALL: {
+                               NDR_CHECK(ndr_pull_samr_AliasInfoAll(ndr, NDR_SCALARS, &r->all));
+                       break; }
+
+                       case ALIASINFONAME: {
+                               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->name));
+                       break; }
+
+                       case ALIASINFODESCRIPTION: {
+                               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->description));
+                       break; }
+
+                       default:
+                               return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               switch (level) {
+                       case ALIASINFOALL:
+                               NDR_CHECK(ndr_pull_samr_AliasInfoAll(ndr, NDR_BUFFERS, &r->all));
+                       break;
+
+                       case ALIASINFONAME:
+                               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->name));
+                       break;
+
+                       case ALIASINFODESCRIPTION:
+                               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->description));
+                       break;
+
+                       default:
+                               return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_AliasInfo(struct ndr_print *ndr, const char *name, const union samr_AliasInfo *r)
+{
+       int level;
+       level = ndr_print_get_switch_value(ndr, r);
+       ndr_print_union(ndr, name, level, "samr_AliasInfo");
+       switch (level) {
+               case ALIASINFOALL:
+                       ndr_print_samr_AliasInfoAll(ndr, "all", &r->all);
+               break;
+
+               case ALIASINFONAME:
+                       ndr_print_lsa_String(ndr, "name", &r->name);
+               break;
+
+               case ALIASINFODESCRIPTION:
+                       ndr_print_lsa_String(ndr, "description", &r->description);
+               break;
+
+               default:
+                       ndr_print_bad_level(ndr, name, level);
+       }
+}
+
+static enum ndr_err_code ndr_push_samr_UserInfo1(struct ndr_push *ndr, int ndr_flags, const struct samr_UserInfo1 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->account_name));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->full_name));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->primary_gid));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->description));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->comment));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->account_name));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->full_name));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->description));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->comment));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_UserInfo1(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo1 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->account_name));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->full_name));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->primary_gid));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->description));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->comment));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->account_name));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->full_name));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->description));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->comment));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_UserInfo1(struct ndr_print *ndr, const char *name, const struct samr_UserInfo1 *r)
+{
+       ndr_print_struct(ndr, name, "samr_UserInfo1");
+       ndr->depth++;
+       ndr_print_lsa_String(ndr, "account_name", &r->account_name);
+       ndr_print_lsa_String(ndr, "full_name", &r->full_name);
+       ndr_print_uint32(ndr, "primary_gid", r->primary_gid);
+       ndr_print_lsa_String(ndr, "description", &r->description);
+       ndr_print_lsa_String(ndr, "comment", &r->comment);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_UserInfo2(struct ndr_push *ndr, int ndr_flags, const struct samr_UserInfo2 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->comment));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->unknown));
+               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->country_code));
+               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->code_page));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->comment));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->unknown));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_UserInfo2(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo2 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->comment));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->unknown));
+               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->country_code));
+               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->code_page));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->comment));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->unknown));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_UserInfo2(struct ndr_print *ndr, const char *name, const struct samr_UserInfo2 *r)
+{
+       ndr_print_struct(ndr, name, "samr_UserInfo2");
+       ndr->depth++;
+       ndr_print_lsa_String(ndr, "comment", &r->comment);
+       ndr_print_lsa_String(ndr, "unknown", &r->unknown);
+       ndr_print_uint16(ndr, "country_code", r->country_code);
+       ndr_print_uint16(ndr, "code_page", r->code_page);
+       ndr->depth--;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_samr_LogonHours(struct ndr_push *ndr, int ndr_flags, const struct samr_LogonHours *r)
+{
+       {
+               uint32_t _flags_save_STRUCT = ndr->flags;
+               ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX);
+               if (ndr_flags & NDR_SCALARS) {
+                       NDR_CHECK(ndr_push_align(ndr, 4));
+                       NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->units_per_week));
+                       NDR_CHECK(ndr_push_unique_ptr(ndr, r->bits));
+               }
+               if (ndr_flags & NDR_BUFFERS) {
+                       if (r->bits) {
+                               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 1260));
+                               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
+                               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->units_per_week / 8));
+                               NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->bits, r->units_per_week / 8));
+                       }
+               }
+               ndr->flags = _flags_save_STRUCT;
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_samr_LogonHours(struct ndr_pull *ndr, int ndr_flags, struct samr_LogonHours *r)
+{
+       uint32_t _ptr_bits;
+       TALLOC_CTX *_mem_save_bits_0;
+       {
+               uint32_t _flags_save_STRUCT = ndr->flags;
+               ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX);
+               if (ndr_flags & NDR_SCALARS) {
+                       NDR_CHECK(ndr_pull_align(ndr, 4));
+                       NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->units_per_week));
+                       NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_bits));
+                       if (_ptr_bits) {
+                               NDR_PULL_ALLOC(ndr, r->bits);
+                       } else {
+                               r->bits = NULL;
+                       }
+               }
+               if (ndr_flags & NDR_BUFFERS) {
+                       if (r->bits) {
+                               _mem_save_bits_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                               NDR_PULL_SET_MEM_CTX(ndr, r->bits, 0);
+                               NDR_CHECK(ndr_pull_array_size(ndr, &r->bits));
+                               NDR_CHECK(ndr_pull_array_length(ndr, &r->bits));
+                               if (ndr_get_array_length(ndr, &r->bits) > ndr_get_array_size(ndr, &r->bits)) {
+                                       return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->bits), ndr_get_array_length(ndr, &r->bits));
+                               }
+                               NDR_PULL_ALLOC_N(ndr, r->bits, ndr_get_array_size(ndr, &r->bits));
+                               NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->bits, ndr_get_array_length(ndr, &r->bits)));
+                               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_bits_0, 0);
+                       }
+                       if (r->bits) {
+                               NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->bits, 1260));
+                       }
+                       if (r->bits) {
+                               NDR_CHECK(ndr_check_array_length(ndr, (void*)&r->bits, r->units_per_week / 8));
+                       }
+               }
+               ndr->flags = _flags_save_STRUCT;
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_LogonHours(struct ndr_print *ndr, const char *name, const struct samr_LogonHours *r)
+{
+       ndr_print_struct(ndr, name, "samr_LogonHours");
+       {
+               uint32_t _flags_save_STRUCT = ndr->flags;
+               ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX);
+               ndr->depth++;
+               ndr_print_uint16(ndr, "units_per_week", r->units_per_week);
+               ndr_print_ptr(ndr, "bits", r->bits);
+               ndr->depth++;
+               if (r->bits) {
+                       ndr_print_array_uint8(ndr, "bits", r->bits, r->units_per_week / 8);
+               }
+               ndr->depth--;
+               ndr->depth--;
+               ndr->flags = _flags_save_STRUCT;
+       }
+}
+
+static enum ndr_err_code ndr_push_samr_UserInfo3(struct ndr_push *ndr, int ndr_flags, const struct samr_UserInfo3 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->account_name));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->full_name));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->rid));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->primary_gid));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->home_directory));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->home_drive));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->logon_script));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->profile_path));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->workstations));
+               NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->last_logon));
+               NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->last_logoff));
+               NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->last_password_change));
+               NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->allow_password_change));
+               NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->force_password_change));
+               NDR_CHECK(ndr_push_samr_LogonHours(ndr, NDR_SCALARS, &r->logon_hours));
+               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->bad_password_count));
+               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->logon_count));
+               NDR_CHECK(ndr_push_samr_AcctFlags(ndr, NDR_SCALARS, r->acct_flags));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->account_name));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->full_name));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->home_directory));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->home_drive));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->logon_script));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->profile_path));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->workstations));
+               NDR_CHECK(ndr_push_samr_LogonHours(ndr, NDR_BUFFERS, &r->logon_hours));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_UserInfo3(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo3 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->account_name));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->full_name));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->rid));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->primary_gid));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->home_directory));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->home_drive));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->logon_script));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->profile_path));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->workstations));
+               NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->last_logon));
+               NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->last_logoff));
+               NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->last_password_change));
+               NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->allow_password_change));
+               NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->force_password_change));
+               NDR_CHECK(ndr_pull_samr_LogonHours(ndr, NDR_SCALARS, &r->logon_hours));
+               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->bad_password_count));
+               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->logon_count));
+               NDR_CHECK(ndr_pull_samr_AcctFlags(ndr, NDR_SCALARS, &r->acct_flags));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->account_name));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->full_name));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->home_directory));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->home_drive));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->logon_script));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->profile_path));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->workstations));
+               NDR_CHECK(ndr_pull_samr_LogonHours(ndr, NDR_BUFFERS, &r->logon_hours));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_UserInfo3(struct ndr_print *ndr, const char *name, const struct samr_UserInfo3 *r)
+{
+       ndr_print_struct(ndr, name, "samr_UserInfo3");
+       ndr->depth++;
+       ndr_print_lsa_String(ndr, "account_name", &r->account_name);
+       ndr_print_lsa_String(ndr, "full_name", &r->full_name);
+       ndr_print_uint32(ndr, "rid", r->rid);
+       ndr_print_uint32(ndr, "primary_gid", r->primary_gid);
+       ndr_print_lsa_String(ndr, "home_directory", &r->home_directory);
+       ndr_print_lsa_String(ndr, "home_drive", &r->home_drive);
+       ndr_print_lsa_String(ndr, "logon_script", &r->logon_script);
+       ndr_print_lsa_String(ndr, "profile_path", &r->profile_path);
+       ndr_print_lsa_String(ndr, "workstations", &r->workstations);
+       ndr_print_NTTIME(ndr, "last_logon", r->last_logon);
+       ndr_print_NTTIME(ndr, "last_logoff", r->last_logoff);
+       ndr_print_NTTIME(ndr, "last_password_change", r->last_password_change);
+       ndr_print_NTTIME(ndr, "allow_password_change", r->allow_password_change);
+       ndr_print_NTTIME(ndr, "force_password_change", r->force_password_change);
+       ndr_print_samr_LogonHours(ndr, "logon_hours", &r->logon_hours);
+       ndr_print_uint16(ndr, "bad_password_count", r->bad_password_count);
+       ndr_print_uint16(ndr, "logon_count", r->logon_count);
+       ndr_print_samr_AcctFlags(ndr, "acct_flags", r->acct_flags);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_UserInfo4(struct ndr_push *ndr, int ndr_flags, const struct samr_UserInfo4 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_samr_LogonHours(ndr, NDR_SCALARS, &r->logon_hours));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_push_samr_LogonHours(ndr, NDR_BUFFERS, &r->logon_hours));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_UserInfo4(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo4 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_samr_LogonHours(ndr, NDR_SCALARS, &r->logon_hours));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_pull_samr_LogonHours(ndr, NDR_BUFFERS, &r->logon_hours));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_UserInfo4(struct ndr_print *ndr, const char *name, const struct samr_UserInfo4 *r)
+{
+       ndr_print_struct(ndr, name, "samr_UserInfo4");
+       ndr->depth++;
+       ndr_print_samr_LogonHours(ndr, "logon_hours", &r->logon_hours);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_UserInfo5(struct ndr_push *ndr, int ndr_flags, const struct samr_UserInfo5 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->account_name));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->full_name));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->rid));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->primary_gid));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->home_directory));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->home_drive));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->logon_script));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->profile_path));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->description));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->workstations));
+               NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->last_logon));
+               NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->last_logoff));
+               NDR_CHECK(ndr_push_samr_LogonHours(ndr, NDR_SCALARS, &r->logon_hours));
+               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->bad_password_count));
+               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->logon_count));
+               NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->last_password_change));
+               NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->acct_expiry));
+               NDR_CHECK(ndr_push_samr_AcctFlags(ndr, NDR_SCALARS, r->acct_flags));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->account_name));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->full_name));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->home_directory));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->home_drive));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->logon_script));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->profile_path));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->description));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->workstations));
+               NDR_CHECK(ndr_push_samr_LogonHours(ndr, NDR_BUFFERS, &r->logon_hours));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_UserInfo5(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo5 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->account_name));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->full_name));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->rid));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->primary_gid));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->home_directory));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->home_drive));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->logon_script));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->profile_path));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->description));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->workstations));
+               NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->last_logon));
+               NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->last_logoff));
+               NDR_CHECK(ndr_pull_samr_LogonHours(ndr, NDR_SCALARS, &r->logon_hours));
+               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->bad_password_count));
+               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->logon_count));
+               NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->last_password_change));
+               NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->acct_expiry));
+               NDR_CHECK(ndr_pull_samr_AcctFlags(ndr, NDR_SCALARS, &r->acct_flags));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->account_name));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->full_name));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->home_directory));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->home_drive));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->logon_script));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->profile_path));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->description));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->workstations));
+               NDR_CHECK(ndr_pull_samr_LogonHours(ndr, NDR_BUFFERS, &r->logon_hours));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_UserInfo5(struct ndr_print *ndr, const char *name, const struct samr_UserInfo5 *r)
+{
+       ndr_print_struct(ndr, name, "samr_UserInfo5");
+       ndr->depth++;
+       ndr_print_lsa_String(ndr, "account_name", &r->account_name);
+       ndr_print_lsa_String(ndr, "full_name", &r->full_name);
+       ndr_print_uint32(ndr, "rid", r->rid);
+       ndr_print_uint32(ndr, "primary_gid", r->primary_gid);
+       ndr_print_lsa_String(ndr, "home_directory", &r->home_directory);
+       ndr_print_lsa_String(ndr, "home_drive", &r->home_drive);
+       ndr_print_lsa_String(ndr, "logon_script", &r->logon_script);
+       ndr_print_lsa_String(ndr, "profile_path", &r->profile_path);
+       ndr_print_lsa_String(ndr, "description", &r->description);
+       ndr_print_lsa_String(ndr, "workstations", &r->workstations);
+       ndr_print_NTTIME(ndr, "last_logon", r->last_logon);
+       ndr_print_NTTIME(ndr, "last_logoff", r->last_logoff);
+       ndr_print_samr_LogonHours(ndr, "logon_hours", &r->logon_hours);
+       ndr_print_uint16(ndr, "bad_password_count", r->bad_password_count);
+       ndr_print_uint16(ndr, "logon_count", r->logon_count);
+       ndr_print_NTTIME(ndr, "last_password_change", r->last_password_change);
+       ndr_print_NTTIME(ndr, "acct_expiry", r->acct_expiry);
+       ndr_print_samr_AcctFlags(ndr, "acct_flags", r->acct_flags);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_UserInfo6(struct ndr_push *ndr, int ndr_flags, const struct samr_UserInfo6 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->account_name));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->full_name));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->account_name));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->full_name));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_UserInfo6(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo6 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->account_name));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->full_name));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->account_name));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->full_name));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_UserInfo6(struct ndr_print *ndr, const char *name, const struct samr_UserInfo6 *r)
+{
+       ndr_print_struct(ndr, name, "samr_UserInfo6");
+       ndr->depth++;
+       ndr_print_lsa_String(ndr, "account_name", &r->account_name);
+       ndr_print_lsa_String(ndr, "full_name", &r->full_name);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_UserInfo7(struct ndr_push *ndr, int ndr_flags, const struct samr_UserInfo7 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->account_name));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->account_name));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_UserInfo7(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo7 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->account_name));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->account_name));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_UserInfo7(struct ndr_print *ndr, const char *name, const struct samr_UserInfo7 *r)
+{
+       ndr_print_struct(ndr, name, "samr_UserInfo7");
+       ndr->depth++;
+       ndr_print_lsa_String(ndr, "account_name", &r->account_name);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_UserInfo8(struct ndr_push *ndr, int ndr_flags, const struct samr_UserInfo8 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->full_name));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->full_name));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_UserInfo8(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo8 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->full_name));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->full_name));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_UserInfo8(struct ndr_print *ndr, const char *name, const struct samr_UserInfo8 *r)
+{
+       ndr_print_struct(ndr, name, "samr_UserInfo8");
+       ndr->depth++;
+       ndr_print_lsa_String(ndr, "full_name", &r->full_name);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_UserInfo9(struct ndr_push *ndr, int ndr_flags, const struct samr_UserInfo9 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->primary_gid));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_UserInfo9(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo9 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->primary_gid));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_UserInfo9(struct ndr_print *ndr, const char *name, const struct samr_UserInfo9 *r)
+{
+       ndr_print_struct(ndr, name, "samr_UserInfo9");
+       ndr->depth++;
+       ndr_print_uint32(ndr, "primary_gid", r->primary_gid);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_UserInfo10(struct ndr_push *ndr, int ndr_flags, const struct samr_UserInfo10 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->home_directory));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->home_drive));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->home_directory));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->home_drive));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_UserInfo10(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo10 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->home_directory));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->home_drive));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->home_directory));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->home_drive));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_UserInfo10(struct ndr_print *ndr, const char *name, const struct samr_UserInfo10 *r)
+{
+       ndr_print_struct(ndr, name, "samr_UserInfo10");
+       ndr->depth++;
+       ndr_print_lsa_String(ndr, "home_directory", &r->home_directory);
+       ndr_print_lsa_String(ndr, "home_drive", &r->home_drive);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_UserInfo11(struct ndr_push *ndr, int ndr_flags, const struct samr_UserInfo11 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->logon_script));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->logon_script));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_UserInfo11(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo11 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->logon_script));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->logon_script));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_UserInfo11(struct ndr_print *ndr, const char *name, const struct samr_UserInfo11 *r)
+{
+       ndr_print_struct(ndr, name, "samr_UserInfo11");
+       ndr->depth++;
+       ndr_print_lsa_String(ndr, "logon_script", &r->logon_script);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_UserInfo12(struct ndr_push *ndr, int ndr_flags, const struct samr_UserInfo12 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->profile_path));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->profile_path));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_UserInfo12(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo12 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->profile_path));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->profile_path));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_UserInfo12(struct ndr_print *ndr, const char *name, const struct samr_UserInfo12 *r)
+{
+       ndr_print_struct(ndr, name, "samr_UserInfo12");
+       ndr->depth++;
+       ndr_print_lsa_String(ndr, "profile_path", &r->profile_path);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_UserInfo13(struct ndr_push *ndr, int ndr_flags, const struct samr_UserInfo13 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->description));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->description));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_UserInfo13(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo13 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->description));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->description));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_UserInfo13(struct ndr_print *ndr, const char *name, const struct samr_UserInfo13 *r)
+{
+       ndr_print_struct(ndr, name, "samr_UserInfo13");
+       ndr->depth++;
+       ndr_print_lsa_String(ndr, "description", &r->description);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_UserInfo14(struct ndr_push *ndr, int ndr_flags, const struct samr_UserInfo14 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->workstations));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->workstations));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_UserInfo14(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo14 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->workstations));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->workstations));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_UserInfo14(struct ndr_print *ndr, const char *name, const struct samr_UserInfo14 *r)
+{
+       ndr_print_struct(ndr, name, "samr_UserInfo14");
+       ndr->depth++;
+       ndr_print_lsa_String(ndr, "workstations", &r->workstations);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_UserInfo16(struct ndr_push *ndr, int ndr_flags, const struct samr_UserInfo16 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_samr_AcctFlags(ndr, NDR_SCALARS, r->acct_flags));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_UserInfo16(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo16 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_samr_AcctFlags(ndr, NDR_SCALARS, &r->acct_flags));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_UserInfo16(struct ndr_print *ndr, const char *name, const struct samr_UserInfo16 *r)
+{
+       ndr_print_struct(ndr, name, "samr_UserInfo16");
+       ndr->depth++;
+       ndr_print_samr_AcctFlags(ndr, "acct_flags", r->acct_flags);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_UserInfo17(struct ndr_push *ndr, int ndr_flags, const struct samr_UserInfo17 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->acct_expiry));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_UserInfo17(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo17 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->acct_expiry));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_UserInfo17(struct ndr_print *ndr, const char *name, const struct samr_UserInfo17 *r)
+{
+       ndr_print_struct(ndr, name, "samr_UserInfo17");
+       ndr->depth++;
+       ndr_print_NTTIME(ndr, "acct_expiry", r->acct_expiry);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_UserInfo20(struct ndr_push *ndr, int ndr_flags, const struct samr_UserInfo20 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->parameters));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->parameters));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_UserInfo20(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo20 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->parameters));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->parameters));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_UserInfo20(struct ndr_print *ndr, const char *name, const struct samr_UserInfo20 *r)
+{
+       ndr_print_struct(ndr, name, "samr_UserInfo20");
+       ndr->depth++;
+       ndr_print_lsa_String(ndr, "parameters", &r->parameters);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_FieldsPresent(struct ndr_push *ndr, int ndr_flags, uint32_t r)
+{
+       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_FieldsPresent(struct ndr_pull *ndr, int ndr_flags, uint32_t *r)
+{
+       uint32_t v;
+       NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
+       *r = v;
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_FieldsPresent(struct ndr_print *ndr, const char *name, uint32_t r)
+{
+       ndr_print_uint32(ndr, name, r);
+       ndr->depth++;
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_FIELD_ACCOUNT_NAME", SAMR_FIELD_ACCOUNT_NAME, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_FIELD_FULL_NAME", SAMR_FIELD_FULL_NAME, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_FIELD_RID", SAMR_FIELD_RID, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_FIELD_PRIMARY_GID", SAMR_FIELD_PRIMARY_GID, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_FIELD_DESCRIPTION", SAMR_FIELD_DESCRIPTION, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_FIELD_COMMENT", SAMR_FIELD_COMMENT, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_FIELD_HOME_DIRECTORY", SAMR_FIELD_HOME_DIRECTORY, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_FIELD_HOME_DRIVE", SAMR_FIELD_HOME_DRIVE, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_FIELD_LOGON_SCRIPT", SAMR_FIELD_LOGON_SCRIPT, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_FIELD_PROFILE_PATH", SAMR_FIELD_PROFILE_PATH, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_FIELD_WORKSTATIONS", SAMR_FIELD_WORKSTATIONS, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_FIELD_LAST_LOGON", SAMR_FIELD_LAST_LOGON, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_FIELD_LAST_LOGOFF", SAMR_FIELD_LAST_LOGOFF, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_FIELD_LOGON_HOURS", SAMR_FIELD_LOGON_HOURS, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_FIELD_BAD_PWD_COUNT", SAMR_FIELD_BAD_PWD_COUNT, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_FIELD_NUM_LOGONS", SAMR_FIELD_NUM_LOGONS, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_FIELD_ALLOW_PWD_CHANGE", SAMR_FIELD_ALLOW_PWD_CHANGE, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_FIELD_FORCE_PWD_CHANGE", SAMR_FIELD_FORCE_PWD_CHANGE, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_FIELD_LAST_PWD_CHANGE", SAMR_FIELD_LAST_PWD_CHANGE, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_FIELD_ACCT_EXPIRY", SAMR_FIELD_ACCT_EXPIRY, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_FIELD_ACCT_FLAGS", SAMR_FIELD_ACCT_FLAGS, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_FIELD_PARAMETERS", SAMR_FIELD_PARAMETERS, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_FIELD_COUNTRY_CODE", SAMR_FIELD_COUNTRY_CODE, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_FIELD_CODE_PAGE", SAMR_FIELD_CODE_PAGE, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_FIELD_PASSWORD", SAMR_FIELD_PASSWORD, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_FIELD_PASSWORD2", SAMR_FIELD_PASSWORD2, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_FIELD_PRIVATE_DATA", SAMR_FIELD_PRIVATE_DATA, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_FIELD_EXPIRED_FLAG", SAMR_FIELD_EXPIRED_FLAG, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_FIELD_SEC_DESC", SAMR_FIELD_SEC_DESC, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_FIELD_OWF_PWD", SAMR_FIELD_OWF_PWD, r);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_UserInfo21(struct ndr_push *ndr, int ndr_flags, const struct samr_UserInfo21 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->last_logon));
+               NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->last_logoff));
+               NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->last_password_change));
+               NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->acct_expiry));
+               NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->allow_password_change));
+               NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->force_password_change));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->account_name));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->full_name));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->home_directory));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->home_drive));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->logon_script));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->profile_path));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->description));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->workstations));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->comment));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->parameters));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->unknown1));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->unknown2));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->unknown3));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->buf_count));
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->buffer));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->rid));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->primary_gid));
+               NDR_CHECK(ndr_push_samr_AcctFlags(ndr, NDR_SCALARS, r->acct_flags));
+               NDR_CHECK(ndr_push_samr_FieldsPresent(ndr, NDR_SCALARS, r->fields_present));
+               NDR_CHECK(ndr_push_samr_LogonHours(ndr, NDR_SCALARS, &r->logon_hours));
+               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->bad_password_count));
+               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->logon_count));
+               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->country_code));
+               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->code_page));
+               NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->nt_password_set));
+               NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->lm_password_set));
+               NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->password_expired));
+               NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->unknown4));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->account_name));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->full_name));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->home_directory));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->home_drive));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->logon_script));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->profile_path));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->description));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->workstations));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->comment));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->parameters));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->unknown1));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->unknown2));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->unknown3));
+               if (r->buffer) {
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->buf_count));
+                       NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->buffer, r->buf_count));
+               }
+               NDR_CHECK(ndr_push_samr_LogonHours(ndr, NDR_BUFFERS, &r->logon_hours));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_UserInfo21(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo21 *r)
+{
+       uint32_t _ptr_buffer;
+       TALLOC_CTX *_mem_save_buffer_0;
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->last_logon));
+               NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->last_logoff));
+               NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->last_password_change));
+               NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->acct_expiry));
+               NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->allow_password_change));
+               NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->force_password_change));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->account_name));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->full_name));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->home_directory));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->home_drive));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->logon_script));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->profile_path));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->description));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->workstations));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->comment));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->parameters));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->unknown1));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->unknown2));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->unknown3));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->buf_count));
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_buffer));
+               if (_ptr_buffer) {
+                       NDR_PULL_ALLOC(ndr, r->buffer);
+               } else {
+                       r->buffer = NULL;
+               }
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->rid));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->primary_gid));
+               NDR_CHECK(ndr_pull_samr_AcctFlags(ndr, NDR_SCALARS, &r->acct_flags));
+               NDR_CHECK(ndr_pull_samr_FieldsPresent(ndr, NDR_SCALARS, &r->fields_present));
+               NDR_CHECK(ndr_pull_samr_LogonHours(ndr, NDR_SCALARS, &r->logon_hours));
+               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->bad_password_count));
+               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->logon_count));
+               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->country_code));
+               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->code_page));
+               NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->nt_password_set));
+               NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->lm_password_set));
+               NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->password_expired));
+               NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->unknown4));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->account_name));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->full_name));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->home_directory));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->home_drive));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->logon_script));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->profile_path));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->description));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->workstations));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->comment));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->parameters));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->unknown1));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->unknown2));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->unknown3));
+               if (r->buffer) {
+                       _mem_save_buffer_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->buffer, 0);
+                       NDR_CHECK(ndr_pull_array_size(ndr, &r->buffer));
+                       NDR_PULL_ALLOC_N(ndr, r->buffer, ndr_get_array_size(ndr, &r->buffer));
+                       NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->buffer, ndr_get_array_size(ndr, &r->buffer)));
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_buffer_0, 0);
+               }
+               NDR_CHECK(ndr_pull_samr_LogonHours(ndr, NDR_BUFFERS, &r->logon_hours));
+               if (r->buffer) {
+                       NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->buffer, r->buf_count));
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_UserInfo21(struct ndr_print *ndr, const char *name, const struct samr_UserInfo21 *r)
+{
+       ndr_print_struct(ndr, name, "samr_UserInfo21");
+       ndr->depth++;
+       ndr_print_NTTIME(ndr, "last_logon", r->last_logon);
+       ndr_print_NTTIME(ndr, "last_logoff", r->last_logoff);
+       ndr_print_NTTIME(ndr, "last_password_change", r->last_password_change);
+       ndr_print_NTTIME(ndr, "acct_expiry", r->acct_expiry);
+       ndr_print_NTTIME(ndr, "allow_password_change", r->allow_password_change);
+       ndr_print_NTTIME(ndr, "force_password_change", r->force_password_change);
+       ndr_print_lsa_String(ndr, "account_name", &r->account_name);
+       ndr_print_lsa_String(ndr, "full_name", &r->full_name);
+       ndr_print_lsa_String(ndr, "home_directory", &r->home_directory);
+       ndr_print_lsa_String(ndr, "home_drive", &r->home_drive);
+       ndr_print_lsa_String(ndr, "logon_script", &r->logon_script);
+       ndr_print_lsa_String(ndr, "profile_path", &r->profile_path);
+       ndr_print_lsa_String(ndr, "description", &r->description);
+       ndr_print_lsa_String(ndr, "workstations", &r->workstations);
+       ndr_print_lsa_String(ndr, "comment", &r->comment);
+       ndr_print_lsa_String(ndr, "parameters", &r->parameters);
+       ndr_print_lsa_String(ndr, "unknown1", &r->unknown1);
+       ndr_print_lsa_String(ndr, "unknown2", &r->unknown2);
+       ndr_print_lsa_String(ndr, "unknown3", &r->unknown3);
+       ndr_print_uint32(ndr, "buf_count", r->buf_count);
+       ndr_print_ptr(ndr, "buffer", r->buffer);
+       ndr->depth++;
+       if (r->buffer) {
+               ndr_print_array_uint8(ndr, "buffer", r->buffer, r->buf_count);
+       }
+       ndr->depth--;
+       ndr_print_uint32(ndr, "rid", r->rid);
+       ndr_print_uint32(ndr, "primary_gid", r->primary_gid);
+       ndr_print_samr_AcctFlags(ndr, "acct_flags", r->acct_flags);
+       ndr_print_samr_FieldsPresent(ndr, "fields_present", r->fields_present);
+       ndr_print_samr_LogonHours(ndr, "logon_hours", &r->logon_hours);
+       ndr_print_uint16(ndr, "bad_password_count", r->bad_password_count);
+       ndr_print_uint16(ndr, "logon_count", r->logon_count);
+       ndr_print_uint16(ndr, "country_code", r->country_code);
+       ndr_print_uint16(ndr, "code_page", r->code_page);
+       ndr_print_uint8(ndr, "nt_password_set", r->nt_password_set);
+       ndr_print_uint8(ndr, "lm_password_set", r->lm_password_set);
+       ndr_print_uint8(ndr, "password_expired", r->password_expired);
+       ndr_print_uint8(ndr, "unknown4", r->unknown4);
+       ndr->depth--;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_samr_CryptPassword(struct ndr_push *ndr, int ndr_flags, const struct samr_CryptPassword *r)
+{
+       {
+               uint32_t _flags_save_STRUCT = ndr->flags;
+               ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX);
+               if (ndr_flags & NDR_SCALARS) {
+                       NDR_CHECK(ndr_push_align(ndr, 1));
+                       NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->data, 516));
+               }
+               if (ndr_flags & NDR_BUFFERS) {
+               }
+               ndr->flags = _flags_save_STRUCT;
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_samr_CryptPassword(struct ndr_pull *ndr, int ndr_flags, struct samr_CryptPassword *r)
+{
+       {
+               uint32_t _flags_save_STRUCT = ndr->flags;
+               ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX);
+               if (ndr_flags & NDR_SCALARS) {
+                       NDR_CHECK(ndr_pull_align(ndr, 1));
+                       NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->data, 516));
+               }
+               if (ndr_flags & NDR_BUFFERS) {
+               }
+               ndr->flags = _flags_save_STRUCT;
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_CryptPassword(struct ndr_print *ndr, const char *name, const struct samr_CryptPassword *r)
+{
+       ndr_print_struct(ndr, name, "samr_CryptPassword");
+       {
+               uint32_t _flags_save_STRUCT = ndr->flags;
+               ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX);
+               ndr->depth++;
+               ndr_print_array_uint8(ndr, "data", r->data, 516);
+               ndr->depth--;
+               ndr->flags = _flags_save_STRUCT;
+       }
+}
+
+static enum ndr_err_code ndr_push_samr_UserInfo23(struct ndr_push *ndr, int ndr_flags, const struct samr_UserInfo23 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_samr_UserInfo21(ndr, NDR_SCALARS, &r->info));
+               NDR_CHECK(ndr_push_samr_CryptPassword(ndr, NDR_SCALARS, &r->password));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_push_samr_UserInfo21(ndr, NDR_BUFFERS, &r->info));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_UserInfo23(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo23 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_samr_UserInfo21(ndr, NDR_SCALARS, &r->info));
+               NDR_CHECK(ndr_pull_samr_CryptPassword(ndr, NDR_SCALARS, &r->password));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_pull_samr_UserInfo21(ndr, NDR_BUFFERS, &r->info));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_UserInfo23(struct ndr_print *ndr, const char *name, const struct samr_UserInfo23 *r)
+{
+       ndr_print_struct(ndr, name, "samr_UserInfo23");
+       ndr->depth++;
+       ndr_print_samr_UserInfo21(ndr, "info", &r->info);
+       ndr_print_samr_CryptPassword(ndr, "password", &r->password);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_UserInfo24(struct ndr_push *ndr, int ndr_flags, const struct samr_UserInfo24 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 1));
+               NDR_CHECK(ndr_push_samr_CryptPassword(ndr, NDR_SCALARS, &r->password));
+               NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->pw_len));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_UserInfo24(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo24 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 1));
+               NDR_CHECK(ndr_pull_samr_CryptPassword(ndr, NDR_SCALARS, &r->password));
+               NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->pw_len));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_UserInfo24(struct ndr_print *ndr, const char *name, const struct samr_UserInfo24 *r)
+{
+       ndr_print_struct(ndr, name, "samr_UserInfo24");
+       ndr->depth++;
+       ndr_print_samr_CryptPassword(ndr, "password", &r->password);
+       ndr_print_uint8(ndr, "pw_len", r->pw_len);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_CryptPasswordEx(struct ndr_push *ndr, int ndr_flags, const struct samr_CryptPasswordEx *r)
+{
+       {
+               uint32_t _flags_save_STRUCT = ndr->flags;
+               ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX);
+               if (ndr_flags & NDR_SCALARS) {
+                       NDR_CHECK(ndr_push_align(ndr, 1));
+                       NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->data, 532));
+               }
+               if (ndr_flags & NDR_BUFFERS) {
+               }
+               ndr->flags = _flags_save_STRUCT;
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_CryptPasswordEx(struct ndr_pull *ndr, int ndr_flags, struct samr_CryptPasswordEx *r)
+{
+       {
+               uint32_t _flags_save_STRUCT = ndr->flags;
+               ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX);
+               if (ndr_flags & NDR_SCALARS) {
+                       NDR_CHECK(ndr_pull_align(ndr, 1));
+                       NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->data, 532));
+               }
+               if (ndr_flags & NDR_BUFFERS) {
+               }
+               ndr->flags = _flags_save_STRUCT;
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_CryptPasswordEx(struct ndr_print *ndr, const char *name, const struct samr_CryptPasswordEx *r)
+{
+       ndr_print_struct(ndr, name, "samr_CryptPasswordEx");
+       {
+               uint32_t _flags_save_STRUCT = ndr->flags;
+               ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX);
+               ndr->depth++;
+               ndr_print_array_uint8(ndr, "data", r->data, 532);
+               ndr->depth--;
+               ndr->flags = _flags_save_STRUCT;
+       }
+}
+
+static enum ndr_err_code ndr_push_samr_UserInfo25(struct ndr_push *ndr, int ndr_flags, const struct samr_UserInfo25 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_samr_UserInfo21(ndr, NDR_SCALARS, &r->info));
+               NDR_CHECK(ndr_push_samr_CryptPasswordEx(ndr, NDR_SCALARS, &r->password));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_push_samr_UserInfo21(ndr, NDR_BUFFERS, &r->info));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_UserInfo25(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo25 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_samr_UserInfo21(ndr, NDR_SCALARS, &r->info));
+               NDR_CHECK(ndr_pull_samr_CryptPasswordEx(ndr, NDR_SCALARS, &r->password));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_pull_samr_UserInfo21(ndr, NDR_BUFFERS, &r->info));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_UserInfo25(struct ndr_print *ndr, const char *name, const struct samr_UserInfo25 *r)
+{
+       ndr_print_struct(ndr, name, "samr_UserInfo25");
+       ndr->depth++;
+       ndr_print_samr_UserInfo21(ndr, "info", &r->info);
+       ndr_print_samr_CryptPasswordEx(ndr, "password", &r->password);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_UserInfo26(struct ndr_push *ndr, int ndr_flags, const struct samr_UserInfo26 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 1));
+               NDR_CHECK(ndr_push_samr_CryptPasswordEx(ndr, NDR_SCALARS, &r->password));
+               NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->pw_len));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_UserInfo26(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo26 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 1));
+               NDR_CHECK(ndr_pull_samr_CryptPasswordEx(ndr, NDR_SCALARS, &r->password));
+               NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->pw_len));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_UserInfo26(struct ndr_print *ndr, const char *name, const struct samr_UserInfo26 *r)
+{
+       ndr_print_struct(ndr, name, "samr_UserInfo26");
+       ndr->depth++;
+       ndr_print_samr_CryptPasswordEx(ndr, "password", &r->password);
+       ndr_print_uint8(ndr, "pw_len", r->pw_len);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_UserInfo(struct ndr_push *ndr, int ndr_flags, const union samr_UserInfo *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               int level = ndr_push_get_switch_value(ndr, r);
+               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, level));
+               switch (level) {
+                       case 1:
+                               NDR_CHECK(ndr_push_samr_UserInfo1(ndr, NDR_SCALARS, &r->info1));
+                       break;
+
+                       case 2:
+                               NDR_CHECK(ndr_push_samr_UserInfo2(ndr, NDR_SCALARS, &r->info2));
+                       break;
+
+                       case 3:
+                               NDR_CHECK(ndr_push_samr_UserInfo3(ndr, NDR_SCALARS, &r->info3));
+                       break;
+
+                       case 4:
+                               NDR_CHECK(ndr_push_samr_UserInfo4(ndr, NDR_SCALARS, &r->info4));
+                       break;
+
+                       case 5:
+                               NDR_CHECK(ndr_push_samr_UserInfo5(ndr, NDR_SCALARS, &r->info5));
+                       break;
+
+                       case 6:
+                               NDR_CHECK(ndr_push_samr_UserInfo6(ndr, NDR_SCALARS, &r->info6));
+                       break;
+
+                       case 7:
+                               NDR_CHECK(ndr_push_samr_UserInfo7(ndr, NDR_SCALARS, &r->info7));
+                       break;
+
+                       case 8:
+                               NDR_CHECK(ndr_push_samr_UserInfo8(ndr, NDR_SCALARS, &r->info8));
+                       break;
+
+                       case 9:
+                               NDR_CHECK(ndr_push_samr_UserInfo9(ndr, NDR_SCALARS, &r->info9));
+                       break;
+
+                       case 10:
+                               NDR_CHECK(ndr_push_samr_UserInfo10(ndr, NDR_SCALARS, &r->info10));
+                       break;
+
+                       case 11:
+                               NDR_CHECK(ndr_push_samr_UserInfo11(ndr, NDR_SCALARS, &r->info11));
+                       break;
+
+                       case 12:
+                               NDR_CHECK(ndr_push_samr_UserInfo12(ndr, NDR_SCALARS, &r->info12));
+                       break;
+
+                       case 13:
+                               NDR_CHECK(ndr_push_samr_UserInfo13(ndr, NDR_SCALARS, &r->info13));
+                       break;
+
+                       case 14:
+                               NDR_CHECK(ndr_push_samr_UserInfo14(ndr, NDR_SCALARS, &r->info14));
+                       break;
+
+                       case 16:
+                               NDR_CHECK(ndr_push_samr_UserInfo16(ndr, NDR_SCALARS, &r->info16));
+                       break;
+
+                       case 17:
+                               NDR_CHECK(ndr_push_samr_UserInfo17(ndr, NDR_SCALARS, &r->info17));
+                       break;
+
+                       case 20:
+                               NDR_CHECK(ndr_push_samr_UserInfo20(ndr, NDR_SCALARS, &r->info20));
+                       break;
+
+                       case 21:
+                               NDR_CHECK(ndr_push_samr_UserInfo21(ndr, NDR_SCALARS, &r->info21));
+                       break;
+
+                       case 23:
+                               NDR_CHECK(ndr_push_samr_UserInfo23(ndr, NDR_SCALARS, &r->info23));
+                       break;
+
+                       case 24:
+                               NDR_CHECK(ndr_push_samr_UserInfo24(ndr, NDR_SCALARS, &r->info24));
+                       break;
+
+                       case 25:
+                               NDR_CHECK(ndr_push_samr_UserInfo25(ndr, NDR_SCALARS, &r->info25));
+                       break;
+
+                       case 26:
+                               NDR_CHECK(ndr_push_samr_UserInfo26(ndr, NDR_SCALARS, &r->info26));
+                       break;
+
+                       default:
+                               return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               int level = ndr_push_get_switch_value(ndr, r);
+               switch (level) {
+                       case 1:
+                               NDR_CHECK(ndr_push_samr_UserInfo1(ndr, NDR_BUFFERS, &r->info1));
+                       break;
+
+                       case 2:
+                               NDR_CHECK(ndr_push_samr_UserInfo2(ndr, NDR_BUFFERS, &r->info2));
+                       break;
+
+                       case 3:
+                               NDR_CHECK(ndr_push_samr_UserInfo3(ndr, NDR_BUFFERS, &r->info3));
+                       break;
+
+                       case 4:
+                               NDR_CHECK(ndr_push_samr_UserInfo4(ndr, NDR_BUFFERS, &r->info4));
+                       break;
+
+                       case 5:
+                               NDR_CHECK(ndr_push_samr_UserInfo5(ndr, NDR_BUFFERS, &r->info5));
+                       break;
+
+                       case 6:
+                               NDR_CHECK(ndr_push_samr_UserInfo6(ndr, NDR_BUFFERS, &r->info6));
+                       break;
+
+                       case 7:
+                               NDR_CHECK(ndr_push_samr_UserInfo7(ndr, NDR_BUFFERS, &r->info7));
+                       break;
+
+                       case 8:
+                               NDR_CHECK(ndr_push_samr_UserInfo8(ndr, NDR_BUFFERS, &r->info8));
+                       break;
+
+                       case 9:
+                       break;
+
+                       case 10:
+                               NDR_CHECK(ndr_push_samr_UserInfo10(ndr, NDR_BUFFERS, &r->info10));
+                       break;
+
+                       case 11:
+                               NDR_CHECK(ndr_push_samr_UserInfo11(ndr, NDR_BUFFERS, &r->info11));
+                       break;
+
+                       case 12:
+                               NDR_CHECK(ndr_push_samr_UserInfo12(ndr, NDR_BUFFERS, &r->info12));
+                       break;
+
+                       case 13:
+                               NDR_CHECK(ndr_push_samr_UserInfo13(ndr, NDR_BUFFERS, &r->info13));
+                       break;
+
+                       case 14:
+                               NDR_CHECK(ndr_push_samr_UserInfo14(ndr, NDR_BUFFERS, &r->info14));
+                       break;
+
+                       case 16:
+                       break;
+
+                       case 17:
+                       break;
+
+                       case 20:
+                               NDR_CHECK(ndr_push_samr_UserInfo20(ndr, NDR_BUFFERS, &r->info20));
+                       break;
+
+                       case 21:
+                               NDR_CHECK(ndr_push_samr_UserInfo21(ndr, NDR_BUFFERS, &r->info21));
+                       break;
+
+                       case 23:
+                               NDR_CHECK(ndr_push_samr_UserInfo23(ndr, NDR_BUFFERS, &r->info23));
+                       break;
+
+                       case 24:
+                       break;
+
+                       case 25:
+                               NDR_CHECK(ndr_push_samr_UserInfo25(ndr, NDR_BUFFERS, &r->info25));
+                       break;
+
+                       case 26:
+                       break;
+
+                       default:
+                               return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_UserInfo(struct ndr_pull *ndr, int ndr_flags, union samr_UserInfo *r)
+{
+       int level;
+       uint16_t _level;
+       level = ndr_pull_get_switch_value(ndr, r);
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &_level));
+               if (_level != level) {
+                       return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u for r", _level);
+               }
+               switch (level) {
+                       case 1: {
+                               NDR_CHECK(ndr_pull_samr_UserInfo1(ndr, NDR_SCALARS, &r->info1));
+                       break; }
+
+                       case 2: {
+                               NDR_CHECK(ndr_pull_samr_UserInfo2(ndr, NDR_SCALARS, &r->info2));
+                       break; }
+
+                       case 3: {
+                               NDR_CHECK(ndr_pull_samr_UserInfo3(ndr, NDR_SCALARS, &r->info3));
+                       break; }
+
+                       case 4: {
+                               NDR_CHECK(ndr_pull_samr_UserInfo4(ndr, NDR_SCALARS, &r->info4));
+                       break; }
+
+                       case 5: {
+                               NDR_CHECK(ndr_pull_samr_UserInfo5(ndr, NDR_SCALARS, &r->info5));
+                       break; }
+
+                       case 6: {
+                               NDR_CHECK(ndr_pull_samr_UserInfo6(ndr, NDR_SCALARS, &r->info6));
+                       break; }
+
+                       case 7: {
+                               NDR_CHECK(ndr_pull_samr_UserInfo7(ndr, NDR_SCALARS, &r->info7));
+                       break; }
+
+                       case 8: {
+                               NDR_CHECK(ndr_pull_samr_UserInfo8(ndr, NDR_SCALARS, &r->info8));
+                       break; }
+
+                       case 9: {
+                               NDR_CHECK(ndr_pull_samr_UserInfo9(ndr, NDR_SCALARS, &r->info9));
+                       break; }
+
+                       case 10: {
+                               NDR_CHECK(ndr_pull_samr_UserInfo10(ndr, NDR_SCALARS, &r->info10));
+                       break; }
+
+                       case 11: {
+                               NDR_CHECK(ndr_pull_samr_UserInfo11(ndr, NDR_SCALARS, &r->info11));
+                       break; }
+
+                       case 12: {
+                               NDR_CHECK(ndr_pull_samr_UserInfo12(ndr, NDR_SCALARS, &r->info12));
+                       break; }
+
+                       case 13: {
+                               NDR_CHECK(ndr_pull_samr_UserInfo13(ndr, NDR_SCALARS, &r->info13));
+                       break; }
+
+                       case 14: {
+                               NDR_CHECK(ndr_pull_samr_UserInfo14(ndr, NDR_SCALARS, &r->info14));
+                       break; }
+
+                       case 16: {
+                               NDR_CHECK(ndr_pull_samr_UserInfo16(ndr, NDR_SCALARS, &r->info16));
+                       break; }
+
+                       case 17: {
+                               NDR_CHECK(ndr_pull_samr_UserInfo17(ndr, NDR_SCALARS, &r->info17));
+                       break; }
+
+                       case 20: {
+                               NDR_CHECK(ndr_pull_samr_UserInfo20(ndr, NDR_SCALARS, &r->info20));
+                       break; }
+
+                       case 21: {
+                               NDR_CHECK(ndr_pull_samr_UserInfo21(ndr, NDR_SCALARS, &r->info21));
+                       break; }
+
+                       case 23: {
+                               NDR_CHECK(ndr_pull_samr_UserInfo23(ndr, NDR_SCALARS, &r->info23));
+                       break; }
+
+                       case 24: {
+                               NDR_CHECK(ndr_pull_samr_UserInfo24(ndr, NDR_SCALARS, &r->info24));
+                       break; }
+
+                       case 25: {
+                               NDR_CHECK(ndr_pull_samr_UserInfo25(ndr, NDR_SCALARS, &r->info25));
+                       break; }
+
+                       case 26: {
+                               NDR_CHECK(ndr_pull_samr_UserInfo26(ndr, NDR_SCALARS, &r->info26));
+                       break; }
+
+                       default:
+                               return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               switch (level) {
+                       case 1:
+                               NDR_CHECK(ndr_pull_samr_UserInfo1(ndr, NDR_BUFFERS, &r->info1));
+                       break;
+
+                       case 2:
+                               NDR_CHECK(ndr_pull_samr_UserInfo2(ndr, NDR_BUFFERS, &r->info2));
+                       break;
+
+                       case 3:
+                               NDR_CHECK(ndr_pull_samr_UserInfo3(ndr, NDR_BUFFERS, &r->info3));
+                       break;
+
+                       case 4:
+                               NDR_CHECK(ndr_pull_samr_UserInfo4(ndr, NDR_BUFFERS, &r->info4));
+                       break;
+
+                       case 5:
+                               NDR_CHECK(ndr_pull_samr_UserInfo5(ndr, NDR_BUFFERS, &r->info5));
+                       break;
+
+                       case 6:
+                               NDR_CHECK(ndr_pull_samr_UserInfo6(ndr, NDR_BUFFERS, &r->info6));
+                       break;
+
+                       case 7:
+                               NDR_CHECK(ndr_pull_samr_UserInfo7(ndr, NDR_BUFFERS, &r->info7));
+                       break;
+
+                       case 8:
+                               NDR_CHECK(ndr_pull_samr_UserInfo8(ndr, NDR_BUFFERS, &r->info8));
+                       break;
+
+                       case 9:
+                       break;
+
+                       case 10:
+                               NDR_CHECK(ndr_pull_samr_UserInfo10(ndr, NDR_BUFFERS, &r->info10));
+                       break;
+
+                       case 11:
+                               NDR_CHECK(ndr_pull_samr_UserInfo11(ndr, NDR_BUFFERS, &r->info11));
+                       break;
+
+                       case 12:
+                               NDR_CHECK(ndr_pull_samr_UserInfo12(ndr, NDR_BUFFERS, &r->info12));
+                       break;
+
+                       case 13:
+                               NDR_CHECK(ndr_pull_samr_UserInfo13(ndr, NDR_BUFFERS, &r->info13));
+                       break;
+
+                       case 14:
+                               NDR_CHECK(ndr_pull_samr_UserInfo14(ndr, NDR_BUFFERS, &r->info14));
+                       break;
+
+                       case 16:
+                       break;
+
+                       case 17:
+                       break;
+
+                       case 20:
+                               NDR_CHECK(ndr_pull_samr_UserInfo20(ndr, NDR_BUFFERS, &r->info20));
+                       break;
+
+                       case 21:
+                               NDR_CHECK(ndr_pull_samr_UserInfo21(ndr, NDR_BUFFERS, &r->info21));
+                       break;
+
+                       case 23:
+                               NDR_CHECK(ndr_pull_samr_UserInfo23(ndr, NDR_BUFFERS, &r->info23));
+                       break;
+
+                       case 24:
+                       break;
+
+                       case 25:
+                               NDR_CHECK(ndr_pull_samr_UserInfo25(ndr, NDR_BUFFERS, &r->info25));
+                       break;
+
+                       case 26:
+                       break;
+
+                       default:
+                               return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_UserInfo(struct ndr_print *ndr, const char *name, const union samr_UserInfo *r)
+{
+       int level;
+       level = ndr_print_get_switch_value(ndr, r);
+       ndr_print_union(ndr, name, level, "samr_UserInfo");
+       switch (level) {
+               case 1:
+                       ndr_print_samr_UserInfo1(ndr, "info1", &r->info1);
+               break;
+
+               case 2:
+                       ndr_print_samr_UserInfo2(ndr, "info2", &r->info2);
+               break;
+
+               case 3:
+                       ndr_print_samr_UserInfo3(ndr, "info3", &r->info3);
+               break;
+
+               case 4:
+                       ndr_print_samr_UserInfo4(ndr, "info4", &r->info4);
+               break;
+
+               case 5:
+                       ndr_print_samr_UserInfo5(ndr, "info5", &r->info5);
+               break;
+
+               case 6:
+                       ndr_print_samr_UserInfo6(ndr, "info6", &r->info6);
+               break;
+
+               case 7:
+                       ndr_print_samr_UserInfo7(ndr, "info7", &r->info7);
+               break;
+
+               case 8:
+                       ndr_print_samr_UserInfo8(ndr, "info8", &r->info8);
+               break;
+
+               case 9:
+                       ndr_print_samr_UserInfo9(ndr, "info9", &r->info9);
+               break;
+
+               case 10:
+                       ndr_print_samr_UserInfo10(ndr, "info10", &r->info10);
+               break;
+
+               case 11:
+                       ndr_print_samr_UserInfo11(ndr, "info11", &r->info11);
+               break;
+
+               case 12:
+                       ndr_print_samr_UserInfo12(ndr, "info12", &r->info12);
+               break;
+
+               case 13:
+                       ndr_print_samr_UserInfo13(ndr, "info13", &r->info13);
+               break;
+
+               case 14:
+                       ndr_print_samr_UserInfo14(ndr, "info14", &r->info14);
+               break;
+
+               case 16:
+                       ndr_print_samr_UserInfo16(ndr, "info16", &r->info16);
+               break;
+
+               case 17:
+                       ndr_print_samr_UserInfo17(ndr, "info17", &r->info17);
+               break;
+
+               case 20:
+                       ndr_print_samr_UserInfo20(ndr, "info20", &r->info20);
+               break;
+
+               case 21:
+                       ndr_print_samr_UserInfo21(ndr, "info21", &r->info21);
+               break;
+
+               case 23:
+                       ndr_print_samr_UserInfo23(ndr, "info23", &r->info23);
+               break;
+
+               case 24:
+                       ndr_print_samr_UserInfo24(ndr, "info24", &r->info24);
+               break;
+
+               case 25:
+                       ndr_print_samr_UserInfo25(ndr, "info25", &r->info25);
+               break;
+
+               case 26:
+                       ndr_print_samr_UserInfo26(ndr, "info26", &r->info26);
+               break;
+
+               default:
+                       ndr_print_bad_level(ndr, name, level);
+       }
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_samr_Password(struct ndr_push *ndr, int ndr_flags, const struct samr_Password *r)
+{
+       {
+               uint32_t _flags_save_STRUCT = ndr->flags;
+               ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX);
+               if (ndr_flags & NDR_SCALARS) {
+                       NDR_CHECK(ndr_push_align(ndr, 1));
+                       NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->hash, 16));
+               }
+               if (ndr_flags & NDR_BUFFERS) {
+               }
+               ndr->flags = _flags_save_STRUCT;
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_samr_Password(struct ndr_pull *ndr, int ndr_flags, struct samr_Password *r)
+{
+       {
+               uint32_t _flags_save_STRUCT = ndr->flags;
+               ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX);
+               if (ndr_flags & NDR_SCALARS) {
+                       NDR_CHECK(ndr_pull_align(ndr, 1));
+                       NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->hash, 16));
+               }
+               if (ndr_flags & NDR_BUFFERS) {
+               }
+               ndr->flags = _flags_save_STRUCT;
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_Password(struct ndr_print *ndr, const char *name, const struct samr_Password *r)
+{
+       ndr_print_struct(ndr, name, "samr_Password");
+       {
+               uint32_t _flags_save_STRUCT = ndr->flags;
+               ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX);
+               ndr->depth++;
+               ndr_print_array_uint8(ndr, "hash", r->hash, 16);
+               ndr->depth--;
+               ndr->flags = _flags_save_STRUCT;
+       }
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_samr_RidWithAttribute(struct ndr_push *ndr, int ndr_flags, const struct samr_RidWithAttribute *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->rid));
+               NDR_CHECK(ndr_push_samr_GroupAttrs(ndr, NDR_SCALARS, r->attributes));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_samr_RidWithAttribute(struct ndr_pull *ndr, int ndr_flags, struct samr_RidWithAttribute *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->rid));
+               NDR_CHECK(ndr_pull_samr_GroupAttrs(ndr, NDR_SCALARS, &r->attributes));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_RidWithAttribute(struct ndr_print *ndr, const char *name, const struct samr_RidWithAttribute *r)
+{
+       ndr_print_struct(ndr, name, "samr_RidWithAttribute");
+       ndr->depth++;
+       ndr_print_uint32(ndr, "rid", r->rid);
+       ndr_print_samr_GroupAttrs(ndr, "attributes", r->attributes);
+       ndr->depth--;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_samr_RidWithAttributeArray(struct ndr_push *ndr, int ndr_flags, const struct samr_RidWithAttributeArray *r)
+{
+       uint32_t cntr_rids_1;
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count));
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->rids));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               if (r->rids) {
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count));
+                       for (cntr_rids_1 = 0; cntr_rids_1 < r->count; cntr_rids_1++) {
+                               NDR_CHECK(ndr_push_samr_RidWithAttribute(ndr, NDR_SCALARS, &r->rids[cntr_rids_1]));
+                       }
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_samr_RidWithAttributeArray(struct ndr_pull *ndr, int ndr_flags, struct samr_RidWithAttributeArray *r)
+{
+       uint32_t _ptr_rids;
+       uint32_t cntr_rids_1;
+       TALLOC_CTX *_mem_save_rids_0;
+       TALLOC_CTX *_mem_save_rids_1;
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->count));
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_rids));
+               if (_ptr_rids) {
+                       NDR_PULL_ALLOC(ndr, r->rids);
+               } else {
+                       r->rids = NULL;
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               if (r->rids) {
+                       _mem_save_rids_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->rids, 0);
+                       NDR_CHECK(ndr_pull_array_size(ndr, &r->rids));
+                       NDR_PULL_ALLOC_N(ndr, r->rids, ndr_get_array_size(ndr, &r->rids));
+                       _mem_save_rids_1 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->rids, 0);
+                       for (cntr_rids_1 = 0; cntr_rids_1 < r->count; cntr_rids_1++) {
+                               NDR_CHECK(ndr_pull_samr_RidWithAttribute(ndr, NDR_SCALARS, &r->rids[cntr_rids_1]));
+                       }
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_rids_1, 0);
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_rids_0, 0);
+               }
+               if (r->rids) {
+                       NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->rids, r->count));
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_RidWithAttributeArray(struct ndr_print *ndr, const char *name, const struct samr_RidWithAttributeArray *r)
+{
+       uint32_t cntr_rids_1;
+       ndr_print_struct(ndr, name, "samr_RidWithAttributeArray");
+       ndr->depth++;
+       ndr_print_uint32(ndr, "count", r->count);
+       ndr_print_ptr(ndr, "rids", r->rids);
+       ndr->depth++;
+       if (r->rids) {
+               ndr->print(ndr, "%s: ARRAY(%d)", "rids", r->count);
+               ndr->depth++;
+               for (cntr_rids_1=0;cntr_rids_1<r->count;cntr_rids_1++) {
+                       char *idx_1=NULL;
+                       asprintf(&idx_1, "[%d]", cntr_rids_1);
+                       if (idx_1) {
+                               ndr_print_samr_RidWithAttribute(ndr, "rids", &r->rids[cntr_rids_1]);
+                               free(idx_1);
+                       }
+               }
+               ndr->depth--;
+       }
+       ndr->depth--;
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_DispEntryGeneral(struct ndr_push *ndr, int ndr_flags, const struct samr_DispEntryGeneral *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->idx));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->rid));
+               NDR_CHECK(ndr_push_samr_AcctFlags(ndr, NDR_SCALARS, r->acct_flags));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->account_name));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->description));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->full_name));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->account_name));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->description));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->full_name));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_DispEntryGeneral(struct ndr_pull *ndr, int ndr_flags, struct samr_DispEntryGeneral *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->idx));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->rid));
+               NDR_CHECK(ndr_pull_samr_AcctFlags(ndr, NDR_SCALARS, &r->acct_flags));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->account_name));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->description));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->full_name));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->account_name));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->description));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->full_name));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_DispEntryGeneral(struct ndr_print *ndr, const char *name, const struct samr_DispEntryGeneral *r)
+{
+       ndr_print_struct(ndr, name, "samr_DispEntryGeneral");
+       ndr->depth++;
+       ndr_print_uint32(ndr, "idx", r->idx);
+       ndr_print_uint32(ndr, "rid", r->rid);
+       ndr_print_samr_AcctFlags(ndr, "acct_flags", r->acct_flags);
+       ndr_print_lsa_String(ndr, "account_name", &r->account_name);
+       ndr_print_lsa_String(ndr, "description", &r->description);
+       ndr_print_lsa_String(ndr, "full_name", &r->full_name);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_DispInfoGeneral(struct ndr_push *ndr, int ndr_flags, const struct samr_DispInfoGeneral *r)
+{
+       uint32_t cntr_entries_1;
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count));
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->entries));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               if (r->entries) {
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count));
+                       for (cntr_entries_1 = 0; cntr_entries_1 < r->count; cntr_entries_1++) {
+                               NDR_CHECK(ndr_push_samr_DispEntryGeneral(ndr, NDR_SCALARS, &r->entries[cntr_entries_1]));
+                       }
+                       for (cntr_entries_1 = 0; cntr_entries_1 < r->count; cntr_entries_1++) {
+                               NDR_CHECK(ndr_push_samr_DispEntryGeneral(ndr, NDR_BUFFERS, &r->entries[cntr_entries_1]));
+                       }
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_DispInfoGeneral(struct ndr_pull *ndr, int ndr_flags, struct samr_DispInfoGeneral *r)
+{
+       uint32_t _ptr_entries;
+       uint32_t cntr_entries_1;
+       TALLOC_CTX *_mem_save_entries_0;
+       TALLOC_CTX *_mem_save_entries_1;
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->count));
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_entries));
+               if (_ptr_entries) {
+                       NDR_PULL_ALLOC(ndr, r->entries);
+               } else {
+                       r->entries = NULL;
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               if (r->entries) {
+                       _mem_save_entries_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->entries, 0);
+                       NDR_CHECK(ndr_pull_array_size(ndr, &r->entries));
+                       NDR_PULL_ALLOC_N(ndr, r->entries, ndr_get_array_size(ndr, &r->entries));
+                       _mem_save_entries_1 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->entries, 0);
+                       for (cntr_entries_1 = 0; cntr_entries_1 < r->count; cntr_entries_1++) {
+                               NDR_CHECK(ndr_pull_samr_DispEntryGeneral(ndr, NDR_SCALARS, &r->entries[cntr_entries_1]));
+                       }
+                       for (cntr_entries_1 = 0; cntr_entries_1 < r->count; cntr_entries_1++) {
+                               NDR_CHECK(ndr_pull_samr_DispEntryGeneral(ndr, NDR_BUFFERS, &r->entries[cntr_entries_1]));
+                       }
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_entries_1, 0);
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_entries_0, 0);
+               }
+               if (r->entries) {
+                       NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->entries, r->count));
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_DispInfoGeneral(struct ndr_print *ndr, const char *name, const struct samr_DispInfoGeneral *r)
+{
+       uint32_t cntr_entries_1;
+       ndr_print_struct(ndr, name, "samr_DispInfoGeneral");
+       ndr->depth++;
+       ndr_print_uint32(ndr, "count", r->count);
+       ndr_print_ptr(ndr, "entries", r->entries);
+       ndr->depth++;
+       if (r->entries) {
+               ndr->print(ndr, "%s: ARRAY(%d)", "entries", r->count);
+               ndr->depth++;
+               for (cntr_entries_1=0;cntr_entries_1<r->count;cntr_entries_1++) {
+                       char *idx_1=NULL;
+                       asprintf(&idx_1, "[%d]", cntr_entries_1);
+                       if (idx_1) {
+                               ndr_print_samr_DispEntryGeneral(ndr, "entries", &r->entries[cntr_entries_1]);
+                               free(idx_1);
+                       }
+               }
+               ndr->depth--;
+       }
+       ndr->depth--;
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_DispEntryFull(struct ndr_push *ndr, int ndr_flags, const struct samr_DispEntryFull *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->idx));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->rid));
+               NDR_CHECK(ndr_push_samr_AcctFlags(ndr, NDR_SCALARS, r->acct_flags));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->account_name));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->description));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->account_name));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->description));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_DispEntryFull(struct ndr_pull *ndr, int ndr_flags, struct samr_DispEntryFull *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->idx));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->rid));
+               NDR_CHECK(ndr_pull_samr_AcctFlags(ndr, NDR_SCALARS, &r->acct_flags));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->account_name));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->description));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->account_name));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->description));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_DispEntryFull(struct ndr_print *ndr, const char *name, const struct samr_DispEntryFull *r)
+{
+       ndr_print_struct(ndr, name, "samr_DispEntryFull");
+       ndr->depth++;
+       ndr_print_uint32(ndr, "idx", r->idx);
+       ndr_print_uint32(ndr, "rid", r->rid);
+       ndr_print_samr_AcctFlags(ndr, "acct_flags", r->acct_flags);
+       ndr_print_lsa_String(ndr, "account_name", &r->account_name);
+       ndr_print_lsa_String(ndr, "description", &r->description);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_DispInfoFull(struct ndr_push *ndr, int ndr_flags, const struct samr_DispInfoFull *r)
+{
+       uint32_t cntr_entries_1;
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count));
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->entries));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               if (r->entries) {
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count));
+                       for (cntr_entries_1 = 0; cntr_entries_1 < r->count; cntr_entries_1++) {
+                               NDR_CHECK(ndr_push_samr_DispEntryFull(ndr, NDR_SCALARS, &r->entries[cntr_entries_1]));
+                       }
+                       for (cntr_entries_1 = 0; cntr_entries_1 < r->count; cntr_entries_1++) {
+                               NDR_CHECK(ndr_push_samr_DispEntryFull(ndr, NDR_BUFFERS, &r->entries[cntr_entries_1]));
+                       }
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_DispInfoFull(struct ndr_pull *ndr, int ndr_flags, struct samr_DispInfoFull *r)
+{
+       uint32_t _ptr_entries;
+       uint32_t cntr_entries_1;
+       TALLOC_CTX *_mem_save_entries_0;
+       TALLOC_CTX *_mem_save_entries_1;
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->count));
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_entries));
+               if (_ptr_entries) {
+                       NDR_PULL_ALLOC(ndr, r->entries);
+               } else {
+                       r->entries = NULL;
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               if (r->entries) {
+                       _mem_save_entries_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->entries, 0);
+                       NDR_CHECK(ndr_pull_array_size(ndr, &r->entries));
+                       NDR_PULL_ALLOC_N(ndr, r->entries, ndr_get_array_size(ndr, &r->entries));
+                       _mem_save_entries_1 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->entries, 0);
+                       for (cntr_entries_1 = 0; cntr_entries_1 < r->count; cntr_entries_1++) {
+                               NDR_CHECK(ndr_pull_samr_DispEntryFull(ndr, NDR_SCALARS, &r->entries[cntr_entries_1]));
+                       }
+                       for (cntr_entries_1 = 0; cntr_entries_1 < r->count; cntr_entries_1++) {
+                               NDR_CHECK(ndr_pull_samr_DispEntryFull(ndr, NDR_BUFFERS, &r->entries[cntr_entries_1]));
+                       }
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_entries_1, 0);
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_entries_0, 0);
+               }
+               if (r->entries) {
+                       NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->entries, r->count));
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_DispInfoFull(struct ndr_print *ndr, const char *name, const struct samr_DispInfoFull *r)
+{
+       uint32_t cntr_entries_1;
+       ndr_print_struct(ndr, name, "samr_DispInfoFull");
+       ndr->depth++;
+       ndr_print_uint32(ndr, "count", r->count);
+       ndr_print_ptr(ndr, "entries", r->entries);
+       ndr->depth++;
+       if (r->entries) {
+               ndr->print(ndr, "%s: ARRAY(%d)", "entries", r->count);
+               ndr->depth++;
+               for (cntr_entries_1=0;cntr_entries_1<r->count;cntr_entries_1++) {
+                       char *idx_1=NULL;
+                       asprintf(&idx_1, "[%d]", cntr_entries_1);
+                       if (idx_1) {
+                               ndr_print_samr_DispEntryFull(ndr, "entries", &r->entries[cntr_entries_1]);
+                               free(idx_1);
+                       }
+               }
+               ndr->depth--;
+       }
+       ndr->depth--;
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_DispEntryFullGroup(struct ndr_push *ndr, int ndr_flags, const struct samr_DispEntryFullGroup *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->idx));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->rid));
+               NDR_CHECK(ndr_push_samr_GroupAttrs(ndr, NDR_SCALARS, r->acct_flags));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->account_name));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->description));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->account_name));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->description));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_DispEntryFullGroup(struct ndr_pull *ndr, int ndr_flags, struct samr_DispEntryFullGroup *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->idx));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->rid));
+               NDR_CHECK(ndr_pull_samr_GroupAttrs(ndr, NDR_SCALARS, &r->acct_flags));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->account_name));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->description));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->account_name));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->description));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_DispEntryFullGroup(struct ndr_print *ndr, const char *name, const struct samr_DispEntryFullGroup *r)
+{
+       ndr_print_struct(ndr, name, "samr_DispEntryFullGroup");
+       ndr->depth++;
+       ndr_print_uint32(ndr, "idx", r->idx);
+       ndr_print_uint32(ndr, "rid", r->rid);
+       ndr_print_samr_GroupAttrs(ndr, "acct_flags", r->acct_flags);
+       ndr_print_lsa_String(ndr, "account_name", &r->account_name);
+       ndr_print_lsa_String(ndr, "description", &r->description);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_DispInfoFullGroups(struct ndr_push *ndr, int ndr_flags, const struct samr_DispInfoFullGroups *r)
+{
+       uint32_t cntr_entries_1;
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count));
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->entries));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               if (r->entries) {
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count));
+                       for (cntr_entries_1 = 0; cntr_entries_1 < r->count; cntr_entries_1++) {
+                               NDR_CHECK(ndr_push_samr_DispEntryFullGroup(ndr, NDR_SCALARS, &r->entries[cntr_entries_1]));
+                       }
+                       for (cntr_entries_1 = 0; cntr_entries_1 < r->count; cntr_entries_1++) {
+                               NDR_CHECK(ndr_push_samr_DispEntryFullGroup(ndr, NDR_BUFFERS, &r->entries[cntr_entries_1]));
+                       }
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_DispInfoFullGroups(struct ndr_pull *ndr, int ndr_flags, struct samr_DispInfoFullGroups *r)
+{
+       uint32_t _ptr_entries;
+       uint32_t cntr_entries_1;
+       TALLOC_CTX *_mem_save_entries_0;
+       TALLOC_CTX *_mem_save_entries_1;
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->count));
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_entries));
+               if (_ptr_entries) {
+                       NDR_PULL_ALLOC(ndr, r->entries);
+               } else {
+                       r->entries = NULL;
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               if (r->entries) {
+                       _mem_save_entries_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->entries, 0);
+                       NDR_CHECK(ndr_pull_array_size(ndr, &r->entries));
+                       NDR_PULL_ALLOC_N(ndr, r->entries, ndr_get_array_size(ndr, &r->entries));
+                       _mem_save_entries_1 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->entries, 0);
+                       for (cntr_entries_1 = 0; cntr_entries_1 < r->count; cntr_entries_1++) {
+                               NDR_CHECK(ndr_pull_samr_DispEntryFullGroup(ndr, NDR_SCALARS, &r->entries[cntr_entries_1]));
+                       }
+                       for (cntr_entries_1 = 0; cntr_entries_1 < r->count; cntr_entries_1++) {
+                               NDR_CHECK(ndr_pull_samr_DispEntryFullGroup(ndr, NDR_BUFFERS, &r->entries[cntr_entries_1]));
+                       }
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_entries_1, 0);
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_entries_0, 0);
+               }
+               if (r->entries) {
+                       NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->entries, r->count));
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_DispInfoFullGroups(struct ndr_print *ndr, const char *name, const struct samr_DispInfoFullGroups *r)
+{
+       uint32_t cntr_entries_1;
+       ndr_print_struct(ndr, name, "samr_DispInfoFullGroups");
+       ndr->depth++;
+       ndr_print_uint32(ndr, "count", r->count);
+       ndr_print_ptr(ndr, "entries", r->entries);
+       ndr->depth++;
+       if (r->entries) {
+               ndr->print(ndr, "%s: ARRAY(%d)", "entries", r->count);
+               ndr->depth++;
+               for (cntr_entries_1=0;cntr_entries_1<r->count;cntr_entries_1++) {
+                       char *idx_1=NULL;
+                       asprintf(&idx_1, "[%d]", cntr_entries_1);
+                       if (idx_1) {
+                               ndr_print_samr_DispEntryFullGroup(ndr, "entries", &r->entries[cntr_entries_1]);
+                               free(idx_1);
+                       }
+               }
+               ndr->depth--;
+       }
+       ndr->depth--;
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_DispEntryAscii(struct ndr_push *ndr, int ndr_flags, const struct samr_DispEntryAscii *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->idx));
+               NDR_CHECK(ndr_push_lsa_AsciiString(ndr, NDR_SCALARS, &r->account_name));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_push_lsa_AsciiString(ndr, NDR_BUFFERS, &r->account_name));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_DispEntryAscii(struct ndr_pull *ndr, int ndr_flags, struct samr_DispEntryAscii *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->idx));
+               NDR_CHECK(ndr_pull_lsa_AsciiString(ndr, NDR_SCALARS, &r->account_name));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_pull_lsa_AsciiString(ndr, NDR_BUFFERS, &r->account_name));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_DispEntryAscii(struct ndr_print *ndr, const char *name, const struct samr_DispEntryAscii *r)
+{
+       ndr_print_struct(ndr, name, "samr_DispEntryAscii");
+       ndr->depth++;
+       ndr_print_uint32(ndr, "idx", r->idx);
+       ndr_print_lsa_AsciiString(ndr, "account_name", &r->account_name);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_DispInfoAscii(struct ndr_push *ndr, int ndr_flags, const struct samr_DispInfoAscii *r)
+{
+       uint32_t cntr_entries_1;
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count));
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->entries));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               if (r->entries) {
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count));
+                       for (cntr_entries_1 = 0; cntr_entries_1 < r->count; cntr_entries_1++) {
+                               NDR_CHECK(ndr_push_samr_DispEntryAscii(ndr, NDR_SCALARS, &r->entries[cntr_entries_1]));
+                       }
+                       for (cntr_entries_1 = 0; cntr_entries_1 < r->count; cntr_entries_1++) {
+                               NDR_CHECK(ndr_push_samr_DispEntryAscii(ndr, NDR_BUFFERS, &r->entries[cntr_entries_1]));
+                       }
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_DispInfoAscii(struct ndr_pull *ndr, int ndr_flags, struct samr_DispInfoAscii *r)
+{
+       uint32_t _ptr_entries;
+       uint32_t cntr_entries_1;
+       TALLOC_CTX *_mem_save_entries_0;
+       TALLOC_CTX *_mem_save_entries_1;
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->count));
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_entries));
+               if (_ptr_entries) {
+                       NDR_PULL_ALLOC(ndr, r->entries);
+               } else {
+                       r->entries = NULL;
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               if (r->entries) {
+                       _mem_save_entries_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->entries, 0);
+                       NDR_CHECK(ndr_pull_array_size(ndr, &r->entries));
+                       NDR_PULL_ALLOC_N(ndr, r->entries, ndr_get_array_size(ndr, &r->entries));
+                       _mem_save_entries_1 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->entries, 0);
+                       for (cntr_entries_1 = 0; cntr_entries_1 < r->count; cntr_entries_1++) {
+                               NDR_CHECK(ndr_pull_samr_DispEntryAscii(ndr, NDR_SCALARS, &r->entries[cntr_entries_1]));
+                       }
+                       for (cntr_entries_1 = 0; cntr_entries_1 < r->count; cntr_entries_1++) {
+                               NDR_CHECK(ndr_pull_samr_DispEntryAscii(ndr, NDR_BUFFERS, &r->entries[cntr_entries_1]));
+                       }
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_entries_1, 0);
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_entries_0, 0);
+               }
+               if (r->entries) {
+                       NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->entries, r->count));
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_DispInfoAscii(struct ndr_print *ndr, const char *name, const struct samr_DispInfoAscii *r)
+{
+       uint32_t cntr_entries_1;
+       ndr_print_struct(ndr, name, "samr_DispInfoAscii");
+       ndr->depth++;
+       ndr_print_uint32(ndr, "count", r->count);
+       ndr_print_ptr(ndr, "entries", r->entries);
+       ndr->depth++;
+       if (r->entries) {
+               ndr->print(ndr, "%s: ARRAY(%d)", "entries", r->count);
+               ndr->depth++;
+               for (cntr_entries_1=0;cntr_entries_1<r->count;cntr_entries_1++) {
+                       char *idx_1=NULL;
+                       asprintf(&idx_1, "[%d]", cntr_entries_1);
+                       if (idx_1) {
+                               ndr_print_samr_DispEntryAscii(ndr, "entries", &r->entries[cntr_entries_1]);
+                               free(idx_1);
+                       }
+               }
+               ndr->depth--;
+       }
+       ndr->depth--;
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_DispInfo(struct ndr_push *ndr, int ndr_flags, const union samr_DispInfo *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               int level = ndr_push_get_switch_value(ndr, r);
+               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, level));
+               switch (level) {
+                       case 1:
+                               NDR_CHECK(ndr_push_samr_DispInfoGeneral(ndr, NDR_SCALARS, &r->info1));
+                       break;
+
+                       case 2:
+                               NDR_CHECK(ndr_push_samr_DispInfoFull(ndr, NDR_SCALARS, &r->info2));
+                       break;
+
+                       case 3:
+                               NDR_CHECK(ndr_push_samr_DispInfoFullGroups(ndr, NDR_SCALARS, &r->info3));
+                       break;
+
+                       case 4:
+                               NDR_CHECK(ndr_push_samr_DispInfoAscii(ndr, NDR_SCALARS, &r->info4));
+                       break;
+
+                       case 5:
+                               NDR_CHECK(ndr_push_samr_DispInfoAscii(ndr, NDR_SCALARS, &r->info5));
+                       break;
+
+                       default:
+                               return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               int level = ndr_push_get_switch_value(ndr, r);
+               switch (level) {
+                       case 1:
+                               NDR_CHECK(ndr_push_samr_DispInfoGeneral(ndr, NDR_BUFFERS, &r->info1));
+                       break;
+
+                       case 2:
+                               NDR_CHECK(ndr_push_samr_DispInfoFull(ndr, NDR_BUFFERS, &r->info2));
+                       break;
+
+                       case 3:
+                               NDR_CHECK(ndr_push_samr_DispInfoFullGroups(ndr, NDR_BUFFERS, &r->info3));
+                       break;
+
+                       case 4:
+                               NDR_CHECK(ndr_push_samr_DispInfoAscii(ndr, NDR_BUFFERS, &r->info4));
+                       break;
+
+                       case 5:
+                               NDR_CHECK(ndr_push_samr_DispInfoAscii(ndr, NDR_BUFFERS, &r->info5));
+                       break;
+
+                       default:
+                               return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_DispInfo(struct ndr_pull *ndr, int ndr_flags, union samr_DispInfo *r)
+{
+       int level;
+       uint16_t _level;
+       level = ndr_pull_get_switch_value(ndr, r);
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &_level));
+               if (_level != level) {
+                       return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u for r", _level);
+               }
+               switch (level) {
+                       case 1: {
+                               NDR_CHECK(ndr_pull_samr_DispInfoGeneral(ndr, NDR_SCALARS, &r->info1));
+                       break; }
+
+                       case 2: {
+                               NDR_CHECK(ndr_pull_samr_DispInfoFull(ndr, NDR_SCALARS, &r->info2));
+                       break; }
+
+                       case 3: {
+                               NDR_CHECK(ndr_pull_samr_DispInfoFullGroups(ndr, NDR_SCALARS, &r->info3));
+                       break; }
+
+                       case 4: {
+                               NDR_CHECK(ndr_pull_samr_DispInfoAscii(ndr, NDR_SCALARS, &r->info4));
+                       break; }
+
+                       case 5: {
+                               NDR_CHECK(ndr_pull_samr_DispInfoAscii(ndr, NDR_SCALARS, &r->info5));
+                       break; }
+
+                       default:
+                               return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               switch (level) {
+                       case 1:
+                               NDR_CHECK(ndr_pull_samr_DispInfoGeneral(ndr, NDR_BUFFERS, &r->info1));
+                       break;
+
+                       case 2:
+                               NDR_CHECK(ndr_pull_samr_DispInfoFull(ndr, NDR_BUFFERS, &r->info2));
+                       break;
+
+                       case 3:
+                               NDR_CHECK(ndr_pull_samr_DispInfoFullGroups(ndr, NDR_BUFFERS, &r->info3));
+                       break;
+
+                       case 4:
+                               NDR_CHECK(ndr_pull_samr_DispInfoAscii(ndr, NDR_BUFFERS, &r->info4));
+                       break;
+
+                       case 5:
+                               NDR_CHECK(ndr_pull_samr_DispInfoAscii(ndr, NDR_BUFFERS, &r->info5));
+                       break;
+
+                       default:
+                               return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_DispInfo(struct ndr_print *ndr, const char *name, const union samr_DispInfo *r)
+{
+       int level;
+       level = ndr_print_get_switch_value(ndr, r);
+       ndr_print_union(ndr, name, level, "samr_DispInfo");
+       switch (level) {
+               case 1:
+                       ndr_print_samr_DispInfoGeneral(ndr, "info1", &r->info1);
+               break;
+
+               case 2:
+                       ndr_print_samr_DispInfoFull(ndr, "info2", &r->info2);
+               break;
+
+               case 3:
+                       ndr_print_samr_DispInfoFullGroups(ndr, "info3", &r->info3);
+               break;
+
+               case 4:
+                       ndr_print_samr_DispInfoAscii(ndr, "info4", &r->info4);
+               break;
+
+               case 5:
+                       ndr_print_samr_DispInfoAscii(ndr, "info5", &r->info5);
+               break;
+
+               default:
+                       ndr_print_bad_level(ndr, name, level);
+       }
+}
+
+static enum ndr_err_code ndr_push_samr_PwInfo(struct ndr_push *ndr, int ndr_flags, const struct samr_PwInfo *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->min_password_length));
+               NDR_CHECK(ndr_push_samr_PasswordProperties(ndr, NDR_SCALARS, r->password_properties));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_PwInfo(struct ndr_pull *ndr, int ndr_flags, struct samr_PwInfo *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->min_password_length));
+               NDR_CHECK(ndr_pull_samr_PasswordProperties(ndr, NDR_SCALARS, &r->password_properties));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_PwInfo(struct ndr_print *ndr, const char *name, const struct samr_PwInfo *r)
+{
+       ndr_print_struct(ndr, name, "samr_PwInfo");
+       ndr->depth++;
+       ndr_print_uint16(ndr, "min_password_length", r->min_password_length);
+       ndr_print_samr_PasswordProperties(ndr, "password_properties", r->password_properties);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_ChangeReject(struct ndr_push *ndr, int ndr_flags, const struct samr_ChangeReject *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_samr_RejectReason(ndr, NDR_SCALARS, r->reason));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->unknown1));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->unknown2));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_ChangeReject(struct ndr_pull *ndr, int ndr_flags, struct samr_ChangeReject *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_samr_RejectReason(ndr, NDR_SCALARS, &r->reason));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->unknown1));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->unknown2));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_ChangeReject(struct ndr_print *ndr, const char *name, const struct samr_ChangeReject *r)
+{
+       ndr_print_struct(ndr, name, "samr_ChangeReject");
+       ndr->depth++;
+       ndr_print_samr_RejectReason(ndr, "reason", r->reason);
+       ndr_print_uint32(ndr, "unknown1", r->unknown1);
+       ndr_print_uint32(ndr, "unknown2", r->unknown2);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_ConnectInfo1(struct ndr_push *ndr, int ndr_flags, const struct samr_ConnectInfo1 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->unknown1));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->unknown2));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_ConnectInfo1(struct ndr_pull *ndr, int ndr_flags, struct samr_ConnectInfo1 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->unknown1));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->unknown2));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_ConnectInfo1(struct ndr_print *ndr, const char *name, const struct samr_ConnectInfo1 *r)
+{
+       ndr_print_struct(ndr, name, "samr_ConnectInfo1");
+       ndr->depth++;
+       ndr_print_uint32(ndr, "unknown1", r->unknown1);
+       ndr_print_uint32(ndr, "unknown2", r->unknown2);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_ConnectInfo(struct ndr_push *ndr, int ndr_flags, const union samr_ConnectInfo *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               int level = ndr_push_get_switch_value(ndr, r);
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, level));
+               switch (level) {
+                       case 1:
+                               NDR_CHECK(ndr_push_samr_ConnectInfo1(ndr, NDR_SCALARS, &r->info1));
+                       break;
+
+                       default:
+                               return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               int level = ndr_push_get_switch_value(ndr, r);
+               switch (level) {
+                       case 1:
+                       break;
+
+                       default:
+                               return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_ConnectInfo(struct ndr_pull *ndr, int ndr_flags, union samr_ConnectInfo *r)
+{
+       int level;
+       uint32_t _level;
+       level = ndr_pull_get_switch_value(ndr, r);
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &_level));
+               if (_level != level) {
+                       return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u for r", _level);
+               }
+               switch (level) {
+                       case 1: {
+                               NDR_CHECK(ndr_pull_samr_ConnectInfo1(ndr, NDR_SCALARS, &r->info1));
+                       break; }
+
+                       default:
+                               return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               switch (level) {
+                       case 1:
+                       break;
+
+                       default:
+                               return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_ConnectInfo(struct ndr_print *ndr, const char *name, const union samr_ConnectInfo *r)
+{
+       int level;
+       level = ndr_print_get_switch_value(ndr, r);
+       ndr_print_union(ndr, name, level, "samr_ConnectInfo");
+       switch (level) {
+               case 1:
+                       ndr_print_samr_ConnectInfo1(ndr, "info1", &r->info1);
+               break;
+
+               default:
+                       ndr_print_bad_level(ndr, name, level);
+       }
+}
+
+static enum ndr_err_code ndr_push_samr_ValidateFieldsPresent(struct ndr_push *ndr, int ndr_flags, uint32_t r)
+{
+       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_ValidateFieldsPresent(struct ndr_pull *ndr, int ndr_flags, uint32_t *r)
+{
+       uint32_t v;
+       NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
+       *r = v;
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_ValidateFieldsPresent(struct ndr_print *ndr, const char *name, uint32_t r)
+{
+       ndr_print_uint32(ndr, name, r);
+       ndr->depth++;
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_VALIDATE_FIELD_PASSWORD_LAST_SET", SAMR_VALIDATE_FIELD_PASSWORD_LAST_SET, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_VALIDATE_FIELD_BAD_PASSWORD_TIME", SAMR_VALIDATE_FIELD_BAD_PASSWORD_TIME, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_VALIDATE_FIELD_LOCKOUT_TIME", SAMR_VALIDATE_FIELD_LOCKOUT_TIME, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_VALIDATE_FIELD_BAD_PASSWORD_COUNT", SAMR_VALIDATE_FIELD_BAD_PASSWORD_COUNT, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_VALIDATE_FIELD_PASSWORD_HISTORY_LENGTH", SAMR_VALIDATE_FIELD_PASSWORD_HISTORY_LENGTH, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_VALIDATE_FIELD_PASSWORD_HISTORY", SAMR_VALIDATE_FIELD_PASSWORD_HISTORY, r);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_ValidatePasswordLevel(struct ndr_push *ndr, int ndr_flags, enum samr_ValidatePasswordLevel r)
+{
+       NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r));
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_ValidatePasswordLevel(struct ndr_pull *ndr, int ndr_flags, enum samr_ValidatePasswordLevel *r)
+{
+       uint16_t v;
+       NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v));
+       *r = v;
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_ValidatePasswordLevel(struct ndr_print *ndr, const char *name, enum samr_ValidatePasswordLevel r)
+{
+       const char *val = NULL;
+
+       switch (r) {
+               case NetValidateAuthentication: val = "NetValidateAuthentication"; break;
+               case NetValidatePasswordChange: val = "NetValidatePasswordChange"; break;
+               case NetValidatePasswordReset: val = "NetValidatePasswordReset"; break;
+       }
+       ndr_print_enum(ndr, name, "ENUM", val, r);
+}
+
+static enum ndr_err_code ndr_push_samr_ValidationStatus(struct ndr_push *ndr, int ndr_flags, enum samr_ValidationStatus r)
+{
+       NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r));
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_ValidationStatus(struct ndr_pull *ndr, int ndr_flags, enum samr_ValidationStatus *r)
+{
+       uint16_t v;
+       NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v));
+       *r = v;
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_ValidationStatus(struct ndr_print *ndr, const char *name, enum samr_ValidationStatus r)
+{
+       const char *val = NULL;
+
+       switch (r) {
+               case SAMR_VALIDATION_STATUS_SUCCESS: val = "SAMR_VALIDATION_STATUS_SUCCESS"; break;
+               case SAMR_VALIDATION_STATUS_PASSWORD_MUST_CHANGE: val = "SAMR_VALIDATION_STATUS_PASSWORD_MUST_CHANGE"; break;
+               case SAMR_VALIDATION_STATUS_ACCOUNT_LOCKED_OUT: val = "SAMR_VALIDATION_STATUS_ACCOUNT_LOCKED_OUT"; break;
+               case SAMR_VALIDATION_STATUS_BAD_PASSWORD: val = "SAMR_VALIDATION_STATUS_BAD_PASSWORD"; break;
+               case SAMR_VALIDATION_STATUS_PWD_HISTORY_CONFLICT: val = "SAMR_VALIDATION_STATUS_PWD_HISTORY_CONFLICT"; break;
+               case SAMR_VALIDATION_STATUS_PWD_TOO_SHORT: val = "SAMR_VALIDATION_STATUS_PWD_TOO_SHORT"; break;
+               case SAMR_VALIDATION_STATUS_PWD_TOO_LONG: val = "SAMR_VALIDATION_STATUS_PWD_TOO_LONG"; break;
+               case SAMR_VALIDATION_STATUS_NOT_COMPLEX_ENOUGH: val = "SAMR_VALIDATION_STATUS_NOT_COMPLEX_ENOUGH"; break;
+               case SAMR_VALIDATION_STATUS_PASSWORD_TOO_RECENT: val = "SAMR_VALIDATION_STATUS_PASSWORD_TOO_RECENT"; break;
+       }
+       ndr_print_enum(ndr, name, "ENUM", val, r);
+}
+
+static enum ndr_err_code ndr_push_samr_ValidationBlob(struct ndr_push *ndr, int ndr_flags, const struct samr_ValidationBlob *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->length));
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->data));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               if (r->data) {
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->length));
+                       NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->data, r->length));
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_ValidationBlob(struct ndr_pull *ndr, int ndr_flags, struct samr_ValidationBlob *r)
+{
+       uint32_t _ptr_data;
+       TALLOC_CTX *_mem_save_data_0;
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->length));
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_data));
+               if (_ptr_data) {
+                       NDR_PULL_ALLOC(ndr, r->data);
+               } else {
+                       r->data = NULL;
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               if (r->data) {
+                       _mem_save_data_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->data, 0);
+                       NDR_CHECK(ndr_pull_array_size(ndr, &r->data));
+                       NDR_PULL_ALLOC_N(ndr, r->data, ndr_get_array_size(ndr, &r->data));
+                       NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->data, ndr_get_array_size(ndr, &r->data)));
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_data_0, 0);
+               }
+               if (r->data) {
+                       NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->data, r->length));
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_ValidationBlob(struct ndr_print *ndr, const char *name, const struct samr_ValidationBlob *r)
+{
+       ndr_print_struct(ndr, name, "samr_ValidationBlob");
+       ndr->depth++;
+       ndr_print_uint32(ndr, "length", r->length);
+       ndr_print_ptr(ndr, "data", r->data);
+       ndr->depth++;
+       if (r->data) {
+               ndr_print_array_uint8(ndr, "data", r->data, r->length);
+       }
+       ndr->depth--;
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_ValidatePasswordInfo(struct ndr_push *ndr, int ndr_flags, const struct samr_ValidatePasswordInfo *r)
+{
+       uint32_t cntr_pwd_history_1;
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 8));
+               NDR_CHECK(ndr_push_samr_ValidateFieldsPresent(ndr, NDR_SCALARS, r->fields_present));
+               NDR_CHECK(ndr_push_NTTIME_hyper(ndr, NDR_SCALARS, r->last_password_change));
+               NDR_CHECK(ndr_push_NTTIME_hyper(ndr, NDR_SCALARS, r->bad_password_time));
+               NDR_CHECK(ndr_push_NTTIME_hyper(ndr, NDR_SCALARS, r->lockout_time));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->bad_pwd_count));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->pwd_history_len));
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->pwd_history));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               if (r->pwd_history) {
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->pwd_history_len));
+                       for (cntr_pwd_history_1 = 0; cntr_pwd_history_1 < r->pwd_history_len; cntr_pwd_history_1++) {
+                               NDR_CHECK(ndr_push_samr_ValidationBlob(ndr, NDR_SCALARS, &r->pwd_history[cntr_pwd_history_1]));
+                       }
+                       for (cntr_pwd_history_1 = 0; cntr_pwd_history_1 < r->pwd_history_len; cntr_pwd_history_1++) {
+                               NDR_CHECK(ndr_push_samr_ValidationBlob(ndr, NDR_BUFFERS, &r->pwd_history[cntr_pwd_history_1]));
+                       }
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_ValidatePasswordInfo(struct ndr_pull *ndr, int ndr_flags, struct samr_ValidatePasswordInfo *r)
+{
+       uint32_t _ptr_pwd_history;
+       uint32_t cntr_pwd_history_1;
+       TALLOC_CTX *_mem_save_pwd_history_0;
+       TALLOC_CTX *_mem_save_pwd_history_1;
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 8));
+               NDR_CHECK(ndr_pull_samr_ValidateFieldsPresent(ndr, NDR_SCALARS, &r->fields_present));
+               NDR_CHECK(ndr_pull_NTTIME_hyper(ndr, NDR_SCALARS, &r->last_password_change));
+               NDR_CHECK(ndr_pull_NTTIME_hyper(ndr, NDR_SCALARS, &r->bad_password_time));
+               NDR_CHECK(ndr_pull_NTTIME_hyper(ndr, NDR_SCALARS, &r->lockout_time));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->bad_pwd_count));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->pwd_history_len));
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_pwd_history));
+               if (_ptr_pwd_history) {
+                       NDR_PULL_ALLOC(ndr, r->pwd_history);
+               } else {
+                       r->pwd_history = NULL;
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               if (r->pwd_history) {
+                       _mem_save_pwd_history_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->pwd_history, 0);
+                       NDR_CHECK(ndr_pull_array_size(ndr, &r->pwd_history));
+                       NDR_PULL_ALLOC_N(ndr, r->pwd_history, ndr_get_array_size(ndr, &r->pwd_history));
+                       _mem_save_pwd_history_1 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->pwd_history, 0);
+                       for (cntr_pwd_history_1 = 0; cntr_pwd_history_1 < r->pwd_history_len; cntr_pwd_history_1++) {
+                               NDR_CHECK(ndr_pull_samr_ValidationBlob(ndr, NDR_SCALARS, &r->pwd_history[cntr_pwd_history_1]));
+                       }
+                       for (cntr_pwd_history_1 = 0; cntr_pwd_history_1 < r->pwd_history_len; cntr_pwd_history_1++) {
+                               NDR_CHECK(ndr_pull_samr_ValidationBlob(ndr, NDR_BUFFERS, &r->pwd_history[cntr_pwd_history_1]));
+                       }
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_pwd_history_1, 0);
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_pwd_history_0, 0);
+               }
+               if (r->pwd_history) {
+                       NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->pwd_history, r->pwd_history_len));
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_ValidatePasswordInfo(struct ndr_print *ndr, const char *name, const struct samr_ValidatePasswordInfo *r)
+{
+       uint32_t cntr_pwd_history_1;
+       ndr_print_struct(ndr, name, "samr_ValidatePasswordInfo");
+       ndr->depth++;
+       ndr_print_samr_ValidateFieldsPresent(ndr, "fields_present", r->fields_present);
+       ndr_print_NTTIME_hyper(ndr, "last_password_change", r->last_password_change);
+       ndr_print_NTTIME_hyper(ndr, "bad_password_time", r->bad_password_time);
+       ndr_print_NTTIME_hyper(ndr, "lockout_time", r->lockout_time);
+       ndr_print_uint32(ndr, "bad_pwd_count", r->bad_pwd_count);
+       ndr_print_uint32(ndr, "pwd_history_len", r->pwd_history_len);
+       ndr_print_ptr(ndr, "pwd_history", r->pwd_history);
+       ndr->depth++;
+       if (r->pwd_history) {
+               ndr->print(ndr, "%s: ARRAY(%d)", "pwd_history", r->pwd_history_len);
+               ndr->depth++;
+               for (cntr_pwd_history_1=0;cntr_pwd_history_1<r->pwd_history_len;cntr_pwd_history_1++) {
+                       char *idx_1=NULL;
+                       asprintf(&idx_1, "[%d]", cntr_pwd_history_1);
+                       if (idx_1) {
+                               ndr_print_samr_ValidationBlob(ndr, "pwd_history", &r->pwd_history[cntr_pwd_history_1]);
+                               free(idx_1);
+                       }
+               }
+               ndr->depth--;
+       }
+       ndr->depth--;
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_ValidatePasswordRepCtr(struct ndr_push *ndr, int ndr_flags, const struct samr_ValidatePasswordRepCtr *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 8));
+               NDR_CHECK(ndr_push_samr_ValidatePasswordInfo(ndr, NDR_SCALARS, &r->info));
+               NDR_CHECK(ndr_push_samr_ValidationStatus(ndr, NDR_SCALARS, r->status));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_push_samr_ValidatePasswordInfo(ndr, NDR_BUFFERS, &r->info));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_ValidatePasswordRepCtr(struct ndr_pull *ndr, int ndr_flags, struct samr_ValidatePasswordRepCtr *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 8));
+               NDR_CHECK(ndr_pull_samr_ValidatePasswordInfo(ndr, NDR_SCALARS, &r->info));
+               NDR_CHECK(ndr_pull_samr_ValidationStatus(ndr, NDR_SCALARS, &r->status));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_pull_samr_ValidatePasswordInfo(ndr, NDR_BUFFERS, &r->info));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_ValidatePasswordRepCtr(struct ndr_print *ndr, const char *name, const struct samr_ValidatePasswordRepCtr *r)
+{
+       ndr_print_struct(ndr, name, "samr_ValidatePasswordRepCtr");
+       ndr->depth++;
+       ndr_print_samr_ValidatePasswordInfo(ndr, "info", &r->info);
+       ndr_print_samr_ValidationStatus(ndr, "status", r->status);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_ValidatePasswordRep(struct ndr_push *ndr, int ndr_flags, const union samr_ValidatePasswordRep *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               int level = ndr_push_get_switch_value(ndr, r);
+               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, level));
+               switch (level) {
+                       case 1:
+                               NDR_CHECK(ndr_push_samr_ValidatePasswordRepCtr(ndr, NDR_SCALARS, &r->ctr1));
+                       break;
+
+                       case 2:
+                               NDR_CHECK(ndr_push_samr_ValidatePasswordRepCtr(ndr, NDR_SCALARS, &r->ctr2));
+                       break;
+
+                       case 3:
+                               NDR_CHECK(ndr_push_samr_ValidatePasswordRepCtr(ndr, NDR_SCALARS, &r->ctr3));
+                       break;
+
+                       default:
+                               return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               int level = ndr_push_get_switch_value(ndr, r);
+               switch (level) {
+                       case 1:
+                               NDR_CHECK(ndr_push_samr_ValidatePasswordRepCtr(ndr, NDR_BUFFERS, &r->ctr1));
+                       break;
+
+                       case 2:
+                               NDR_CHECK(ndr_push_samr_ValidatePasswordRepCtr(ndr, NDR_BUFFERS, &r->ctr2));
+                       break;
+
+                       case 3:
+                               NDR_CHECK(ndr_push_samr_ValidatePasswordRepCtr(ndr, NDR_BUFFERS, &r->ctr3));
+                       break;
+
+                       default:
+                               return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_ValidatePasswordRep(struct ndr_pull *ndr, int ndr_flags, union samr_ValidatePasswordRep *r)
+{
+       int level;
+       uint16_t _level;
+       level = ndr_pull_get_switch_value(ndr, r);
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &_level));
+               if (_level != level) {
+                       return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u for r", _level);
+               }
+               switch (level) {
+                       case 1: {
+                               NDR_CHECK(ndr_pull_samr_ValidatePasswordRepCtr(ndr, NDR_SCALARS, &r->ctr1));
+                       break; }
+
+                       case 2: {
+                               NDR_CHECK(ndr_pull_samr_ValidatePasswordRepCtr(ndr, NDR_SCALARS, &r->ctr2));
+                       break; }
+
+                       case 3: {
+                               NDR_CHECK(ndr_pull_samr_ValidatePasswordRepCtr(ndr, NDR_SCALARS, &r->ctr3));
+                       break; }
+
+                       default:
+                               return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               switch (level) {
+                       case 1:
+                               NDR_CHECK(ndr_pull_samr_ValidatePasswordRepCtr(ndr, NDR_BUFFERS, &r->ctr1));
+                       break;
+
+                       case 2:
+                               NDR_CHECK(ndr_pull_samr_ValidatePasswordRepCtr(ndr, NDR_BUFFERS, &r->ctr2));
+                       break;
+
+                       case 3:
+                               NDR_CHECK(ndr_pull_samr_ValidatePasswordRepCtr(ndr, NDR_BUFFERS, &r->ctr3));
+                       break;
+
+                       default:
+                               return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_ValidatePasswordRep(struct ndr_print *ndr, const char *name, const union samr_ValidatePasswordRep *r)
+{
+       int level;
+       level = ndr_print_get_switch_value(ndr, r);
+       ndr_print_union(ndr, name, level, "samr_ValidatePasswordRep");
+       switch (level) {
+               case 1:
+                       ndr_print_samr_ValidatePasswordRepCtr(ndr, "ctr1", &r->ctr1);
+               break;
+
+               case 2:
+                       ndr_print_samr_ValidatePasswordRepCtr(ndr, "ctr2", &r->ctr2);
+               break;
+
+               case 3:
+                       ndr_print_samr_ValidatePasswordRepCtr(ndr, "ctr3", &r->ctr3);
+               break;
+
+               default:
+                       ndr_print_bad_level(ndr, name, level);
+       }
+}
+
+static enum ndr_err_code ndr_push_samr_ValidatePasswordReq3(struct ndr_push *ndr, int ndr_flags, const struct samr_ValidatePasswordReq3 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 8));
+               NDR_CHECK(ndr_push_samr_ValidatePasswordInfo(ndr, NDR_SCALARS, &r->info));
+               NDR_CHECK(ndr_push_lsa_StringLarge(ndr, NDR_SCALARS, &r->password));
+               NDR_CHECK(ndr_push_lsa_StringLarge(ndr, NDR_SCALARS, &r->account));
+               NDR_CHECK(ndr_push_samr_ValidationBlob(ndr, NDR_SCALARS, &r->hash));
+               NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->pwd_must_change_at_next_logon));
+               NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->clear_lockout));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_push_samr_ValidatePasswordInfo(ndr, NDR_BUFFERS, &r->info));
+               NDR_CHECK(ndr_push_lsa_StringLarge(ndr, NDR_BUFFERS, &r->password));
+               NDR_CHECK(ndr_push_lsa_StringLarge(ndr, NDR_BUFFERS, &r->account));
+               NDR_CHECK(ndr_push_samr_ValidationBlob(ndr, NDR_BUFFERS, &r->hash));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_ValidatePasswordReq3(struct ndr_pull *ndr, int ndr_flags, struct samr_ValidatePasswordReq3 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 8));
+               NDR_CHECK(ndr_pull_samr_ValidatePasswordInfo(ndr, NDR_SCALARS, &r->info));
+               NDR_CHECK(ndr_pull_lsa_StringLarge(ndr, NDR_SCALARS, &r->password));
+               NDR_CHECK(ndr_pull_lsa_StringLarge(ndr, NDR_SCALARS, &r->account));
+               NDR_CHECK(ndr_pull_samr_ValidationBlob(ndr, NDR_SCALARS, &r->hash));
+               NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->pwd_must_change_at_next_logon));
+               NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->clear_lockout));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_pull_samr_ValidatePasswordInfo(ndr, NDR_BUFFERS, &r->info));
+               NDR_CHECK(ndr_pull_lsa_StringLarge(ndr, NDR_BUFFERS, &r->password));
+               NDR_CHECK(ndr_pull_lsa_StringLarge(ndr, NDR_BUFFERS, &r->account));
+               NDR_CHECK(ndr_pull_samr_ValidationBlob(ndr, NDR_BUFFERS, &r->hash));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_ValidatePasswordReq3(struct ndr_print *ndr, const char *name, const struct samr_ValidatePasswordReq3 *r)
+{
+       ndr_print_struct(ndr, name, "samr_ValidatePasswordReq3");
+       ndr->depth++;
+       ndr_print_samr_ValidatePasswordInfo(ndr, "info", &r->info);
+       ndr_print_lsa_StringLarge(ndr, "password", &r->password);
+       ndr_print_lsa_StringLarge(ndr, "account", &r->account);
+       ndr_print_samr_ValidationBlob(ndr, "hash", &r->hash);
+       ndr_print_uint8(ndr, "pwd_must_change_at_next_logon", r->pwd_must_change_at_next_logon);
+       ndr_print_uint8(ndr, "clear_lockout", r->clear_lockout);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_ValidatePasswordReq2(struct ndr_push *ndr, int ndr_flags, const struct samr_ValidatePasswordReq2 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 8));
+               NDR_CHECK(ndr_push_samr_ValidatePasswordInfo(ndr, NDR_SCALARS, &r->info));
+               NDR_CHECK(ndr_push_lsa_StringLarge(ndr, NDR_SCALARS, &r->password));
+               NDR_CHECK(ndr_push_lsa_StringLarge(ndr, NDR_SCALARS, &r->account));
+               NDR_CHECK(ndr_push_samr_ValidationBlob(ndr, NDR_SCALARS, &r->hash));
+               NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->password_matched));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_push_samr_ValidatePasswordInfo(ndr, NDR_BUFFERS, &r->info));
+               NDR_CHECK(ndr_push_lsa_StringLarge(ndr, NDR_BUFFERS, &r->password));
+               NDR_CHECK(ndr_push_lsa_StringLarge(ndr, NDR_BUFFERS, &r->account));
+               NDR_CHECK(ndr_push_samr_ValidationBlob(ndr, NDR_BUFFERS, &r->hash));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_ValidatePasswordReq2(struct ndr_pull *ndr, int ndr_flags, struct samr_ValidatePasswordReq2 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 8));
+               NDR_CHECK(ndr_pull_samr_ValidatePasswordInfo(ndr, NDR_SCALARS, &r->info));
+               NDR_CHECK(ndr_pull_lsa_StringLarge(ndr, NDR_SCALARS, &r->password));
+               NDR_CHECK(ndr_pull_lsa_StringLarge(ndr, NDR_SCALARS, &r->account));
+               NDR_CHECK(ndr_pull_samr_ValidationBlob(ndr, NDR_SCALARS, &r->hash));
+               NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->password_matched));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_pull_samr_ValidatePasswordInfo(ndr, NDR_BUFFERS, &r->info));
+               NDR_CHECK(ndr_pull_lsa_StringLarge(ndr, NDR_BUFFERS, &r->password));
+               NDR_CHECK(ndr_pull_lsa_StringLarge(ndr, NDR_BUFFERS, &r->account));
+               NDR_CHECK(ndr_pull_samr_ValidationBlob(ndr, NDR_BUFFERS, &r->hash));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_ValidatePasswordReq2(struct ndr_print *ndr, const char *name, const struct samr_ValidatePasswordReq2 *r)
+{
+       ndr_print_struct(ndr, name, "samr_ValidatePasswordReq2");
+       ndr->depth++;
+       ndr_print_samr_ValidatePasswordInfo(ndr, "info", &r->info);
+       ndr_print_lsa_StringLarge(ndr, "password", &r->password);
+       ndr_print_lsa_StringLarge(ndr, "account", &r->account);
+       ndr_print_samr_ValidationBlob(ndr, "hash", &r->hash);
+       ndr_print_uint8(ndr, "password_matched", r->password_matched);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_ValidatePasswordReq1(struct ndr_push *ndr, int ndr_flags, const struct samr_ValidatePasswordReq1 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 8));
+               NDR_CHECK(ndr_push_samr_ValidatePasswordInfo(ndr, NDR_SCALARS, &r->info));
+               NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->password_matched));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_push_samr_ValidatePasswordInfo(ndr, NDR_BUFFERS, &r->info));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_ValidatePasswordReq1(struct ndr_pull *ndr, int ndr_flags, struct samr_ValidatePasswordReq1 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 8));
+               NDR_CHECK(ndr_pull_samr_ValidatePasswordInfo(ndr, NDR_SCALARS, &r->info));
+               NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->password_matched));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_pull_samr_ValidatePasswordInfo(ndr, NDR_BUFFERS, &r->info));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_ValidatePasswordReq1(struct ndr_print *ndr, const char *name, const struct samr_ValidatePasswordReq1 *r)
+{
+       ndr_print_struct(ndr, name, "samr_ValidatePasswordReq1");
+       ndr->depth++;
+       ndr_print_samr_ValidatePasswordInfo(ndr, "info", &r->info);
+       ndr_print_uint8(ndr, "password_matched", r->password_matched);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_ValidatePasswordReq(struct ndr_push *ndr, int ndr_flags, const union samr_ValidatePasswordReq *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               int level = ndr_push_get_switch_value(ndr, r);
+               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, level));
+               switch (level) {
+                       case 1:
+                               NDR_CHECK(ndr_push_samr_ValidatePasswordReq1(ndr, NDR_SCALARS, &r->req1));
+                       break;
+
+                       case 2:
+                               NDR_CHECK(ndr_push_samr_ValidatePasswordReq2(ndr, NDR_SCALARS, &r->req2));
+                       break;
+
+                       case 3:
+                               NDR_CHECK(ndr_push_samr_ValidatePasswordReq3(ndr, NDR_SCALARS, &r->req3));
+                       break;
+
+                       default:
+                               return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               int level = ndr_push_get_switch_value(ndr, r);
+               switch (level) {
+                       case 1:
+                               NDR_CHECK(ndr_push_samr_ValidatePasswordReq1(ndr, NDR_BUFFERS, &r->req1));
+                       break;
+
+                       case 2:
+                               NDR_CHECK(ndr_push_samr_ValidatePasswordReq2(ndr, NDR_BUFFERS, &r->req2));
+                       break;
+
+                       case 3:
+                               NDR_CHECK(ndr_push_samr_ValidatePasswordReq3(ndr, NDR_BUFFERS, &r->req3));
+                       break;
+
+                       default:
+                               return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_ValidatePasswordReq(struct ndr_pull *ndr, int ndr_flags, union samr_ValidatePasswordReq *r)
+{
+       int level;
+       uint16_t _level;
+       level = ndr_pull_get_switch_value(ndr, r);
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &_level));
+               if (_level != level) {
+                       return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u for r", _level);
+               }
+               switch (level) {
+                       case 1: {
+                               NDR_CHECK(ndr_pull_samr_ValidatePasswordReq1(ndr, NDR_SCALARS, &r->req1));
+                       break; }
+
+                       case 2: {
+                               NDR_CHECK(ndr_pull_samr_ValidatePasswordReq2(ndr, NDR_SCALARS, &r->req2));
+                       break; }
+
+                       case 3: {
+                               NDR_CHECK(ndr_pull_samr_ValidatePasswordReq3(ndr, NDR_SCALARS, &r->req3));
+                       break; }
+
+                       default:
+                               return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               switch (level) {
+                       case 1:
+                               NDR_CHECK(ndr_pull_samr_ValidatePasswordReq1(ndr, NDR_BUFFERS, &r->req1));
+                       break;
+
+                       case 2:
+                               NDR_CHECK(ndr_pull_samr_ValidatePasswordReq2(ndr, NDR_BUFFERS, &r->req2));
+                       break;
+
+                       case 3:
+                               NDR_CHECK(ndr_pull_samr_ValidatePasswordReq3(ndr, NDR_BUFFERS, &r->req3));
+                       break;
+
+                       default:
+                               return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_ValidatePasswordReq(struct ndr_print *ndr, const char *name, const union samr_ValidatePasswordReq *r)
+{
+       int level;
+       level = ndr_print_get_switch_value(ndr, r);
+       ndr_print_union(ndr, name, level, "samr_ValidatePasswordReq");
+       switch (level) {
+               case 1:
+                       ndr_print_samr_ValidatePasswordReq1(ndr, "req1", &r->req1);
+               break;
+
+               case 2:
+                       ndr_print_samr_ValidatePasswordReq2(ndr, "req2", &r->req2);
+               break;
+
+               case 3:
+                       ndr_print_samr_ValidatePasswordReq3(ndr, "req3", &r->req3);
+               break;
+
+               default:
+                       ndr_print_bad_level(ndr, name, level);
+       }
+}
+
+static enum ndr_err_code ndr_push_samr_Connect(struct ndr_push *ndr, int flags, const struct samr_Connect *r)
+{
+       if (flags & NDR_IN) {
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.system_name));
+               if (r->in.system_name) {
+                       NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, *r->in.system_name));
+               }
+               NDR_CHECK(ndr_push_samr_ConnectAccessMask(ndr, NDR_SCALARS, r->in.access_mask));
+       }
+       if (flags & NDR_OUT) {
+               if (r->out.connect_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.connect_handle));
+               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_Connect(struct ndr_pull *ndr, int flags, struct samr_Connect *r)
+{
+       uint32_t _ptr_system_name;
+       TALLOC_CTX *_mem_save_system_name_0;
+       TALLOC_CTX *_mem_save_connect_handle_0;
+       if (flags & NDR_IN) {
+               ZERO_STRUCT(r->out);
+
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_system_name));
+               if (_ptr_system_name) {
+                       NDR_PULL_ALLOC(ndr, r->in.system_name);
+               } else {
+                       r->in.system_name = NULL;
+               }
+               if (r->in.system_name) {
+                       _mem_save_system_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->in.system_name, 0);
+                       NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, r->in.system_name));
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_system_name_0, 0);
+               }
+               NDR_CHECK(ndr_pull_samr_ConnectAccessMask(ndr, NDR_SCALARS, &r->in.access_mask));
+               NDR_PULL_ALLOC(ndr, r->out.connect_handle);
+               ZERO_STRUCTP(r->out.connect_handle);
+       }
+       if (flags & NDR_OUT) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.connect_handle);
+               }
+               _mem_save_connect_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.connect_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->out.connect_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_connect_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_Connect(struct ndr_print *ndr, const char *name, int flags, const struct samr_Connect *r)
+{
+       ndr_print_struct(ndr, name, "samr_Connect");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "samr_Connect");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "system_name", r->in.system_name);
+               ndr->depth++;
+               if (r->in.system_name) {
+                       ndr_print_uint16(ndr, "system_name", *r->in.system_name);
+               }
+               ndr->depth--;
+               ndr_print_samr_ConnectAccessMask(ndr, "access_mask", r->in.access_mask);
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "samr_Connect");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "connect_handle", r->out.connect_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "connect_handle", r->out.connect_handle);
+               ndr->depth--;
+               ndr_print_NTSTATUS(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_samr_Close(struct ndr_push *ndr, int flags, const struct samr_Close *r)
+{
+       if (flags & NDR_IN) {
+               if (r->in.handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.handle));
+       }
+       if (flags & NDR_OUT) {
+               if (r->out.handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.handle));
+               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_samr_Close(struct ndr_pull *ndr, int flags, struct samr_Close *r)
+{
+       TALLOC_CTX *_mem_save_handle_0;
+       if (flags & NDR_IN) {
+               ZERO_STRUCT(r->out);
+
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.handle);
+               }
+               _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_PULL_ALLOC(ndr, r->out.handle);
+               *r->out.handle = *r->in.handle;
+       }
+       if (flags & NDR_OUT) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.handle);
+               }
+               _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->out.handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_Close(struct ndr_print *ndr, const char *name, int flags, const struct samr_Close *r)
+{
+       ndr_print_struct(ndr, name, "samr_Close");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "samr_Close");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "handle", r->in.handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "handle", r->in.handle);
+               ndr->depth--;
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "samr_Close");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "handle", r->out.handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "handle", r->out.handle);
+               ndr->depth--;
+               ndr_print_NTSTATUS(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_SetSecurity(struct ndr_push *ndr, int flags, const struct samr_SetSecurity *r)
+{
+       if (flags & NDR_IN) {
+               if (r->in.handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.handle));
+               NDR_CHECK(ndr_push_security_secinfo(ndr, NDR_SCALARS, r->in.sec_info));
+               if (r->in.sdbuf == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_sec_desc_buf(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.sdbuf));
+       }
+       if (flags & NDR_OUT) {
+               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_SetSecurity(struct ndr_pull *ndr, int flags, struct samr_SetSecurity *r)
+{
+       TALLOC_CTX *_mem_save_handle_0;
+       TALLOC_CTX *_mem_save_sdbuf_0;
+       if (flags & NDR_IN) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.handle);
+               }
+               _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_security_secinfo(ndr, NDR_SCALARS, &r->in.sec_info));
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.sdbuf);
+               }
+               _mem_save_sdbuf_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.sdbuf, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_sec_desc_buf(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.sdbuf));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sdbuf_0, LIBNDR_FLAG_REF_ALLOC);
+       }
+       if (flags & NDR_OUT) {
+               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_SetSecurity(struct ndr_print *ndr, const char *name, int flags, const struct samr_SetSecurity *r)
+{
+       ndr_print_struct(ndr, name, "samr_SetSecurity");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "samr_SetSecurity");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "handle", r->in.handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "handle", r->in.handle);
+               ndr->depth--;
+               ndr_print_security_secinfo(ndr, "sec_info", r->in.sec_info);
+               ndr_print_ptr(ndr, "sdbuf", r->in.sdbuf);
+               ndr->depth++;
+               ndr_print_sec_desc_buf(ndr, "sdbuf", r->in.sdbuf);
+               ndr->depth--;
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "samr_SetSecurity");
+               ndr->depth++;
+               ndr_print_NTSTATUS(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_QuerySecurity(struct ndr_push *ndr, int flags, const struct samr_QuerySecurity *r)
+{
+       if (flags & NDR_IN) {
+               if (r->in.handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.handle));
+               NDR_CHECK(ndr_push_security_secinfo(ndr, NDR_SCALARS, r->in.sec_info));
+       }
+       if (flags & NDR_OUT) {
+               if (r->out.sdbuf == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_sec_desc_buf(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.sdbuf));
+               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_QuerySecurity(struct ndr_pull *ndr, int flags, struct samr_QuerySecurity *r)
+{
+       TALLOC_CTX *_mem_save_handle_0;
+       TALLOC_CTX *_mem_save_sdbuf_0;
+       if (flags & NDR_IN) {
+               ZERO_STRUCT(r->out);
+
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.handle);
+               }
+               _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_security_secinfo(ndr, NDR_SCALARS, &r->in.sec_info));
+               NDR_PULL_ALLOC(ndr, r->out.sdbuf);
+               ZERO_STRUCTP(r->out.sdbuf);
+       }
+       if (flags & NDR_OUT) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.sdbuf);
+               }
+               _mem_save_sdbuf_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.sdbuf, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_sec_desc_buf(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.sdbuf));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sdbuf_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_QuerySecurity(struct ndr_print *ndr, const char *name, int flags, const struct samr_QuerySecurity *r)
+{
+       ndr_print_struct(ndr, name, "samr_QuerySecurity");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "samr_QuerySecurity");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "handle", r->in.handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "handle", r->in.handle);
+               ndr->depth--;
+               ndr_print_security_secinfo(ndr, "sec_info", r->in.sec_info);
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "samr_QuerySecurity");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "sdbuf", r->out.sdbuf);
+               ndr->depth++;
+               ndr_print_sec_desc_buf(ndr, "sdbuf", r->out.sdbuf);
+               ndr->depth--;
+               ndr_print_NTSTATUS(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_Shutdown(struct ndr_push *ndr, int flags, const struct samr_Shutdown *r)
+{
+       if (flags & NDR_IN) {
+               if (r->in.connect_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.connect_handle));
+       }
+       if (flags & NDR_OUT) {
+               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_Shutdown(struct ndr_pull *ndr, int flags, struct samr_Shutdown *r)
+{
+       TALLOC_CTX *_mem_save_connect_handle_0;
+       if (flags & NDR_IN) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.connect_handle);
+               }
+               _mem_save_connect_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.connect_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.connect_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_connect_handle_0, LIBNDR_FLAG_REF_ALLOC);
+       }
+       if (flags & NDR_OUT) {
+               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_Shutdown(struct ndr_print *ndr, const char *name, int flags, const struct samr_Shutdown *r)
+{
+       ndr_print_struct(ndr, name, "samr_Shutdown");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "samr_Shutdown");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "connect_handle", r->in.connect_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "connect_handle", r->in.connect_handle);
+               ndr->depth--;
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "samr_Shutdown");
+               ndr->depth++;
+               ndr_print_NTSTATUS(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_LookupDomain(struct ndr_push *ndr, int flags, const struct samr_LookupDomain *r)
+{
+       if (flags & NDR_IN) {
+               if (r->in.connect_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.connect_handle));
+               if (r->in.domain_name == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.domain_name));
+       }
+       if (flags & NDR_OUT) {
+               if (r->out.sid == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_dom_sid2(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.sid));
+               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_LookupDomain(struct ndr_pull *ndr, int flags, struct samr_LookupDomain *r)
+{
+       TALLOC_CTX *_mem_save_connect_handle_0;
+       TALLOC_CTX *_mem_save_domain_name_0;
+       TALLOC_CTX *_mem_save_sid_0;
+       if (flags & NDR_IN) {
+               ZERO_STRUCT(r->out);
+
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.connect_handle);
+               }
+               _mem_save_connect_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.connect_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.connect_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_connect_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.domain_name);
+               }
+               _mem_save_domain_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.domain_name, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.domain_name));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_name_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_PULL_ALLOC(ndr, r->out.sid);
+               ZERO_STRUCTP(r->out.sid);
+       }
+       if (flags & NDR_OUT) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.sid);
+               }
+               _mem_save_sid_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.sid, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_dom_sid2(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.sid));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sid_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_LookupDomain(struct ndr_print *ndr, const char *name, int flags, const struct samr_LookupDomain *r)
+{
+       ndr_print_struct(ndr, name, "samr_LookupDomain");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "samr_LookupDomain");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "connect_handle", r->in.connect_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "connect_handle", r->in.connect_handle);
+               ndr->depth--;
+               ndr_print_ptr(ndr, "domain_name", r->in.domain_name);
+               ndr->depth++;
+               ndr_print_lsa_String(ndr, "domain_name", r->in.domain_name);
+               ndr->depth--;
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "samr_LookupDomain");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "sid", r->out.sid);
+               ndr->depth++;
+               ndr_print_dom_sid2(ndr, "sid", r->out.sid);
+               ndr->depth--;
+               ndr_print_NTSTATUS(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_EnumDomains(struct ndr_push *ndr, int flags, const struct samr_EnumDomains *r)
+{
+       if (flags & NDR_IN) {
+               if (r->in.connect_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.connect_handle));
+               if (r->in.resume_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.resume_handle));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.buf_size));
+       }
+       if (flags & NDR_OUT) {
+               if (r->out.resume_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.resume_handle));
+               if (r->out.sam == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_samr_SamArray(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.sam));
+               if (r->out.num_entries == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.num_entries));
+               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_EnumDomains(struct ndr_pull *ndr, int flags, struct samr_EnumDomains *r)
+{
+       TALLOC_CTX *_mem_save_connect_handle_0;
+       TALLOC_CTX *_mem_save_resume_handle_0;
+       TALLOC_CTX *_mem_save_sam_0;
+       TALLOC_CTX *_mem_save_num_entries_0;
+       if (flags & NDR_IN) {
+               ZERO_STRUCT(r->out);
+
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.connect_handle);
+               }
+               _mem_save_connect_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.connect_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.connect_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_connect_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.resume_handle);
+               }
+               _mem_save_resume_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.resume_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->in.resume_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_resume_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.buf_size));
+               NDR_PULL_ALLOC(ndr, r->out.resume_handle);
+               *r->out.resume_handle = *r->in.resume_handle;
+               NDR_PULL_ALLOC(ndr, r->out.sam);
+               ZERO_STRUCTP(r->out.sam);
+               NDR_PULL_ALLOC(ndr, r->out.num_entries);
+               ZERO_STRUCTP(r->out.num_entries);
+       }
+       if (flags & NDR_OUT) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.resume_handle);
+               }
+               _mem_save_resume_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.resume_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.resume_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_resume_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.sam);
+               }
+               _mem_save_sam_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.sam, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_samr_SamArray(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.sam));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sam_0, LIBNDR_FLAG_REF_ALLOC);
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.num_entries);
+               }
+               _mem_save_num_entries_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.num_entries, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.num_entries));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_num_entries_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_EnumDomains(struct ndr_print *ndr, const char *name, int flags, const struct samr_EnumDomains *r)
+{
+       ndr_print_struct(ndr, name, "samr_EnumDomains");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "samr_EnumDomains");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "connect_handle", r->in.connect_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "connect_handle", r->in.connect_handle);
+               ndr->depth--;
+               ndr_print_ptr(ndr, "resume_handle", r->in.resume_handle);
+               ndr->depth++;
+               ndr_print_uint32(ndr, "resume_handle", *r->in.resume_handle);
+               ndr->depth--;
+               ndr_print_uint32(ndr, "buf_size", r->in.buf_size);
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "samr_EnumDomains");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "resume_handle", r->out.resume_handle);
+               ndr->depth++;
+               ndr_print_uint32(ndr, "resume_handle", *r->out.resume_handle);
+               ndr->depth--;
+               ndr_print_ptr(ndr, "sam", r->out.sam);
+               ndr->depth++;
+               ndr_print_samr_SamArray(ndr, "sam", r->out.sam);
+               ndr->depth--;
+               ndr_print_ptr(ndr, "num_entries", r->out.num_entries);
+               ndr->depth++;
+               ndr_print_uint32(ndr, "num_entries", *r->out.num_entries);
+               ndr->depth--;
+               ndr_print_NTSTATUS(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_samr_OpenDomain(struct ndr_push *ndr, int flags, const struct samr_OpenDomain *r)
+{
+       if (flags & NDR_IN) {
+               if (r->in.connect_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.connect_handle));
+               NDR_CHECK(ndr_push_samr_DomainAccessMask(ndr, NDR_SCALARS, r->in.access_mask));
+               if (r->in.sid == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_dom_sid2(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.sid));
+       }
+       if (flags & NDR_OUT) {
+               if (r->out.domain_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.domain_handle));
+               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_samr_OpenDomain(struct ndr_pull *ndr, int flags, struct samr_OpenDomain *r)
+{
+       TALLOC_CTX *_mem_save_connect_handle_0;
+       TALLOC_CTX *_mem_save_sid_0;
+       TALLOC_CTX *_mem_save_domain_handle_0;
+       if (flags & NDR_IN) {
+               ZERO_STRUCT(r->out);
+
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.connect_handle);
+               }
+               _mem_save_connect_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.connect_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.connect_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_connect_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_samr_DomainAccessMask(ndr, NDR_SCALARS, &r->in.access_mask));
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.sid);
+               }
+               _mem_save_sid_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.sid, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_dom_sid2(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.sid));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sid_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_PULL_ALLOC(ndr, r->out.domain_handle);
+               ZERO_STRUCTP(r->out.domain_handle);
+       }
+       if (flags & NDR_OUT) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.domain_handle);
+               }
+               _mem_save_domain_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.domain_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->out.domain_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_OpenDomain(struct ndr_print *ndr, const char *name, int flags, const struct samr_OpenDomain *r)
+{
+       ndr_print_struct(ndr, name, "samr_OpenDomain");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "samr_OpenDomain");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "connect_handle", r->in.connect_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "connect_handle", r->in.connect_handle);
+               ndr->depth--;
+               ndr_print_samr_DomainAccessMask(ndr, "access_mask", r->in.access_mask);
+               ndr_print_ptr(ndr, "sid", r->in.sid);
+               ndr->depth++;
+               ndr_print_dom_sid2(ndr, "sid", r->in.sid);
+               ndr->depth--;
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "samr_OpenDomain");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "domain_handle", r->out.domain_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "domain_handle", r->out.domain_handle);
+               ndr->depth--;
+               ndr_print_NTSTATUS(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_QueryDomainInfo(struct ndr_push *ndr, int flags, const struct samr_QueryDomainInfo *r)
+{
+       if (flags & NDR_IN) {
+               if (r->in.domain_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle));
+               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->in.level));
+       }
+       if (flags & NDR_OUT) {
+               if (r->out.info == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_set_switch_value(ndr, r->out.info, r->in.level));
+               NDR_CHECK(ndr_push_samr_DomainInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info));
+               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_QueryDomainInfo(struct ndr_pull *ndr, int flags, struct samr_QueryDomainInfo *r)
+{
+       TALLOC_CTX *_mem_save_domain_handle_0;
+       TALLOC_CTX *_mem_save_info_0;
+       if (flags & NDR_IN) {
+               ZERO_STRUCT(r->out);
+
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.domain_handle);
+               }
+               _mem_save_domain_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.domain_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->in.level));
+               NDR_PULL_ALLOC(ndr, r->out.info);
+               ZERO_STRUCTP(r->out.info);
+       }
+       if (flags & NDR_OUT) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.info);
+               }
+               _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.info, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_set_switch_value(ndr, r->out.info, r->in.level));
+               NDR_CHECK(ndr_pull_samr_DomainInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_QueryDomainInfo(struct ndr_print *ndr, const char *name, int flags, const struct samr_QueryDomainInfo *r)
+{
+       ndr_print_struct(ndr, name, "samr_QueryDomainInfo");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "samr_QueryDomainInfo");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "domain_handle", r->in.domain_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "domain_handle", r->in.domain_handle);
+               ndr->depth--;
+               ndr_print_uint16(ndr, "level", r->in.level);
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "samr_QueryDomainInfo");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "info", r->out.info);
+               ndr->depth++;
+               ndr_print_set_switch_value(ndr, r->out.info, r->in.level);
+               ndr_print_samr_DomainInfo(ndr, "info", r->out.info);
+               ndr->depth--;
+               ndr_print_NTSTATUS(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_SetDomainInfo(struct ndr_push *ndr, int flags, const struct samr_SetDomainInfo *r)
+{
+       if (flags & NDR_IN) {
+               if (r->in.domain_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle));
+               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->in.level));
+               if (r->in.info == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_set_switch_value(ndr, r->in.info, r->in.level));
+               NDR_CHECK(ndr_push_samr_DomainInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.info));
+       }
+       if (flags & NDR_OUT) {
+               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_SetDomainInfo(struct ndr_pull *ndr, int flags, struct samr_SetDomainInfo *r)
+{
+       TALLOC_CTX *_mem_save_domain_handle_0;
+       TALLOC_CTX *_mem_save_info_0;
+       if (flags & NDR_IN) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.domain_handle);
+               }
+               _mem_save_domain_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.domain_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->in.level));
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.info);
+               }
+               _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.info, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_set_switch_value(ndr, r->in.info, r->in.level));
+               NDR_CHECK(ndr_pull_samr_DomainInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.info));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, LIBNDR_FLAG_REF_ALLOC);
+       }
+       if (flags & NDR_OUT) {
+               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_SetDomainInfo(struct ndr_print *ndr, const char *name, int flags, const struct samr_SetDomainInfo *r)
+{
+       ndr_print_struct(ndr, name, "samr_SetDomainInfo");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "samr_SetDomainInfo");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "domain_handle", r->in.domain_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "domain_handle", r->in.domain_handle);
+               ndr->depth--;
+               ndr_print_uint16(ndr, "level", r->in.level);
+               ndr_print_ptr(ndr, "info", r->in.info);
+               ndr->depth++;
+               ndr_print_set_switch_value(ndr, r->in.info, r->in.level);
+               ndr_print_samr_DomainInfo(ndr, "info", r->in.info);
+               ndr->depth--;
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "samr_SetDomainInfo");
+               ndr->depth++;
+               ndr_print_NTSTATUS(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_CreateDomainGroup(struct ndr_push *ndr, int flags, const struct samr_CreateDomainGroup *r)
+{
+       if (flags & NDR_IN) {
+               if (r->in.domain_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle));
+               if (r->in.name == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.name));
+               NDR_CHECK(ndr_push_samr_GroupAccessMask(ndr, NDR_SCALARS, r->in.access_mask));
+       }
+       if (flags & NDR_OUT) {
+               if (r->out.group_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.group_handle));
+               if (r->out.rid == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.rid));
+               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_CreateDomainGroup(struct ndr_pull *ndr, int flags, struct samr_CreateDomainGroup *r)
+{
+       TALLOC_CTX *_mem_save_domain_handle_0;
+       TALLOC_CTX *_mem_save_name_0;
+       TALLOC_CTX *_mem_save_group_handle_0;
+       TALLOC_CTX *_mem_save_rid_0;
+       if (flags & NDR_IN) {
+               ZERO_STRUCT(r->out);
+
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.domain_handle);
+               }
+               _mem_save_domain_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.domain_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.name);
+               }
+               _mem_save_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.name, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.name));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_name_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_samr_GroupAccessMask(ndr, NDR_SCALARS, &r->in.access_mask));
+               NDR_PULL_ALLOC(ndr, r->out.group_handle);
+               ZERO_STRUCTP(r->out.group_handle);
+               NDR_PULL_ALLOC(ndr, r->out.rid);
+               ZERO_STRUCTP(r->out.rid);
+       }
+       if (flags & NDR_OUT) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.group_handle);
+               }
+               _mem_save_group_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.group_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->out.group_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_group_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.rid);
+               }
+               _mem_save_rid_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.rid, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.rid));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_rid_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_CreateDomainGroup(struct ndr_print *ndr, const char *name, int flags, const struct samr_CreateDomainGroup *r)
+{
+       ndr_print_struct(ndr, name, "samr_CreateDomainGroup");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "samr_CreateDomainGroup");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "domain_handle", r->in.domain_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "domain_handle", r->in.domain_handle);
+               ndr->depth--;
+               ndr_print_ptr(ndr, "name", r->in.name);
+               ndr->depth++;
+               ndr_print_lsa_String(ndr, "name", r->in.name);
+               ndr->depth--;
+               ndr_print_samr_GroupAccessMask(ndr, "access_mask", r->in.access_mask);
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "samr_CreateDomainGroup");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "group_handle", r->out.group_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "group_handle", r->out.group_handle);
+               ndr->depth--;
+               ndr_print_ptr(ndr, "rid", r->out.rid);
+               ndr->depth++;
+               ndr_print_uint32(ndr, "rid", *r->out.rid);
+               ndr->depth--;
+               ndr_print_NTSTATUS(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_EnumDomainGroups(struct ndr_push *ndr, int flags, const struct samr_EnumDomainGroups *r)
+{
+       if (flags & NDR_IN) {
+               if (r->in.domain_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle));
+               if (r->in.resume_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.resume_handle));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.max_size));
+       }
+       if (flags & NDR_OUT) {
+               if (r->out.resume_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.resume_handle));
+               if (r->out.sam == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_samr_SamArray(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.sam));
+               if (r->out.num_entries == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.num_entries));
+               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_EnumDomainGroups(struct ndr_pull *ndr, int flags, struct samr_EnumDomainGroups *r)
+{
+       TALLOC_CTX *_mem_save_domain_handle_0;
+       TALLOC_CTX *_mem_save_resume_handle_0;
+       TALLOC_CTX *_mem_save_sam_0;
+       TALLOC_CTX *_mem_save_num_entries_0;
+       if (flags & NDR_IN) {
+               ZERO_STRUCT(r->out);
+
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.domain_handle);
+               }
+               _mem_save_domain_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.domain_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.resume_handle);
+               }
+               _mem_save_resume_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.resume_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->in.resume_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_resume_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.max_size));
+               NDR_PULL_ALLOC(ndr, r->out.resume_handle);
+               *r->out.resume_handle = *r->in.resume_handle;
+               NDR_PULL_ALLOC(ndr, r->out.sam);
+               ZERO_STRUCTP(r->out.sam);
+               NDR_PULL_ALLOC(ndr, r->out.num_entries);
+               ZERO_STRUCTP(r->out.num_entries);
+       }
+       if (flags & NDR_OUT) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.resume_handle);
+               }
+               _mem_save_resume_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.resume_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.resume_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_resume_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.sam);
+               }
+               _mem_save_sam_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.sam, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_samr_SamArray(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.sam));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sam_0, LIBNDR_FLAG_REF_ALLOC);
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.num_entries);
+               }
+               _mem_save_num_entries_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.num_entries, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.num_entries));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_num_entries_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_EnumDomainGroups(struct ndr_print *ndr, const char *name, int flags, const struct samr_EnumDomainGroups *r)
+{
+       ndr_print_struct(ndr, name, "samr_EnumDomainGroups");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "samr_EnumDomainGroups");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "domain_handle", r->in.domain_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "domain_handle", r->in.domain_handle);
+               ndr->depth--;
+               ndr_print_ptr(ndr, "resume_handle", r->in.resume_handle);
+               ndr->depth++;
+               ndr_print_uint32(ndr, "resume_handle", *r->in.resume_handle);
+               ndr->depth--;
+               ndr_print_uint32(ndr, "max_size", r->in.max_size);
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "samr_EnumDomainGroups");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "resume_handle", r->out.resume_handle);
+               ndr->depth++;
+               ndr_print_uint32(ndr, "resume_handle", *r->out.resume_handle);
+               ndr->depth--;
+               ndr_print_ptr(ndr, "sam", r->out.sam);
+               ndr->depth++;
+               ndr_print_samr_SamArray(ndr, "sam", r->out.sam);
+               ndr->depth--;
+               ndr_print_ptr(ndr, "num_entries", r->out.num_entries);
+               ndr->depth++;
+               ndr_print_uint32(ndr, "num_entries", *r->out.num_entries);
+               ndr->depth--;
+               ndr_print_NTSTATUS(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_CreateUser(struct ndr_push *ndr, int flags, const struct samr_CreateUser *r)
+{
+       if (flags & NDR_IN) {
+               if (r->in.domain_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle));
+               if (r->in.account_name == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.account_name));
+               NDR_CHECK(ndr_push_samr_UserAccessMask(ndr, NDR_SCALARS, r->in.access_mask));
+       }
+       if (flags & NDR_OUT) {
+               if (r->out.user_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.user_handle));
+               if (r->out.rid == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.rid));
+               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_CreateUser(struct ndr_pull *ndr, int flags, struct samr_CreateUser *r)
+{
+       TALLOC_CTX *_mem_save_domain_handle_0;
+       TALLOC_CTX *_mem_save_account_name_0;
+       TALLOC_CTX *_mem_save_user_handle_0;
+       TALLOC_CTX *_mem_save_rid_0;
+       if (flags & NDR_IN) {
+               ZERO_STRUCT(r->out);
+
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.domain_handle);
+               }
+               _mem_save_domain_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.domain_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.account_name);
+               }
+               _mem_save_account_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.account_name, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.account_name));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_account_name_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_samr_UserAccessMask(ndr, NDR_SCALARS, &r->in.access_mask));
+               NDR_PULL_ALLOC(ndr, r->out.user_handle);
+               ZERO_STRUCTP(r->out.user_handle);
+               NDR_PULL_ALLOC(ndr, r->out.rid);
+               ZERO_STRUCTP(r->out.rid);
+       }
+       if (flags & NDR_OUT) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.user_handle);
+               }
+               _mem_save_user_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.user_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->out.user_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_user_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.rid);
+               }
+               _mem_save_rid_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.rid, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.rid));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_rid_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_CreateUser(struct ndr_print *ndr, const char *name, int flags, const struct samr_CreateUser *r)
+{
+       ndr_print_struct(ndr, name, "samr_CreateUser");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "samr_CreateUser");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "domain_handle", r->in.domain_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "domain_handle", r->in.domain_handle);
+               ndr->depth--;
+               ndr_print_ptr(ndr, "account_name", r->in.account_name);
+               ndr->depth++;
+               ndr_print_lsa_String(ndr, "account_name", r->in.account_name);
+               ndr->depth--;
+               ndr_print_samr_UserAccessMask(ndr, "access_mask", r->in.access_mask);
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "samr_CreateUser");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "user_handle", r->out.user_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "user_handle", r->out.user_handle);
+               ndr->depth--;
+               ndr_print_ptr(ndr, "rid", r->out.rid);
+               ndr->depth++;
+               ndr_print_uint32(ndr, "rid", *r->out.rid);
+               ndr->depth--;
+               ndr_print_NTSTATUS(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_EnumDomainUsers(struct ndr_push *ndr, int flags, const struct samr_EnumDomainUsers *r)
+{
+       if (flags & NDR_IN) {
+               if (r->in.domain_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle));
+               if (r->in.resume_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.resume_handle));
+               NDR_CHECK(ndr_push_samr_AcctFlags(ndr, NDR_SCALARS, r->in.acct_flags));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.max_size));
+       }
+       if (flags & NDR_OUT) {
+               if (r->out.resume_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.resume_handle));
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.sam));
+               if (r->out.sam) {
+                       NDR_CHECK(ndr_push_samr_SamArray(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.sam));
+               }
+               if (r->out.num_entries == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.num_entries));
+               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_EnumDomainUsers(struct ndr_pull *ndr, int flags, struct samr_EnumDomainUsers *r)
+{
+       uint32_t _ptr_sam;
+       TALLOC_CTX *_mem_save_domain_handle_0;
+       TALLOC_CTX *_mem_save_resume_handle_0;
+       TALLOC_CTX *_mem_save_sam_0;
+       TALLOC_CTX *_mem_save_num_entries_0;
+       if (flags & NDR_IN) {
+               ZERO_STRUCT(r->out);
+
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.domain_handle);
+               }
+               _mem_save_domain_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.domain_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.resume_handle);
+               }
+               _mem_save_resume_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.resume_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->in.resume_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_resume_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_samr_AcctFlags(ndr, NDR_SCALARS, &r->in.acct_flags));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.max_size));
+               NDR_PULL_ALLOC(ndr, r->out.resume_handle);
+               *r->out.resume_handle = *r->in.resume_handle;
+               NDR_PULL_ALLOC(ndr, r->out.num_entries);
+               ZERO_STRUCTP(r->out.num_entries);
+       }
+       if (flags & NDR_OUT) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.resume_handle);
+               }
+               _mem_save_resume_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.resume_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.resume_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_resume_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_sam));
+               if (_ptr_sam) {
+                       NDR_PULL_ALLOC(ndr, r->out.sam);
+               } else {
+                       r->out.sam = NULL;
+               }
+               if (r->out.sam) {
+                       _mem_save_sam_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->out.sam, 0);
+                       NDR_CHECK(ndr_pull_samr_SamArray(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.sam));
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sam_0, 0);
+               }
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.num_entries);
+               }
+               _mem_save_num_entries_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.num_entries, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.num_entries));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_num_entries_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_EnumDomainUsers(struct ndr_print *ndr, const char *name, int flags, const struct samr_EnumDomainUsers *r)
+{
+       ndr_print_struct(ndr, name, "samr_EnumDomainUsers");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "samr_EnumDomainUsers");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "domain_handle", r->in.domain_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "domain_handle", r->in.domain_handle);
+               ndr->depth--;
+               ndr_print_ptr(ndr, "resume_handle", r->in.resume_handle);
+               ndr->depth++;
+               ndr_print_uint32(ndr, "resume_handle", *r->in.resume_handle);
+               ndr->depth--;
+               ndr_print_samr_AcctFlags(ndr, "acct_flags", r->in.acct_flags);
+               ndr_print_uint32(ndr, "max_size", r->in.max_size);
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "samr_EnumDomainUsers");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "resume_handle", r->out.resume_handle);
+               ndr->depth++;
+               ndr_print_uint32(ndr, "resume_handle", *r->out.resume_handle);
+               ndr->depth--;
+               ndr_print_ptr(ndr, "sam", r->out.sam);
+               ndr->depth++;
+               if (r->out.sam) {
+                       ndr_print_samr_SamArray(ndr, "sam", r->out.sam);
+               }
+               ndr->depth--;
+               ndr_print_ptr(ndr, "num_entries", r->out.num_entries);
+               ndr->depth++;
+               ndr_print_uint32(ndr, "num_entries", *r->out.num_entries);
+               ndr->depth--;
+               ndr_print_NTSTATUS(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_CreateDomAlias(struct ndr_push *ndr, int flags, const struct samr_CreateDomAlias *r)
+{
+       if (flags & NDR_IN) {
+               if (r->in.domain_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle));
+               if (r->in.alias_name == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.alias_name));
+               NDR_CHECK(ndr_push_samr_AliasAccessMask(ndr, NDR_SCALARS, r->in.access_mask));
+       }
+       if (flags & NDR_OUT) {
+               if (r->out.alias_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.alias_handle));
+               if (r->out.rid == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.rid));
+               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_CreateDomAlias(struct ndr_pull *ndr, int flags, struct samr_CreateDomAlias *r)
+{
+       TALLOC_CTX *_mem_save_domain_handle_0;
+       TALLOC_CTX *_mem_save_alias_name_0;
+       TALLOC_CTX *_mem_save_alias_handle_0;
+       TALLOC_CTX *_mem_save_rid_0;
+       if (flags & NDR_IN) {
+               ZERO_STRUCT(r->out);
+
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.domain_handle);
+               }
+               _mem_save_domain_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.domain_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.alias_name);
+               }
+               _mem_save_alias_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.alias_name, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.alias_name));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_alias_name_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_samr_AliasAccessMask(ndr, NDR_SCALARS, &r->in.access_mask));
+               NDR_PULL_ALLOC(ndr, r->out.alias_handle);
+               ZERO_STRUCTP(r->out.alias_handle);
+               NDR_PULL_ALLOC(ndr, r->out.rid);
+               ZERO_STRUCTP(r->out.rid);
+       }
+       if (flags & NDR_OUT) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.alias_handle);
+               }
+               _mem_save_alias_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.alias_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->out.alias_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_alias_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.rid);
+               }
+               _mem_save_rid_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.rid, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.rid));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_rid_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_CreateDomAlias(struct ndr_print *ndr, const char *name, int flags, const struct samr_CreateDomAlias *r)
+{
+       ndr_print_struct(ndr, name, "samr_CreateDomAlias");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "samr_CreateDomAlias");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "domain_handle", r->in.domain_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "domain_handle", r->in.domain_handle);
+               ndr->depth--;
+               ndr_print_ptr(ndr, "alias_name", r->in.alias_name);
+               ndr->depth++;
+               ndr_print_lsa_String(ndr, "alias_name", r->in.alias_name);
+               ndr->depth--;
+               ndr_print_samr_AliasAccessMask(ndr, "access_mask", r->in.access_mask);
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "samr_CreateDomAlias");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "alias_handle", r->out.alias_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "alias_handle", r->out.alias_handle);
+               ndr->depth--;
+               ndr_print_ptr(ndr, "rid", r->out.rid);
+               ndr->depth++;
+               ndr_print_uint32(ndr, "rid", *r->out.rid);
+               ndr->depth--;
+               ndr_print_NTSTATUS(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_EnumDomainAliases(struct ndr_push *ndr, int flags, const struct samr_EnumDomainAliases *r)
+{
+       if (flags & NDR_IN) {
+               if (r->in.domain_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle));
+               if (r->in.resume_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.resume_handle));
+               NDR_CHECK(ndr_push_samr_AcctFlags(ndr, NDR_SCALARS, r->in.acct_flags));
+       }
+       if (flags & NDR_OUT) {
+               if (r->out.resume_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.resume_handle));
+               if (r->out.sam == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_samr_SamArray(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.sam));
+               if (r->out.num_entries == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.num_entries));
+               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_EnumDomainAliases(struct ndr_pull *ndr, int flags, struct samr_EnumDomainAliases *r)
+{
+       TALLOC_CTX *_mem_save_domain_handle_0;
+       TALLOC_CTX *_mem_save_resume_handle_0;
+       TALLOC_CTX *_mem_save_sam_0;
+       TALLOC_CTX *_mem_save_num_entries_0;
+       if (flags & NDR_IN) {
+               ZERO_STRUCT(r->out);
+
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.domain_handle);
+               }
+               _mem_save_domain_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.domain_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.resume_handle);
+               }
+               _mem_save_resume_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.resume_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->in.resume_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_resume_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_samr_AcctFlags(ndr, NDR_SCALARS, &r->in.acct_flags));
+               NDR_PULL_ALLOC(ndr, r->out.resume_handle);
+               *r->out.resume_handle = *r->in.resume_handle;
+               NDR_PULL_ALLOC(ndr, r->out.sam);
+               ZERO_STRUCTP(r->out.sam);
+               NDR_PULL_ALLOC(ndr, r->out.num_entries);
+               ZERO_STRUCTP(r->out.num_entries);
+       }
+       if (flags & NDR_OUT) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.resume_handle);
+               }
+               _mem_save_resume_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.resume_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.resume_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_resume_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.sam);
+               }
+               _mem_save_sam_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.sam, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_samr_SamArray(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.sam));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sam_0, LIBNDR_FLAG_REF_ALLOC);
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.num_entries);
+               }
+               _mem_save_num_entries_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.num_entries, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.num_entries));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_num_entries_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_EnumDomainAliases(struct ndr_print *ndr, const char *name, int flags, const struct samr_EnumDomainAliases *r)
+{
+       ndr_print_struct(ndr, name, "samr_EnumDomainAliases");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "samr_EnumDomainAliases");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "domain_handle", r->in.domain_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "domain_handle", r->in.domain_handle);
+               ndr->depth--;
+               ndr_print_ptr(ndr, "resume_handle", r->in.resume_handle);
+               ndr->depth++;
+               ndr_print_uint32(ndr, "resume_handle", *r->in.resume_handle);
+               ndr->depth--;
+               ndr_print_samr_AcctFlags(ndr, "acct_flags", r->in.acct_flags);
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "samr_EnumDomainAliases");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "resume_handle", r->out.resume_handle);
+               ndr->depth++;
+               ndr_print_uint32(ndr, "resume_handle", *r->out.resume_handle);
+               ndr->depth--;
+               ndr_print_ptr(ndr, "sam", r->out.sam);
+               ndr->depth++;
+               ndr_print_samr_SamArray(ndr, "sam", r->out.sam);
+               ndr->depth--;
+               ndr_print_ptr(ndr, "num_entries", r->out.num_entries);
+               ndr->depth++;
+               ndr_print_uint32(ndr, "num_entries", *r->out.num_entries);
+               ndr->depth--;
+               ndr_print_NTSTATUS(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_GetAliasMembership(struct ndr_push *ndr, int flags, const struct samr_GetAliasMembership *r)
+{
+       if (flags & NDR_IN) {
+               if (r->in.domain_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle));
+               if (r->in.sids == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_lsa_SidArray(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.sids));
+       }
+       if (flags & NDR_OUT) {
+               if (r->out.rids == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_samr_Ids(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.rids));
+               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_GetAliasMembership(struct ndr_pull *ndr, int flags, struct samr_GetAliasMembership *r)
+{
+       TALLOC_CTX *_mem_save_domain_handle_0;
+       TALLOC_CTX *_mem_save_sids_0;
+       TALLOC_CTX *_mem_save_rids_0;
+       if (flags & NDR_IN) {
+               ZERO_STRUCT(r->out);
+
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.domain_handle);
+               }
+               _mem_save_domain_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.domain_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.sids);
+               }
+               _mem_save_sids_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.sids, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_lsa_SidArray(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.sids));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sids_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_PULL_ALLOC(ndr, r->out.rids);
+               ZERO_STRUCTP(r->out.rids);
+       }
+       if (flags & NDR_OUT) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.rids);
+               }
+               _mem_save_rids_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.rids, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_samr_Ids(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.rids));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_rids_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_GetAliasMembership(struct ndr_print *ndr, const char *name, int flags, const struct samr_GetAliasMembership *r)
+{
+       ndr_print_struct(ndr, name, "samr_GetAliasMembership");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "samr_GetAliasMembership");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "domain_handle", r->in.domain_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "domain_handle", r->in.domain_handle);
+               ndr->depth--;
+               ndr_print_ptr(ndr, "sids", r->in.sids);
+               ndr->depth++;
+               ndr_print_lsa_SidArray(ndr, "sids", r->in.sids);
+               ndr->depth--;
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "samr_GetAliasMembership");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "rids", r->out.rids);
+               ndr->depth++;
+               ndr_print_samr_Ids(ndr, "rids", r->out.rids);
+               ndr->depth--;
+               ndr_print_NTSTATUS(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_samr_LookupNames(struct ndr_push *ndr, int flags, const struct samr_LookupNames *r)
+{
+       uint32_t cntr_names_0;
+       if (flags & NDR_IN) {
+               if (r->in.domain_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.num_names));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 1000));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.num_names));
+               for (cntr_names_0 = 0; cntr_names_0 < r->in.num_names; cntr_names_0++) {
+                       NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->in.names[cntr_names_0]));
+               }
+               for (cntr_names_0 = 0; cntr_names_0 < r->in.num_names; cntr_names_0++) {
+                       NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->in.names[cntr_names_0]));
+               }
+       }
+       if (flags & NDR_OUT) {
+               if (r->out.rids == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_samr_Ids(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.rids));
+               if (r->out.types == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_samr_Ids(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.types));
+               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_samr_LookupNames(struct ndr_pull *ndr, int flags, struct samr_LookupNames *r)
+{
+       uint32_t cntr_names_0;
+       TALLOC_CTX *_mem_save_domain_handle_0;
+       TALLOC_CTX *_mem_save_names_0;
+       TALLOC_CTX *_mem_save_rids_0;
+       TALLOC_CTX *_mem_save_types_0;
+       if (flags & NDR_IN) {
+               ZERO_STRUCT(r->out);
+
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.domain_handle);
+               }
+               _mem_save_domain_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.domain_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.num_names));
+               if (r->in.num_names < 0 || r->in.num_names > 1000) {
+                       return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
+               }
+               NDR_CHECK(ndr_pull_array_size(ndr, &r->in.names));
+               NDR_CHECK(ndr_pull_array_length(ndr, &r->in.names));
+               if (ndr_get_array_length(ndr, &r->in.names) > ndr_get_array_size(ndr, &r->in.names)) {
+                       return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.names), ndr_get_array_length(ndr, &r->in.names));
+               }
+               NDR_PULL_ALLOC_N(ndr, r->in.names, ndr_get_array_size(ndr, &r->in.names));
+               _mem_save_names_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.names, 0);
+               for (cntr_names_0 = 0; cntr_names_0 < r->in.num_names; cntr_names_0++) {
+                       NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->in.names[cntr_names_0]));
+               }
+               for (cntr_names_0 = 0; cntr_names_0 < r->in.num_names; cntr_names_0++) {
+                       NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->in.names[cntr_names_0]));
+               }
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_names_0, 0);
+               NDR_PULL_ALLOC(ndr, r->out.rids);
+               ZERO_STRUCTP(r->out.rids);
+               NDR_PULL_ALLOC(ndr, r->out.types);
+               ZERO_STRUCTP(r->out.types);
+               if (r->in.names) {
+                       NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->in.names, 1000));
+               }
+               if (r->in.names) {
+                       NDR_CHECK(ndr_check_array_length(ndr, (void*)&r->in.names, r->in.num_names));
+               }
+       }
+       if (flags & NDR_OUT) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.rids);
+               }
+               _mem_save_rids_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.rids, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_samr_Ids(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.rids));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_rids_0, LIBNDR_FLAG_REF_ALLOC);
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.types);
+               }
+               _mem_save_types_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.types, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_samr_Ids(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.types));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_types_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_LookupNames(struct ndr_print *ndr, const char *name, int flags, const struct samr_LookupNames *r)
+{
+       uint32_t cntr_names_0;
+       ndr_print_struct(ndr, name, "samr_LookupNames");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "samr_LookupNames");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "domain_handle", r->in.domain_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "domain_handle", r->in.domain_handle);
+               ndr->depth--;
+               ndr_print_uint32(ndr, "num_names", r->in.num_names);
+               ndr->print(ndr, "%s: ARRAY(%d)", "names", r->in.num_names);
+               ndr->depth++;
+               for (cntr_names_0=0;cntr_names_0<r->in.num_names;cntr_names_0++) {
+                       char *idx_0=NULL;
+                       asprintf(&idx_0, "[%d]", cntr_names_0);
+                       if (idx_0) {
+                               ndr_print_lsa_String(ndr, "names", &r->in.names[cntr_names_0]);
+                               free(idx_0);
+                       }
+               }
+               ndr->depth--;
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "samr_LookupNames");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "rids", r->out.rids);
+               ndr->depth++;
+               ndr_print_samr_Ids(ndr, "rids", r->out.rids);
+               ndr->depth--;
+               ndr_print_ptr(ndr, "types", r->out.types);
+               ndr->depth++;
+               ndr_print_samr_Ids(ndr, "types", r->out.types);
+               ndr->depth--;
+               ndr_print_NTSTATUS(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_LookupRids(struct ndr_push *ndr, int flags, const struct samr_LookupRids *r)
+{
+       uint32_t cntr_rids_0;
+       if (flags & NDR_IN) {
+               if (r->in.domain_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.num_rids));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 1000));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.num_rids));
+               for (cntr_rids_0 = 0; cntr_rids_0 < r->in.num_rids; cntr_rids_0++) {
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.rids[cntr_rids_0]));
+               }
+       }
+       if (flags & NDR_OUT) {
+               if (r->out.names == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_lsa_Strings(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.names));
+               if (r->out.types == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_samr_Ids(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.types));
+               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_LookupRids(struct ndr_pull *ndr, int flags, struct samr_LookupRids *r)
+{
+       uint32_t cntr_rids_0;
+       TALLOC_CTX *_mem_save_domain_handle_0;
+       TALLOC_CTX *_mem_save_rids_0;
+       TALLOC_CTX *_mem_save_names_0;
+       TALLOC_CTX *_mem_save_types_0;
+       if (flags & NDR_IN) {
+               ZERO_STRUCT(r->out);
+
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.domain_handle);
+               }
+               _mem_save_domain_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.domain_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.num_rids));
+               if (r->in.num_rids < 0 || r->in.num_rids > 1000) {
+                       return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
+               }
+               NDR_CHECK(ndr_pull_array_size(ndr, &r->in.rids));
+               NDR_CHECK(ndr_pull_array_length(ndr, &r->in.rids));
+               if (ndr_get_array_length(ndr, &r->in.rids) > ndr_get_array_size(ndr, &r->in.rids)) {
+                       return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.rids), ndr_get_array_length(ndr, &r->in.rids));
+               }
+               NDR_PULL_ALLOC_N(ndr, r->in.rids, ndr_get_array_size(ndr, &r->in.rids));
+               _mem_save_rids_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.rids, 0);
+               for (cntr_rids_0 = 0; cntr_rids_0 < r->in.num_rids; cntr_rids_0++) {
+                       NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.rids[cntr_rids_0]));
+               }
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_rids_0, 0);
+               NDR_PULL_ALLOC(ndr, r->out.names);
+               ZERO_STRUCTP(r->out.names);
+               NDR_PULL_ALLOC(ndr, r->out.types);
+               ZERO_STRUCTP(r->out.types);
+               if (r->in.rids) {
+                       NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->in.rids, 1000));
+               }
+               if (r->in.rids) {
+                       NDR_CHECK(ndr_check_array_length(ndr, (void*)&r->in.rids, r->in.num_rids));
+               }
+       }
+       if (flags & NDR_OUT) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.names);
+               }
+               _mem_save_names_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.names, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_lsa_Strings(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.names));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_names_0, LIBNDR_FLAG_REF_ALLOC);
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.types);
+               }
+               _mem_save_types_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.types, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_samr_Ids(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.types));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_types_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_LookupRids(struct ndr_print *ndr, const char *name, int flags, const struct samr_LookupRids *r)
+{
+       uint32_t cntr_rids_0;
+       ndr_print_struct(ndr, name, "samr_LookupRids");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "samr_LookupRids");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "domain_handle", r->in.domain_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "domain_handle", r->in.domain_handle);
+               ndr->depth--;
+               ndr_print_uint32(ndr, "num_rids", r->in.num_rids);
+               ndr->print(ndr, "%s: ARRAY(%d)", "rids", r->in.num_rids);
+               ndr->depth++;
+               for (cntr_rids_0=0;cntr_rids_0<r->in.num_rids;cntr_rids_0++) {
+                       char *idx_0=NULL;
+                       asprintf(&idx_0, "[%d]", cntr_rids_0);
+                       if (idx_0) {
+                               ndr_print_uint32(ndr, "rids", r->in.rids[cntr_rids_0]);
+                               free(idx_0);
+                       }
+               }
+               ndr->depth--;
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "samr_LookupRids");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "names", r->out.names);
+               ndr->depth++;
+               ndr_print_lsa_Strings(ndr, "names", r->out.names);
+               ndr->depth--;
+               ndr_print_ptr(ndr, "types", r->out.types);
+               ndr->depth++;
+               ndr_print_samr_Ids(ndr, "types", r->out.types);
+               ndr->depth--;
+               ndr_print_NTSTATUS(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_OpenGroup(struct ndr_push *ndr, int flags, const struct samr_OpenGroup *r)
+{
+       if (flags & NDR_IN) {
+               if (r->in.domain_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle));
+               NDR_CHECK(ndr_push_samr_GroupAccessMask(ndr, NDR_SCALARS, r->in.access_mask));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.rid));
+       }
+       if (flags & NDR_OUT) {
+               if (r->out.group_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.group_handle));
+               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_OpenGroup(struct ndr_pull *ndr, int flags, struct samr_OpenGroup *r)
+{
+       TALLOC_CTX *_mem_save_domain_handle_0;
+       TALLOC_CTX *_mem_save_group_handle_0;
+       if (flags & NDR_IN) {
+               ZERO_STRUCT(r->out);
+
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.domain_handle);
+               }
+               _mem_save_domain_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.domain_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_samr_GroupAccessMask(ndr, NDR_SCALARS, &r->in.access_mask));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.rid));
+               NDR_PULL_ALLOC(ndr, r->out.group_handle);
+               ZERO_STRUCTP(r->out.group_handle);
+       }
+       if (flags & NDR_OUT) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.group_handle);
+               }
+               _mem_save_group_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.group_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->out.group_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_group_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_OpenGroup(struct ndr_print *ndr, const char *name, int flags, const struct samr_OpenGroup *r)
+{
+       ndr_print_struct(ndr, name, "samr_OpenGroup");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "samr_OpenGroup");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "domain_handle", r->in.domain_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "domain_handle", r->in.domain_handle);
+               ndr->depth--;
+               ndr_print_samr_GroupAccessMask(ndr, "access_mask", r->in.access_mask);
+               ndr_print_uint32(ndr, "rid", r->in.rid);
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "samr_OpenGroup");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "group_handle", r->out.group_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "group_handle", r->out.group_handle);
+               ndr->depth--;
+               ndr_print_NTSTATUS(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_QueryGroupInfo(struct ndr_push *ndr, int flags, const struct samr_QueryGroupInfo *r)
+{
+       if (flags & NDR_IN) {
+               if (r->in.group_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.group_handle));
+               NDR_CHECK(ndr_push_samr_GroupInfoEnum(ndr, NDR_SCALARS, r->in.level));
+       }
+       if (flags & NDR_OUT) {
+               if (r->out.info == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_set_switch_value(ndr, r->out.info, r->in.level));
+               NDR_CHECK(ndr_push_samr_GroupInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info));
+               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_QueryGroupInfo(struct ndr_pull *ndr, int flags, struct samr_QueryGroupInfo *r)
+{
+       TALLOC_CTX *_mem_save_group_handle_0;
+       TALLOC_CTX *_mem_save_info_0;
+       if (flags & NDR_IN) {
+               ZERO_STRUCT(r->out);
+
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.group_handle);
+               }
+               _mem_save_group_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.group_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.group_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_group_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_samr_GroupInfoEnum(ndr, NDR_SCALARS, &r->in.level));
+               NDR_PULL_ALLOC(ndr, r->out.info);
+               ZERO_STRUCTP(r->out.info);
+       }
+       if (flags & NDR_OUT) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.info);
+               }
+               _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.info, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_set_switch_value(ndr, r->out.info, r->in.level));
+               NDR_CHECK(ndr_pull_samr_GroupInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_QueryGroupInfo(struct ndr_print *ndr, const char *name, int flags, const struct samr_QueryGroupInfo *r)
+{
+       ndr_print_struct(ndr, name, "samr_QueryGroupInfo");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "samr_QueryGroupInfo");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "group_handle", r->in.group_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "group_handle", r->in.group_handle);
+               ndr->depth--;
+               ndr_print_samr_GroupInfoEnum(ndr, "level", r->in.level);
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "samr_QueryGroupInfo");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "info", r->out.info);
+               ndr->depth++;
+               ndr_print_set_switch_value(ndr, r->out.info, r->in.level);
+               ndr_print_samr_GroupInfo(ndr, "info", r->out.info);
+               ndr->depth--;
+               ndr_print_NTSTATUS(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_SetGroupInfo(struct ndr_push *ndr, int flags, const struct samr_SetGroupInfo *r)
+{
+       if (flags & NDR_IN) {
+               if (r->in.group_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.group_handle));
+               NDR_CHECK(ndr_push_samr_GroupInfoEnum(ndr, NDR_SCALARS, r->in.level));
+               if (r->in.info == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_set_switch_value(ndr, r->in.info, r->in.level));
+               NDR_CHECK(ndr_push_samr_GroupInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.info));
+       }
+       if (flags & NDR_OUT) {
+               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_SetGroupInfo(struct ndr_pull *ndr, int flags, struct samr_SetGroupInfo *r)
+{
+       TALLOC_CTX *_mem_save_group_handle_0;
+       TALLOC_CTX *_mem_save_info_0;
+       if (flags & NDR_IN) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.group_handle);
+               }
+               _mem_save_group_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.group_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.group_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_group_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_samr_GroupInfoEnum(ndr, NDR_SCALARS, &r->in.level));
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.info);
+               }
+               _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.info, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_set_switch_value(ndr, r->in.info, r->in.level));
+               NDR_CHECK(ndr_pull_samr_GroupInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.info));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, LIBNDR_FLAG_REF_ALLOC);
+       }
+       if (flags & NDR_OUT) {
+               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_SetGroupInfo(struct ndr_print *ndr, const char *name, int flags, const struct samr_SetGroupInfo *r)
+{
+       ndr_print_struct(ndr, name, "samr_SetGroupInfo");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "samr_SetGroupInfo");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "group_handle", r->in.group_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "group_handle", r->in.group_handle);
+               ndr->depth--;
+               ndr_print_samr_GroupInfoEnum(ndr, "level", r->in.level);
+               ndr_print_ptr(ndr, "info", r->in.info);
+               ndr->depth++;
+               ndr_print_set_switch_value(ndr, r->in.info, r->in.level);
+               ndr_print_samr_GroupInfo(ndr, "info", r->in.info);
+               ndr->depth--;
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "samr_SetGroupInfo");
+               ndr->depth++;
+               ndr_print_NTSTATUS(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_AddGroupMember(struct ndr_push *ndr, int flags, const struct samr_AddGroupMember *r)
+{
+       if (flags & NDR_IN) {
+               if (r->in.group_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.group_handle));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.rid));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.flags));
+       }
+       if (flags & NDR_OUT) {
+               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_AddGroupMember(struct ndr_pull *ndr, int flags, struct samr_AddGroupMember *r)
+{
+       TALLOC_CTX *_mem_save_group_handle_0;
+       if (flags & NDR_IN) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.group_handle);
+               }
+               _mem_save_group_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.group_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.group_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_group_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.rid));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.flags));
+       }
+       if (flags & NDR_OUT) {
+               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_AddGroupMember(struct ndr_print *ndr, const char *name, int flags, const struct samr_AddGroupMember *r)
+{
+       ndr_print_struct(ndr, name, "samr_AddGroupMember");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "samr_AddGroupMember");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "group_handle", r->in.group_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "group_handle", r->in.group_handle);
+               ndr->depth--;
+               ndr_print_uint32(ndr, "rid", r->in.rid);
+               ndr_print_uint32(ndr, "flags", r->in.flags);
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "samr_AddGroupMember");
+               ndr->depth++;
+               ndr_print_NTSTATUS(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_DeleteDomainGroup(struct ndr_push *ndr, int flags, const struct samr_DeleteDomainGroup *r)
+{
+       if (flags & NDR_IN) {
+               if (r->in.group_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.group_handle));
+       }
+       if (flags & NDR_OUT) {
+               if (r->out.group_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.group_handle));
+               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_DeleteDomainGroup(struct ndr_pull *ndr, int flags, struct samr_DeleteDomainGroup *r)
+{
+       TALLOC_CTX *_mem_save_group_handle_0;
+       if (flags & NDR_IN) {
+               ZERO_STRUCT(r->out);
+
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.group_handle);
+               }
+               _mem_save_group_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.group_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.group_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_group_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_PULL_ALLOC(ndr, r->out.group_handle);
+               *r->out.group_handle = *r->in.group_handle;
+       }
+       if (flags & NDR_OUT) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.group_handle);
+               }
+               _mem_save_group_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.group_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->out.group_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_group_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_DeleteDomainGroup(struct ndr_print *ndr, const char *name, int flags, const struct samr_DeleteDomainGroup *r)
+{
+       ndr_print_struct(ndr, name, "samr_DeleteDomainGroup");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "samr_DeleteDomainGroup");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "group_handle", r->in.group_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "group_handle", r->in.group_handle);
+               ndr->depth--;
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "samr_DeleteDomainGroup");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "group_handle", r->out.group_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "group_handle", r->out.group_handle);
+               ndr->depth--;
+               ndr_print_NTSTATUS(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_DeleteGroupMember(struct ndr_push *ndr, int flags, const struct samr_DeleteGroupMember *r)
+{
+       if (flags & NDR_IN) {
+               if (r->in.group_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.group_handle));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.rid));
+       }
+       if (flags & NDR_OUT) {
+               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_DeleteGroupMember(struct ndr_pull *ndr, int flags, struct samr_DeleteGroupMember *r)
+{
+       TALLOC_CTX *_mem_save_group_handle_0;
+       if (flags & NDR_IN) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.group_handle);
+               }
+               _mem_save_group_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.group_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.group_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_group_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.rid));
+       }
+       if (flags & NDR_OUT) {
+               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_DeleteGroupMember(struct ndr_print *ndr, const char *name, int flags, const struct samr_DeleteGroupMember *r)
+{
+       ndr_print_struct(ndr, name, "samr_DeleteGroupMember");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "samr_DeleteGroupMember");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "group_handle", r->in.group_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "group_handle", r->in.group_handle);
+               ndr->depth--;
+               ndr_print_uint32(ndr, "rid", r->in.rid);
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "samr_DeleteGroupMember");
+               ndr->depth++;
+               ndr_print_NTSTATUS(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_QueryGroupMember(struct ndr_push *ndr, int flags, const struct samr_QueryGroupMember *r)
+{
+       if (flags & NDR_IN) {
+               if (r->in.group_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.group_handle));
+       }
+       if (flags & NDR_OUT) {
+               if (r->out.rids == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_samr_RidTypeArray(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.rids));
+               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_QueryGroupMember(struct ndr_pull *ndr, int flags, struct samr_QueryGroupMember *r)
+{
+       TALLOC_CTX *_mem_save_group_handle_0;
+       TALLOC_CTX *_mem_save_rids_0;
+       if (flags & NDR_IN) {
+               ZERO_STRUCT(r->out);
+
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.group_handle);
+               }
+               _mem_save_group_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.group_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.group_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_group_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_PULL_ALLOC(ndr, r->out.rids);
+               ZERO_STRUCTP(r->out.rids);
+       }
+       if (flags & NDR_OUT) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.rids);
+               }
+               _mem_save_rids_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.rids, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_samr_RidTypeArray(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.rids));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_rids_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_QueryGroupMember(struct ndr_print *ndr, const char *name, int flags, const struct samr_QueryGroupMember *r)
+{
+       ndr_print_struct(ndr, name, "samr_QueryGroupMember");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "samr_QueryGroupMember");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "group_handle", r->in.group_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "group_handle", r->in.group_handle);
+               ndr->depth--;
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "samr_QueryGroupMember");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "rids", r->out.rids);
+               ndr->depth++;
+               ndr_print_samr_RidTypeArray(ndr, "rids", r->out.rids);
+               ndr->depth--;
+               ndr_print_NTSTATUS(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_SetMemberAttributesOfGroup(struct ndr_push *ndr, int flags, const struct samr_SetMemberAttributesOfGroup *r)
+{
+       if (flags & NDR_IN) {
+               if (r->in.group_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.group_handle));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.unknown1));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.unknown2));
+       }
+       if (flags & NDR_OUT) {
+               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_SetMemberAttributesOfGroup(struct ndr_pull *ndr, int flags, struct samr_SetMemberAttributesOfGroup *r)
+{
+       TALLOC_CTX *_mem_save_group_handle_0;
+       if (flags & NDR_IN) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.group_handle);
+               }
+               _mem_save_group_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.group_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.group_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_group_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.unknown1));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.unknown2));
+       }
+       if (flags & NDR_OUT) {
+               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_SetMemberAttributesOfGroup(struct ndr_print *ndr, const char *name, int flags, const struct samr_SetMemberAttributesOfGroup *r)
+{
+       ndr_print_struct(ndr, name, "samr_SetMemberAttributesOfGroup");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "samr_SetMemberAttributesOfGroup");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "group_handle", r->in.group_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "group_handle", r->in.group_handle);
+               ndr->depth--;
+               ndr_print_uint32(ndr, "unknown1", r->in.unknown1);
+               ndr_print_uint32(ndr, "unknown2", r->in.unknown2);
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "samr_SetMemberAttributesOfGroup");
+               ndr->depth++;
+               ndr_print_NTSTATUS(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_OpenAlias(struct ndr_push *ndr, int flags, const struct samr_OpenAlias *r)
+{
+       if (flags & NDR_IN) {
+               if (r->in.domain_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle));
+               NDR_CHECK(ndr_push_samr_AliasAccessMask(ndr, NDR_SCALARS, r->in.access_mask));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.rid));
+       }
+       if (flags & NDR_OUT) {
+               if (r->out.alias_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.alias_handle));
+               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_OpenAlias(struct ndr_pull *ndr, int flags, struct samr_OpenAlias *r)
+{
+       TALLOC_CTX *_mem_save_domain_handle_0;
+       TALLOC_CTX *_mem_save_alias_handle_0;
+       if (flags & NDR_IN) {
+               ZERO_STRUCT(r->out);
+
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.domain_handle);
+               }
+               _mem_save_domain_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.domain_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_samr_AliasAccessMask(ndr, NDR_SCALARS, &r->in.access_mask));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.rid));
+               NDR_PULL_ALLOC(ndr, r->out.alias_handle);
+               ZERO_STRUCTP(r->out.alias_handle);
+       }
+       if (flags & NDR_OUT) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.alias_handle);
+               }
+               _mem_save_alias_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.alias_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->out.alias_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_alias_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_OpenAlias(struct ndr_print *ndr, const char *name, int flags, const struct samr_OpenAlias *r)
+{
+       ndr_print_struct(ndr, name, "samr_OpenAlias");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "samr_OpenAlias");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "domain_handle", r->in.domain_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "domain_handle", r->in.domain_handle);
+               ndr->depth--;
+               ndr_print_samr_AliasAccessMask(ndr, "access_mask", r->in.access_mask);
+               ndr_print_uint32(ndr, "rid", r->in.rid);
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "samr_OpenAlias");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "alias_handle", r->out.alias_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "alias_handle", r->out.alias_handle);
+               ndr->depth--;
+               ndr_print_NTSTATUS(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_QueryAliasInfo(struct ndr_push *ndr, int flags, const struct samr_QueryAliasInfo *r)
+{
+       if (flags & NDR_IN) {
+               if (r->in.alias_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.alias_handle));
+               NDR_CHECK(ndr_push_samr_AliasInfoEnum(ndr, NDR_SCALARS, r->in.level));
+       }
+       if (flags & NDR_OUT) {
+               if (r->out.info == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_set_switch_value(ndr, r->out.info, r->in.level));
+               NDR_CHECK(ndr_push_samr_AliasInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info));
+               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_QueryAliasInfo(struct ndr_pull *ndr, int flags, struct samr_QueryAliasInfo *r)
+{
+       TALLOC_CTX *_mem_save_alias_handle_0;
+       TALLOC_CTX *_mem_save_info_0;
+       if (flags & NDR_IN) {
+               ZERO_STRUCT(r->out);
+
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.alias_handle);
+               }
+               _mem_save_alias_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.alias_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.alias_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_alias_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_samr_AliasInfoEnum(ndr, NDR_SCALARS, &r->in.level));
+               NDR_PULL_ALLOC(ndr, r->out.info);
+               ZERO_STRUCTP(r->out.info);
+       }
+       if (flags & NDR_OUT) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.info);
+               }
+               _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.info, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_set_switch_value(ndr, r->out.info, r->in.level));
+               NDR_CHECK(ndr_pull_samr_AliasInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_QueryAliasInfo(struct ndr_print *ndr, const char *name, int flags, const struct samr_QueryAliasInfo *r)
+{
+       ndr_print_struct(ndr, name, "samr_QueryAliasInfo");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "samr_QueryAliasInfo");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "alias_handle", r->in.alias_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "alias_handle", r->in.alias_handle);
+               ndr->depth--;
+               ndr_print_samr_AliasInfoEnum(ndr, "level", r->in.level);
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "samr_QueryAliasInfo");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "info", r->out.info);
+               ndr->depth++;
+               ndr_print_set_switch_value(ndr, r->out.info, r->in.level);
+               ndr_print_samr_AliasInfo(ndr, "info", r->out.info);
+               ndr->depth--;
+               ndr_print_NTSTATUS(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_SetAliasInfo(struct ndr_push *ndr, int flags, const struct samr_SetAliasInfo *r)
+{
+       if (flags & NDR_IN) {
+               if (r->in.alias_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.alias_handle));
+               NDR_CHECK(ndr_push_samr_AliasInfoEnum(ndr, NDR_SCALARS, r->in.level));
+               if (r->in.info == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_set_switch_value(ndr, r->in.info, r->in.level));
+               NDR_CHECK(ndr_push_samr_AliasInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.info));
+       }
+       if (flags & NDR_OUT) {
+               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_SetAliasInfo(struct ndr_pull *ndr, int flags, struct samr_SetAliasInfo *r)
+{
+       TALLOC_CTX *_mem_save_alias_handle_0;
+       TALLOC_CTX *_mem_save_info_0;
+       if (flags & NDR_IN) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.alias_handle);
+               }
+               _mem_save_alias_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.alias_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.alias_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_alias_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_samr_AliasInfoEnum(ndr, NDR_SCALARS, &r->in.level));
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.info);
+               }
+               _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.info, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_set_switch_value(ndr, r->in.info, r->in.level));
+               NDR_CHECK(ndr_pull_samr_AliasInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.info));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, LIBNDR_FLAG_REF_ALLOC);
+       }
+       if (flags & NDR_OUT) {
+               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_SetAliasInfo(struct ndr_print *ndr, const char *name, int flags, const struct samr_SetAliasInfo *r)
+{
+       ndr_print_struct(ndr, name, "samr_SetAliasInfo");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "samr_SetAliasInfo");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "alias_handle", r->in.alias_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "alias_handle", r->in.alias_handle);
+               ndr->depth--;
+               ndr_print_samr_AliasInfoEnum(ndr, "level", r->in.level);
+               ndr_print_ptr(ndr, "info", r->in.info);
+               ndr->depth++;
+               ndr_print_set_switch_value(ndr, r->in.info, r->in.level);
+               ndr_print_samr_AliasInfo(ndr, "info", r->in.info);
+               ndr->depth--;
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "samr_SetAliasInfo");
+               ndr->depth++;
+               ndr_print_NTSTATUS(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_DeleteDomAlias(struct ndr_push *ndr, int flags, const struct samr_DeleteDomAlias *r)
+{
+       if (flags & NDR_IN) {
+               if (r->in.alias_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.alias_handle));
+       }
+       if (flags & NDR_OUT) {
+               if (r->out.alias_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.alias_handle));
+               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_DeleteDomAlias(struct ndr_pull *ndr, int flags, struct samr_DeleteDomAlias *r)
+{
+       TALLOC_CTX *_mem_save_alias_handle_0;
+       if (flags & NDR_IN) {
+               ZERO_STRUCT(r->out);
+
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.alias_handle);
+               }
+               _mem_save_alias_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.alias_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.alias_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_alias_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_PULL_ALLOC(ndr, r->out.alias_handle);
+               *r->out.alias_handle = *r->in.alias_handle;
+       }
+       if (flags & NDR_OUT) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.alias_handle);
+               }
+               _mem_save_alias_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.alias_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->out.alias_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_alias_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_DeleteDomAlias(struct ndr_print *ndr, const char *name, int flags, const struct samr_DeleteDomAlias *r)
+{
+       ndr_print_struct(ndr, name, "samr_DeleteDomAlias");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "samr_DeleteDomAlias");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "alias_handle", r->in.alias_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "alias_handle", r->in.alias_handle);
+               ndr->depth--;
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "samr_DeleteDomAlias");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "alias_handle", r->out.alias_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "alias_handle", r->out.alias_handle);
+               ndr->depth--;
+               ndr_print_NTSTATUS(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_AddAliasMember(struct ndr_push *ndr, int flags, const struct samr_AddAliasMember *r)
+{
+       if (flags & NDR_IN) {
+               if (r->in.alias_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.alias_handle));
+               if (r->in.sid == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_dom_sid2(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.sid));
+       }
+       if (flags & NDR_OUT) {
+               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_AddAliasMember(struct ndr_pull *ndr, int flags, struct samr_AddAliasMember *r)
+{
+       TALLOC_CTX *_mem_save_alias_handle_0;
+       TALLOC_CTX *_mem_save_sid_0;
+       if (flags & NDR_IN) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.alias_handle);
+               }
+               _mem_save_alias_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.alias_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.alias_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_alias_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.sid);
+               }
+               _mem_save_sid_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.sid, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_dom_sid2(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.sid));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sid_0, LIBNDR_FLAG_REF_ALLOC);
+       }
+       if (flags & NDR_OUT) {
+               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_AddAliasMember(struct ndr_print *ndr, const char *name, int flags, const struct samr_AddAliasMember *r)
+{
+       ndr_print_struct(ndr, name, "samr_AddAliasMember");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "samr_AddAliasMember");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "alias_handle", r->in.alias_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "alias_handle", r->in.alias_handle);
+               ndr->depth--;
+               ndr_print_ptr(ndr, "sid", r->in.sid);
+               ndr->depth++;
+               ndr_print_dom_sid2(ndr, "sid", r->in.sid);
+               ndr->depth--;
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "samr_AddAliasMember");
+               ndr->depth++;
+               ndr_print_NTSTATUS(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_DeleteAliasMember(struct ndr_push *ndr, int flags, const struct samr_DeleteAliasMember *r)
+{
+       if (flags & NDR_IN) {
+               if (r->in.alias_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.alias_handle));
+               if (r->in.sid == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_dom_sid2(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.sid));
+       }
+       if (flags & NDR_OUT) {
+               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_DeleteAliasMember(struct ndr_pull *ndr, int flags, struct samr_DeleteAliasMember *r)
+{
+       TALLOC_CTX *_mem_save_alias_handle_0;
+       TALLOC_CTX *_mem_save_sid_0;
+       if (flags & NDR_IN) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.alias_handle);
+               }
+               _mem_save_alias_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.alias_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.alias_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_alias_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.sid);
+               }
+               _mem_save_sid_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.sid, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_dom_sid2(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.sid));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sid_0, LIBNDR_FLAG_REF_ALLOC);
+       }
+       if (flags & NDR_OUT) {
+               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_DeleteAliasMember(struct ndr_print *ndr, const char *name, int flags, const struct samr_DeleteAliasMember *r)
+{
+       ndr_print_struct(ndr, name, "samr_DeleteAliasMember");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "samr_DeleteAliasMember");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "alias_handle", r->in.alias_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "alias_handle", r->in.alias_handle);
+               ndr->depth--;
+               ndr_print_ptr(ndr, "sid", r->in.sid);
+               ndr->depth++;
+               ndr_print_dom_sid2(ndr, "sid", r->in.sid);
+               ndr->depth--;
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "samr_DeleteAliasMember");
+               ndr->depth++;
+               ndr_print_NTSTATUS(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_GetMembersInAlias(struct ndr_push *ndr, int flags, const struct samr_GetMembersInAlias *r)
+{
+       if (flags & NDR_IN) {
+               if (r->in.alias_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.alias_handle));
+       }
+       if (flags & NDR_OUT) {
+               if (r->out.sids == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_lsa_SidArray(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.sids));
+               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_GetMembersInAlias(struct ndr_pull *ndr, int flags, struct samr_GetMembersInAlias *r)
+{
+       TALLOC_CTX *_mem_save_alias_handle_0;
+       TALLOC_CTX *_mem_save_sids_0;
+       if (flags & NDR_IN) {
+               ZERO_STRUCT(r->out);
+
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.alias_handle);
+               }
+               _mem_save_alias_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.alias_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.alias_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_alias_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_PULL_ALLOC(ndr, r->out.sids);
+               ZERO_STRUCTP(r->out.sids);
+       }
+       if (flags & NDR_OUT) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.sids);
+               }
+               _mem_save_sids_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.sids, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_lsa_SidArray(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.sids));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sids_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_GetMembersInAlias(struct ndr_print *ndr, const char *name, int flags, const struct samr_GetMembersInAlias *r)
+{
+       ndr_print_struct(ndr, name, "samr_GetMembersInAlias");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "samr_GetMembersInAlias");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "alias_handle", r->in.alias_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "alias_handle", r->in.alias_handle);
+               ndr->depth--;
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "samr_GetMembersInAlias");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "sids", r->out.sids);
+               ndr->depth++;
+               ndr_print_lsa_SidArray(ndr, "sids", r->out.sids);
+               ndr->depth--;
+               ndr_print_NTSTATUS(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_samr_OpenUser(struct ndr_push *ndr, int flags, const struct samr_OpenUser *r)
+{
+       if (flags & NDR_IN) {
+               if (r->in.domain_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle));
+               NDR_CHECK(ndr_push_samr_UserAccessMask(ndr, NDR_SCALARS, r->in.access_mask));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.rid));
+       }
+       if (flags & NDR_OUT) {
+               if (r->out.user_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.user_handle));
+               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_samr_OpenUser(struct ndr_pull *ndr, int flags, struct samr_OpenUser *r)
+{
+       TALLOC_CTX *_mem_save_domain_handle_0;
+       TALLOC_CTX *_mem_save_user_handle_0;
+       if (flags & NDR_IN) {
+               ZERO_STRUCT(r->out);
+
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.domain_handle);
+               }
+               _mem_save_domain_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.domain_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_samr_UserAccessMask(ndr, NDR_SCALARS, &r->in.access_mask));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.rid));
+               NDR_PULL_ALLOC(ndr, r->out.user_handle);
+               ZERO_STRUCTP(r->out.user_handle);
+       }
+       if (flags & NDR_OUT) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.user_handle);
+               }
+               _mem_save_user_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.user_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->out.user_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_user_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_OpenUser(struct ndr_print *ndr, const char *name, int flags, const struct samr_OpenUser *r)
+{
+       ndr_print_struct(ndr, name, "samr_OpenUser");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "samr_OpenUser");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "domain_handle", r->in.domain_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "domain_handle", r->in.domain_handle);
+               ndr->depth--;
+               ndr_print_samr_UserAccessMask(ndr, "access_mask", r->in.access_mask);
+               ndr_print_uint32(ndr, "rid", r->in.rid);
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "samr_OpenUser");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "user_handle", r->out.user_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "user_handle", r->out.user_handle);
+               ndr->depth--;
+               ndr_print_NTSTATUS(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_DeleteUser(struct ndr_push *ndr, int flags, const struct samr_DeleteUser *r)
+{
+       if (flags & NDR_IN) {
+               if (r->in.user_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.user_handle));
+       }
+       if (flags & NDR_OUT) {
+               if (r->out.user_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.user_handle));
+               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_DeleteUser(struct ndr_pull *ndr, int flags, struct samr_DeleteUser *r)
+{
+       TALLOC_CTX *_mem_save_user_handle_0;
+       if (flags & NDR_IN) {
+               ZERO_STRUCT(r->out);
+
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.user_handle);
+               }
+               _mem_save_user_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.user_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.user_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_user_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_PULL_ALLOC(ndr, r->out.user_handle);
+               *r->out.user_handle = *r->in.user_handle;
+       }
+       if (flags & NDR_OUT) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.user_handle);
+               }
+               _mem_save_user_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.user_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->out.user_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_user_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_DeleteUser(struct ndr_print *ndr, const char *name, int flags, const struct samr_DeleteUser *r)
+{
+       ndr_print_struct(ndr, name, "samr_DeleteUser");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "samr_DeleteUser");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "user_handle", r->in.user_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "user_handle", r->in.user_handle);
+               ndr->depth--;
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "samr_DeleteUser");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "user_handle", r->out.user_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "user_handle", r->out.user_handle);
+               ndr->depth--;
+               ndr_print_NTSTATUS(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_samr_QueryUserInfo(struct ndr_push *ndr, int flags, const struct samr_QueryUserInfo *r)
+{
+       if (flags & NDR_IN) {
+               if (r->in.user_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.user_handle));
+               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->in.level));
+       }
+       if (flags & NDR_OUT) {
+               if (r->out.info == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_set_switch_value(ndr, r->out.info, r->in.level));
+               NDR_CHECK(ndr_push_samr_UserInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info));
+               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_samr_QueryUserInfo(struct ndr_pull *ndr, int flags, struct samr_QueryUserInfo *r)
+{
+       TALLOC_CTX *_mem_save_user_handle_0;
+       TALLOC_CTX *_mem_save_info_0;
+       if (flags & NDR_IN) {
+               ZERO_STRUCT(r->out);
+
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.user_handle);
+               }
+               _mem_save_user_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.user_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.user_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_user_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->in.level));
+               NDR_PULL_ALLOC(ndr, r->out.info);
+               ZERO_STRUCTP(r->out.info);
+       }
+       if (flags & NDR_OUT) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.info);
+               }
+               _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.info, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_set_switch_value(ndr, r->out.info, r->in.level));
+               NDR_CHECK(ndr_pull_samr_UserInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_QueryUserInfo(struct ndr_print *ndr, const char *name, int flags, const struct samr_QueryUserInfo *r)
+{
+       ndr_print_struct(ndr, name, "samr_QueryUserInfo");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "samr_QueryUserInfo");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "user_handle", r->in.user_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "user_handle", r->in.user_handle);
+               ndr->depth--;
+               ndr_print_uint16(ndr, "level", r->in.level);
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "samr_QueryUserInfo");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "info", r->out.info);
+               ndr->depth++;
+               ndr_print_set_switch_value(ndr, r->out.info, r->in.level);
+               ndr_print_samr_UserInfo(ndr, "info", r->out.info);
+               ndr->depth--;
+               ndr_print_NTSTATUS(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_samr_SetUserInfo(struct ndr_push *ndr, int flags, const struct samr_SetUserInfo *r)
+{
+       if (flags & NDR_IN) {
+               if (r->in.user_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.user_handle));
+               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->in.level));
+               if (r->in.info == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_set_switch_value(ndr, r->in.info, r->in.level));
+               NDR_CHECK(ndr_push_samr_UserInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.info));
+       }
+       if (flags & NDR_OUT) {
+               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_samr_SetUserInfo(struct ndr_pull *ndr, int flags, struct samr_SetUserInfo *r)
+{
+       TALLOC_CTX *_mem_save_user_handle_0;
+       TALLOC_CTX *_mem_save_info_0;
+       if (flags & NDR_IN) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.user_handle);
+               }
+               _mem_save_user_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.user_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.user_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_user_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->in.level));
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.info);
+               }
+               _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.info, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_set_switch_value(ndr, r->in.info, r->in.level));
+               NDR_CHECK(ndr_pull_samr_UserInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.info));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, LIBNDR_FLAG_REF_ALLOC);
+       }
+       if (flags & NDR_OUT) {
+               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_SetUserInfo(struct ndr_print *ndr, const char *name, int flags, const struct samr_SetUserInfo *r)
+{
+       ndr_print_struct(ndr, name, "samr_SetUserInfo");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "samr_SetUserInfo");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "user_handle", r->in.user_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "user_handle", r->in.user_handle);
+               ndr->depth--;
+               ndr_print_uint16(ndr, "level", r->in.level);
+               ndr_print_ptr(ndr, "info", r->in.info);
+               ndr->depth++;
+               ndr_print_set_switch_value(ndr, r->in.info, r->in.level);
+               ndr_print_samr_UserInfo(ndr, "info", r->in.info);
+               ndr->depth--;
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "samr_SetUserInfo");
+               ndr->depth++;
+               ndr_print_NTSTATUS(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_ChangePasswordUser(struct ndr_push *ndr, int flags, const struct samr_ChangePasswordUser *r)
+{
+       if (flags & NDR_IN) {
+               if (r->in.user_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.user_handle));
+               NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->in.lm_present));
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.old_lm_crypted));
+               if (r->in.old_lm_crypted) {
+                       NDR_CHECK(ndr_push_samr_Password(ndr, NDR_SCALARS, r->in.old_lm_crypted));
+               }
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.new_lm_crypted));
+               if (r->in.new_lm_crypted) {
+                       NDR_CHECK(ndr_push_samr_Password(ndr, NDR_SCALARS, r->in.new_lm_crypted));
+               }
+               NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->in.nt_present));
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.old_nt_crypted));
+               if (r->in.old_nt_crypted) {
+                       NDR_CHECK(ndr_push_samr_Password(ndr, NDR_SCALARS, r->in.old_nt_crypted));
+               }
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.new_nt_crypted));
+               if (r->in.new_nt_crypted) {
+                       NDR_CHECK(ndr_push_samr_Password(ndr, NDR_SCALARS, r->in.new_nt_crypted));
+               }
+               NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->in.cross1_present));
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.nt_cross));
+               if (r->in.nt_cross) {
+                       NDR_CHECK(ndr_push_samr_Password(ndr, NDR_SCALARS, r->in.nt_cross));
+               }
+               NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->in.cross2_present));
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.lm_cross));
+               if (r->in.lm_cross) {
+                       NDR_CHECK(ndr_push_samr_Password(ndr, NDR_SCALARS, r->in.lm_cross));
+               }
+       }
+       if (flags & NDR_OUT) {
+               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_ChangePasswordUser(struct ndr_pull *ndr, int flags, struct samr_ChangePasswordUser *r)
+{
+       uint32_t _ptr_old_lm_crypted;
+       uint32_t _ptr_new_lm_crypted;
+       uint32_t _ptr_old_nt_crypted;
+       uint32_t _ptr_new_nt_crypted;
+       uint32_t _ptr_nt_cross;
+       uint32_t _ptr_lm_cross;
+       TALLOC_CTX *_mem_save_user_handle_0;
+       TALLOC_CTX *_mem_save_old_lm_crypted_0;
+       TALLOC_CTX *_mem_save_new_lm_crypted_0;
+       TALLOC_CTX *_mem_save_old_nt_crypted_0;
+       TALLOC_CTX *_mem_save_new_nt_crypted_0;
+       TALLOC_CTX *_mem_save_nt_cross_0;
+       TALLOC_CTX *_mem_save_lm_cross_0;
+       if (flags & NDR_IN) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.user_handle);
+               }
+               _mem_save_user_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.user_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.user_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_user_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->in.lm_present));
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_old_lm_crypted));
+               if (_ptr_old_lm_crypted) {
+                       NDR_PULL_ALLOC(ndr, r->in.old_lm_crypted);
+               } else {
+                       r->in.old_lm_crypted = NULL;
+               }
+               if (r->in.old_lm_crypted) {
+                       _mem_save_old_lm_crypted_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->in.old_lm_crypted, 0);
+                       NDR_CHECK(ndr_pull_samr_Password(ndr, NDR_SCALARS, r->in.old_lm_crypted));
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_old_lm_crypted_0, 0);
+               }
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_new_lm_crypted));
+               if (_ptr_new_lm_crypted) {
+                       NDR_PULL_ALLOC(ndr, r->in.new_lm_crypted);
+               } else {
+                       r->in.new_lm_crypted = NULL;
+               }
+               if (r->in.new_lm_crypted) {
+                       _mem_save_new_lm_crypted_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->in.new_lm_crypted, 0);
+                       NDR_CHECK(ndr_pull_samr_Password(ndr, NDR_SCALARS, r->in.new_lm_crypted));
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_new_lm_crypted_0, 0);
+               }
+               NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->in.nt_present));
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_old_nt_crypted));
+               if (_ptr_old_nt_crypted) {
+                       NDR_PULL_ALLOC(ndr, r->in.old_nt_crypted);
+               } else {
+                       r->in.old_nt_crypted = NULL;
+               }
+               if (r->in.old_nt_crypted) {
+                       _mem_save_old_nt_crypted_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->in.old_nt_crypted, 0);
+                       NDR_CHECK(ndr_pull_samr_Password(ndr, NDR_SCALARS, r->in.old_nt_crypted));
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_old_nt_crypted_0, 0);
+               }
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_new_nt_crypted));
+               if (_ptr_new_nt_crypted) {
+                       NDR_PULL_ALLOC(ndr, r->in.new_nt_crypted);
+               } else {
+                       r->in.new_nt_crypted = NULL;
+               }
+               if (r->in.new_nt_crypted) {
+                       _mem_save_new_nt_crypted_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->in.new_nt_crypted, 0);
+                       NDR_CHECK(ndr_pull_samr_Password(ndr, NDR_SCALARS, r->in.new_nt_crypted));
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_new_nt_crypted_0, 0);
+               }
+               NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->in.cross1_present));
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_nt_cross));
+               if (_ptr_nt_cross) {
+                       NDR_PULL_ALLOC(ndr, r->in.nt_cross);
+               } else {
+                       r->in.nt_cross = NULL;
+               }
+               if (r->in.nt_cross) {
+                       _mem_save_nt_cross_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->in.nt_cross, 0);
+                       NDR_CHECK(ndr_pull_samr_Password(ndr, NDR_SCALARS, r->in.nt_cross));
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_nt_cross_0, 0);
+               }
+               NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->in.cross2_present));
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_lm_cross));
+               if (_ptr_lm_cross) {
+                       NDR_PULL_ALLOC(ndr, r->in.lm_cross);
+               } else {
+                       r->in.lm_cross = NULL;
+               }
+               if (r->in.lm_cross) {
+                       _mem_save_lm_cross_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->in.lm_cross, 0);
+                       NDR_CHECK(ndr_pull_samr_Password(ndr, NDR_SCALARS, r->in.lm_cross));
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_lm_cross_0, 0);
+               }
+       }
+       if (flags & NDR_OUT) {
+               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_ChangePasswordUser(struct ndr_print *ndr, const char *name, int flags, const struct samr_ChangePasswordUser *r)
+{
+       ndr_print_struct(ndr, name, "samr_ChangePasswordUser");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "samr_ChangePasswordUser");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "user_handle", r->in.user_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "user_handle", r->in.user_handle);
+               ndr->depth--;
+               ndr_print_uint8(ndr, "lm_present", r->in.lm_present);
+               ndr_print_ptr(ndr, "old_lm_crypted", r->in.old_lm_crypted);
+               ndr->depth++;
+               if (r->in.old_lm_crypted) {
+                       ndr_print_samr_Password(ndr, "old_lm_crypted", r->in.old_lm_crypted);
+               }
+               ndr->depth--;
+               ndr_print_ptr(ndr, "new_lm_crypted", r->in.new_lm_crypted);
+               ndr->depth++;
+               if (r->in.new_lm_crypted) {
+                       ndr_print_samr_Password(ndr, "new_lm_crypted", r->in.new_lm_crypted);
+               }
+               ndr->depth--;
+               ndr_print_uint8(ndr, "nt_present", r->in.nt_present);
+               ndr_print_ptr(ndr, "old_nt_crypted", r->in.old_nt_crypted);
+               ndr->depth++;
+               if (r->in.old_nt_crypted) {
+                       ndr_print_samr_Password(ndr, "old_nt_crypted", r->in.old_nt_crypted);
+               }
+               ndr->depth--;
+               ndr_print_ptr(ndr, "new_nt_crypted", r->in.new_nt_crypted);
+               ndr->depth++;
+               if (r->in.new_nt_crypted) {
+                       ndr_print_samr_Password(ndr, "new_nt_crypted", r->in.new_nt_crypted);
+               }
+               ndr->depth--;
+               ndr_print_uint8(ndr, "cross1_present", r->in.cross1_present);
+               ndr_print_ptr(ndr, "nt_cross", r->in.nt_cross);
+               ndr->depth++;
+               if (r->in.nt_cross) {
+                       ndr_print_samr_Password(ndr, "nt_cross", r->in.nt_cross);
+               }
+               ndr->depth--;
+               ndr_print_uint8(ndr, "cross2_present", r->in.cross2_present);
+               ndr_print_ptr(ndr, "lm_cross", r->in.lm_cross);
+               ndr->depth++;
+               if (r->in.lm_cross) {
+                       ndr_print_samr_Password(ndr, "lm_cross", r->in.lm_cross);
+               }
+               ndr->depth--;
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "samr_ChangePasswordUser");
+               ndr->depth++;
+               ndr_print_NTSTATUS(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_GetGroupsForUser(struct ndr_push *ndr, int flags, const struct samr_GetGroupsForUser *r)
+{
+       if (flags & NDR_IN) {
+               if (r->in.user_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.user_handle));
+       }
+       if (flags & NDR_OUT) {
+               if (r->out.rids == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_samr_RidWithAttributeArray(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.rids));
+               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_GetGroupsForUser(struct ndr_pull *ndr, int flags, struct samr_GetGroupsForUser *r)
+{
+       TALLOC_CTX *_mem_save_user_handle_0;
+       TALLOC_CTX *_mem_save_rids_0;
+       if (flags & NDR_IN) {
+               ZERO_STRUCT(r->out);
+
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.user_handle);
+               }
+               _mem_save_user_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.user_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.user_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_user_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_PULL_ALLOC(ndr, r->out.rids);
+               ZERO_STRUCTP(r->out.rids);
+       }
+       if (flags & NDR_OUT) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.rids);
+               }
+               _mem_save_rids_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.rids, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_samr_RidWithAttributeArray(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.rids));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_rids_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_GetGroupsForUser(struct ndr_print *ndr, const char *name, int flags, const struct samr_GetGroupsForUser *r)
+{
+       ndr_print_struct(ndr, name, "samr_GetGroupsForUser");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "samr_GetGroupsForUser");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "user_handle", r->in.user_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "user_handle", r->in.user_handle);
+               ndr->depth--;
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "samr_GetGroupsForUser");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "rids", r->out.rids);
+               ndr->depth++;
+               ndr_print_samr_RidWithAttributeArray(ndr, "rids", r->out.rids);
+               ndr->depth--;
+               ndr_print_NTSTATUS(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_QueryDisplayInfo(struct ndr_push *ndr, int flags, const struct samr_QueryDisplayInfo *r)
+{
+       if (flags & NDR_IN) {
+               if (r->in.domain_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle));
+               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->in.level));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.start_idx));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.max_entries));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.buf_size));
+       }
+       if (flags & NDR_OUT) {
+               if (r->out.total_size == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.total_size));
+               if (r->out.returned_size == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.returned_size));
+               if (r->out.info == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_set_switch_value(ndr, r->out.info, r->in.level));
+               NDR_CHECK(ndr_push_samr_DispInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info));
+               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_QueryDisplayInfo(struct ndr_pull *ndr, int flags, struct samr_QueryDisplayInfo *r)
+{
+       TALLOC_CTX *_mem_save_domain_handle_0;
+       TALLOC_CTX *_mem_save_total_size_0;
+       TALLOC_CTX *_mem_save_returned_size_0;
+       TALLOC_CTX *_mem_save_info_0;
+       if (flags & NDR_IN) {
+               ZERO_STRUCT(r->out);
+
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.domain_handle);
+               }
+               _mem_save_domain_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.domain_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->in.level));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.start_idx));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.max_entries));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.buf_size));
+               NDR_PULL_ALLOC(ndr, r->out.total_size);
+               ZERO_STRUCTP(r->out.total_size);
+               NDR_PULL_ALLOC(ndr, r->out.returned_size);
+               ZERO_STRUCTP(r->out.returned_size);
+               NDR_PULL_ALLOC(ndr, r->out.info);
+               ZERO_STRUCTP(r->out.info);
+       }
+       if (flags & NDR_OUT) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.total_size);
+               }
+               _mem_save_total_size_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.total_size, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.total_size));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_total_size_0, LIBNDR_FLAG_REF_ALLOC);
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.returned_size);
+               }
+               _mem_save_returned_size_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.returned_size, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.returned_size));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_returned_size_0, LIBNDR_FLAG_REF_ALLOC);
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.info);
+               }
+               _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.info, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_set_switch_value(ndr, r->out.info, r->in.level));
+               NDR_CHECK(ndr_pull_samr_DispInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_QueryDisplayInfo(struct ndr_print *ndr, const char *name, int flags, const struct samr_QueryDisplayInfo *r)
+{
+       ndr_print_struct(ndr, name, "samr_QueryDisplayInfo");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "samr_QueryDisplayInfo");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "domain_handle", r->in.domain_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "domain_handle", r->in.domain_handle);
+               ndr->depth--;
+               ndr_print_uint16(ndr, "level", r->in.level);
+               ndr_print_uint32(ndr, "start_idx", r->in.start_idx);
+               ndr_print_uint32(ndr, "max_entries", r->in.max_entries);
+               ndr_print_uint32(ndr, "buf_size", r->in.buf_size);
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "samr_QueryDisplayInfo");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "total_size", r->out.total_size);
+               ndr->depth++;
+               ndr_print_uint32(ndr, "total_size", *r->out.total_size);
+               ndr->depth--;
+               ndr_print_ptr(ndr, "returned_size", r->out.returned_size);
+               ndr->depth++;
+               ndr_print_uint32(ndr, "returned_size", *r->out.returned_size);
+               ndr->depth--;
+               ndr_print_ptr(ndr, "info", r->out.info);
+               ndr->depth++;
+               ndr_print_set_switch_value(ndr, r->out.info, r->in.level);
+               ndr_print_samr_DispInfo(ndr, "info", r->out.info);
+               ndr->depth--;
+               ndr_print_NTSTATUS(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_GetDisplayEnumerationIndex(struct ndr_push *ndr, int flags, const struct samr_GetDisplayEnumerationIndex *r)
+{
+       if (flags & NDR_IN) {
+               if (r->in.domain_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle));
+               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->in.level));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.name));
+       }
+       if (flags & NDR_OUT) {
+               if (r->out.idx == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.idx));
+               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_GetDisplayEnumerationIndex(struct ndr_pull *ndr, int flags, struct samr_GetDisplayEnumerationIndex *r)
+{
+       TALLOC_CTX *_mem_save_domain_handle_0;
+       TALLOC_CTX *_mem_save_idx_0;
+       if (flags & NDR_IN) {
+               ZERO_STRUCT(r->out);
+
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.domain_handle);
+               }
+               _mem_save_domain_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.domain_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->in.level));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.name));
+               NDR_PULL_ALLOC(ndr, r->out.idx);
+               ZERO_STRUCTP(r->out.idx);
+       }
+       if (flags & NDR_OUT) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.idx);
+               }
+               _mem_save_idx_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.idx, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.idx));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_idx_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_GetDisplayEnumerationIndex(struct ndr_print *ndr, const char *name, int flags, const struct samr_GetDisplayEnumerationIndex *r)
+{
+       ndr_print_struct(ndr, name, "samr_GetDisplayEnumerationIndex");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "samr_GetDisplayEnumerationIndex");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "domain_handle", r->in.domain_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "domain_handle", r->in.domain_handle);
+               ndr->depth--;
+               ndr_print_uint16(ndr, "level", r->in.level);
+               ndr_print_lsa_String(ndr, "name", &r->in.name);
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "samr_GetDisplayEnumerationIndex");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "idx", r->out.idx);
+               ndr->depth++;
+               ndr_print_uint32(ndr, "idx", *r->out.idx);
+               ndr->depth--;
+               ndr_print_NTSTATUS(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_TestPrivateFunctionsDomain(struct ndr_push *ndr, int flags, const struct samr_TestPrivateFunctionsDomain *r)
+{
+       if (flags & NDR_IN) {
+               if (r->in.domain_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle));
+       }
+       if (flags & NDR_OUT) {
+               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_TestPrivateFunctionsDomain(struct ndr_pull *ndr, int flags, struct samr_TestPrivateFunctionsDomain *r)
+{
+       TALLOC_CTX *_mem_save_domain_handle_0;
+       if (flags & NDR_IN) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.domain_handle);
+               }
+               _mem_save_domain_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.domain_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_handle_0, LIBNDR_FLAG_REF_ALLOC);
+       }
+       if (flags & NDR_OUT) {
+               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_TestPrivateFunctionsDomain(struct ndr_print *ndr, const char *name, int flags, const struct samr_TestPrivateFunctionsDomain *r)
+{
+       ndr_print_struct(ndr, name, "samr_TestPrivateFunctionsDomain");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "samr_TestPrivateFunctionsDomain");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "domain_handle", r->in.domain_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "domain_handle", r->in.domain_handle);
+               ndr->depth--;
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "samr_TestPrivateFunctionsDomain");
+               ndr->depth++;
+               ndr_print_NTSTATUS(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_TestPrivateFunctionsUser(struct ndr_push *ndr, int flags, const struct samr_TestPrivateFunctionsUser *r)
+{
+       if (flags & NDR_IN) {
+               if (r->in.user_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.user_handle));
+       }
+       if (flags & NDR_OUT) {
+               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_TestPrivateFunctionsUser(struct ndr_pull *ndr, int flags, struct samr_TestPrivateFunctionsUser *r)
+{
+       TALLOC_CTX *_mem_save_user_handle_0;
+       if (flags & NDR_IN) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.user_handle);
+               }
+               _mem_save_user_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.user_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.user_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_user_handle_0, LIBNDR_FLAG_REF_ALLOC);
+       }
+       if (flags & NDR_OUT) {
+               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_TestPrivateFunctionsUser(struct ndr_print *ndr, const char *name, int flags, const struct samr_TestPrivateFunctionsUser *r)
+{
+       ndr_print_struct(ndr, name, "samr_TestPrivateFunctionsUser");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "samr_TestPrivateFunctionsUser");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "user_handle", r->in.user_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "user_handle", r->in.user_handle);
+               ndr->depth--;
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "samr_TestPrivateFunctionsUser");
+               ndr->depth++;
+               ndr_print_NTSTATUS(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_samr_GetUserPwInfo(struct ndr_push *ndr, int flags, const struct samr_GetUserPwInfo *r)
+{
+       if (flags & NDR_IN) {
+               if (r->in.user_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.user_handle));
+       }
+       if (flags & NDR_OUT) {
+               if (r->out.info == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_samr_PwInfo(ndr, NDR_SCALARS, r->out.info));
+               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_samr_GetUserPwInfo(struct ndr_pull *ndr, int flags, struct samr_GetUserPwInfo *r)
+{
+       TALLOC_CTX *_mem_save_user_handle_0;
+       TALLOC_CTX *_mem_save_info_0;
+       if (flags & NDR_IN) {
+               ZERO_STRUCT(r->out);
+
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.user_handle);
+               }
+               _mem_save_user_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.user_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.user_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_user_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_PULL_ALLOC(ndr, r->out.info);
+               ZERO_STRUCTP(r->out.info);
+       }
+       if (flags & NDR_OUT) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.info);
+               }
+               _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.info, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_samr_PwInfo(ndr, NDR_SCALARS, r->out.info));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_GetUserPwInfo(struct ndr_print *ndr, const char *name, int flags, const struct samr_GetUserPwInfo *r)
+{
+       ndr_print_struct(ndr, name, "samr_GetUserPwInfo");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "samr_GetUserPwInfo");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "user_handle", r->in.user_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "user_handle", r->in.user_handle);
+               ndr->depth--;
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "samr_GetUserPwInfo");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "info", r->out.info);
+               ndr->depth++;
+               ndr_print_samr_PwInfo(ndr, "info", r->out.info);
+               ndr->depth--;
+               ndr_print_NTSTATUS(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_RemoveMemberFromForeignDomain(struct ndr_push *ndr, int flags, const struct samr_RemoveMemberFromForeignDomain *r)
+{
+       if (flags & NDR_IN) {
+               if (r->in.domain_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle));
+               if (r->in.sid == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_dom_sid2(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.sid));
+       }
+       if (flags & NDR_OUT) {
+               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_RemoveMemberFromForeignDomain(struct ndr_pull *ndr, int flags, struct samr_RemoveMemberFromForeignDomain *r)
+{
+       TALLOC_CTX *_mem_save_domain_handle_0;
+       TALLOC_CTX *_mem_save_sid_0;
+       if (flags & NDR_IN) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.domain_handle);
+               }
+               _mem_save_domain_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.domain_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.sid);
+               }
+               _mem_save_sid_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.sid, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_dom_sid2(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.sid));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sid_0, LIBNDR_FLAG_REF_ALLOC);
+       }
+       if (flags & NDR_OUT) {
+               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_RemoveMemberFromForeignDomain(struct ndr_print *ndr, const char *name, int flags, const struct samr_RemoveMemberFromForeignDomain *r)
+{
+       ndr_print_struct(ndr, name, "samr_RemoveMemberFromForeignDomain");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "samr_RemoveMemberFromForeignDomain");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "domain_handle", r->in.domain_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "domain_handle", r->in.domain_handle);
+               ndr->depth--;
+               ndr_print_ptr(ndr, "sid", r->in.sid);
+               ndr->depth++;
+               ndr_print_dom_sid2(ndr, "sid", r->in.sid);
+               ndr->depth--;
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "samr_RemoveMemberFromForeignDomain");
+               ndr->depth++;
+               ndr_print_NTSTATUS(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_QueryDomainInfo2(struct ndr_push *ndr, int flags, const struct samr_QueryDomainInfo2 *r)
+{
+       if (flags & NDR_IN) {
+               if (r->in.domain_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle));
+               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->in.level));
+       }
+       if (flags & NDR_OUT) {
+               if (r->out.info == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_set_switch_value(ndr, r->out.info, r->in.level));
+               NDR_CHECK(ndr_push_samr_DomainInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info));
+               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_QueryDomainInfo2(struct ndr_pull *ndr, int flags, struct samr_QueryDomainInfo2 *r)
+{
+       TALLOC_CTX *_mem_save_domain_handle_0;
+       TALLOC_CTX *_mem_save_info_0;
+       if (flags & NDR_IN) {
+               ZERO_STRUCT(r->out);
+
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.domain_handle);
+               }
+               _mem_save_domain_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.domain_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->in.level));
+               NDR_PULL_ALLOC(ndr, r->out.info);
+               ZERO_STRUCTP(r->out.info);
+       }
+       if (flags & NDR_OUT) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.info);
+               }
+               _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.info, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_set_switch_value(ndr, r->out.info, r->in.level));
+               NDR_CHECK(ndr_pull_samr_DomainInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_QueryDomainInfo2(struct ndr_print *ndr, const char *name, int flags, const struct samr_QueryDomainInfo2 *r)
+{
+       ndr_print_struct(ndr, name, "samr_QueryDomainInfo2");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "samr_QueryDomainInfo2");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "domain_handle", r->in.domain_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "domain_handle", r->in.domain_handle);
+               ndr->depth--;
+               ndr_print_uint16(ndr, "level", r->in.level);
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "samr_QueryDomainInfo2");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "info", r->out.info);
+               ndr->depth++;
+               ndr_print_set_switch_value(ndr, r->out.info, r->in.level);
+               ndr_print_samr_DomainInfo(ndr, "info", r->out.info);
+               ndr->depth--;
+               ndr_print_NTSTATUS(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_QueryUserInfo2(struct ndr_push *ndr, int flags, const struct samr_QueryUserInfo2 *r)
+{
+       if (flags & NDR_IN) {
+               if (r->in.user_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.user_handle));
+               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->in.level));
+       }
+       if (flags & NDR_OUT) {
+               if (r->out.info == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_set_switch_value(ndr, r->out.info, r->in.level));
+               NDR_CHECK(ndr_push_samr_UserInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info));
+               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_QueryUserInfo2(struct ndr_pull *ndr, int flags, struct samr_QueryUserInfo2 *r)
+{
+       TALLOC_CTX *_mem_save_user_handle_0;
+       TALLOC_CTX *_mem_save_info_0;
+       if (flags & NDR_IN) {
+               ZERO_STRUCT(r->out);
+
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.user_handle);
+               }
+               _mem_save_user_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.user_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.user_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_user_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->in.level));
+               NDR_PULL_ALLOC(ndr, r->out.info);
+               ZERO_STRUCTP(r->out.info);
+       }
+       if (flags & NDR_OUT) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.info);
+               }
+               _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.info, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_set_switch_value(ndr, r->out.info, r->in.level));
+               NDR_CHECK(ndr_pull_samr_UserInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_QueryUserInfo2(struct ndr_print *ndr, const char *name, int flags, const struct samr_QueryUserInfo2 *r)
+{
+       ndr_print_struct(ndr, name, "samr_QueryUserInfo2");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "samr_QueryUserInfo2");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "user_handle", r->in.user_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "user_handle", r->in.user_handle);
+               ndr->depth--;
+               ndr_print_uint16(ndr, "level", r->in.level);
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "samr_QueryUserInfo2");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "info", r->out.info);
+               ndr->depth++;
+               ndr_print_set_switch_value(ndr, r->out.info, r->in.level);
+               ndr_print_samr_UserInfo(ndr, "info", r->out.info);
+               ndr->depth--;
+               ndr_print_NTSTATUS(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_QueryDisplayInfo2(struct ndr_push *ndr, int flags, const struct samr_QueryDisplayInfo2 *r)
+{
+       if (flags & NDR_IN) {
+               if (r->in.domain_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle));
+               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->in.level));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.start_idx));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.max_entries));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.buf_size));
+       }
+       if (flags & NDR_OUT) {
+               if (r->out.total_size == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.total_size));
+               if (r->out.returned_size == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.returned_size));
+               if (r->out.info == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_set_switch_value(ndr, r->out.info, r->in.level));
+               NDR_CHECK(ndr_push_samr_DispInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info));
+               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_QueryDisplayInfo2(struct ndr_pull *ndr, int flags, struct samr_QueryDisplayInfo2 *r)
+{
+       TALLOC_CTX *_mem_save_domain_handle_0;
+       TALLOC_CTX *_mem_save_total_size_0;
+       TALLOC_CTX *_mem_save_returned_size_0;
+       TALLOC_CTX *_mem_save_info_0;
+       if (flags & NDR_IN) {
+               ZERO_STRUCT(r->out);
+
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.domain_handle);
+               }
+               _mem_save_domain_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.domain_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->in.level));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.start_idx));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.max_entries));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.buf_size));
+               NDR_PULL_ALLOC(ndr, r->out.total_size);
+               ZERO_STRUCTP(r->out.total_size);
+               NDR_PULL_ALLOC(ndr, r->out.returned_size);
+               ZERO_STRUCTP(r->out.returned_size);
+               NDR_PULL_ALLOC(ndr, r->out.info);
+               ZERO_STRUCTP(r->out.info);
+       }
+       if (flags & NDR_OUT) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.total_size);
+               }
+               _mem_save_total_size_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.total_size, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.total_size));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_total_size_0, LIBNDR_FLAG_REF_ALLOC);
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.returned_size);
+               }
+               _mem_save_returned_size_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.returned_size, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.returned_size));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_returned_size_0, LIBNDR_FLAG_REF_ALLOC);
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.info);
+               }
+               _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.info, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_set_switch_value(ndr, r->out.info, r->in.level));
+               NDR_CHECK(ndr_pull_samr_DispInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_QueryDisplayInfo2(struct ndr_print *ndr, const char *name, int flags, const struct samr_QueryDisplayInfo2 *r)
+{
+       ndr_print_struct(ndr, name, "samr_QueryDisplayInfo2");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "samr_QueryDisplayInfo2");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "domain_handle", r->in.domain_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "domain_handle", r->in.domain_handle);
+               ndr->depth--;
+               ndr_print_uint16(ndr, "level", r->in.level);
+               ndr_print_uint32(ndr, "start_idx", r->in.start_idx);
+               ndr_print_uint32(ndr, "max_entries", r->in.max_entries);
+               ndr_print_uint32(ndr, "buf_size", r->in.buf_size);
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "samr_QueryDisplayInfo2");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "total_size", r->out.total_size);
+               ndr->depth++;
+               ndr_print_uint32(ndr, "total_size", *r->out.total_size);
+               ndr->depth--;
+               ndr_print_ptr(ndr, "returned_size", r->out.returned_size);
+               ndr->depth++;
+               ndr_print_uint32(ndr, "returned_size", *r->out.returned_size);
+               ndr->depth--;
+               ndr_print_ptr(ndr, "info", r->out.info);
+               ndr->depth++;
+               ndr_print_set_switch_value(ndr, r->out.info, r->in.level);
+               ndr_print_samr_DispInfo(ndr, "info", r->out.info);
+               ndr->depth--;
+               ndr_print_NTSTATUS(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_GetDisplayEnumerationIndex2(struct ndr_push *ndr, int flags, const struct samr_GetDisplayEnumerationIndex2 *r)
+{
+       if (flags & NDR_IN) {
+               if (r->in.domain_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle));
+               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->in.level));
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.name));
+       }
+       if (flags & NDR_OUT) {
+               if (r->out.idx == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.idx));
+               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_GetDisplayEnumerationIndex2(struct ndr_pull *ndr, int flags, struct samr_GetDisplayEnumerationIndex2 *r)
+{
+       TALLOC_CTX *_mem_save_domain_handle_0;
+       TALLOC_CTX *_mem_save_idx_0;
+       if (flags & NDR_IN) {
+               ZERO_STRUCT(r->out);
+
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.domain_handle);
+               }
+               _mem_save_domain_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.domain_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->in.level));
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.name));
+               NDR_PULL_ALLOC(ndr, r->out.idx);
+               ZERO_STRUCTP(r->out.idx);
+       }
+       if (flags & NDR_OUT) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.idx);
+               }
+               _mem_save_idx_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.idx, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.idx));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_idx_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_GetDisplayEnumerationIndex2(struct ndr_print *ndr, const char *name, int flags, const struct samr_GetDisplayEnumerationIndex2 *r)
+{
+       ndr_print_struct(ndr, name, "samr_GetDisplayEnumerationIndex2");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "samr_GetDisplayEnumerationIndex2");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "domain_handle", r->in.domain_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "domain_handle", r->in.domain_handle);
+               ndr->depth--;
+               ndr_print_uint16(ndr, "level", r->in.level);
+               ndr_print_lsa_String(ndr, "name", &r->in.name);
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "samr_GetDisplayEnumerationIndex2");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "idx", r->out.idx);
+               ndr->depth++;
+               ndr_print_uint32(ndr, "idx", *r->out.idx);
+               ndr->depth--;
+               ndr_print_NTSTATUS(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_CreateUser2(struct ndr_push *ndr, int flags, const struct samr_CreateUser2 *r)
+{
+       if (flags & NDR_IN) {
+               if (r->in.domain_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle));
+               if (r->in.account_name == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.account_name));
+               NDR_CHECK(ndr_push_samr_AcctFlags(ndr, NDR_SCALARS, r->in.acct_flags));
+               NDR_CHECK(ndr_push_samr_UserAccessMask(ndr, NDR_SCALARS, r->in.access_mask));
+       }
+       if (flags & NDR_OUT) {
+               if (r->out.user_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.user_handle));
+               if (r->out.access_granted == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.access_granted));
+               if (r->out.rid == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.rid));
+               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_CreateUser2(struct ndr_pull *ndr, int flags, struct samr_CreateUser2 *r)
+{
+       TALLOC_CTX *_mem_save_domain_handle_0;
+       TALLOC_CTX *_mem_save_account_name_0;
+       TALLOC_CTX *_mem_save_user_handle_0;
+       TALLOC_CTX *_mem_save_access_granted_0;
+       TALLOC_CTX *_mem_save_rid_0;
+       if (flags & NDR_IN) {
+               ZERO_STRUCT(r->out);
+
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.domain_handle);
+               }
+               _mem_save_domain_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.domain_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.account_name);
+               }
+               _mem_save_account_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.account_name, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.account_name));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_account_name_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_samr_AcctFlags(ndr, NDR_SCALARS, &r->in.acct_flags));
+               NDR_CHECK(ndr_pull_samr_UserAccessMask(ndr, NDR_SCALARS, &r->in.access_mask));
+               NDR_PULL_ALLOC(ndr, r->out.user_handle);
+               ZERO_STRUCTP(r->out.user_handle);
+               NDR_PULL_ALLOC(ndr, r->out.access_granted);
+               ZERO_STRUCTP(r->out.access_granted);
+               NDR_PULL_ALLOC(ndr, r->out.rid);
+               ZERO_STRUCTP(r->out.rid);
+       }
+       if (flags & NDR_OUT) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.user_handle);
+               }
+               _mem_save_user_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.user_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->out.user_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_user_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.access_granted);
+               }
+               _mem_save_access_granted_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.access_granted, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.access_granted));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_access_granted_0, LIBNDR_FLAG_REF_ALLOC);
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.rid);
+               }
+               _mem_save_rid_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.rid, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.rid));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_rid_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_CreateUser2(struct ndr_print *ndr, const char *name, int flags, const struct samr_CreateUser2 *r)
+{
+       ndr_print_struct(ndr, name, "samr_CreateUser2");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "samr_CreateUser2");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "domain_handle", r->in.domain_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "domain_handle", r->in.domain_handle);
+               ndr->depth--;
+               ndr_print_ptr(ndr, "account_name", r->in.account_name);
+               ndr->depth++;
+               ndr_print_lsa_String(ndr, "account_name", r->in.account_name);
+               ndr->depth--;
+               ndr_print_samr_AcctFlags(ndr, "acct_flags", r->in.acct_flags);
+               ndr_print_samr_UserAccessMask(ndr, "access_mask", r->in.access_mask);
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "samr_CreateUser2");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "user_handle", r->out.user_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "user_handle", r->out.user_handle);
+               ndr->depth--;
+               ndr_print_ptr(ndr, "access_granted", r->out.access_granted);
+               ndr->depth++;
+               ndr_print_uint32(ndr, "access_granted", *r->out.access_granted);
+               ndr->depth--;
+               ndr_print_ptr(ndr, "rid", r->out.rid);
+               ndr->depth++;
+               ndr_print_uint32(ndr, "rid", *r->out.rid);
+               ndr->depth--;
+               ndr_print_NTSTATUS(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_QueryDisplayInfo3(struct ndr_push *ndr, int flags, const struct samr_QueryDisplayInfo3 *r)
+{
+       if (flags & NDR_IN) {
+               if (r->in.domain_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle));
+               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->in.level));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.start_idx));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.max_entries));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.buf_size));
+       }
+       if (flags & NDR_OUT) {
+               if (r->out.total_size == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.total_size));
+               if (r->out.returned_size == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.returned_size));
+               if (r->out.info == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_set_switch_value(ndr, r->out.info, r->in.level));
+               NDR_CHECK(ndr_push_samr_DispInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info));
+               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_QueryDisplayInfo3(struct ndr_pull *ndr, int flags, struct samr_QueryDisplayInfo3 *r)
+{
+       TALLOC_CTX *_mem_save_domain_handle_0;
+       TALLOC_CTX *_mem_save_total_size_0;
+       TALLOC_CTX *_mem_save_returned_size_0;
+       TALLOC_CTX *_mem_save_info_0;
+       if (flags & NDR_IN) {
+               ZERO_STRUCT(r->out);
+
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.domain_handle);
+               }
+               _mem_save_domain_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.domain_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->in.level));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.start_idx));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.max_entries));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.buf_size));
+               NDR_PULL_ALLOC(ndr, r->out.total_size);
+               ZERO_STRUCTP(r->out.total_size);
+               NDR_PULL_ALLOC(ndr, r->out.returned_size);
+               ZERO_STRUCTP(r->out.returned_size);
+               NDR_PULL_ALLOC(ndr, r->out.info);
+               ZERO_STRUCTP(r->out.info);
+       }
+       if (flags & NDR_OUT) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.total_size);
+               }
+               _mem_save_total_size_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.total_size, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.total_size));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_total_size_0, LIBNDR_FLAG_REF_ALLOC);
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.returned_size);
+               }
+               _mem_save_returned_size_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.returned_size, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.returned_size));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_returned_size_0, LIBNDR_FLAG_REF_ALLOC);
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.info);
+               }
+               _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.info, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_set_switch_value(ndr, r->out.info, r->in.level));
+               NDR_CHECK(ndr_pull_samr_DispInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_QueryDisplayInfo3(struct ndr_print *ndr, const char *name, int flags, const struct samr_QueryDisplayInfo3 *r)
+{
+       ndr_print_struct(ndr, name, "samr_QueryDisplayInfo3");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "samr_QueryDisplayInfo3");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "domain_handle", r->in.domain_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "domain_handle", r->in.domain_handle);
+               ndr->depth--;
+               ndr_print_uint16(ndr, "level", r->in.level);
+               ndr_print_uint32(ndr, "start_idx", r->in.start_idx);
+               ndr_print_uint32(ndr, "max_entries", r->in.max_entries);
+               ndr_print_uint32(ndr, "buf_size", r->in.buf_size);
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "samr_QueryDisplayInfo3");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "total_size", r->out.total_size);
+               ndr->depth++;
+               ndr_print_uint32(ndr, "total_size", *r->out.total_size);
+               ndr->depth--;
+               ndr_print_ptr(ndr, "returned_size", r->out.returned_size);
+               ndr->depth++;
+               ndr_print_uint32(ndr, "returned_size", *r->out.returned_size);
+               ndr->depth--;
+               ndr_print_ptr(ndr, "info", r->out.info);
+               ndr->depth++;
+               ndr_print_set_switch_value(ndr, r->out.info, r->in.level);
+               ndr_print_samr_DispInfo(ndr, "info", r->out.info);
+               ndr->depth--;
+               ndr_print_NTSTATUS(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_AddMultipleMembersToAlias(struct ndr_push *ndr, int flags, const struct samr_AddMultipleMembersToAlias *r)
+{
+       if (flags & NDR_IN) {
+               if (r->in.alias_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.alias_handle));
+               if (r->in.sids == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_lsa_SidArray(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.sids));
+       }
+       if (flags & NDR_OUT) {
+               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_AddMultipleMembersToAlias(struct ndr_pull *ndr, int flags, struct samr_AddMultipleMembersToAlias *r)
+{
+       TALLOC_CTX *_mem_save_alias_handle_0;
+       TALLOC_CTX *_mem_save_sids_0;
+       if (flags & NDR_IN) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.alias_handle);
+               }
+               _mem_save_alias_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.alias_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.alias_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_alias_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.sids);
+               }
+               _mem_save_sids_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.sids, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_lsa_SidArray(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.sids));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sids_0, LIBNDR_FLAG_REF_ALLOC);
+       }
+       if (flags & NDR_OUT) {
+               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_AddMultipleMembersToAlias(struct ndr_print *ndr, const char *name, int flags, const struct samr_AddMultipleMembersToAlias *r)
+{
+       ndr_print_struct(ndr, name, "samr_AddMultipleMembersToAlias");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "samr_AddMultipleMembersToAlias");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "alias_handle", r->in.alias_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "alias_handle", r->in.alias_handle);
+               ndr->depth--;
+               ndr_print_ptr(ndr, "sids", r->in.sids);
+               ndr->depth++;
+               ndr_print_lsa_SidArray(ndr, "sids", r->in.sids);
+               ndr->depth--;
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "samr_AddMultipleMembersToAlias");
+               ndr->depth++;
+               ndr_print_NTSTATUS(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_RemoveMultipleMembersFromAlias(struct ndr_push *ndr, int flags, const struct samr_RemoveMultipleMembersFromAlias *r)
+{
+       if (flags & NDR_IN) {
+               if (r->in.alias_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.alias_handle));
+               if (r->in.sids == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_lsa_SidArray(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.sids));
+       }
+       if (flags & NDR_OUT) {
+               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_RemoveMultipleMembersFromAlias(struct ndr_pull *ndr, int flags, struct samr_RemoveMultipleMembersFromAlias *r)
+{
+       TALLOC_CTX *_mem_save_alias_handle_0;
+       TALLOC_CTX *_mem_save_sids_0;
+       if (flags & NDR_IN) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.alias_handle);
+               }
+               _mem_save_alias_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.alias_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.alias_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_alias_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.sids);
+               }
+               _mem_save_sids_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.sids, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_lsa_SidArray(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.sids));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sids_0, LIBNDR_FLAG_REF_ALLOC);
+       }
+       if (flags & NDR_OUT) {
+               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_RemoveMultipleMembersFromAlias(struct ndr_print *ndr, const char *name, int flags, const struct samr_RemoveMultipleMembersFromAlias *r)
+{
+       ndr_print_struct(ndr, name, "samr_RemoveMultipleMembersFromAlias");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "samr_RemoveMultipleMembersFromAlias");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "alias_handle", r->in.alias_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "alias_handle", r->in.alias_handle);
+               ndr->depth--;
+               ndr_print_ptr(ndr, "sids", r->in.sids);
+               ndr->depth++;
+               ndr_print_lsa_SidArray(ndr, "sids", r->in.sids);
+               ndr->depth--;
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "samr_RemoveMultipleMembersFromAlias");
+               ndr->depth++;
+               ndr_print_NTSTATUS(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_OemChangePasswordUser2(struct ndr_push *ndr, int flags, const struct samr_OemChangePasswordUser2 *r)
+{
+       if (flags & NDR_IN) {
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.server));
+               if (r->in.server) {
+                       NDR_CHECK(ndr_push_lsa_AsciiString(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.server));
+               }
+               if (r->in.account == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_lsa_AsciiString(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.account));
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.password));
+               if (r->in.password) {
+                       NDR_CHECK(ndr_push_samr_CryptPassword(ndr, NDR_SCALARS, r->in.password));
+               }
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.hash));
+               if (r->in.hash) {
+                       NDR_CHECK(ndr_push_samr_Password(ndr, NDR_SCALARS, r->in.hash));
+               }
+       }
+       if (flags & NDR_OUT) {
+               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_OemChangePasswordUser2(struct ndr_pull *ndr, int flags, struct samr_OemChangePasswordUser2 *r)
+{
+       uint32_t _ptr_server;
+       uint32_t _ptr_password;
+       uint32_t _ptr_hash;
+       TALLOC_CTX *_mem_save_server_0;
+       TALLOC_CTX *_mem_save_account_0;
+       TALLOC_CTX *_mem_save_password_0;
+       TALLOC_CTX *_mem_save_hash_0;
+       if (flags & NDR_IN) {
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_server));
+               if (_ptr_server) {
+                       NDR_PULL_ALLOC(ndr, r->in.server);
+               } else {
+                       r->in.server = NULL;
+               }
+               if (r->in.server) {
+                       _mem_save_server_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->in.server, 0);
+                       NDR_CHECK(ndr_pull_lsa_AsciiString(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.server));
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_server_0, 0);
+               }
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.account);
+               }
+               _mem_save_account_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.account, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_lsa_AsciiString(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.account));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_account_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_password));
+               if (_ptr_password) {
+                       NDR_PULL_ALLOC(ndr, r->in.password);
+               } else {
+                       r->in.password = NULL;
+               }
+               if (r->in.password) {
+                       _mem_save_password_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->in.password, 0);
+                       NDR_CHECK(ndr_pull_samr_CryptPassword(ndr, NDR_SCALARS, r->in.password));
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_password_0, 0);
+               }
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_hash));
+               if (_ptr_hash) {
+                       NDR_PULL_ALLOC(ndr, r->in.hash);
+               } else {
+                       r->in.hash = NULL;
+               }
+               if (r->in.hash) {
+                       _mem_save_hash_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->in.hash, 0);
+                       NDR_CHECK(ndr_pull_samr_Password(ndr, NDR_SCALARS, r->in.hash));
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_hash_0, 0);
+               }
+       }
+       if (flags & NDR_OUT) {
+               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_OemChangePasswordUser2(struct ndr_print *ndr, const char *name, int flags, const struct samr_OemChangePasswordUser2 *r)
+{
+       ndr_print_struct(ndr, name, "samr_OemChangePasswordUser2");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "samr_OemChangePasswordUser2");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "server", r->in.server);
+               ndr->depth++;
+               if (r->in.server) {
+                       ndr_print_lsa_AsciiString(ndr, "server", r->in.server);
+               }
+               ndr->depth--;
+               ndr_print_ptr(ndr, "account", r->in.account);
+               ndr->depth++;
+               ndr_print_lsa_AsciiString(ndr, "account", r->in.account);
+               ndr->depth--;
+               ndr_print_ptr(ndr, "password", r->in.password);
+               ndr->depth++;
+               if (r->in.password) {
+                       ndr_print_samr_CryptPassword(ndr, "password", r->in.password);
+               }
+               ndr->depth--;
+               ndr_print_ptr(ndr, "hash", r->in.hash);
+               ndr->depth++;
+               if (r->in.hash) {
+                       ndr_print_samr_Password(ndr, "hash", r->in.hash);
+               }
+               ndr->depth--;
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "samr_OemChangePasswordUser2");
+               ndr->depth++;
+               ndr_print_NTSTATUS(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_ChangePasswordUser2(struct ndr_push *ndr, int flags, const struct samr_ChangePasswordUser2 *r)
+{
+       if (flags & NDR_IN) {
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.server));
+               if (r->in.server) {
+                       NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.server));
+               }
+               if (r->in.account == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.account));
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.nt_password));
+               if (r->in.nt_password) {
+                       NDR_CHECK(ndr_push_samr_CryptPassword(ndr, NDR_SCALARS, r->in.nt_password));
+               }
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.nt_verifier));
+               if (r->in.nt_verifier) {
+                       NDR_CHECK(ndr_push_samr_Password(ndr, NDR_SCALARS, r->in.nt_verifier));
+               }
+               NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->in.lm_change));
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.lm_password));
+               if (r->in.lm_password) {
+                       NDR_CHECK(ndr_push_samr_CryptPassword(ndr, NDR_SCALARS, r->in.lm_password));
+               }
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.lm_verifier));
+               if (r->in.lm_verifier) {
+                       NDR_CHECK(ndr_push_samr_Password(ndr, NDR_SCALARS, r->in.lm_verifier));
+               }
+       }
+       if (flags & NDR_OUT) {
+               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_ChangePasswordUser2(struct ndr_pull *ndr, int flags, struct samr_ChangePasswordUser2 *r)
+{
+       uint32_t _ptr_server;
+       uint32_t _ptr_nt_password;
+       uint32_t _ptr_nt_verifier;
+       uint32_t _ptr_lm_password;
+       uint32_t _ptr_lm_verifier;
+       TALLOC_CTX *_mem_save_server_0;
+       TALLOC_CTX *_mem_save_account_0;
+       TALLOC_CTX *_mem_save_nt_password_0;
+       TALLOC_CTX *_mem_save_nt_verifier_0;
+       TALLOC_CTX *_mem_save_lm_password_0;
+       TALLOC_CTX *_mem_save_lm_verifier_0;
+       if (flags & NDR_IN) {
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_server));
+               if (_ptr_server) {
+                       NDR_PULL_ALLOC(ndr, r->in.server);
+               } else {
+                       r->in.server = NULL;
+               }
+               if (r->in.server) {
+                       _mem_save_server_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->in.server, 0);
+                       NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.server));
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_server_0, 0);
+               }
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.account);
+               }
+               _mem_save_account_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.account, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.account));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_account_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_nt_password));
+               if (_ptr_nt_password) {
+                       NDR_PULL_ALLOC(ndr, r->in.nt_password);
+               } else {
+                       r->in.nt_password = NULL;
+               }
+               if (r->in.nt_password) {
+                       _mem_save_nt_password_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->in.nt_password, 0);
+                       NDR_CHECK(ndr_pull_samr_CryptPassword(ndr, NDR_SCALARS, r->in.nt_password));
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_nt_password_0, 0);
+               }
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_nt_verifier));
+               if (_ptr_nt_verifier) {
+                       NDR_PULL_ALLOC(ndr, r->in.nt_verifier);
+               } else {
+                       r->in.nt_verifier = NULL;
+               }
+               if (r->in.nt_verifier) {
+                       _mem_save_nt_verifier_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->in.nt_verifier, 0);
+                       NDR_CHECK(ndr_pull_samr_Password(ndr, NDR_SCALARS, r->in.nt_verifier));
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_nt_verifier_0, 0);
+               }
+               NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->in.lm_change));
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_lm_password));
+               if (_ptr_lm_password) {
+                       NDR_PULL_ALLOC(ndr, r->in.lm_password);
+               } else {
+                       r->in.lm_password = NULL;
+               }
+               if (r->in.lm_password) {
+                       _mem_save_lm_password_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->in.lm_password, 0);
+                       NDR_CHECK(ndr_pull_samr_CryptPassword(ndr, NDR_SCALARS, r->in.lm_password));
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_lm_password_0, 0);
+               }
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_lm_verifier));
+               if (_ptr_lm_verifier) {
+                       NDR_PULL_ALLOC(ndr, r->in.lm_verifier);
+               } else {
+                       r->in.lm_verifier = NULL;
+               }
+               if (r->in.lm_verifier) {
+                       _mem_save_lm_verifier_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->in.lm_verifier, 0);
+                       NDR_CHECK(ndr_pull_samr_Password(ndr, NDR_SCALARS, r->in.lm_verifier));
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_lm_verifier_0, 0);
+               }
+       }
+       if (flags & NDR_OUT) {
+               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_ChangePasswordUser2(struct ndr_print *ndr, const char *name, int flags, const struct samr_ChangePasswordUser2 *r)
+{
+       ndr_print_struct(ndr, name, "samr_ChangePasswordUser2");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "samr_ChangePasswordUser2");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "server", r->in.server);
+               ndr->depth++;
+               if (r->in.server) {
+                       ndr_print_lsa_String(ndr, "server", r->in.server);
+               }
+               ndr->depth--;
+               ndr_print_ptr(ndr, "account", r->in.account);
+               ndr->depth++;
+               ndr_print_lsa_String(ndr, "account", r->in.account);
+               ndr->depth--;
+               ndr_print_ptr(ndr, "nt_password", r->in.nt_password);
+               ndr->depth++;
+               if (r->in.nt_password) {
+                       ndr_print_samr_CryptPassword(ndr, "nt_password", r->in.nt_password);
+               }
+               ndr->depth--;
+               ndr_print_ptr(ndr, "nt_verifier", r->in.nt_verifier);
+               ndr->depth++;
+               if (r->in.nt_verifier) {
+                       ndr_print_samr_Password(ndr, "nt_verifier", r->in.nt_verifier);
+               }
+               ndr->depth--;
+               ndr_print_uint8(ndr, "lm_change", r->in.lm_change);
+               ndr_print_ptr(ndr, "lm_password", r->in.lm_password);
+               ndr->depth++;
+               if (r->in.lm_password) {
+                       ndr_print_samr_CryptPassword(ndr, "lm_password", r->in.lm_password);
+               }
+               ndr->depth--;
+               ndr_print_ptr(ndr, "lm_verifier", r->in.lm_verifier);
+               ndr->depth++;
+               if (r->in.lm_verifier) {
+                       ndr_print_samr_Password(ndr, "lm_verifier", r->in.lm_verifier);
+               }
+               ndr->depth--;
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "samr_ChangePasswordUser2");
+               ndr->depth++;
+               ndr_print_NTSTATUS(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_GetDomPwInfo(struct ndr_push *ndr, int flags, const struct samr_GetDomPwInfo *r)
+{
+       if (flags & NDR_IN) {
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.domain_name));
+               if (r->in.domain_name) {
+                       NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.domain_name));
+               }
+       }
+       if (flags & NDR_OUT) {
+               if (r->out.info == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_samr_PwInfo(ndr, NDR_SCALARS, r->out.info));
+               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_GetDomPwInfo(struct ndr_pull *ndr, int flags, struct samr_GetDomPwInfo *r)
+{
+       uint32_t _ptr_domain_name;
+       TALLOC_CTX *_mem_save_domain_name_0;
+       TALLOC_CTX *_mem_save_info_0;
+       if (flags & NDR_IN) {
+               ZERO_STRUCT(r->out);
+
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_domain_name));
+               if (_ptr_domain_name) {
+                       NDR_PULL_ALLOC(ndr, r->in.domain_name);
+               } else {
+                       r->in.domain_name = NULL;
+               }
+               if (r->in.domain_name) {
+                       _mem_save_domain_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->in.domain_name, 0);
+                       NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.domain_name));
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_name_0, 0);
+               }
+               NDR_PULL_ALLOC(ndr, r->out.info);
+               ZERO_STRUCTP(r->out.info);
+       }
+       if (flags & NDR_OUT) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.info);
+               }
+               _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.info, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_samr_PwInfo(ndr, NDR_SCALARS, r->out.info));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_GetDomPwInfo(struct ndr_print *ndr, const char *name, int flags, const struct samr_GetDomPwInfo *r)
+{
+       ndr_print_struct(ndr, name, "samr_GetDomPwInfo");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "samr_GetDomPwInfo");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "domain_name", r->in.domain_name);
+               ndr->depth++;
+               if (r->in.domain_name) {
+                       ndr_print_lsa_String(ndr, "domain_name", r->in.domain_name);
+               }
+               ndr->depth--;
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "samr_GetDomPwInfo");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "info", r->out.info);
+               ndr->depth++;
+               ndr_print_samr_PwInfo(ndr, "info", r->out.info);
+               ndr->depth--;
+               ndr_print_NTSTATUS(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_Connect2(struct ndr_push *ndr, int flags, const struct samr_Connect2 *r)
+{
+       if (flags & NDR_IN) {
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.system_name));
+               if (r->in.system_name) {
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.system_name, CH_UTF16)));
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.system_name, CH_UTF16)));
+                       NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.system_name, ndr_charset_length(r->in.system_name, CH_UTF16), sizeof(uint16_t), CH_UTF16));
+               }
+               NDR_CHECK(ndr_push_samr_ConnectAccessMask(ndr, NDR_SCALARS, r->in.access_mask));
+       }
+       if (flags & NDR_OUT) {
+               if (r->out.connect_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.connect_handle));
+               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_Connect2(struct ndr_pull *ndr, int flags, struct samr_Connect2 *r)
+{
+       uint32_t _ptr_system_name;
+       TALLOC_CTX *_mem_save_system_name_0;
+       TALLOC_CTX *_mem_save_connect_handle_0;
+       if (flags & NDR_IN) {
+               ZERO_STRUCT(r->out);
+
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_system_name));
+               if (_ptr_system_name) {
+                       NDR_PULL_ALLOC(ndr, r->in.system_name);
+               } else {
+                       r->in.system_name = NULL;
+               }
+               if (r->in.system_name) {
+                       _mem_save_system_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->in.system_name, 0);
+                       NDR_CHECK(ndr_pull_array_size(ndr, &r->in.system_name));
+                       NDR_CHECK(ndr_pull_array_length(ndr, &r->in.system_name));
+                       if (ndr_get_array_length(ndr, &r->in.system_name) > ndr_get_array_size(ndr, &r->in.system_name)) {
+                               return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.system_name), ndr_get_array_length(ndr, &r->in.system_name));
+                       }
+                       NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.system_name), sizeof(uint16_t)));
+                       NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.system_name, ndr_get_array_length(ndr, &r->in.system_name), sizeof(uint16_t), CH_UTF16));
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_system_name_0, 0);
+               }
+               NDR_CHECK(ndr_pull_samr_ConnectAccessMask(ndr, NDR_SCALARS, &r->in.access_mask));
+               NDR_PULL_ALLOC(ndr, r->out.connect_handle);
+               ZERO_STRUCTP(r->out.connect_handle);
+       }
+       if (flags & NDR_OUT) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.connect_handle);
+               }
+               _mem_save_connect_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.connect_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->out.connect_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_connect_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_Connect2(struct ndr_print *ndr, const char *name, int flags, const struct samr_Connect2 *r)
+{
+       ndr_print_struct(ndr, name, "samr_Connect2");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "samr_Connect2");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "system_name", r->in.system_name);
+               ndr->depth++;
+               if (r->in.system_name) {
+                       ndr_print_string(ndr, "system_name", r->in.system_name);
+               }
+               ndr->depth--;
+               ndr_print_samr_ConnectAccessMask(ndr, "access_mask", r->in.access_mask);
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "samr_Connect2");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "connect_handle", r->out.connect_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "connect_handle", r->out.connect_handle);
+               ndr->depth--;
+               ndr_print_NTSTATUS(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_samr_SetUserInfo2(struct ndr_push *ndr, int flags, const struct samr_SetUserInfo2 *r)
+{
+       if (flags & NDR_IN) {
+               if (r->in.user_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.user_handle));
+               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->in.level));
+               if (r->in.info == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_set_switch_value(ndr, r->in.info, r->in.level));
+               NDR_CHECK(ndr_push_samr_UserInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.info));
+       }
+       if (flags & NDR_OUT) {
+               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_samr_SetUserInfo2(struct ndr_pull *ndr, int flags, struct samr_SetUserInfo2 *r)
+{
+       TALLOC_CTX *_mem_save_user_handle_0;
+       TALLOC_CTX *_mem_save_info_0;
+       if (flags & NDR_IN) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.user_handle);
+               }
+               _mem_save_user_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.user_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.user_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_user_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->in.level));
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.info);
+               }
+               _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.info, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_set_switch_value(ndr, r->in.info, r->in.level));
+               NDR_CHECK(ndr_pull_samr_UserInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.info));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, LIBNDR_FLAG_REF_ALLOC);
+       }
+       if (flags & NDR_OUT) {
+               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_SetUserInfo2(struct ndr_print *ndr, const char *name, int flags, const struct samr_SetUserInfo2 *r)
+{
+       ndr_print_struct(ndr, name, "samr_SetUserInfo2");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "samr_SetUserInfo2");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "user_handle", r->in.user_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "user_handle", r->in.user_handle);
+               ndr->depth--;
+               ndr_print_uint16(ndr, "level", r->in.level);
+               ndr_print_ptr(ndr, "info", r->in.info);
+               ndr->depth++;
+               ndr_print_set_switch_value(ndr, r->in.info, r->in.level);
+               ndr_print_samr_UserInfo(ndr, "info", r->in.info);
+               ndr->depth--;
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "samr_SetUserInfo2");
+               ndr->depth++;
+               ndr_print_NTSTATUS(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_SetBootKeyInformation(struct ndr_push *ndr, int flags, const struct samr_SetBootKeyInformation *r)
+{
+       if (flags & NDR_IN) {
+               if (r->in.connect_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.connect_handle));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.unknown1));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.unknown2));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.unknown3));
+       }
+       if (flags & NDR_OUT) {
+               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_SetBootKeyInformation(struct ndr_pull *ndr, int flags, struct samr_SetBootKeyInformation *r)
+{
+       TALLOC_CTX *_mem_save_connect_handle_0;
+       if (flags & NDR_IN) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.connect_handle);
+               }
+               _mem_save_connect_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.connect_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.connect_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_connect_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.unknown1));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.unknown2));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.unknown3));
+       }
+       if (flags & NDR_OUT) {
+               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_SetBootKeyInformation(struct ndr_print *ndr, const char *name, int flags, const struct samr_SetBootKeyInformation *r)
+{
+       ndr_print_struct(ndr, name, "samr_SetBootKeyInformation");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "samr_SetBootKeyInformation");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "connect_handle", r->in.connect_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "connect_handle", r->in.connect_handle);
+               ndr->depth--;
+               ndr_print_uint32(ndr, "unknown1", r->in.unknown1);
+               ndr_print_uint32(ndr, "unknown2", r->in.unknown2);
+               ndr_print_uint32(ndr, "unknown3", r->in.unknown3);
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "samr_SetBootKeyInformation");
+               ndr->depth++;
+               ndr_print_NTSTATUS(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_GetBootKeyInformation(struct ndr_push *ndr, int flags, const struct samr_GetBootKeyInformation *r)
+{
+       if (flags & NDR_IN) {
+               if (r->in.domain_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle));
+       }
+       if (flags & NDR_OUT) {
+               if (r->out.unknown == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.unknown));
+               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_GetBootKeyInformation(struct ndr_pull *ndr, int flags, struct samr_GetBootKeyInformation *r)
+{
+       TALLOC_CTX *_mem_save_domain_handle_0;
+       TALLOC_CTX *_mem_save_unknown_0;
+       if (flags & NDR_IN) {
+               ZERO_STRUCT(r->out);
+
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.domain_handle);
+               }
+               _mem_save_domain_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.domain_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_PULL_ALLOC(ndr, r->out.unknown);
+               ZERO_STRUCTP(r->out.unknown);
+       }
+       if (flags & NDR_OUT) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.unknown);
+               }
+               _mem_save_unknown_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.unknown, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.unknown));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_unknown_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_GetBootKeyInformation(struct ndr_print *ndr, const char *name, int flags, const struct samr_GetBootKeyInformation *r)
+{
+       ndr_print_struct(ndr, name, "samr_GetBootKeyInformation");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "samr_GetBootKeyInformation");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "domain_handle", r->in.domain_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "domain_handle", r->in.domain_handle);
+               ndr->depth--;
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "samr_GetBootKeyInformation");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "unknown", r->out.unknown);
+               ndr->depth++;
+               ndr_print_uint32(ndr, "unknown", *r->out.unknown);
+               ndr->depth--;
+               ndr_print_NTSTATUS(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_Connect3(struct ndr_push *ndr, int flags, const struct samr_Connect3 *r)
+{
+       if (flags & NDR_IN) {
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.system_name));
+               if (r->in.system_name) {
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.system_name, CH_UTF16)));
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.system_name, CH_UTF16)));
+                       NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.system_name, ndr_charset_length(r->in.system_name, CH_UTF16), sizeof(uint16_t), CH_UTF16));
+               }
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.unknown));
+               NDR_CHECK(ndr_push_samr_ConnectAccessMask(ndr, NDR_SCALARS, r->in.access_mask));
+       }
+       if (flags & NDR_OUT) {
+               if (r->out.connect_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.connect_handle));
+               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_Connect3(struct ndr_pull *ndr, int flags, struct samr_Connect3 *r)
+{
+       uint32_t _ptr_system_name;
+       TALLOC_CTX *_mem_save_system_name_0;
+       TALLOC_CTX *_mem_save_connect_handle_0;
+       if (flags & NDR_IN) {
+               ZERO_STRUCT(r->out);
+
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_system_name));
+               if (_ptr_system_name) {
+                       NDR_PULL_ALLOC(ndr, r->in.system_name);
+               } else {
+                       r->in.system_name = NULL;
+               }
+               if (r->in.system_name) {
+                       _mem_save_system_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->in.system_name, 0);
+                       NDR_CHECK(ndr_pull_array_size(ndr, &r->in.system_name));
+                       NDR_CHECK(ndr_pull_array_length(ndr, &r->in.system_name));
+                       if (ndr_get_array_length(ndr, &r->in.system_name) > ndr_get_array_size(ndr, &r->in.system_name)) {
+                               return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.system_name), ndr_get_array_length(ndr, &r->in.system_name));
+                       }
+                       NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.system_name), sizeof(uint16_t)));
+                       NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.system_name, ndr_get_array_length(ndr, &r->in.system_name), sizeof(uint16_t), CH_UTF16));
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_system_name_0, 0);
+               }
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.unknown));
+               NDR_CHECK(ndr_pull_samr_ConnectAccessMask(ndr, NDR_SCALARS, &r->in.access_mask));
+               NDR_PULL_ALLOC(ndr, r->out.connect_handle);
+               ZERO_STRUCTP(r->out.connect_handle);
+       }
+       if (flags & NDR_OUT) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.connect_handle);
+               }
+               _mem_save_connect_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.connect_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->out.connect_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_connect_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_Connect3(struct ndr_print *ndr, const char *name, int flags, const struct samr_Connect3 *r)
+{
+       ndr_print_struct(ndr, name, "samr_Connect3");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "samr_Connect3");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "system_name", r->in.system_name);
+               ndr->depth++;
+               if (r->in.system_name) {
+                       ndr_print_string(ndr, "system_name", r->in.system_name);
+               }
+               ndr->depth--;
+               ndr_print_uint32(ndr, "unknown", r->in.unknown);
+               ndr_print_samr_ConnectAccessMask(ndr, "access_mask", r->in.access_mask);
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "samr_Connect3");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "connect_handle", r->out.connect_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "connect_handle", r->out.connect_handle);
+               ndr->depth--;
+               ndr_print_NTSTATUS(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_Connect4(struct ndr_push *ndr, int flags, const struct samr_Connect4 *r)
+{
+       if (flags & NDR_IN) {
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.system_name));
+               if (r->in.system_name) {
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.system_name, CH_UTF16)));
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.system_name, CH_UTF16)));
+                       NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.system_name, ndr_charset_length(r->in.system_name, CH_UTF16), sizeof(uint16_t), CH_UTF16));
+               }
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.unknown));
+               NDR_CHECK(ndr_push_samr_ConnectAccessMask(ndr, NDR_SCALARS, r->in.access_mask));
+       }
+       if (flags & NDR_OUT) {
+               if (r->out.connect_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.connect_handle));
+               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_Connect4(struct ndr_pull *ndr, int flags, struct samr_Connect4 *r)
+{
+       uint32_t _ptr_system_name;
+       TALLOC_CTX *_mem_save_system_name_0;
+       TALLOC_CTX *_mem_save_connect_handle_0;
+       if (flags & NDR_IN) {
+               ZERO_STRUCT(r->out);
+
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_system_name));
+               if (_ptr_system_name) {
+                       NDR_PULL_ALLOC(ndr, r->in.system_name);
+               } else {
+                       r->in.system_name = NULL;
+               }
+               if (r->in.system_name) {
+                       _mem_save_system_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->in.system_name, 0);
+                       NDR_CHECK(ndr_pull_array_size(ndr, &r->in.system_name));
+                       NDR_CHECK(ndr_pull_array_length(ndr, &r->in.system_name));
+                       if (ndr_get_array_length(ndr, &r->in.system_name) > ndr_get_array_size(ndr, &r->in.system_name)) {
+                               return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.system_name), ndr_get_array_length(ndr, &r->in.system_name));
+                       }
+                       NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.system_name), sizeof(uint16_t)));
+                       NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.system_name, ndr_get_array_length(ndr, &r->in.system_name), sizeof(uint16_t), CH_UTF16));
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_system_name_0, 0);
+               }
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.unknown));
+               NDR_CHECK(ndr_pull_samr_ConnectAccessMask(ndr, NDR_SCALARS, &r->in.access_mask));
+               NDR_PULL_ALLOC(ndr, r->out.connect_handle);
+               ZERO_STRUCTP(r->out.connect_handle);
+       }
+       if (flags & NDR_OUT) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.connect_handle);
+               }
+               _mem_save_connect_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.connect_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->out.connect_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_connect_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_Connect4(struct ndr_print *ndr, const char *name, int flags, const struct samr_Connect4 *r)
+{
+       ndr_print_struct(ndr, name, "samr_Connect4");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "samr_Connect4");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "system_name", r->in.system_name);
+               ndr->depth++;
+               if (r->in.system_name) {
+                       ndr_print_string(ndr, "system_name", r->in.system_name);
+               }
+               ndr->depth--;
+               ndr_print_uint32(ndr, "unknown", r->in.unknown);
+               ndr_print_samr_ConnectAccessMask(ndr, "access_mask", r->in.access_mask);
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "samr_Connect4");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "connect_handle", r->out.connect_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "connect_handle", r->out.connect_handle);
+               ndr->depth--;
+               ndr_print_NTSTATUS(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_ChangePasswordUser3(struct ndr_push *ndr, int flags, const struct samr_ChangePasswordUser3 *r)
+{
+       if (flags & NDR_IN) {
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.server));
+               if (r->in.server) {
+                       NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.server));
+               }
+               if (r->in.account == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.account));
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.nt_password));
+               if (r->in.nt_password) {
+                       NDR_CHECK(ndr_push_samr_CryptPassword(ndr, NDR_SCALARS, r->in.nt_password));
+               }
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.nt_verifier));
+               if (r->in.nt_verifier) {
+                       NDR_CHECK(ndr_push_samr_Password(ndr, NDR_SCALARS, r->in.nt_verifier));
+               }
+               NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->in.lm_change));
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.lm_password));
+               if (r->in.lm_password) {
+                       NDR_CHECK(ndr_push_samr_CryptPassword(ndr, NDR_SCALARS, r->in.lm_password));
+               }
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.lm_verifier));
+               if (r->in.lm_verifier) {
+                       NDR_CHECK(ndr_push_samr_Password(ndr, NDR_SCALARS, r->in.lm_verifier));
+               }
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.password3));
+               if (r->in.password3) {
+                       NDR_CHECK(ndr_push_samr_CryptPassword(ndr, NDR_SCALARS, r->in.password3));
+               }
+       }
+       if (flags & NDR_OUT) {
+               if (r->out.dominfo == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_samr_DomInfo1(ndr, NDR_SCALARS, r->out.dominfo));
+               if (r->out.reject == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_samr_ChangeReject(ndr, NDR_SCALARS, r->out.reject));
+               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_ChangePasswordUser3(struct ndr_pull *ndr, int flags, struct samr_ChangePasswordUser3 *r)
+{
+       uint32_t _ptr_server;
+       uint32_t _ptr_nt_password;
+       uint32_t _ptr_nt_verifier;
+       uint32_t _ptr_lm_password;
+       uint32_t _ptr_lm_verifier;
+       uint32_t _ptr_password3;
+       TALLOC_CTX *_mem_save_server_0;
+       TALLOC_CTX *_mem_save_account_0;
+       TALLOC_CTX *_mem_save_nt_password_0;
+       TALLOC_CTX *_mem_save_nt_verifier_0;
+       TALLOC_CTX *_mem_save_lm_password_0;
+       TALLOC_CTX *_mem_save_lm_verifier_0;
+       TALLOC_CTX *_mem_save_password3_0;
+       TALLOC_CTX *_mem_save_dominfo_0;
+       TALLOC_CTX *_mem_save_reject_0;
+       if (flags & NDR_IN) {
+               ZERO_STRUCT(r->out);
+
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_server));
+               if (_ptr_server) {
+                       NDR_PULL_ALLOC(ndr, r->in.server);
+               } else {
+                       r->in.server = NULL;
+               }
+               if (r->in.server) {
+                       _mem_save_server_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->in.server, 0);
+                       NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.server));
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_server_0, 0);
+               }
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.account);
+               }
+               _mem_save_account_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.account, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.account));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_account_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_nt_password));
+               if (_ptr_nt_password) {
+                       NDR_PULL_ALLOC(ndr, r->in.nt_password);
+               } else {
+                       r->in.nt_password = NULL;
+               }
+               if (r->in.nt_password) {
+                       _mem_save_nt_password_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->in.nt_password, 0);
+                       NDR_CHECK(ndr_pull_samr_CryptPassword(ndr, NDR_SCALARS, r->in.nt_password));
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_nt_password_0, 0);
+               }
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_nt_verifier));
+               if (_ptr_nt_verifier) {
+                       NDR_PULL_ALLOC(ndr, r->in.nt_verifier);
+               } else {
+                       r->in.nt_verifier = NULL;
+               }
+               if (r->in.nt_verifier) {
+                       _mem_save_nt_verifier_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->in.nt_verifier, 0);
+                       NDR_CHECK(ndr_pull_samr_Password(ndr, NDR_SCALARS, r->in.nt_verifier));
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_nt_verifier_0, 0);
+               }
+               NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->in.lm_change));
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_lm_password));
+               if (_ptr_lm_password) {
+                       NDR_PULL_ALLOC(ndr, r->in.lm_password);
+               } else {
+                       r->in.lm_password = NULL;
+               }
+               if (r->in.lm_password) {
+                       _mem_save_lm_password_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->in.lm_password, 0);
+                       NDR_CHECK(ndr_pull_samr_CryptPassword(ndr, NDR_SCALARS, r->in.lm_password));
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_lm_password_0, 0);
+               }
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_lm_verifier));
+               if (_ptr_lm_verifier) {
+                       NDR_PULL_ALLOC(ndr, r->in.lm_verifier);
+               } else {
+                       r->in.lm_verifier = NULL;
+               }
+               if (r->in.lm_verifier) {
+                       _mem_save_lm_verifier_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->in.lm_verifier, 0);
+                       NDR_CHECK(ndr_pull_samr_Password(ndr, NDR_SCALARS, r->in.lm_verifier));
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_lm_verifier_0, 0);
+               }
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_password3));
+               if (_ptr_password3) {
+                       NDR_PULL_ALLOC(ndr, r->in.password3);
+               } else {
+                       r->in.password3 = NULL;
+               }
+               if (r->in.password3) {
+                       _mem_save_password3_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->in.password3, 0);
+                       NDR_CHECK(ndr_pull_samr_CryptPassword(ndr, NDR_SCALARS, r->in.password3));
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_password3_0, 0);
+               }
+               NDR_PULL_ALLOC(ndr, r->out.dominfo);
+               ZERO_STRUCTP(r->out.dominfo);
+               NDR_PULL_ALLOC(ndr, r->out.reject);
+               ZERO_STRUCTP(r->out.reject);
+       }
+       if (flags & NDR_OUT) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.dominfo);
+               }
+               _mem_save_dominfo_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.dominfo, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_samr_DomInfo1(ndr, NDR_SCALARS, r->out.dominfo));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_dominfo_0, LIBNDR_FLAG_REF_ALLOC);
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.reject);
+               }
+               _mem_save_reject_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.reject, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_samr_ChangeReject(ndr, NDR_SCALARS, r->out.reject));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_reject_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_ChangePasswordUser3(struct ndr_print *ndr, const char *name, int flags, const struct samr_ChangePasswordUser3 *r)
+{
+       ndr_print_struct(ndr, name, "samr_ChangePasswordUser3");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "samr_ChangePasswordUser3");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "server", r->in.server);
+               ndr->depth++;
+               if (r->in.server) {
+                       ndr_print_lsa_String(ndr, "server", r->in.server);
+               }
+               ndr->depth--;
+               ndr_print_ptr(ndr, "account", r->in.account);
+               ndr->depth++;
+               ndr_print_lsa_String(ndr, "account", r->in.account);
+               ndr->depth--;
+               ndr_print_ptr(ndr, "nt_password", r->in.nt_password);
+               ndr->depth++;
+               if (r->in.nt_password) {
+                       ndr_print_samr_CryptPassword(ndr, "nt_password", r->in.nt_password);
+               }
+               ndr->depth--;
+               ndr_print_ptr(ndr, "nt_verifier", r->in.nt_verifier);
+               ndr->depth++;
+               if (r->in.nt_verifier) {
+                       ndr_print_samr_Password(ndr, "nt_verifier", r->in.nt_verifier);
+               }
+               ndr->depth--;
+               ndr_print_uint8(ndr, "lm_change", r->in.lm_change);
+               ndr_print_ptr(ndr, "lm_password", r->in.lm_password);
+               ndr->depth++;
+               if (r->in.lm_password) {
+                       ndr_print_samr_CryptPassword(ndr, "lm_password", r->in.lm_password);
+               }
+               ndr->depth--;
+               ndr_print_ptr(ndr, "lm_verifier", r->in.lm_verifier);
+               ndr->depth++;
+               if (r->in.lm_verifier) {
+                       ndr_print_samr_Password(ndr, "lm_verifier", r->in.lm_verifier);
+               }
+               ndr->depth--;
+               ndr_print_ptr(ndr, "password3", r->in.password3);
+               ndr->depth++;
+               if (r->in.password3) {
+                       ndr_print_samr_CryptPassword(ndr, "password3", r->in.password3);
+               }
+               ndr->depth--;
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "samr_ChangePasswordUser3");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "dominfo", r->out.dominfo);
+               ndr->depth++;
+               ndr_print_samr_DomInfo1(ndr, "dominfo", r->out.dominfo);
+               ndr->depth--;
+               ndr_print_ptr(ndr, "reject", r->out.reject);
+               ndr->depth++;
+               ndr_print_samr_ChangeReject(ndr, "reject", r->out.reject);
+               ndr->depth--;
+               ndr_print_NTSTATUS(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_samr_Connect5(struct ndr_push *ndr, int flags, const struct samr_Connect5 *r)
+{
+       if (flags & NDR_IN) {
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.system_name));
+               if (r->in.system_name) {
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.system_name, CH_UTF16)));
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.system_name, CH_UTF16)));
+                       NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.system_name, ndr_charset_length(r->in.system_name, CH_UTF16), sizeof(uint16_t), CH_UTF16));
+               }
+               NDR_CHECK(ndr_push_samr_ConnectAccessMask(ndr, NDR_SCALARS, r->in.access_mask));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.level_in));
+               if (r->in.info_in == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_set_switch_value(ndr, r->in.info_in, r->in.level_in));
+               NDR_CHECK(ndr_push_samr_ConnectInfo(ndr, NDR_SCALARS, r->in.info_in));
+       }
+       if (flags & NDR_OUT) {
+               if (r->out.level_out == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.level_out));
+               if (r->out.info_out == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_set_switch_value(ndr, r->out.info_out, *r->out.level_out));
+               NDR_CHECK(ndr_push_samr_ConnectInfo(ndr, NDR_SCALARS, r->out.info_out));
+               if (r->out.connect_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.connect_handle));
+               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_samr_Connect5(struct ndr_pull *ndr, int flags, struct samr_Connect5 *r)
+{
+       uint32_t _ptr_system_name;
+       TALLOC_CTX *_mem_save_system_name_0;
+       TALLOC_CTX *_mem_save_info_in_0;
+       TALLOC_CTX *_mem_save_level_out_0;
+       TALLOC_CTX *_mem_save_info_out_0;
+       TALLOC_CTX *_mem_save_connect_handle_0;
+       if (flags & NDR_IN) {
+               ZERO_STRUCT(r->out);
+
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_system_name));
+               if (_ptr_system_name) {
+                       NDR_PULL_ALLOC(ndr, r->in.system_name);
+               } else {
+                       r->in.system_name = NULL;
+               }
+               if (r->in.system_name) {
+                       _mem_save_system_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->in.system_name, 0);
+                       NDR_CHECK(ndr_pull_array_size(ndr, &r->in.system_name));
+                       NDR_CHECK(ndr_pull_array_length(ndr, &r->in.system_name));
+                       if (ndr_get_array_length(ndr, &r->in.system_name) > ndr_get_array_size(ndr, &r->in.system_name)) {
+                               return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.system_name), ndr_get_array_length(ndr, &r->in.system_name));
+                       }
+                       NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.system_name), sizeof(uint16_t)));
+                       NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.system_name, ndr_get_array_length(ndr, &r->in.system_name), sizeof(uint16_t), CH_UTF16));
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_system_name_0, 0);
+               }
+               NDR_CHECK(ndr_pull_samr_ConnectAccessMask(ndr, NDR_SCALARS, &r->in.access_mask));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.level_in));
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.info_in);
+               }
+               _mem_save_info_in_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.info_in, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_set_switch_value(ndr, r->in.info_in, r->in.level_in));
+               NDR_CHECK(ndr_pull_samr_ConnectInfo(ndr, NDR_SCALARS, r->in.info_in));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_in_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_PULL_ALLOC(ndr, r->out.level_out);
+               ZERO_STRUCTP(r->out.level_out);
+               NDR_PULL_ALLOC(ndr, r->out.info_out);
+               ZERO_STRUCTP(r->out.info_out);
+               NDR_PULL_ALLOC(ndr, r->out.connect_handle);
+               ZERO_STRUCTP(r->out.connect_handle);
+       }
+       if (flags & NDR_OUT) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.level_out);
+               }
+               _mem_save_level_out_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.level_out, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.level_out));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_level_out_0, LIBNDR_FLAG_REF_ALLOC);
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.info_out);
+               }
+               _mem_save_info_out_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.info_out, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_set_switch_value(ndr, r->out.info_out, *r->out.level_out));
+               NDR_CHECK(ndr_pull_samr_ConnectInfo(ndr, NDR_SCALARS, r->out.info_out));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_out_0, LIBNDR_FLAG_REF_ALLOC);
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.connect_handle);
+               }
+               _mem_save_connect_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.connect_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->out.connect_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_connect_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_Connect5(struct ndr_print *ndr, const char *name, int flags, const struct samr_Connect5 *r)
+{
+       ndr_print_struct(ndr, name, "samr_Connect5");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "samr_Connect5");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "system_name", r->in.system_name);
+               ndr->depth++;
+               if (r->in.system_name) {
+                       ndr_print_string(ndr, "system_name", r->in.system_name);
+               }
+               ndr->depth--;
+               ndr_print_samr_ConnectAccessMask(ndr, "access_mask", r->in.access_mask);
+               ndr_print_uint32(ndr, "level_in", r->in.level_in);
+               ndr_print_ptr(ndr, "info_in", r->in.info_in);
+               ndr->depth++;
+               ndr_print_set_switch_value(ndr, r->in.info_in, r->in.level_in);
+               ndr_print_samr_ConnectInfo(ndr, "info_in", r->in.info_in);
+               ndr->depth--;
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "samr_Connect5");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "level_out", r->out.level_out);
+               ndr->depth++;
+               ndr_print_uint32(ndr, "level_out", *r->out.level_out);
+               ndr->depth--;
+               ndr_print_ptr(ndr, "info_out", r->out.info_out);
+               ndr->depth++;
+               ndr_print_set_switch_value(ndr, r->out.info_out, *r->out.level_out);
+               ndr_print_samr_ConnectInfo(ndr, "info_out", r->out.info_out);
+               ndr->depth--;
+               ndr_print_ptr(ndr, "connect_handle", r->out.connect_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "connect_handle", r->out.connect_handle);
+               ndr->depth--;
+               ndr_print_NTSTATUS(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_RidToSid(struct ndr_push *ndr, int flags, const struct samr_RidToSid *r)
+{
+       if (flags & NDR_IN) {
+               if (r->in.domain_handle == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.rid));
+       }
+       if (flags & NDR_OUT) {
+               if (r->out.sid == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_dom_sid2(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.sid));
+               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_RidToSid(struct ndr_pull *ndr, int flags, struct samr_RidToSid *r)
+{
+       TALLOC_CTX *_mem_save_domain_handle_0;
+       TALLOC_CTX *_mem_save_sid_0;
+       if (flags & NDR_IN) {
+               ZERO_STRUCT(r->out);
+
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->in.domain_handle);
+               }
+               _mem_save_domain_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->in.domain_handle, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_handle_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.rid));
+               NDR_PULL_ALLOC(ndr, r->out.sid);
+               ZERO_STRUCTP(r->out.sid);
+       }
+       if (flags & NDR_OUT) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.sid);
+               }
+               _mem_save_sid_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.sid, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_dom_sid2(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.sid));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sid_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_RidToSid(struct ndr_print *ndr, const char *name, int flags, const struct samr_RidToSid *r)
+{
+       ndr_print_struct(ndr, name, "samr_RidToSid");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "samr_RidToSid");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "domain_handle", r->in.domain_handle);
+               ndr->depth++;
+               ndr_print_policy_handle(ndr, "domain_handle", r->in.domain_handle);
+               ndr->depth--;
+               ndr_print_uint32(ndr, "rid", r->in.rid);
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "samr_RidToSid");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "sid", r->out.sid);
+               ndr->depth++;
+               ndr_print_dom_sid2(ndr, "sid", r->out.sid);
+               ndr->depth--;
+               ndr_print_NTSTATUS(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_SetDsrmPassword(struct ndr_push *ndr, int flags, const struct samr_SetDsrmPassword *r)
+{
+       if (flags & NDR_IN) {
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.name));
+               if (r->in.name) {
+                       NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.name));
+               }
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.unknown));
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.hash));
+               if (r->in.hash) {
+                       NDR_CHECK(ndr_push_samr_Password(ndr, NDR_SCALARS, r->in.hash));
+               }
+       }
+       if (flags & NDR_OUT) {
+               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_SetDsrmPassword(struct ndr_pull *ndr, int flags, struct samr_SetDsrmPassword *r)
+{
+       uint32_t _ptr_name;
+       uint32_t _ptr_hash;
+       TALLOC_CTX *_mem_save_name_0;
+       TALLOC_CTX *_mem_save_hash_0;
+       if (flags & NDR_IN) {
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_name));
+               if (_ptr_name) {
+                       NDR_PULL_ALLOC(ndr, r->in.name);
+               } else {
+                       r->in.name = NULL;
+               }
+               if (r->in.name) {
+                       _mem_save_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->in.name, 0);
+                       NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.name));
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_name_0, 0);
+               }
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.unknown));
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_hash));
+               if (_ptr_hash) {
+                       NDR_PULL_ALLOC(ndr, r->in.hash);
+               } else {
+                       r->in.hash = NULL;
+               }
+               if (r->in.hash) {
+                       _mem_save_hash_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->in.hash, 0);
+                       NDR_CHECK(ndr_pull_samr_Password(ndr, NDR_SCALARS, r->in.hash));
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_hash_0, 0);
+               }
+       }
+       if (flags & NDR_OUT) {
+               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_SetDsrmPassword(struct ndr_print *ndr, const char *name, int flags, const struct samr_SetDsrmPassword *r)
+{
+       ndr_print_struct(ndr, name, "samr_SetDsrmPassword");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "samr_SetDsrmPassword");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "name", r->in.name);
+               ndr->depth++;
+               if (r->in.name) {
+                       ndr_print_lsa_String(ndr, "name", r->in.name);
+               }
+               ndr->depth--;
+               ndr_print_uint32(ndr, "unknown", r->in.unknown);
+               ndr_print_ptr(ndr, "hash", r->in.hash);
+               ndr->depth++;
+               if (r->in.hash) {
+                       ndr_print_samr_Password(ndr, "hash", r->in.hash);
+               }
+               ndr->depth--;
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "samr_SetDsrmPassword");
+               ndr->depth++;
+               ndr_print_NTSTATUS(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_samr_ValidatePassword(struct ndr_push *ndr, int flags, const struct samr_ValidatePassword *r)
+{
+       if (flags & NDR_IN) {
+               NDR_CHECK(ndr_push_samr_ValidatePasswordLevel(ndr, NDR_SCALARS, r->in.level));
+               NDR_CHECK(ndr_push_set_switch_value(ndr, &r->in.req, r->in.level));
+               NDR_CHECK(ndr_push_samr_ValidatePasswordReq(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.req));
+       }
+       if (flags & NDR_OUT) {
+               if (r->out.rep == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_set_switch_value(ndr, r->out.rep, r->in.level));
+               NDR_CHECK(ndr_push_samr_ValidatePasswordRep(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.rep));
+               NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_samr_ValidatePassword(struct ndr_pull *ndr, int flags, struct samr_ValidatePassword *r)
+{
+       TALLOC_CTX *_mem_save_rep_0;
+       if (flags & NDR_IN) {
+               ZERO_STRUCT(r->out);
+
+               NDR_CHECK(ndr_pull_samr_ValidatePasswordLevel(ndr, NDR_SCALARS, &r->in.level));
+               NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->in.req, r->in.level));
+               NDR_CHECK(ndr_pull_samr_ValidatePasswordReq(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.req));
+               NDR_PULL_ALLOC(ndr, r->out.rep);
+               ZERO_STRUCTP(r->out.rep);
+       }
+       if (flags & NDR_OUT) {
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.rep);
+               }
+               _mem_save_rep_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.rep, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_set_switch_value(ndr, r->out.rep, r->in.level));
+               NDR_CHECK(ndr_pull_samr_ValidatePasswordRep(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.rep));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_rep_0, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_samr_ValidatePassword(struct ndr_print *ndr, const char *name, int flags, const struct samr_ValidatePassword *r)
+{
+       ndr_print_struct(ndr, name, "samr_ValidatePassword");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "samr_ValidatePassword");
+               ndr->depth++;
+               ndr_print_samr_ValidatePasswordLevel(ndr, "level", r->in.level);
+               ndr_print_set_switch_value(ndr, &r->in.req, r->in.level);
+               ndr_print_samr_ValidatePasswordReq(ndr, "req", &r->in.req);
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "samr_ValidatePassword");
+               ndr->depth++;
+               ndr_print_ptr(ndr, "rep", r->out.rep);
+               ndr->depth++;
+               ndr_print_set_switch_value(ndr, r->out.rep, r->in.level);
+               ndr_print_samr_ValidatePasswordRep(ndr, "rep", r->out.rep);
+               ndr->depth--;
+               ndr_print_NTSTATUS(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+static const struct ndr_interface_call samr_calls[] = {
+       {
+               "samr_Connect",
+               sizeof(struct samr_Connect),
+               (ndr_push_flags_fn_t) ndr_push_samr_Connect,
+               (ndr_pull_flags_fn_t) ndr_pull_samr_Connect,
+               (ndr_print_function_t) ndr_print_samr_Connect,
+               false,
+       },
+       {
+               "samr_Close",
+               sizeof(struct samr_Close),
+               (ndr_push_flags_fn_t) ndr_push_samr_Close,
+               (ndr_pull_flags_fn_t) ndr_pull_samr_Close,
+               (ndr_print_function_t) ndr_print_samr_Close,
+               false,
+       },
+       {
+               "samr_SetSecurity",
+               sizeof(struct samr_SetSecurity),
+               (ndr_push_flags_fn_t) ndr_push_samr_SetSecurity,
+               (ndr_pull_flags_fn_t) ndr_pull_samr_SetSecurity,
+               (ndr_print_function_t) ndr_print_samr_SetSecurity,
+               false,
+       },
+       {
+               "samr_QuerySecurity",
+               sizeof(struct samr_QuerySecurity),
+               (ndr_push_flags_fn_t) ndr_push_samr_QuerySecurity,
+               (ndr_pull_flags_fn_t) ndr_pull_samr_QuerySecurity,
+               (ndr_print_function_t) ndr_print_samr_QuerySecurity,
+               false,
+       },
+       {
+               "samr_Shutdown",
+               sizeof(struct samr_Shutdown),
+               (ndr_push_flags_fn_t) ndr_push_samr_Shutdown,
+               (ndr_pull_flags_fn_t) ndr_pull_samr_Shutdown,
+               (ndr_print_function_t) ndr_print_samr_Shutdown,
+               false,
+       },
+       {
+               "samr_LookupDomain",
+               sizeof(struct samr_LookupDomain),
+               (ndr_push_flags_fn_t) ndr_push_samr_LookupDomain,
+               (ndr_pull_flags_fn_t) ndr_pull_samr_LookupDomain,
+               (ndr_print_function_t) ndr_print_samr_LookupDomain,
+               false,
+       },
+       {
+               "samr_EnumDomains",
+               sizeof(struct samr_EnumDomains),
+               (ndr_push_flags_fn_t) ndr_push_samr_EnumDomains,
+               (ndr_pull_flags_fn_t) ndr_pull_samr_EnumDomains,
+               (ndr_print_function_t) ndr_print_samr_EnumDomains,
+               false,
+       },
+       {
+               "samr_OpenDomain",
+               sizeof(struct samr_OpenDomain),
+               (ndr_push_flags_fn_t) ndr_push_samr_OpenDomain,
+               (ndr_pull_flags_fn_t) ndr_pull_samr_OpenDomain,
+               (ndr_print_function_t) ndr_print_samr_OpenDomain,
+               false,
+       },
+       {
+               "samr_QueryDomainInfo",
+               sizeof(struct samr_QueryDomainInfo),
+               (ndr_push_flags_fn_t) ndr_push_samr_QueryDomainInfo,
+               (ndr_pull_flags_fn_t) ndr_pull_samr_QueryDomainInfo,
+               (ndr_print_function_t) ndr_print_samr_QueryDomainInfo,
+               false,
+       },
+       {
+               "samr_SetDomainInfo",
+               sizeof(struct samr_SetDomainInfo),
+               (ndr_push_flags_fn_t) ndr_push_samr_SetDomainInfo,
+               (ndr_pull_flags_fn_t) ndr_pull_samr_SetDomainInfo,
+               (ndr_print_function_t) ndr_print_samr_SetDomainInfo,
+               false,
+       },
+       {
+               "samr_CreateDomainGroup",
+               sizeof(struct samr_CreateDomainGroup),
+               (ndr_push_flags_fn_t) ndr_push_samr_CreateDomainGroup,
+               (ndr_pull_flags_fn_t) ndr_pull_samr_CreateDomainGroup,
+               (ndr_print_function_t) ndr_print_samr_CreateDomainGroup,
+               false,
+       },
+       {
+               "samr_EnumDomainGroups",
+               sizeof(struct samr_EnumDomainGroups),
+               (ndr_push_flags_fn_t) ndr_push_samr_EnumDomainGroups,
+               (ndr_pull_flags_fn_t) ndr_pull_samr_EnumDomainGroups,
+               (ndr_print_function_t) ndr_print_samr_EnumDomainGroups,
+               false,
+       },
+       {
+               "samr_CreateUser",
+               sizeof(struct samr_CreateUser),
+               (ndr_push_flags_fn_t) ndr_push_samr_CreateUser,
+               (ndr_pull_flags_fn_t) ndr_pull_samr_CreateUser,
+               (ndr_print_function_t) ndr_print_samr_CreateUser,
+               false,
+       },
+       {
+               "samr_EnumDomainUsers",
+               sizeof(struct samr_EnumDomainUsers),
+               (ndr_push_flags_fn_t) ndr_push_samr_EnumDomainUsers,
+               (ndr_pull_flags_fn_t) ndr_pull_samr_EnumDomainUsers,
+               (ndr_print_function_t) ndr_print_samr_EnumDomainUsers,
+               false,
+       },
+       {
+               "samr_CreateDomAlias",
+               sizeof(struct samr_CreateDomAlias),
+               (ndr_push_flags_fn_t) ndr_push_samr_CreateDomAlias,
+               (ndr_pull_flags_fn_t) ndr_pull_samr_CreateDomAlias,
+               (ndr_print_function_t) ndr_print_samr_CreateDomAlias,
+               false,
+       },
+       {
+               "samr_EnumDomainAliases",
+               sizeof(struct samr_EnumDomainAliases),
+               (ndr_push_flags_fn_t) ndr_push_samr_EnumDomainAliases,
+               (ndr_pull_flags_fn_t) ndr_pull_samr_EnumDomainAliases,
+               (ndr_print_function_t) ndr_print_samr_EnumDomainAliases,
+               false,
+       },
+       {
+               "samr_GetAliasMembership",
+               sizeof(struct samr_GetAliasMembership),
+               (ndr_push_flags_fn_t) ndr_push_samr_GetAliasMembership,
+               (ndr_pull_flags_fn_t) ndr_pull_samr_GetAliasMembership,
+               (ndr_print_function_t) ndr_print_samr_GetAliasMembership,
+               false,
+       },
+       {
+               "samr_LookupNames",
+               sizeof(struct samr_LookupNames),
+               (ndr_push_flags_fn_t) ndr_push_samr_LookupNames,
+               (ndr_pull_flags_fn_t) ndr_pull_samr_LookupNames,
+               (ndr_print_function_t) ndr_print_samr_LookupNames,
+               false,
+       },
+       {
+               "samr_LookupRids",
+               sizeof(struct samr_LookupRids),
+               (ndr_push_flags_fn_t) ndr_push_samr_LookupRids,
+               (ndr_pull_flags_fn_t) ndr_pull_samr_LookupRids,
+               (ndr_print_function_t) ndr_print_samr_LookupRids,
+               false,
+       },
+       {
+               "samr_OpenGroup",
+               sizeof(struct samr_OpenGroup),
+               (ndr_push_flags_fn_t) ndr_push_samr_OpenGroup,
+               (ndr_pull_flags_fn_t) ndr_pull_samr_OpenGroup,
+               (ndr_print_function_t) ndr_print_samr_OpenGroup,
+               false,
+       },
+       {
+               "samr_QueryGroupInfo",
+               sizeof(struct samr_QueryGroupInfo),
+               (ndr_push_flags_fn_t) ndr_push_samr_QueryGroupInfo,
+               (ndr_pull_flags_fn_t) ndr_pull_samr_QueryGroupInfo,
+               (ndr_print_function_t) ndr_print_samr_QueryGroupInfo,
+               false,
+       },
+       {
+               "samr_SetGroupInfo",
+               sizeof(struct samr_SetGroupInfo),
+               (ndr_push_flags_fn_t) ndr_push_samr_SetGroupInfo,
+               (ndr_pull_flags_fn_t) ndr_pull_samr_SetGroupInfo,
+               (ndr_print_function_t) ndr_print_samr_SetGroupInfo,
+               false,
+       },
+       {
+               "samr_AddGroupMember",
+               sizeof(struct samr_AddGroupMember),
+               (ndr_push_flags_fn_t) ndr_push_samr_AddGroupMember,
+               (ndr_pull_flags_fn_t) ndr_pull_samr_AddGroupMember,
+               (ndr_print_function_t) ndr_print_samr_AddGroupMember,
+               false,
+       },
+       {
+               "samr_DeleteDomainGroup",
+               sizeof(struct samr_DeleteDomainGroup),
+               (ndr_push_flags_fn_t) ndr_push_samr_DeleteDomainGroup,
+               (ndr_pull_flags_fn_t) ndr_pull_samr_DeleteDomainGroup,
+               (ndr_print_function_t) ndr_print_samr_DeleteDomainGroup,
+               false,
+       },
+       {
+               "samr_DeleteGroupMember",
+               sizeof(struct samr_DeleteGroupMember),
+               (ndr_push_flags_fn_t) ndr_push_samr_DeleteGroupMember,
+               (ndr_pull_flags_fn_t) ndr_pull_samr_DeleteGroupMember,
+               (ndr_print_function_t) ndr_print_samr_DeleteGroupMember,
+               false,
+       },
+       {
+               "samr_QueryGroupMember",
+               sizeof(struct samr_QueryGroupMember),
+               (ndr_push_flags_fn_t) ndr_push_samr_QueryGroupMember,
+               (ndr_pull_flags_fn_t) ndr_pull_samr_QueryGroupMember,
+               (ndr_print_function_t) ndr_print_samr_QueryGroupMember,
+               false,
+       },
+       {
+               "samr_SetMemberAttributesOfGroup",
+               sizeof(struct samr_SetMemberAttributesOfGroup),
+               (ndr_push_flags_fn_t) ndr_push_samr_SetMemberAttributesOfGroup,
+               (ndr_pull_flags_fn_t) ndr_pull_samr_SetMemberAttributesOfGroup,
+               (ndr_print_function_t) ndr_print_samr_SetMemberAttributesOfGroup,
+               false,
+       },
+       {
+               "samr_OpenAlias",
+               sizeof(struct samr_OpenAlias),
+               (ndr_push_flags_fn_t) ndr_push_samr_OpenAlias,
+               (ndr_pull_flags_fn_t) ndr_pull_samr_OpenAlias,
+               (ndr_print_function_t) ndr_print_samr_OpenAlias,
+               false,
+       },
+       {
+               "samr_QueryAliasInfo",
+               sizeof(struct samr_QueryAliasInfo),
+               (ndr_push_flags_fn_t) ndr_push_samr_QueryAliasInfo,
+               (ndr_pull_flags_fn_t) ndr_pull_samr_QueryAliasInfo,
+               (ndr_print_function_t) ndr_print_samr_QueryAliasInfo,
+               false,
+       },
+       {
+               "samr_SetAliasInfo",
+               sizeof(struct samr_SetAliasInfo),
+               (ndr_push_flags_fn_t) ndr_push_samr_SetAliasInfo,
+               (ndr_pull_flags_fn_t) ndr_pull_samr_SetAliasInfo,
+               (ndr_print_function_t) ndr_print_samr_SetAliasInfo,
+               false,
+       },
+       {
+               "samr_DeleteDomAlias",
+               sizeof(struct samr_DeleteDomAlias),
+               (ndr_push_flags_fn_t) ndr_push_samr_DeleteDomAlias,
+               (ndr_pull_flags_fn_t) ndr_pull_samr_DeleteDomAlias,
+               (ndr_print_function_t) ndr_print_samr_DeleteDomAlias,
+               false,
+       },
+       {
+               "samr_AddAliasMember",
+               sizeof(struct samr_AddAliasMember),
+               (ndr_push_flags_fn_t) ndr_push_samr_AddAliasMember,
+               (ndr_pull_flags_fn_t) ndr_pull_samr_AddAliasMember,
+               (ndr_print_function_t) ndr_print_samr_AddAliasMember,
+               false,
+       },
+       {
+               "samr_DeleteAliasMember",
+               sizeof(struct samr_DeleteAliasMember),
+               (ndr_push_flags_fn_t) ndr_push_samr_DeleteAliasMember,
+               (ndr_pull_flags_fn_t) ndr_pull_samr_DeleteAliasMember,
+               (ndr_print_function_t) ndr_print_samr_DeleteAliasMember,
+               false,
+       },
+       {
+               "samr_GetMembersInAlias",
+               sizeof(struct samr_GetMembersInAlias),
+               (ndr_push_flags_fn_t) ndr_push_samr_GetMembersInAlias,
+               (ndr_pull_flags_fn_t) ndr_pull_samr_GetMembersInAlias,
+               (ndr_print_function_t) ndr_print_samr_GetMembersInAlias,
+               false,
+       },
+       {
+               "samr_OpenUser",
+               sizeof(struct samr_OpenUser),
+               (ndr_push_flags_fn_t) ndr_push_samr_OpenUser,
+               (ndr_pull_flags_fn_t) ndr_pull_samr_OpenUser,
+               (ndr_print_function_t) ndr_print_samr_OpenUser,
+               false,
+       },
+       {
+               "samr_DeleteUser",
+               sizeof(struct samr_DeleteUser),
+               (ndr_push_flags_fn_t) ndr_push_samr_DeleteUser,
+               (ndr_pull_flags_fn_t) ndr_pull_samr_DeleteUser,
+               (ndr_print_function_t) ndr_print_samr_DeleteUser,
+               false,
+       },
+       {
+               "samr_QueryUserInfo",
+               sizeof(struct samr_QueryUserInfo),
+               (ndr_push_flags_fn_t) ndr_push_samr_QueryUserInfo,
+               (ndr_pull_flags_fn_t) ndr_pull_samr_QueryUserInfo,
+               (ndr_print_function_t) ndr_print_samr_QueryUserInfo,
+               false,
+       },
+       {
+               "samr_SetUserInfo",
+               sizeof(struct samr_SetUserInfo),
+               (ndr_push_flags_fn_t) ndr_push_samr_SetUserInfo,
+               (ndr_pull_flags_fn_t) ndr_pull_samr_SetUserInfo,
+               (ndr_print_function_t) ndr_print_samr_SetUserInfo,
+               false,
+       },
+       {
+               "samr_ChangePasswordUser",
+               sizeof(struct samr_ChangePasswordUser),
+               (ndr_push_flags_fn_t) ndr_push_samr_ChangePasswordUser,
+               (ndr_pull_flags_fn_t) ndr_pull_samr_ChangePasswordUser,
+               (ndr_print_function_t) ndr_print_samr_ChangePasswordUser,
+               false,
+       },
+       {
+               "samr_GetGroupsForUser",
+               sizeof(struct samr_GetGroupsForUser),
+               (ndr_push_flags_fn_t) ndr_push_samr_GetGroupsForUser,
+               (ndr_pull_flags_fn_t) ndr_pull_samr_GetGroupsForUser,
+               (ndr_print_function_t) ndr_print_samr_GetGroupsForUser,
+               false,
+       },
+       {
+               "samr_QueryDisplayInfo",
+               sizeof(struct samr_QueryDisplayInfo),
+               (ndr_push_flags_fn_t) ndr_push_samr_QueryDisplayInfo,
+               (ndr_pull_flags_fn_t) ndr_pull_samr_QueryDisplayInfo,
+               (ndr_print_function_t) ndr_print_samr_QueryDisplayInfo,
+               false,
+       },
+       {
+               "samr_GetDisplayEnumerationIndex",
+               sizeof(struct samr_GetDisplayEnumerationIndex),
+               (ndr_push_flags_fn_t) ndr_push_samr_GetDisplayEnumerationIndex,
+               (ndr_pull_flags_fn_t) ndr_pull_samr_GetDisplayEnumerationIndex,
+               (ndr_print_function_t) ndr_print_samr_GetDisplayEnumerationIndex,
+               false,
+       },
+       {
+               "samr_TestPrivateFunctionsDomain",
+               sizeof(struct samr_TestPrivateFunctionsDomain),
+               (ndr_push_flags_fn_t) ndr_push_samr_TestPrivateFunctionsDomain,
+               (ndr_pull_flags_fn_t) ndr_pull_samr_TestPrivateFunctionsDomain,
+               (ndr_print_function_t) ndr_print_samr_TestPrivateFunctionsDomain,
+               false,
+       },
+       {
+               "samr_TestPrivateFunctionsUser",
+               sizeof(struct samr_TestPrivateFunctionsUser),
+               (ndr_push_flags_fn_t) ndr_push_samr_TestPrivateFunctionsUser,
+               (ndr_pull_flags_fn_t) ndr_pull_samr_TestPrivateFunctionsUser,
+               (ndr_print_function_t) ndr_print_samr_TestPrivateFunctionsUser,
+               false,
+       },
+       {
+               "samr_GetUserPwInfo",
+               sizeof(struct samr_GetUserPwInfo),
+               (ndr_push_flags_fn_t) ndr_push_samr_GetUserPwInfo,
+               (ndr_pull_flags_fn_t) ndr_pull_samr_GetUserPwInfo,
+               (ndr_print_function_t) ndr_print_samr_GetUserPwInfo,
+               false,
+       },
+       {
+               "samr_RemoveMemberFromForeignDomain",
+               sizeof(struct samr_RemoveMemberFromForeignDomain),
+               (ndr_push_flags_fn_t) ndr_push_samr_RemoveMemberFromForeignDomain,
+               (ndr_pull_flags_fn_t) ndr_pull_samr_RemoveMemberFromForeignDomain,
+               (ndr_print_function_t) ndr_print_samr_RemoveMemberFromForeignDomain,
+               false,
+       },
+       {
+               "samr_QueryDomainInfo2",
+               sizeof(struct samr_QueryDomainInfo2),
+               (ndr_push_flags_fn_t) ndr_push_samr_QueryDomainInfo2,
+               (ndr_pull_flags_fn_t) ndr_pull_samr_QueryDomainInfo2,
+               (ndr_print_function_t) ndr_print_samr_QueryDomainInfo2,
+               false,
+       },
+       {
+               "samr_QueryUserInfo2",
+               sizeof(struct samr_QueryUserInfo2),
+               (ndr_push_flags_fn_t) ndr_push_samr_QueryUserInfo2,
+               (ndr_pull_flags_fn_t) ndr_pull_samr_QueryUserInfo2,
+               (ndr_print_function_t) ndr_print_samr_QueryUserInfo2,
+               false,
+       },
+       {
+               "samr_QueryDisplayInfo2",
+               sizeof(struct samr_QueryDisplayInfo2),
+               (ndr_push_flags_fn_t) ndr_push_samr_QueryDisplayInfo2,
+               (ndr_pull_flags_fn_t) ndr_pull_samr_QueryDisplayInfo2,
+               (ndr_print_function_t) ndr_print_samr_QueryDisplayInfo2,
+               false,
+       },
+       {
+               "samr_GetDisplayEnumerationIndex2",
+               sizeof(struct samr_GetDisplayEnumerationIndex2),
+               (ndr_push_flags_fn_t) ndr_push_samr_GetDisplayEnumerationIndex2,
+               (ndr_pull_flags_fn_t) ndr_pull_samr_GetDisplayEnumerationIndex2,
+               (ndr_print_function_t) ndr_print_samr_GetDisplayEnumerationIndex2,
+               false,
+       },
+       {
+               "samr_CreateUser2",
+               sizeof(struct samr_CreateUser2),
+               (ndr_push_flags_fn_t) ndr_push_samr_CreateUser2,
+               (ndr_pull_flags_fn_t) ndr_pull_samr_CreateUser2,
+               (ndr_print_function_t) ndr_print_samr_CreateUser2,
+               false,
+       },
+       {
+               "samr_QueryDisplayInfo3",
+               sizeof(struct samr_QueryDisplayInfo3),
+               (ndr_push_flags_fn_t) ndr_push_samr_QueryDisplayInfo3,
+               (ndr_pull_flags_fn_t) ndr_pull_samr_QueryDisplayInfo3,
+               (ndr_print_function_t) ndr_print_samr_QueryDisplayInfo3,
+               false,
+       },
+       {
+               "samr_AddMultipleMembersToAlias",
+               sizeof(struct samr_AddMultipleMembersToAlias),
+               (ndr_push_flags_fn_t) ndr_push_samr_AddMultipleMembersToAlias,
+               (ndr_pull_flags_fn_t) ndr_pull_samr_AddMultipleMembersToAlias,
+               (ndr_print_function_t) ndr_print_samr_AddMultipleMembersToAlias,
+               false,
+       },
+       {
+               "samr_RemoveMultipleMembersFromAlias",
+               sizeof(struct samr_RemoveMultipleMembersFromAlias),
+               (ndr_push_flags_fn_t) ndr_push_samr_RemoveMultipleMembersFromAlias,
+               (ndr_pull_flags_fn_t) ndr_pull_samr_RemoveMultipleMembersFromAlias,
+               (ndr_print_function_t) ndr_print_samr_RemoveMultipleMembersFromAlias,
+               false,
+       },
+       {
+               "samr_OemChangePasswordUser2",
+               sizeof(struct samr_OemChangePasswordUser2),
+               (ndr_push_flags_fn_t) ndr_push_samr_OemChangePasswordUser2,
+               (ndr_pull_flags_fn_t) ndr_pull_samr_OemChangePasswordUser2,
+               (ndr_print_function_t) ndr_print_samr_OemChangePasswordUser2,
+               false,
+       },
+       {
+               "samr_ChangePasswordUser2",
+               sizeof(struct samr_ChangePasswordUser2),
+               (ndr_push_flags_fn_t) ndr_push_samr_ChangePasswordUser2,
+               (ndr_pull_flags_fn_t) ndr_pull_samr_ChangePasswordUser2,
+               (ndr_print_function_t) ndr_print_samr_ChangePasswordUser2,
+               false,
+       },
+       {
+               "samr_GetDomPwInfo",
+               sizeof(struct samr_GetDomPwInfo),
+               (ndr_push_flags_fn_t) ndr_push_samr_GetDomPwInfo,
+               (ndr_pull_flags_fn_t) ndr_pull_samr_GetDomPwInfo,
+               (ndr_print_function_t) ndr_print_samr_GetDomPwInfo,
+               false,
+       },
+       {
+               "samr_Connect2",
+               sizeof(struct samr_Connect2),
+               (ndr_push_flags_fn_t) ndr_push_samr_Connect2,
+               (ndr_pull_flags_fn_t) ndr_pull_samr_Connect2,
+               (ndr_print_function_t) ndr_print_samr_Connect2,
+               false,
+       },
+       {
+               "samr_SetUserInfo2",
+               sizeof(struct samr_SetUserInfo2),
+               (ndr_push_flags_fn_t) ndr_push_samr_SetUserInfo2,
+               (ndr_pull_flags_fn_t) ndr_pull_samr_SetUserInfo2,
+               (ndr_print_function_t) ndr_print_samr_SetUserInfo2,
+               false,
+       },
+       {
+               "samr_SetBootKeyInformation",
+               sizeof(struct samr_SetBootKeyInformation),
+               (ndr_push_flags_fn_t) ndr_push_samr_SetBootKeyInformation,
+               (ndr_pull_flags_fn_t) ndr_pull_samr_SetBootKeyInformation,
+               (ndr_print_function_t) ndr_print_samr_SetBootKeyInformation,
+               false,
+       },
+       {
+               "samr_GetBootKeyInformation",
+               sizeof(struct samr_GetBootKeyInformation),
+               (ndr_push_flags_fn_t) ndr_push_samr_GetBootKeyInformation,
+               (ndr_pull_flags_fn_t) ndr_pull_samr_GetBootKeyInformation,
+               (ndr_print_function_t) ndr_print_samr_GetBootKeyInformation,
+               false,
+       },
+       {
+               "samr_Connect3",
+               sizeof(struct samr_Connect3),
+               (ndr_push_flags_fn_t) ndr_push_samr_Connect3,
+               (ndr_pull_flags_fn_t) ndr_pull_samr_Connect3,
+               (ndr_print_function_t) ndr_print_samr_Connect3,
+               false,
+       },
+       {
+               "samr_Connect4",
+               sizeof(struct samr_Connect4),
+               (ndr_push_flags_fn_t) ndr_push_samr_Connect4,
+               (ndr_pull_flags_fn_t) ndr_pull_samr_Connect4,
+               (ndr_print_function_t) ndr_print_samr_Connect4,
+               false,
+       },
+       {
+               "samr_ChangePasswordUser3",
+               sizeof(struct samr_ChangePasswordUser3),
+               (ndr_push_flags_fn_t) ndr_push_samr_ChangePasswordUser3,
+               (ndr_pull_flags_fn_t) ndr_pull_samr_ChangePasswordUser3,
+               (ndr_print_function_t) ndr_print_samr_ChangePasswordUser3,
+               false,
+       },
+       {
+               "samr_Connect5",
+               sizeof(struct samr_Connect5),
+               (ndr_push_flags_fn_t) ndr_push_samr_Connect5,
+               (ndr_pull_flags_fn_t) ndr_pull_samr_Connect5,
+               (ndr_print_function_t) ndr_print_samr_Connect5,
+               false,
+       },
+       {
+               "samr_RidToSid",
+               sizeof(struct samr_RidToSid),
+               (ndr_push_flags_fn_t) ndr_push_samr_RidToSid,
+               (ndr_pull_flags_fn_t) ndr_pull_samr_RidToSid,
+               (ndr_print_function_t) ndr_print_samr_RidToSid,
+               false,
+       },
+       {
+               "samr_SetDsrmPassword",
+               sizeof(struct samr_SetDsrmPassword),
+               (ndr_push_flags_fn_t) ndr_push_samr_SetDsrmPassword,
+               (ndr_pull_flags_fn_t) ndr_pull_samr_SetDsrmPassword,
+               (ndr_print_function_t) ndr_print_samr_SetDsrmPassword,
+               false,
+       },
+       {
+               "samr_ValidatePassword",
+               sizeof(struct samr_ValidatePassword),
+               (ndr_push_flags_fn_t) ndr_push_samr_ValidatePassword,
+               (ndr_pull_flags_fn_t) ndr_pull_samr_ValidatePassword,
+               (ndr_print_function_t) ndr_print_samr_ValidatePassword,
+               false,
+       },
+       { NULL, 0, NULL, NULL, NULL, false }
+};
+
+static const char * const samr_endpoint_strings[] = {
+       "ncacn_np:[\\pipe\\samr]", 
+       "ncacn_ip_tcp:", 
+       "ncalrpc:", 
+};
+
+static const struct ndr_interface_string_array samr_endpoints = {
+       .count  = 3,
+       .names  = samr_endpoint_strings
+};
+
+static const char * const samr_authservice_strings[] = {
+       "host", 
+};
+
+static const struct ndr_interface_string_array samr_authservices = {
+       .count  = 3,
+       .names  = samr_authservice_strings
+};
+
+
+const struct ndr_interface_table ndr_table_samr = {
+       .name           = "samr",
+       .syntax_id      = {
+               {0x12345778,0x1234,0xabcd,{0xef,0x00},{0x01,0x23,0x45,0x67,0x89,0xac}},
+               NDR_SAMR_VERSION
+       },
+       .helpstring     = NDR_SAMR_HELPSTRING,
+       .num_calls      = 68,
+       .calls          = samr_calls,
+       .endpoints      = &samr_endpoints,
+       .authservices   = &samr_authservices
+};
+
diff --git a/source/librpc/gen_ndr/ndr_samr.h b/source/librpc/gen_ndr/ndr_samr.h
new file mode 100644 (file)
index 0000000..96fd59b
--- /dev/null
@@ -0,0 +1,340 @@
+/* header auto-generated by pidl */
+
+#include "librpc/ndr/libndr.h"
+#include "librpc/gen_ndr/samr.h"
+
+#ifndef _HEADER_NDR_samr
+#define _HEADER_NDR_samr
+
+#define NDR_SAMR_UUID "12345778-1234-abcd-ef00-0123456789ac"
+#define NDR_SAMR_VERSION 1.0
+#define NDR_SAMR_NAME "samr"
+#define NDR_SAMR_HELPSTRING NULL
+extern const struct ndr_interface_table ndr_table_samr;
+#define NDR_SAMR_CONNECT (0x00)
+
+#define NDR_SAMR_CLOSE (0x01)
+
+#define NDR_SAMR_SETSECURITY (0x02)
+
+#define NDR_SAMR_QUERYSECURITY (0x03)
+
+#define NDR_SAMR_SHUTDOWN (0x04)
+
+#define NDR_SAMR_LOOKUPDOMAIN (0x05)
+
+#define NDR_SAMR_ENUMDOMAINS (0x06)
+
+#define NDR_SAMR_OPENDOMAIN (0x07)
+
+#define NDR_SAMR_QUERYDOMAININFO (0x08)
+
+#define NDR_SAMR_SETDOMAININFO (0x09)
+
+#define NDR_SAMR_CREATEDOMAINGROUP (0x0a)
+
+#define NDR_SAMR_ENUMDOMAINGROUPS (0x0b)
+
+#define NDR_SAMR_CREATEUSER (0x0c)
+
+#define NDR_SAMR_ENUMDOMAINUSERS (0x0d)
+
+#define NDR_SAMR_CREATEDOMALIAS (0x0e)
+
+#define NDR_SAMR_ENUMDOMAINALIASES (0x0f)
+
+#define NDR_SAMR_GETALIASMEMBERSHIP (0x10)
+
+#define NDR_SAMR_LOOKUPNAMES (0x11)
+
+#define NDR_SAMR_LOOKUPRIDS (0x12)
+
+#define NDR_SAMR_OPENGROUP (0x13)
+
+#define NDR_SAMR_QUERYGROUPINFO (0x14)
+
+#define NDR_SAMR_SETGROUPINFO (0x15)
+
+#define NDR_SAMR_ADDGROUPMEMBER (0x16)
+
+#define NDR_SAMR_DELETEDOMAINGROUP (0x17)
+
+#define NDR_SAMR_DELETEGROUPMEMBER (0x18)
+
+#define NDR_SAMR_QUERYGROUPMEMBER (0x19)
+
+#define NDR_SAMR_SETMEMBERATTRIBUTESOFGROUP (0x1a)
+
+#define NDR_SAMR_OPENALIAS (0x1b)
+
+#define NDR_SAMR_QUERYALIASINFO (0x1c)
+
+#define NDR_SAMR_SETALIASINFO (0x1d)
+
+#define NDR_SAMR_DELETEDOMALIAS (0x1e)
+
+#define NDR_SAMR_ADDALIASMEMBER (0x1f)
+
+#define NDR_SAMR_DELETEALIASMEMBER (0x20)
+
+#define NDR_SAMR_GETMEMBERSINALIAS (0x21)
+
+#define NDR_SAMR_OPENUSER (0x22)
+
+#define NDR_SAMR_DELETEUSER (0x23)
+
+#define NDR_SAMR_QUERYUSERINFO (0x24)
+
+#define NDR_SAMR_SETUSERINFO (0x25)
+
+#define NDR_SAMR_CHANGEPASSWORDUSER (0x26)
+
+#define NDR_SAMR_GETGROUPSFORUSER (0x27)
+
+#define NDR_SAMR_QUERYDISPLAYINFO (0x28)
+
+#define NDR_SAMR_GETDISPLAYENUMERATIONINDEX (0x29)
+
+#define NDR_SAMR_TESTPRIVATEFUNCTIONSDOMAIN (0x2a)
+
+#define NDR_SAMR_TESTPRIVATEFUNCTIONSUSER (0x2b)
+
+#define NDR_SAMR_GETUSERPWINFO (0x2c)
+
+#define NDR_SAMR_REMOVEMEMBERFROMFOREIGNDOMAIN (0x2d)
+
+#define NDR_SAMR_QUERYDOMAININFO2 (0x2e)
+
+#define NDR_SAMR_QUERYUSERINFO2 (0x2f)
+
+#define NDR_SAMR_QUERYDISPLAYINFO2 (0x30)
+
+#define NDR_SAMR_GETDISPLAYENUMERATIONINDEX2 (0x31)
+
+#define NDR_SAMR_CREATEUSER2 (0x32)
+
+#define NDR_SAMR_QUERYDISPLAYINFO3 (0x33)
+
+#define NDR_SAMR_ADDMULTIPLEMEMBERSTOALIAS (0x34)
+
+#define NDR_SAMR_REMOVEMULTIPLEMEMBERSFROMALIAS (0x35)
+
+#define NDR_SAMR_OEMCHANGEPASSWORDUSER2 (0x36)
+
+#define NDR_SAMR_CHANGEPASSWORDUSER2 (0x37)
+
+#define NDR_SAMR_GETDOMPWINFO (0x38)
+
+#define NDR_SAMR_CONNECT2 (0x39)
+
+#define NDR_SAMR_SETUSERINFO2 (0x3a)
+
+#define NDR_SAMR_SETBOOTKEYINFORMATION (0x3b)
+
+#define NDR_SAMR_GETBOOTKEYINFORMATION (0x3c)
+
+#define NDR_SAMR_CONNECT3 (0x3d)
+
+#define NDR_SAMR_CONNECT4 (0x3e)
+
+#define NDR_SAMR_CHANGEPASSWORDUSER3 (0x3f)
+
+#define NDR_SAMR_CONNECT5 (0x40)
+
+#define NDR_SAMR_RIDTOSID (0x41)
+
+#define NDR_SAMR_SETDSRMPASSWORD (0x42)
+
+#define NDR_SAMR_VALIDATEPASSWORD (0x43)
+
+#define NDR_SAMR_CALL_COUNT (68)
+enum ndr_err_code ndr_push_samr_AcctFlags(struct ndr_push *ndr, int ndr_flags, uint32_t r);
+enum ndr_err_code ndr_pull_samr_AcctFlags(struct ndr_pull *ndr, int ndr_flags, uint32_t *r);
+void ndr_print_samr_AcctFlags(struct ndr_print *ndr, const char *name, uint32_t r);
+void ndr_print_samr_ConnectAccessMask(struct ndr_print *ndr, const char *name, uint32_t r);
+void ndr_print_samr_UserAccessMask(struct ndr_print *ndr, const char *name, uint32_t r);
+void ndr_print_samr_DomainAccessMask(struct ndr_print *ndr, const char *name, uint32_t r);
+void ndr_print_samr_GroupAccessMask(struct ndr_print *ndr, const char *name, uint32_t r);
+void ndr_print_samr_AliasAccessMask(struct ndr_print *ndr, const char *name, uint32_t r);
+void ndr_print_samr_SamEntry(struct ndr_print *ndr, const char *name, const struct samr_SamEntry *r);
+void ndr_print_samr_SamArray(struct ndr_print *ndr, const char *name, const struct samr_SamArray *r);
+void ndr_print_samr_Role(struct ndr_print *ndr, const char *name, enum samr_Role r);
+enum ndr_err_code ndr_push_samr_PasswordProperties(struct ndr_push *ndr, int ndr_flags, uint32_t r);
+enum ndr_err_code ndr_pull_samr_PasswordProperties(struct ndr_pull *ndr, int ndr_flags, uint32_t *r);
+void ndr_print_samr_PasswordProperties(struct ndr_print *ndr, const char *name, uint32_t r);
+void ndr_print_samr_DomInfo1(struct ndr_print *ndr, const char *name, const struct samr_DomInfo1 *r);
+void ndr_print_samr_DomInfo2(struct ndr_print *ndr, const char *name, const struct samr_DomInfo2 *r);
+void ndr_print_samr_DomInfo3(struct ndr_print *ndr, const char *name, const struct samr_DomInfo3 *r);
+void ndr_print_samr_DomInfo4(struct ndr_print *ndr, const char *name, const struct samr_DomInfo4 *r);
+void ndr_print_samr_DomInfo5(struct ndr_print *ndr, const char *name, const struct samr_DomInfo5 *r);
+void ndr_print_samr_DomInfo6(struct ndr_print *ndr, const char *name, const struct samr_DomInfo6 *r);
+void ndr_print_samr_DomInfo7(struct ndr_print *ndr, const char *name, const struct samr_DomInfo7 *r);
+void ndr_print_samr_DomInfo8(struct ndr_print *ndr, const char *name, const struct samr_DomInfo8 *r);
+void ndr_print_samr_DomInfo9(struct ndr_print *ndr, const char *name, const struct samr_DomInfo9 *r);
+void ndr_print_samr_DomInfo11(struct ndr_print *ndr, const char *name, const struct samr_DomInfo11 *r);
+void ndr_print_samr_DomInfo12(struct ndr_print *ndr, const char *name, const struct samr_DomInfo12 *r);
+void ndr_print_samr_DomInfo13(struct ndr_print *ndr, const char *name, const struct samr_DomInfo13 *r);
+void ndr_print_samr_DomainInfo(struct ndr_print *ndr, const char *name, const union samr_DomainInfo *r);
+void ndr_print_samr_Ids(struct ndr_print *ndr, const char *name, const struct samr_Ids *r);
+enum ndr_err_code ndr_push_samr_GroupAttrs(struct ndr_push *ndr, int ndr_flags, uint32_t r);
+enum ndr_err_code ndr_pull_samr_GroupAttrs(struct ndr_pull *ndr, int ndr_flags, uint32_t *r);
+void ndr_print_samr_GroupAttrs(struct ndr_print *ndr, const char *name, uint32_t r);
+void ndr_print_samr_GroupInfoAll(struct ndr_print *ndr, const char *name, const struct samr_GroupInfoAll *r);
+void ndr_print_samr_GroupInfoAttributes(struct ndr_print *ndr, const char *name, const struct samr_GroupInfoAttributes *r);
+void ndr_print_samr_GroupInfoEnum(struct ndr_print *ndr, const char *name, enum samr_GroupInfoEnum r);
+void ndr_print_samr_GroupInfo(struct ndr_print *ndr, const char *name, const union samr_GroupInfo *r);
+void ndr_print_samr_RidTypeArray(struct ndr_print *ndr, const char *name, const struct samr_RidTypeArray *r);
+void ndr_print_samr_AliasInfoAll(struct ndr_print *ndr, const char *name, const struct samr_AliasInfoAll *r);
+void ndr_print_samr_AliasInfoEnum(struct ndr_print *ndr, const char *name, enum samr_AliasInfoEnum r);
+void ndr_print_samr_AliasInfo(struct ndr_print *ndr, const char *name, const union samr_AliasInfo *r);
+void ndr_print_samr_UserInfo1(struct ndr_print *ndr, const char *name, const struct samr_UserInfo1 *r);
+void ndr_print_samr_UserInfo2(struct ndr_print *ndr, const char *name, const struct samr_UserInfo2 *r);
+enum ndr_err_code ndr_push_samr_LogonHours(struct ndr_push *ndr, int ndr_flags, const struct samr_LogonHours *r);
+enum ndr_err_code ndr_pull_samr_LogonHours(struct ndr_pull *ndr, int ndr_flags, struct samr_LogonHours *r);
+void ndr_print_samr_LogonHours(struct ndr_print *ndr, const char *name, const struct samr_LogonHours *r);
+void ndr_print_samr_UserInfo3(struct ndr_print *ndr, const char *name, const struct samr_UserInfo3 *r);
+void ndr_print_samr_UserInfo4(struct ndr_print *ndr, const char *name, const struct samr_UserInfo4 *r);
+void ndr_print_samr_UserInfo5(struct ndr_print *ndr, const char *name, const struct samr_UserInfo5 *r);
+void ndr_print_samr_UserInfo6(struct ndr_print *ndr, const char *name, const struct samr_UserInfo6 *r);
+void ndr_print_samr_UserInfo7(struct ndr_print *ndr, const char *name, const struct samr_UserInfo7 *r);
+void ndr_print_samr_UserInfo8(struct ndr_print *ndr, const char *name, const struct samr_UserInfo8 *r);
+void ndr_print_samr_UserInfo9(struct ndr_print *ndr, const char *name, const struct samr_UserInfo9 *r);
+void ndr_print_samr_UserInfo10(struct ndr_print *ndr, const char *name, const struct samr_UserInfo10 *r);
+void ndr_print_samr_UserInfo11(struct ndr_print *ndr, const char *name, const struct samr_UserInfo11 *r);
+void ndr_print_samr_UserInfo12(struct ndr_print *ndr, const char *name, const struct samr_UserInfo12 *r);
+void ndr_print_samr_UserInfo13(struct ndr_print *ndr, const char *name, const struct samr_UserInfo13 *r);
+void ndr_print_samr_UserInfo14(struct ndr_print *ndr, const char *name, const struct samr_UserInfo14 *r);
+void ndr_print_samr_UserInfo16(struct ndr_print *ndr, const char *name, const struct samr_UserInfo16 *r);
+void ndr_print_samr_UserInfo17(struct ndr_print *ndr, const char *name, const struct samr_UserInfo17 *r);
+void ndr_print_samr_UserInfo20(struct ndr_print *ndr, const char *name, const struct samr_UserInfo20 *r);
+void ndr_print_samr_FieldsPresent(struct ndr_print *ndr, const char *name, uint32_t r);
+void ndr_print_samr_UserInfo21(struct ndr_print *ndr, const char *name, const struct samr_UserInfo21 *r);
+enum ndr_err_code ndr_push_samr_CryptPassword(struct ndr_push *ndr, int ndr_flags, const struct samr_CryptPassword *r);
+enum ndr_err_code ndr_pull_samr_CryptPassword(struct ndr_pull *ndr, int ndr_flags, struct samr_CryptPassword *r);
+void ndr_print_samr_CryptPassword(struct ndr_print *ndr, const char *name, const struct samr_CryptPassword *r);
+void ndr_print_samr_UserInfo23(struct ndr_print *ndr, const char *name, const struct samr_UserInfo23 *r);
+void ndr_print_samr_UserInfo24(struct ndr_print *ndr, const char *name, const struct samr_UserInfo24 *r);
+void ndr_print_samr_CryptPasswordEx(struct ndr_print *ndr, const char *name, const struct samr_CryptPasswordEx *r);
+void ndr_print_samr_UserInfo25(struct ndr_print *ndr, const char *name, const struct samr_UserInfo25 *r);
+void ndr_print_samr_UserInfo26(struct ndr_print *ndr, const char *name, const struct samr_UserInfo26 *r);
+void ndr_print_samr_UserInfo(struct ndr_print *ndr, const char *name, const union samr_UserInfo *r);
+enum ndr_err_code ndr_push_samr_Password(struct ndr_push *ndr, int ndr_flags, const struct samr_Password *r);
+enum ndr_err_code ndr_pull_samr_Password(struct ndr_pull *ndr, int ndr_flags, struct samr_Password *r);
+void ndr_print_samr_Password(struct ndr_print *ndr, const char *name, const struct samr_Password *r);
+enum ndr_err_code ndr_push_samr_RidWithAttribute(struct ndr_push *ndr, int ndr_flags, const struct samr_RidWithAttribute *r);
+enum ndr_err_code ndr_pull_samr_RidWithAttribute(struct ndr_pull *ndr, int ndr_flags, struct samr_RidWithAttribute *r);
+void ndr_print_samr_RidWithAttribute(struct ndr_print *ndr, const char *name, const struct samr_RidWithAttribute *r);
+enum ndr_err_code ndr_push_samr_RidWithAttributeArray(struct ndr_push *ndr, int ndr_flags, const struct samr_RidWithAttributeArray *r);
+enum ndr_err_code ndr_pull_samr_RidWithAttributeArray(struct ndr_pull *ndr, int ndr_flags, struct samr_RidWithAttributeArray *r);
+void ndr_print_samr_RidWithAttributeArray(struct ndr_print *ndr, const char *name, const struct samr_RidWithAttributeArray *r);
+void ndr_print_samr_DispEntryGeneral(struct ndr_print *ndr, const char *name, const struct samr_DispEntryGeneral *r);
+void ndr_print_samr_DispInfoGeneral(struct ndr_print *ndr, const char *name, const struct samr_DispInfoGeneral *r);
+void ndr_print_samr_DispEntryFull(struct ndr_print *ndr, const char *name, const struct samr_DispEntryFull *r);
+void ndr_print_samr_DispInfoFull(struct ndr_print *ndr, const char *name, const struct samr_DispInfoFull *r);
+void ndr_print_samr_DispEntryFullGroup(struct ndr_print *ndr, const char *name, const struct samr_DispEntryFullGroup *r);
+void ndr_print_samr_DispInfoFullGroups(struct ndr_print *ndr, const char *name, const struct samr_DispInfoFullGroups *r);
+void ndr_print_samr_DispEntryAscii(struct ndr_print *ndr, const char *name, const struct samr_DispEntryAscii *r);
+void ndr_print_samr_DispInfoAscii(struct ndr_print *ndr, const char *name, const struct samr_DispInfoAscii *r);
+void ndr_print_samr_DispInfo(struct ndr_print *ndr, const char *name, const union samr_DispInfo *r);
+void ndr_print_samr_PwInfo(struct ndr_print *ndr, const char *name, const struct samr_PwInfo *r);
+void ndr_print_samr_ChangeReject(struct ndr_print *ndr, const char *name, const struct samr_ChangeReject *r);
+void ndr_print_samr_ConnectInfo1(struct ndr_print *ndr, const char *name, const struct samr_ConnectInfo1 *r);
+void ndr_print_samr_ConnectInfo(struct ndr_print *ndr, const char *name, const union samr_ConnectInfo *r);
+void ndr_print_samr_ValidateFieldsPresent(struct ndr_print *ndr, const char *name, uint32_t r);
+void ndr_print_samr_ValidatePasswordLevel(struct ndr_print *ndr, const char *name, enum samr_ValidatePasswordLevel r);
+void ndr_print_samr_ValidationStatus(struct ndr_print *ndr, const char *name, enum samr_ValidationStatus r);
+void ndr_print_samr_ValidationBlob(struct ndr_print *ndr, const char *name, const struct samr_ValidationBlob *r);
+void ndr_print_samr_ValidatePasswordInfo(struct ndr_print *ndr, const char *name, const struct samr_ValidatePasswordInfo *r);
+void ndr_print_samr_ValidatePasswordRepCtr(struct ndr_print *ndr, const char *name, const struct samr_ValidatePasswordRepCtr *r);
+void ndr_print_samr_ValidatePasswordRep(struct ndr_print *ndr, const char *name, const union samr_ValidatePasswordRep *r);
+void ndr_print_samr_ValidatePasswordReq3(struct ndr_print *ndr, const char *name, const struct samr_ValidatePasswordReq3 *r);
+void ndr_print_samr_ValidatePasswordReq2(struct ndr_print *ndr, const char *name, const struct samr_ValidatePasswordReq2 *r);
+void ndr_print_samr_ValidatePasswordReq1(struct ndr_print *ndr, const char *name, const struct samr_ValidatePasswordReq1 *r);
+void ndr_print_samr_ValidatePasswordReq(struct ndr_print *ndr, const char *name, const union samr_ValidatePasswordReq *r);
+void ndr_print_samr_Connect(struct ndr_print *ndr, const char *name, int flags, const struct samr_Connect *r);
+enum ndr_err_code ndr_push_samr_Close(struct ndr_push *ndr, int flags, const struct samr_Close *r);
+enum ndr_err_code ndr_pull_samr_Close(struct ndr_pull *ndr, int flags, struct samr_Close *r);
+void ndr_print_samr_Close(struct ndr_print *ndr, const char *name, int flags, const struct samr_Close *r);
+void ndr_print_samr_SetSecurity(struct ndr_print *ndr, const char *name, int flags, const struct samr_SetSecurity *r);
+void ndr_print_samr_QuerySecurity(struct ndr_print *ndr, const char *name, int flags, const struct samr_QuerySecurity *r);
+void ndr_print_samr_Shutdown(struct ndr_print *ndr, const char *name, int flags, const struct samr_Shutdown *r);
+void ndr_print_samr_LookupDomain(struct ndr_print *ndr, const char *name, int flags, const struct samr_LookupDomain *r);
+void ndr_print_samr_EnumDomains(struct ndr_print *ndr, const char *name, int flags, const struct samr_EnumDomains *r);
+enum ndr_err_code ndr_push_samr_OpenDomain(struct ndr_push *ndr, int flags, const struct samr_OpenDomain *r);
+enum ndr_err_code ndr_pull_samr_OpenDomain(struct ndr_pull *ndr, int flags, struct samr_OpenDomain *r);
+void ndr_print_samr_OpenDomain(struct ndr_print *ndr, const char *name, int flags, const struct samr_OpenDomain *r);
+void ndr_print_samr_QueryDomainInfo(struct ndr_print *ndr, const char *name, int flags, const struct samr_QueryDomainInfo *r);
+void ndr_print_samr_SetDomainInfo(struct ndr_print *ndr, const char *name, int flags, const struct samr_SetDomainInfo *r);
+void ndr_print_samr_CreateDomainGroup(struct ndr_print *ndr, const char *name, int flags, const struct samr_CreateDomainGroup *r);
+void ndr_print_samr_EnumDomainGroups(struct ndr_print *ndr, const char *name, int flags, const struct samr_EnumDomainGroups *r);
+void ndr_print_samr_CreateUser(struct ndr_print *ndr, const char *name, int flags, const struct samr_CreateUser *r);
+void ndr_print_samr_EnumDomainUsers(struct ndr_print *ndr, const char *name, int flags, const struct samr_EnumDomainUsers *r);
+void ndr_print_samr_CreateDomAlias(struct ndr_print *ndr, const char *name, int flags, const struct samr_CreateDomAlias *r);
+void ndr_print_samr_EnumDomainAliases(struct ndr_print *ndr, const char *name, int flags, const struct samr_EnumDomainAliases *r);
+void ndr_print_samr_GetAliasMembership(struct ndr_print *ndr, const char *name, int flags, const struct samr_GetAliasMembership *r);
+enum ndr_err_code ndr_push_samr_LookupNames(struct ndr_push *ndr, int flags, const struct samr_LookupNames *r);
+enum ndr_err_code ndr_pull_samr_LookupNames(struct ndr_pull *ndr, int flags, struct samr_LookupNames *r);
+void ndr_print_samr_LookupNames(struct ndr_print *ndr, const char *name, int flags, const struct samr_LookupNames *r);
+void ndr_print_samr_LookupRids(struct ndr_print *ndr, const char *name, int flags, const struct samr_LookupRids *r);
+void ndr_print_samr_OpenGroup(struct ndr_print *ndr, const char *name, int flags, const struct samr_OpenGroup *r);
+void ndr_print_samr_QueryGroupInfo(struct ndr_print *ndr, const char *name, int flags, const struct samr_QueryGroupInfo *r);
+void ndr_print_samr_SetGroupInfo(struct ndr_print *ndr, const char *name, int flags, const struct samr_SetGroupInfo *r);
+void ndr_print_samr_AddGroupMember(struct ndr_print *ndr, const char *name, int flags, const struct samr_AddGroupMember *r);
+void ndr_print_samr_DeleteDomainGroup(struct ndr_print *ndr, const char *name, int flags, const struct samr_DeleteDomainGroup *r);
+void ndr_print_samr_DeleteGroupMember(struct ndr_print *ndr, const char *name, int flags, const struct samr_DeleteGroupMember *r);
+void ndr_print_samr_QueryGroupMember(struct ndr_print *ndr, const char *name, int flags, const struct samr_QueryGroupMember *r);
+void ndr_print_samr_SetMemberAttributesOfGroup(struct ndr_print *ndr, const char *name, int flags, const struct samr_SetMemberAttributesOfGroup *r);
+void ndr_print_samr_OpenAlias(struct ndr_print *ndr, const char *name, int flags, const struct samr_OpenAlias *r);
+void ndr_print_samr_QueryAliasInfo(struct ndr_print *ndr, const char *name, int flags, const struct samr_QueryAliasInfo *r);
+void ndr_print_samr_SetAliasInfo(struct ndr_print *ndr, const char *name, int flags, const struct samr_SetAliasInfo *r);
+void ndr_print_samr_DeleteDomAlias(struct ndr_print *ndr, const char *name, int flags, const struct samr_DeleteDomAlias *r);
+void ndr_print_samr_AddAliasMember(struct ndr_print *ndr, const char *name, int flags, const struct samr_AddAliasMember *r);
+void ndr_print_samr_DeleteAliasMember(struct ndr_print *ndr, const char *name, int flags, const struct samr_DeleteAliasMember *r);
+void ndr_print_samr_GetMembersInAlias(struct ndr_print *ndr, const char *name, int flags, const struct samr_GetMembersInAlias *r);
+enum ndr_err_code ndr_push_samr_OpenUser(struct ndr_push *ndr, int flags, const struct samr_OpenUser *r);
+enum ndr_err_code ndr_pull_samr_OpenUser(struct ndr_pull *ndr, int flags, struct samr_OpenUser *r);
+void ndr_print_samr_OpenUser(struct ndr_print *ndr, const char *name, int flags, const struct samr_OpenUser *r);
+void ndr_print_samr_DeleteUser(struct ndr_print *ndr, const char *name, int flags, const struct samr_DeleteUser *r);
+enum ndr_err_code ndr_push_samr_QueryUserInfo(struct ndr_push *ndr, int flags, const struct samr_QueryUserInfo *r);
+enum ndr_err_code ndr_pull_samr_QueryUserInfo(struct ndr_pull *ndr, int flags, struct samr_QueryUserInfo *r);
+void ndr_print_samr_QueryUserInfo(struct ndr_print *ndr, const char *name, int flags, const struct samr_QueryUserInfo *r);
+enum ndr_err_code ndr_push_samr_SetUserInfo(struct ndr_push *ndr, int flags, const struct samr_SetUserInfo *r);
+enum ndr_err_code ndr_pull_samr_SetUserInfo(struct ndr_pull *ndr, int flags, struct samr_SetUserInfo *r);
+void ndr_print_samr_SetUserInfo(struct ndr_print *ndr, const char *name, int flags, const struct samr_SetUserInfo *r);
+void ndr_print_samr_ChangePasswordUser(struct ndr_print *ndr, const char *name, int flags, const struct samr_ChangePasswordUser *r);
+void ndr_print_samr_GetGroupsForUser(struct ndr_print *ndr, const char *name, int flags, const struct samr_GetGroupsForUser *r);
+void ndr_print_samr_QueryDisplayInfo(struct ndr_print *ndr, const char *name, int flags, const struct samr_QueryDisplayInfo *r);
+void ndr_print_samr_GetDisplayEnumerationIndex(struct ndr_print *ndr, const char *name, int flags, const struct samr_GetDisplayEnumerationIndex *r);
+void ndr_print_samr_TestPrivateFunctionsDomain(struct ndr_print *ndr, const char *name, int flags, const struct samr_TestPrivateFunctionsDomain *r);
+void ndr_print_samr_TestPrivateFunctionsUser(struct ndr_print *ndr, const char *name, int flags, const struct samr_TestPrivateFunctionsUser *r);
+enum ndr_err_code ndr_push_samr_GetUserPwInfo(struct ndr_push *ndr, int flags, const struct samr_GetUserPwInfo *r);
+enum ndr_err_code ndr_pull_samr_GetUserPwInfo(struct ndr_pull *ndr, int flags, struct samr_GetUserPwInfo *r);
+void ndr_print_samr_GetUserPwInfo(struct ndr_print *ndr, const char *name, int flags, const struct samr_GetUserPwInfo *r);
+void ndr_print_samr_RemoveMemberFromForeignDomain(struct ndr_print *ndr, const char *name, int flags, const struct samr_RemoveMemberFromForeignDomain *r);
+void ndr_print_samr_QueryDomainInfo2(struct ndr_print *ndr, const char *name, int flags, const struct samr_QueryDomainInfo2 *r);
+void ndr_print_samr_QueryUserInfo2(struct ndr_print *ndr, const char *name, int flags, const struct samr_QueryUserInfo2 *r);
+void ndr_print_samr_QueryDisplayInfo2(struct ndr_print *ndr, const char *name, int flags, const struct samr_QueryDisplayInfo2 *r);
+void ndr_print_samr_GetDisplayEnumerationIndex2(struct ndr_print *ndr, const char *name, int flags, const struct samr_GetDisplayEnumerationIndex2 *r);
+void ndr_print_samr_CreateUser2(struct ndr_print *ndr, const char *name, int flags, const struct samr_CreateUser2 *r);
+void ndr_print_samr_QueryDisplayInfo3(struct ndr_print *ndr, const char *name, int flags, const struct samr_QueryDisplayInfo3 *r);
+void ndr_print_samr_AddMultipleMembersToAlias(struct ndr_print *ndr, const char *name, int flags, const struct samr_AddMultipleMembersToAlias *r);
+void ndr_print_samr_RemoveMultipleMembersFromAlias(struct ndr_print *ndr, const char *name, int flags, const struct samr_RemoveMultipleMembersFromAlias *r);
+void ndr_print_samr_OemChangePasswordUser2(struct ndr_print *ndr, const char *name, int flags, const struct samr_OemChangePasswordUser2 *r);
+void ndr_print_samr_ChangePasswordUser2(struct ndr_print *ndr, const char *name, int flags, const struct samr_ChangePasswordUser2 *r);
+void ndr_print_samr_GetDomPwInfo(struct ndr_print *ndr, const char *name, int flags, const struct samr_GetDomPwInfo *r);
+void ndr_print_samr_Connect2(struct ndr_print *ndr, const char *name, int flags, const struct samr_Connect2 *r);
+enum ndr_err_code ndr_push_samr_SetUserInfo2(struct ndr_push *ndr, int flags, const struct samr_SetUserInfo2 *r);
+enum ndr_err_code ndr_pull_samr_SetUserInfo2(struct ndr_pull *ndr, int flags, struct samr_SetUserInfo2 *r);
+void ndr_print_samr_SetUserInfo2(struct ndr_print *ndr, const char *name, int flags, const struct samr_SetUserInfo2 *r);
+void ndr_print_samr_SetBootKeyInformation(struct ndr_print *ndr, const char *name, int flags, const struct samr_SetBootKeyInformation *r);
+void ndr_print_samr_GetBootKeyInformation(struct ndr_print *ndr, const char *name, int flags, const struct samr_GetBootKeyInformation *r);
+void ndr_print_samr_Connect3(struct ndr_print *ndr, const char *name, int flags, const struct samr_Connect3 *r);
+void ndr_print_samr_Connect4(struct ndr_print *ndr, const char *name, int flags, const struct samr_Connect4 *r);
+void ndr_print_samr_ChangePasswordUser3(struct ndr_print *ndr, const char *name, int flags, const struct samr_ChangePasswordUser3 *r);
+enum ndr_err_code ndr_push_samr_Connect5(struct ndr_push *ndr, int flags, const struct samr_Connect5 *r);
+enum ndr_err_code ndr_pull_samr_Connect5(struct ndr_pull *ndr, int flags, struct samr_Connect5 *r);
+void ndr_print_samr_Connect5(struct ndr_print *ndr, const char *name, int flags, const struct samr_Connect5 *r);
+void ndr_print_samr_RidToSid(struct ndr_print *ndr, const char *name, int flags, const struct samr_RidToSid *r);
+void ndr_print_samr_SetDsrmPassword(struct ndr_print *ndr, const char *name, int flags, const struct samr_SetDsrmPassword *r);
+void ndr_print_samr_ValidatePassword(struct ndr_print *ndr, const char *name, int flags, const struct samr_ValidatePassword *r);
+#endif /* _HEADER_NDR_samr */
diff --git a/source/librpc/gen_ndr/ndr_security.c b/source/librpc/gen_ndr/ndr_security.c
new file mode 100644 (file)
index 0000000..a6ee1a5
--- /dev/null
@@ -0,0 +1,1028 @@
+/* parser auto-generated by pidl */
+
+#include "includes.h"
+#include "librpc/gen_ndr/ndr_security.h"
+
+#include "librpc/gen_ndr/ndr_misc.h"
+static enum ndr_err_code ndr_push_security_ace_flags(struct ndr_push *ndr, int ndr_flags, uint8_t r)
+{
+       NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r));
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_security_ace_flags(struct ndr_pull *ndr, int ndr_flags, uint8_t *r)
+{
+       uint8_t v;
+       NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &v));
+       *r = v;
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_security_ace_flags(struct ndr_print *ndr, const char *name, uint8_t r)
+{
+       ndr_print_uint8(ndr, name, r);
+       ndr->depth++;
+       ndr_print_bitmap_flag(ndr, sizeof(uint8_t), "SEC_ACE_FLAG_OBJECT_INHERIT", SEC_ACE_FLAG_OBJECT_INHERIT, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint8_t), "SEC_ACE_FLAG_CONTAINER_INHERIT", SEC_ACE_FLAG_CONTAINER_INHERIT, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint8_t), "SEC_ACE_FLAG_NO_PROPAGATE_INHERIT", SEC_ACE_FLAG_NO_PROPAGATE_INHERIT, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint8_t), "SEC_ACE_FLAG_INHERIT_ONLY", SEC_ACE_FLAG_INHERIT_ONLY, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint8_t), "SEC_ACE_FLAG_INHERITED_ACE", SEC_ACE_FLAG_INHERITED_ACE, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint8_t), "SEC_ACE_FLAG_VALID_INHERIT", SEC_ACE_FLAG_VALID_INHERIT, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint8_t), "SEC_ACE_FLAG_SUCCESSFUL_ACCESS", SEC_ACE_FLAG_SUCCESSFUL_ACCESS, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint8_t), "SEC_ACE_FLAG_FAILED_ACCESS", SEC_ACE_FLAG_FAILED_ACCESS, r);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_security_ace_type(struct ndr_push *ndr, int ndr_flags, enum security_ace_type r)
+{
+       NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r));
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_security_ace_type(struct ndr_pull *ndr, int ndr_flags, enum security_ace_type *r)
+{
+       uint8_t v;
+       NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &v));
+       *r = v;
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_security_ace_type(struct ndr_print *ndr, const char *name, enum security_ace_type r)
+{
+       const char *val = NULL;
+
+       switch (r) {
+               case SEC_ACE_TYPE_ACCESS_ALLOWED: val = "SEC_ACE_TYPE_ACCESS_ALLOWED"; break;
+               case SEC_ACE_TYPE_ACCESS_DENIED: val = "SEC_ACE_TYPE_ACCESS_DENIED"; break;
+               case SEC_ACE_TYPE_SYSTEM_AUDIT: val = "SEC_ACE_TYPE_SYSTEM_AUDIT"; break;
+               case SEC_ACE_TYPE_SYSTEM_ALARM: val = "SEC_ACE_TYPE_SYSTEM_ALARM"; break;
+               case SEC_ACE_TYPE_ALLOWED_COMPOUND: val = "SEC_ACE_TYPE_ALLOWED_COMPOUND"; break;
+               case SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT: val = "SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT"; break;
+               case SEC_ACE_TYPE_ACCESS_DENIED_OBJECT: val = "SEC_ACE_TYPE_ACCESS_DENIED_OBJECT"; break;
+               case SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT: val = "SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT"; break;
+               case SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT: val = "SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT"; break;
+       }
+       ndr_print_enum(ndr, name, "ENUM", val, r);
+}
+
+static enum ndr_err_code ndr_push_security_ace_object_flags(struct ndr_push *ndr, int ndr_flags, uint32_t r)
+{
+       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_security_ace_object_flags(struct ndr_pull *ndr, int ndr_flags, uint32_t *r)
+{
+       uint32_t v;
+       NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
+       *r = v;
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_security_ace_object_flags(struct ndr_print *ndr, const char *name, uint32_t r)
+{
+       ndr_print_uint32(ndr, name, r);
+       ndr->depth++;
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SEC_ACE_OBJECT_TYPE_PRESENT", SEC_ACE_OBJECT_TYPE_PRESENT, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT", SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT, r);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_security_ace_object_type(struct ndr_push *ndr, int ndr_flags, const union security_ace_object_type *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               int level = ndr_push_get_switch_value(ndr, r);
+               switch (level) {
+                       case SEC_ACE_OBJECT_TYPE_PRESENT:
+                               NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &r->type));
+                       break;
+
+                       default:
+                       break;
+
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               int level = ndr_push_get_switch_value(ndr, r);
+               switch (level) {
+                       case SEC_ACE_OBJECT_TYPE_PRESENT:
+                       break;
+
+                       default:
+                       break;
+
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_security_ace_object_type(struct ndr_pull *ndr, int ndr_flags, union security_ace_object_type *r)
+{
+       int level;
+       level = ndr_pull_get_switch_value(ndr, r);
+       if (ndr_flags & NDR_SCALARS) {
+               switch (level) {
+                       case SEC_ACE_OBJECT_TYPE_PRESENT: {
+                               NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, &r->type));
+                       break; }
+
+                       default: {
+                       break; }
+
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               switch (level) {
+                       case SEC_ACE_OBJECT_TYPE_PRESENT:
+                       break;
+
+                       default:
+                       break;
+
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_security_ace_object_type(struct ndr_print *ndr, const char *name, const union security_ace_object_type *r)
+{
+       int level;
+       level = ndr_print_get_switch_value(ndr, r);
+       ndr_print_union(ndr, name, level, "security_ace_object_type");
+       switch (level) {
+               case SEC_ACE_OBJECT_TYPE_PRESENT:
+                       ndr_print_GUID(ndr, "type", &r->type);
+               break;
+
+               default:
+               break;
+
+       }
+}
+
+static enum ndr_err_code ndr_push_security_ace_object_inherited_type(struct ndr_push *ndr, int ndr_flags, const union security_ace_object_inherited_type *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               int level = ndr_push_get_switch_value(ndr, r);
+               switch (level) {
+                       case SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT:
+                               NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &r->inherited_type));
+                       break;
+
+                       default:
+                       break;
+
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               int level = ndr_push_get_switch_value(ndr, r);
+               switch (level) {
+                       case SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT:
+                       break;
+
+                       default:
+                       break;
+
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_security_ace_object_inherited_type(struct ndr_pull *ndr, int ndr_flags, union security_ace_object_inherited_type *r)
+{
+       int level;
+       level = ndr_pull_get_switch_value(ndr, r);
+       if (ndr_flags & NDR_SCALARS) {
+               switch (level) {
+                       case SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT: {
+                               NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, &r->inherited_type));
+                       break; }
+
+                       default: {
+                       break; }
+
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               switch (level) {
+                       case SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT:
+                       break;
+
+                       default:
+                       break;
+
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_security_ace_object_inherited_type(struct ndr_print *ndr, const char *name, const union security_ace_object_inherited_type *r)
+{
+       int level;
+       level = ndr_print_get_switch_value(ndr, r);
+       ndr_print_union(ndr, name, level, "security_ace_object_inherited_type");
+       switch (level) {
+               case SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT:
+                       ndr_print_GUID(ndr, "inherited_type", &r->inherited_type);
+               break;
+
+               default:
+               break;
+
+       }
+}
+
+static enum ndr_err_code ndr_push_security_ace_object(struct ndr_push *ndr, int ndr_flags, const struct security_ace_object *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_security_ace_object_flags(ndr, NDR_SCALARS, r->flags));
+               NDR_CHECK(ndr_push_set_switch_value(ndr, &r->type, r->flags & SEC_ACE_OBJECT_TYPE_PRESENT));
+               NDR_CHECK(ndr_push_security_ace_object_type(ndr, NDR_SCALARS, &r->type));
+               NDR_CHECK(ndr_push_set_switch_value(ndr, &r->inherited_type, r->flags & SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT));
+               NDR_CHECK(ndr_push_security_ace_object_inherited_type(ndr, NDR_SCALARS, &r->inherited_type));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_push_security_ace_object_type(ndr, NDR_BUFFERS, &r->type));
+               NDR_CHECK(ndr_push_security_ace_object_inherited_type(ndr, NDR_BUFFERS, &r->inherited_type));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_security_ace_object(struct ndr_pull *ndr, int ndr_flags, struct security_ace_object *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_security_ace_object_flags(ndr, NDR_SCALARS, &r->flags));
+               NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->type, r->flags & SEC_ACE_OBJECT_TYPE_PRESENT));
+               NDR_CHECK(ndr_pull_security_ace_object_type(ndr, NDR_SCALARS, &r->type));
+               NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->inherited_type, r->flags & SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT));
+               NDR_CHECK(ndr_pull_security_ace_object_inherited_type(ndr, NDR_SCALARS, &r->inherited_type));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_pull_security_ace_object_type(ndr, NDR_BUFFERS, &r->type));
+               NDR_CHECK(ndr_pull_security_ace_object_inherited_type(ndr, NDR_BUFFERS, &r->inherited_type));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_security_ace_object(struct ndr_print *ndr, const char *name, const struct security_ace_object *r)
+{
+       ndr_print_struct(ndr, name, "security_ace_object");
+       ndr->depth++;
+       ndr_print_security_ace_object_flags(ndr, "flags", r->flags);
+       ndr_print_set_switch_value(ndr, &r->type, r->flags & SEC_ACE_OBJECT_TYPE_PRESENT);
+       ndr_print_security_ace_object_type(ndr, "type", &r->type);
+       ndr_print_set_switch_value(ndr, &r->inherited_type, r->flags & SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT);
+       ndr_print_security_ace_object_inherited_type(ndr, "inherited_type", &r->inherited_type);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_security_ace_object_ctr(struct ndr_push *ndr, int ndr_flags, const union security_ace_object_ctr *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               int level = ndr_push_get_switch_value(ndr, r);
+               switch (level) {
+                       case SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT:
+                               NDR_CHECK(ndr_push_security_ace_object(ndr, NDR_SCALARS, &r->object));
+                       break;
+
+                       case SEC_ACE_TYPE_ACCESS_DENIED_OBJECT:
+                               NDR_CHECK(ndr_push_security_ace_object(ndr, NDR_SCALARS, &r->object));
+                       break;
+
+                       case SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT:
+                               NDR_CHECK(ndr_push_security_ace_object(ndr, NDR_SCALARS, &r->object));
+                       break;
+
+                       case SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT:
+                               NDR_CHECK(ndr_push_security_ace_object(ndr, NDR_SCALARS, &r->object));
+                       break;
+
+                       default:
+                       break;
+
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               int level = ndr_push_get_switch_value(ndr, r);
+               switch (level) {
+                       case SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT:
+                               NDR_CHECK(ndr_push_security_ace_object(ndr, NDR_BUFFERS, &r->object));
+                       break;
+
+                       case SEC_ACE_TYPE_ACCESS_DENIED_OBJECT:
+                               NDR_CHECK(ndr_push_security_ace_object(ndr, NDR_BUFFERS, &r->object));
+                       break;
+
+                       case SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT:
+                               NDR_CHECK(ndr_push_security_ace_object(ndr, NDR_BUFFERS, &r->object));
+                       break;
+
+                       case SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT:
+                               NDR_CHECK(ndr_push_security_ace_object(ndr, NDR_BUFFERS, &r->object));
+                       break;
+
+                       default:
+                       break;
+
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_security_ace_object_ctr(struct ndr_pull *ndr, int ndr_flags, union security_ace_object_ctr *r)
+{
+       int level;
+       level = ndr_pull_get_switch_value(ndr, r);
+       if (ndr_flags & NDR_SCALARS) {
+               switch (level) {
+                       case SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT: {
+                               NDR_CHECK(ndr_pull_security_ace_object(ndr, NDR_SCALARS, &r->object));
+                       break; }
+
+                       case SEC_ACE_TYPE_ACCESS_DENIED_OBJECT: {
+                               NDR_CHECK(ndr_pull_security_ace_object(ndr, NDR_SCALARS, &r->object));
+                       break; }
+
+                       case SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT: {
+                               NDR_CHECK(ndr_pull_security_ace_object(ndr, NDR_SCALARS, &r->object));
+                       break; }
+
+                       case SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT: {
+                               NDR_CHECK(ndr_pull_security_ace_object(ndr, NDR_SCALARS, &r->object));
+                       break; }
+
+                       default: {
+                       break; }
+
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               switch (level) {
+                       case SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT:
+                               NDR_CHECK(ndr_pull_security_ace_object(ndr, NDR_BUFFERS, &r->object));
+                       break;
+
+                       case SEC_ACE_TYPE_ACCESS_DENIED_OBJECT:
+                               NDR_CHECK(ndr_pull_security_ace_object(ndr, NDR_BUFFERS, &r->object));
+                       break;
+
+                       case SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT:
+                               NDR_CHECK(ndr_pull_security_ace_object(ndr, NDR_BUFFERS, &r->object));
+                       break;
+
+                       case SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT:
+                               NDR_CHECK(ndr_pull_security_ace_object(ndr, NDR_BUFFERS, &r->object));
+                       break;
+
+                       default:
+                       break;
+
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_security_ace_object_ctr(struct ndr_print *ndr, const char *name, const union security_ace_object_ctr *r)
+{
+       int level;
+       level = ndr_print_get_switch_value(ndr, r);
+       ndr_print_union(ndr, name, level, "security_ace_object_ctr");
+       switch (level) {
+               case SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT:
+                       ndr_print_security_ace_object(ndr, "object", &r->object);
+               break;
+
+               case SEC_ACE_TYPE_ACCESS_DENIED_OBJECT:
+                       ndr_print_security_ace_object(ndr, "object", &r->object);
+               break;
+
+               case SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT:
+                       ndr_print_security_ace_object(ndr, "object", &r->object);
+               break;
+
+               case SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT:
+                       ndr_print_security_ace_object(ndr, "object", &r->object);
+               break;
+
+               default:
+               break;
+
+       }
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_security_ace(struct ndr_push *ndr, int ndr_flags, const struct security_ace *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_security_ace_type(ndr, NDR_SCALARS, r->type));
+               NDR_CHECK(ndr_push_security_ace_flags(ndr, NDR_SCALARS, r->flags));
+               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, ndr_size_security_ace(r, ndr->flags)));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->access_mask));
+               NDR_CHECK(ndr_push_set_switch_value(ndr, &r->object, r->type));
+               NDR_CHECK(ndr_push_security_ace_object_ctr(ndr, NDR_SCALARS, &r->object));
+               NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS, &r->trustee));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_push_security_ace_object_ctr(ndr, NDR_BUFFERS, &r->object));
+               NDR_CHECK(ndr_push_dom_sid(ndr, NDR_BUFFERS, &r->trustee));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_security_ace(struct ndr_pull *ndr, int ndr_flags, struct security_ace *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_security_ace_type(ndr, NDR_SCALARS, &r->type));
+               NDR_CHECK(ndr_pull_security_ace_flags(ndr, NDR_SCALARS, &r->flags));
+               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->size));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->access_mask));
+               NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->object, r->type));
+               NDR_CHECK(ndr_pull_security_ace_object_ctr(ndr, NDR_SCALARS, &r->object));
+               NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS, &r->trustee));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_pull_security_ace_object_ctr(ndr, NDR_BUFFERS, &r->object));
+               NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_BUFFERS, &r->trustee));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_security_ace(struct ndr_print *ndr, const char *name, const struct security_ace *r)
+{
+       ndr_print_struct(ndr, name, "security_ace");
+       ndr->depth++;
+       ndr_print_security_ace_type(ndr, "type", r->type);
+       ndr_print_security_ace_flags(ndr, "flags", r->flags);
+       ndr_print_uint16(ndr, "size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?ndr_size_security_ace(r, ndr->flags):r->size);
+       ndr_print_uint32(ndr, "access_mask", r->access_mask);
+       ndr_print_set_switch_value(ndr, &r->object, r->type);
+       ndr_print_security_ace_object_ctr(ndr, "object", &r->object);
+       ndr_print_dom_sid(ndr, "trustee", &r->trustee);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_security_acl_revision(struct ndr_push *ndr, int ndr_flags, enum security_acl_revision r)
+{
+       NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r));
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_security_acl_revision(struct ndr_pull *ndr, int ndr_flags, enum security_acl_revision *r)
+{
+       uint16_t v;
+       NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v));
+       *r = v;
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_security_acl_revision(struct ndr_print *ndr, const char *name, enum security_acl_revision r)
+{
+       const char *val = NULL;
+
+       switch (r) {
+               case SECURITY_ACL_REVISION_NT4: val = "SECURITY_ACL_REVISION_NT4"; break;
+               case SECURITY_ACL_REVISION_ADS: val = "SECURITY_ACL_REVISION_ADS"; break;
+       }
+       ndr_print_enum(ndr, name, "ENUM", val, r);
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_security_acl(struct ndr_push *ndr, int ndr_flags, const struct security_acl *r)
+{
+       uint32_t cntr_aces_0;
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_security_acl_revision(ndr, NDR_SCALARS, r->revision));
+               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, ndr_size_security_acl(r, ndr->flags)));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num_aces));
+               for (cntr_aces_0 = 0; cntr_aces_0 < r->num_aces; cntr_aces_0++) {
+                       NDR_CHECK(ndr_push_security_ace(ndr, NDR_SCALARS, &r->aces[cntr_aces_0]));
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               for (cntr_aces_0 = 0; cntr_aces_0 < r->num_aces; cntr_aces_0++) {
+                       NDR_CHECK(ndr_push_security_ace(ndr, NDR_BUFFERS, &r->aces[cntr_aces_0]));
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_security_acl(struct ndr_pull *ndr, int ndr_flags, struct security_acl *r)
+{
+       uint32_t cntr_aces_0;
+       TALLOC_CTX *_mem_save_aces_0;
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_security_acl_revision(ndr, NDR_SCALARS, &r->revision));
+               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->size));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->num_aces));
+               if (r->num_aces < 0 || r->num_aces > 1000) {
+                       return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
+               }
+               NDR_PULL_ALLOC_N(ndr, r->aces, r->num_aces);
+               _mem_save_aces_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->aces, 0);
+               for (cntr_aces_0 = 0; cntr_aces_0 < r->num_aces; cntr_aces_0++) {
+                       NDR_CHECK(ndr_pull_security_ace(ndr, NDR_SCALARS, &r->aces[cntr_aces_0]));
+               }
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_aces_0, 0);
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               _mem_save_aces_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->aces, 0);
+               for (cntr_aces_0 = 0; cntr_aces_0 < r->num_aces; cntr_aces_0++) {
+                       NDR_CHECK(ndr_pull_security_ace(ndr, NDR_BUFFERS, &r->aces[cntr_aces_0]));
+               }
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_aces_0, 0);
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_security_acl(struct ndr_print *ndr, const char *name, const struct security_acl *r)
+{
+       uint32_t cntr_aces_0;
+       ndr_print_struct(ndr, name, "security_acl");
+       ndr->depth++;
+       ndr_print_security_acl_revision(ndr, "revision", r->revision);
+       ndr_print_uint16(ndr, "size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?ndr_size_security_acl(r, ndr->flags):r->size);
+       ndr_print_uint32(ndr, "num_aces", r->num_aces);
+       ndr->print(ndr, "%s: ARRAY(%d)", "aces", r->num_aces);
+       ndr->depth++;
+       for (cntr_aces_0=0;cntr_aces_0<r->num_aces;cntr_aces_0++) {
+               char *idx_0=NULL;
+               asprintf(&idx_0, "[%d]", cntr_aces_0);
+               if (idx_0) {
+                       ndr_print_security_ace(ndr, "aces", &r->aces[cntr_aces_0]);
+                       free(idx_0);
+               }
+       }
+       ndr->depth--;
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_security_descriptor_revision(struct ndr_push *ndr, int ndr_flags, enum security_descriptor_revision r)
+{
+       NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r));
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_security_descriptor_revision(struct ndr_pull *ndr, int ndr_flags, enum security_descriptor_revision *r)
+{
+       uint8_t v;
+       NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &v));
+       *r = v;
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_security_descriptor_revision(struct ndr_print *ndr, const char *name, enum security_descriptor_revision r)
+{
+       const char *val = NULL;
+
+       switch (r) {
+               case SECURITY_DESCRIPTOR_REVISION_1: val = "SECURITY_DESCRIPTOR_REVISION_1"; break;
+       }
+       ndr_print_enum(ndr, name, "ENUM", val, r);
+}
+
+static enum ndr_err_code ndr_push_security_descriptor_type(struct ndr_push *ndr, int ndr_flags, uint16_t r)
+{
+       NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r));
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_security_descriptor_type(struct ndr_pull *ndr, int ndr_flags, uint16_t *r)
+{
+       uint16_t v;
+       NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v));
+       *r = v;
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_security_descriptor_type(struct ndr_print *ndr, const char *name, uint16_t r)
+{
+       ndr_print_uint16(ndr, name, r);
+       ndr->depth++;
+       ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_OWNER_DEFAULTED", SEC_DESC_OWNER_DEFAULTED, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_GROUP_DEFAULTED", SEC_DESC_GROUP_DEFAULTED, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_DACL_PRESENT", SEC_DESC_DACL_PRESENT, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_DACL_DEFAULTED", SEC_DESC_DACL_DEFAULTED, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SACL_PRESENT", SEC_DESC_SACL_PRESENT, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SACL_DEFAULTED", SEC_DESC_SACL_DEFAULTED, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_DACL_TRUSTED", SEC_DESC_DACL_TRUSTED, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SERVER_SECURITY", SEC_DESC_SERVER_SECURITY, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_DACL_AUTO_INHERIT_REQ", SEC_DESC_DACL_AUTO_INHERIT_REQ, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SACL_AUTO_INHERIT_REQ", SEC_DESC_SACL_AUTO_INHERIT_REQ, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_DACL_AUTO_INHERITED", SEC_DESC_DACL_AUTO_INHERITED, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SACL_AUTO_INHERITED", SEC_DESC_SACL_AUTO_INHERITED, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_DACL_PROTECTED", SEC_DESC_DACL_PROTECTED, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SACL_PROTECTED", SEC_DESC_SACL_PROTECTED, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_RM_CONTROL_VALID", SEC_DESC_RM_CONTROL_VALID, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SELF_RELATIVE", SEC_DESC_SELF_RELATIVE, r);
+       ndr->depth--;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_security_descriptor(struct ndr_push *ndr, int ndr_flags, const struct security_descriptor *r)
+{
+       {
+               uint32_t _flags_save_STRUCT = ndr->flags;
+               ndr_set_flags(&ndr->flags, LIBNDR_FLAG_LITTLE_ENDIAN);
+               if (ndr_flags & NDR_SCALARS) {
+                       NDR_CHECK(ndr_push_align(ndr, 4));
+                       NDR_CHECK(ndr_push_security_descriptor_revision(ndr, NDR_SCALARS, r->revision));
+                       NDR_CHECK(ndr_push_security_descriptor_type(ndr, NDR_SCALARS, r->type));
+                       NDR_CHECK(ndr_push_relative_ptr1(ndr, r->owner_sid));
+                       NDR_CHECK(ndr_push_relative_ptr1(ndr, r->group_sid));
+                       NDR_CHECK(ndr_push_relative_ptr1(ndr, r->sacl));
+                       NDR_CHECK(ndr_push_relative_ptr1(ndr, r->dacl));
+               }
+               if (ndr_flags & NDR_BUFFERS) {
+                       if (r->owner_sid) {
+                               NDR_CHECK(ndr_push_relative_ptr2(ndr, r->owner_sid));
+                               NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS|NDR_BUFFERS, r->owner_sid));
+                       }
+                       if (r->group_sid) {
+                               NDR_CHECK(ndr_push_relative_ptr2(ndr, r->group_sid));
+                               NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS|NDR_BUFFERS, r->group_sid));
+                       }
+                       if (r->sacl) {
+                               NDR_CHECK(ndr_push_relative_ptr2(ndr, r->sacl));
+                               NDR_CHECK(ndr_push_security_acl(ndr, NDR_SCALARS|NDR_BUFFERS, r->sacl));
+                       }
+                       if (r->dacl) {
+                               NDR_CHECK(ndr_push_relative_ptr2(ndr, r->dacl));
+                               NDR_CHECK(ndr_push_security_acl(ndr, NDR_SCALARS|NDR_BUFFERS, r->dacl));
+                       }
+               }
+               ndr->flags = _flags_save_STRUCT;
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_security_descriptor(struct ndr_pull *ndr, int ndr_flags, struct security_descriptor *r)
+{
+       uint32_t _ptr_owner_sid;
+       TALLOC_CTX *_mem_save_owner_sid_0;
+       uint32_t _ptr_group_sid;
+       TALLOC_CTX *_mem_save_group_sid_0;
+       uint32_t _ptr_sacl;
+       TALLOC_CTX *_mem_save_sacl_0;
+       uint32_t _ptr_dacl;
+       TALLOC_CTX *_mem_save_dacl_0;
+       {
+               uint32_t _flags_save_STRUCT = ndr->flags;
+               ndr_set_flags(&ndr->flags, LIBNDR_FLAG_LITTLE_ENDIAN);
+               if (ndr_flags & NDR_SCALARS) {
+                       NDR_CHECK(ndr_pull_align(ndr, 4));
+                       NDR_CHECK(ndr_pull_security_descriptor_revision(ndr, NDR_SCALARS, &r->revision));
+                       NDR_CHECK(ndr_pull_security_descriptor_type(ndr, NDR_SCALARS, &r->type));
+                       NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_owner_sid));
+                       if (_ptr_owner_sid) {
+                               NDR_PULL_ALLOC(ndr, r->owner_sid);
+                               NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->owner_sid, _ptr_owner_sid));
+                       } else {
+                               r->owner_sid = NULL;
+                       }
+                       NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_group_sid));
+                       if (_ptr_group_sid) {
+                               NDR_PULL_ALLOC(ndr, r->group_sid);
+                               NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->group_sid, _ptr_group_sid));
+                       } else {
+                               r->group_sid = NULL;
+                       }
+                       NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_sacl));
+                       if (_ptr_sacl) {
+                               NDR_PULL_ALLOC(ndr, r->sacl);
+                               NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->sacl, _ptr_sacl));
+                       } else {
+                               r->sacl = NULL;
+                       }
+                       NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_dacl));
+                       if (_ptr_dacl) {
+                               NDR_PULL_ALLOC(ndr, r->dacl);
+                               NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->dacl, _ptr_dacl));
+                       } else {
+                               r->dacl = NULL;
+                       }
+               }
+               if (ndr_flags & NDR_BUFFERS) {
+                       if (r->owner_sid) {
+                               uint32_t _relative_save_offset;
+                               _relative_save_offset = ndr->offset;
+                               NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->owner_sid));
+                               _mem_save_owner_sid_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                               NDR_PULL_SET_MEM_CTX(ndr, r->owner_sid, 0);
+                               NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS|NDR_BUFFERS, r->owner_sid));
+                               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_owner_sid_0, 0);
+                               ndr->offset = _relative_save_offset;
+                       }
+                       if (r->group_sid) {
+                               uint32_t _relative_save_offset;
+                               _relative_save_offset = ndr->offset;
+                               NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->group_sid));
+                               _mem_save_group_sid_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                               NDR_PULL_SET_MEM_CTX(ndr, r->group_sid, 0);
+                               NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS|NDR_BUFFERS, r->group_sid));
+                               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_group_sid_0, 0);
+                               ndr->offset = _relative_save_offset;
+                       }
+                       if (r->sacl) {
+                               uint32_t _relative_save_offset;
+                               _relative_save_offset = ndr->offset;
+                               NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->sacl));
+                               _mem_save_sacl_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                               NDR_PULL_SET_MEM_CTX(ndr, r->sacl, 0);
+                               NDR_CHECK(ndr_pull_security_acl(ndr, NDR_SCALARS|NDR_BUFFERS, r->sacl));
+                               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sacl_0, 0);
+                               ndr->offset = _relative_save_offset;
+                       }
+                       if (r->dacl) {
+                               uint32_t _relative_save_offset;
+                               _relative_save_offset = ndr->offset;
+                               NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->dacl));
+                               _mem_save_dacl_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                               NDR_PULL_SET_MEM_CTX(ndr, r->dacl, 0);
+                               NDR_CHECK(ndr_pull_security_acl(ndr, NDR_SCALARS|NDR_BUFFERS, r->dacl));
+                               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_dacl_0, 0);
+                               ndr->offset = _relative_save_offset;
+                       }
+               }
+               ndr->flags = _flags_save_STRUCT;
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_security_descriptor(struct ndr_print *ndr, const char *name, const struct security_descriptor *r)
+{
+       ndr_print_struct(ndr, name, "security_descriptor");
+       {
+               uint32_t _flags_save_STRUCT = ndr->flags;
+               ndr_set_flags(&ndr->flags, LIBNDR_FLAG_LITTLE_ENDIAN);
+               ndr->depth++;
+               ndr_print_security_descriptor_revision(ndr, "revision", r->revision);
+               ndr_print_security_descriptor_type(ndr, "type", r->type);
+               ndr_print_ptr(ndr, "owner_sid", r->owner_sid);
+               ndr->depth++;
+               if (r->owner_sid) {
+                       ndr_print_dom_sid(ndr, "owner_sid", r->owner_sid);
+               }
+               ndr->depth--;
+               ndr_print_ptr(ndr, "group_sid", r->group_sid);
+               ndr->depth++;
+               if (r->group_sid) {
+                       ndr_print_dom_sid(ndr, "group_sid", r->group_sid);
+               }
+               ndr->depth--;
+               ndr_print_ptr(ndr, "sacl", r->sacl);
+               ndr->depth++;
+               if (r->sacl) {
+                       ndr_print_security_acl(ndr, "sacl", r->sacl);
+               }
+               ndr->depth--;
+               ndr_print_ptr(ndr, "dacl", r->dacl);
+               ndr->depth++;
+               if (r->dacl) {
+                       ndr_print_security_acl(ndr, "dacl", r->dacl);
+               }
+               ndr->depth--;
+               ndr->depth--;
+               ndr->flags = _flags_save_STRUCT;
+       }
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_sec_desc_buf(struct ndr_push *ndr, int ndr_flags, const struct sec_desc_buf *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_size_security_descriptor(r->sd, ndr->flags)));
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->sd));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               if (r->sd) {
+                       {
+                               struct ndr_push *_ndr_sd;
+                               NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_sd, 4, -1));
+                               NDR_CHECK(ndr_push_security_descriptor(_ndr_sd, NDR_SCALARS|NDR_BUFFERS, r->sd));
+                               NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_sd, 4, -1));
+                       }
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_sec_desc_buf(struct ndr_pull *ndr, int ndr_flags, struct sec_desc_buf *r)
+{
+       uint32_t _ptr_sd;
+       TALLOC_CTX *_mem_save_sd_0;
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->sd_size));
+               if (r->sd_size < 0 || r->sd_size > 0x40000) {
+                       return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
+               }
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_sd));
+               if (_ptr_sd) {
+                       NDR_PULL_ALLOC(ndr, r->sd);
+               } else {
+                       r->sd = NULL;
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               if (r->sd) {
+                       _mem_save_sd_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->sd, 0);
+                       {
+                               struct ndr_pull *_ndr_sd;
+                               NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_sd, 4, -1));
+                               NDR_CHECK(ndr_pull_security_descriptor(_ndr_sd, NDR_SCALARS|NDR_BUFFERS, r->sd));
+                               NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_sd, 4, -1));
+                       }
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sd_0, 0);
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_sec_desc_buf(struct ndr_print *ndr, const char *name, const struct sec_desc_buf *r)
+{
+       ndr_print_struct(ndr, name, "sec_desc_buf");
+       ndr->depth++;
+       ndr_print_uint32(ndr, "sd_size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?ndr_size_security_descriptor(r->sd, ndr->flags):r->sd_size);
+       ndr_print_ptr(ndr, "sd", r->sd);
+       ndr->depth++;
+       if (r->sd) {
+               ndr_print_security_descriptor(ndr, "sd", r->sd);
+       }
+       ndr->depth--;
+       ndr->depth--;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_security_token(struct ndr_push *ndr, int ndr_flags, const struct security_token *r)
+{
+       uint32_t cntr_sids_0;
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->user_sid));
+               NDR_CHECK(ndr_push_unique_ptr(ndr, r->group_sid));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num_sids));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num_sids));
+               for (cntr_sids_0 = 0; cntr_sids_0 < r->num_sids; cntr_sids_0++) {
+                       NDR_CHECK(ndr_push_unique_ptr(ndr, r->sids[cntr_sids_0]));
+               }
+               NDR_CHECK(ndr_push_udlong(ndr, NDR_SCALARS, r->privilege_mask));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               if (r->user_sid) {
+                       NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS|NDR_BUFFERS, r->user_sid));
+               }
+               if (r->group_sid) {
+                       NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS|NDR_BUFFERS, r->group_sid));
+               }
+               for (cntr_sids_0 = 0; cntr_sids_0 < r->num_sids; cntr_sids_0++) {
+                       if (r->sids[cntr_sids_0]) {
+                               NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS|NDR_BUFFERS, r->sids[cntr_sids_0]));
+                       }
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_security_token(struct ndr_pull *ndr, int ndr_flags, struct security_token *r)
+{
+       uint32_t _ptr_user_sid;
+       TALLOC_CTX *_mem_save_user_sid_0;
+       uint32_t _ptr_group_sid;
+       TALLOC_CTX *_mem_save_group_sid_0;
+       uint32_t _ptr_sids;
+       uint32_t cntr_sids_0;
+       TALLOC_CTX *_mem_save_sids_0;
+       TALLOC_CTX *_mem_save_sids_1;
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_user_sid));
+               if (_ptr_user_sid) {
+                       NDR_PULL_ALLOC(ndr, r->user_sid);
+               } else {
+                       r->user_sid = NULL;
+               }
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_group_sid));
+               if (_ptr_group_sid) {
+                       NDR_PULL_ALLOC(ndr, r->group_sid);
+               } else {
+                       r->group_sid = NULL;
+               }
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->num_sids));
+               NDR_CHECK(ndr_pull_array_size(ndr, &r->sids));
+               NDR_PULL_ALLOC_N(ndr, r->sids, ndr_get_array_size(ndr, &r->sids));
+               _mem_save_sids_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->sids, 0);
+               for (cntr_sids_0 = 0; cntr_sids_0 < r->num_sids; cntr_sids_0++) {
+                       NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_sids));
+                       if (_ptr_sids) {
+                               NDR_PULL_ALLOC(ndr, r->sids[cntr_sids_0]);
+                       } else {
+                               r->sids[cntr_sids_0] = NULL;
+                       }
+               }
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sids_0, 0);
+               NDR_CHECK(ndr_pull_udlong(ndr, NDR_SCALARS, &r->privilege_mask));
+               if (r->sids) {
+                       NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->sids, r->num_sids));
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               if (r->user_sid) {
+                       _mem_save_user_sid_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->user_sid, 0);
+                       NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS|NDR_BUFFERS, r->user_sid));
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_user_sid_0, 0);
+               }
+               if (r->group_sid) {
+                       _mem_save_group_sid_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->group_sid, 0);
+                       NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS|NDR_BUFFERS, r->group_sid));
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_group_sid_0, 0);
+               }
+               _mem_save_sids_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->sids, 0);
+               for (cntr_sids_0 = 0; cntr_sids_0 < r->num_sids; cntr_sids_0++) {
+                       if (r->sids[cntr_sids_0]) {
+                               _mem_save_sids_1 = NDR_PULL_GET_MEM_CTX(ndr);
+                               NDR_PULL_SET_MEM_CTX(ndr, r->sids[cntr_sids_0], 0);
+                               NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS|NDR_BUFFERS, r->sids[cntr_sids_0]));
+                               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sids_1, 0);
+                       }
+               }
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sids_0, 0);
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_security_token(struct ndr_print *ndr, const char *name, const struct security_token *r)
+{
+       uint32_t cntr_sids_0;
+       ndr_print_struct(ndr, name, "security_token");
+       ndr->depth++;
+       ndr_print_ptr(ndr, "user_sid", r->user_sid);
+       ndr->depth++;
+       if (r->user_sid) {
+               ndr_print_dom_sid(ndr, "user_sid", r->user_sid);
+       }
+       ndr->depth--;
+       ndr_print_ptr(ndr, "group_sid", r->group_sid);
+       ndr->depth++;
+       if (r->group_sid) {
+               ndr_print_dom_sid(ndr, "group_sid", r->group_sid);
+       }
+       ndr->depth--;
+       ndr_print_uint32(ndr, "num_sids", r->num_sids);
+       ndr->print(ndr, "%s: ARRAY(%d)", "sids", r->num_sids);
+       ndr->depth++;
+       for (cntr_sids_0=0;cntr_sids_0<r->num_sids;cntr_sids_0++) {
+               char *idx_0=NULL;
+               asprintf(&idx_0, "[%d]", cntr_sids_0);
+               if (idx_0) {
+                       ndr_print_ptr(ndr, "sids", r->sids[cntr_sids_0]);
+                       ndr->depth++;
+                       if (r->sids[cntr_sids_0]) {
+                               ndr_print_dom_sid(ndr, "sids", r->sids[cntr_sids_0]);
+                       }
+                       ndr->depth--;
+                       free(idx_0);
+               }
+       }
+       ndr->depth--;
+       ndr_print_udlong(ndr, "privilege_mask", r->privilege_mask);
+       ndr->depth--;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_security_secinfo(struct ndr_push *ndr, int ndr_flags, uint32_t r)
+{
+       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_security_secinfo(struct ndr_pull *ndr, int ndr_flags, uint32_t *r)
+{
+       uint32_t v;
+       NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
+       *r = v;
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_security_secinfo(struct ndr_print *ndr, const char *name, uint32_t r)
+{
+       ndr_print_uint32(ndr, name, r);
+       ndr->depth++;
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_OWNER", SECINFO_OWNER, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_GROUP", SECINFO_GROUP, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_DACL", SECINFO_DACL, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_SACL", SECINFO_SACL, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_UNPROTECTED_SACL", SECINFO_UNPROTECTED_SACL, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_UNPROTECTED_DACL", SECINFO_UNPROTECTED_DACL, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_PROTECTED_SACL", SECINFO_PROTECTED_SACL, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_PROTECTED_DACL", SECINFO_PROTECTED_DACL, r);
+       ndr->depth--;
+}
+
index 292e9011c6223496d113af0ae3d83957b4a1d95d..79bfd78f5155d268565d6af50e3e13b7fee92341 100644 (file)
@@ -1,2 +1,41 @@
-/* empty header to deal with pidl */
+/* header auto-generated by pidl */
 
+#include "librpc/ndr/libndr.h"
+#include "librpc/gen_ndr/security.h"
+
+#ifndef _HEADER_NDR_security
+#define _HEADER_NDR_security
+
+#define NDR_SECURITY_CALL_COUNT (0)
+void ndr_print_security_ace_flags(struct ndr_print *ndr, const char *name, uint8_t r);
+void ndr_print_security_ace_type(struct ndr_print *ndr, const char *name, enum security_ace_type r);
+void ndr_print_security_ace_object_flags(struct ndr_print *ndr, const char *name, uint32_t r);
+void ndr_print_security_ace_object_type(struct ndr_print *ndr, const char *name, const union security_ace_object_type *r);
+void ndr_print_security_ace_object_inherited_type(struct ndr_print *ndr, const char *name, const union security_ace_object_inherited_type *r);
+void ndr_print_security_ace_object(struct ndr_print *ndr, const char *name, const struct security_ace_object *r);
+void ndr_print_security_ace_object_ctr(struct ndr_print *ndr, const char *name, const union security_ace_object_ctr *r);
+enum ndr_err_code ndr_push_security_ace(struct ndr_push *ndr, int ndr_flags, const struct security_ace *r);
+enum ndr_err_code ndr_pull_security_ace(struct ndr_pull *ndr, int ndr_flags, struct security_ace *r);
+void ndr_print_security_ace(struct ndr_print *ndr, const char *name, const struct security_ace *r);
+size_t ndr_size_security_ace(const struct security_ace *r, int flags);
+void ndr_print_security_acl_revision(struct ndr_print *ndr, const char *name, enum security_acl_revision r);
+enum ndr_err_code ndr_push_security_acl(struct ndr_push *ndr, int ndr_flags, const struct security_acl *r);
+enum ndr_err_code ndr_pull_security_acl(struct ndr_pull *ndr, int ndr_flags, struct security_acl *r);
+void ndr_print_security_acl(struct ndr_print *ndr, const char *name, const struct security_acl *r);
+size_t ndr_size_security_acl(const struct security_acl *r, int flags);
+void ndr_print_security_descriptor_revision(struct ndr_print *ndr, const char *name, enum security_descriptor_revision r);
+void ndr_print_security_descriptor_type(struct ndr_print *ndr, const char *name, uint16_t r);
+enum ndr_err_code ndr_push_security_descriptor(struct ndr_push *ndr, int ndr_flags, const struct security_descriptor *r);
+enum ndr_err_code ndr_pull_security_descriptor(struct ndr_pull *ndr, int ndr_flags, struct security_descriptor *r);
+void ndr_print_security_descriptor(struct ndr_print *ndr, const char *name, const struct security_descriptor *r);
+size_t ndr_size_security_descriptor(const struct security_descriptor *r, int flags);
+enum ndr_err_code ndr_push_sec_desc_buf(struct ndr_push *ndr, int ndr_flags, const struct sec_desc_buf *r);
+enum ndr_err_code ndr_pull_sec_desc_buf(struct ndr_pull *ndr, int ndr_flags, struct sec_desc_buf *r);
+void ndr_print_sec_desc_buf(struct ndr_print *ndr, const char *name, const struct sec_desc_buf *r);
+enum ndr_err_code ndr_push_security_token(struct ndr_push *ndr, int ndr_flags, const struct security_token *r);
+enum ndr_err_code ndr_pull_security_token(struct ndr_pull *ndr, int ndr_flags, struct security_token *r);
+void ndr_print_security_token(struct ndr_print *ndr, const char *name, const struct security_token *r);
+enum ndr_err_code ndr_push_security_secinfo(struct ndr_push *ndr, int ndr_flags, uint32_t r);
+enum ndr_err_code ndr_pull_security_secinfo(struct ndr_pull *ndr, int ndr_flags, uint32_t *r);
+void ndr_print_security_secinfo(struct ndr_print *ndr, const char *name, uint32_t r);
+#endif /* _HEADER_NDR_security */
index 7da684db87c7f21a4ebb7a869b0592b82adb967f..b8d5dc186d6b1a1958c3c850c98e9cea333b479a 100644 (file)
@@ -197,14 +197,14 @@ static enum ndr_err_code ndr_pull_ENUM_SERVICE_STATUS(struct ndr_pull *ndr, int
                        uint32_t _flags_save_string = ndr->flags;
                        ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM);
                        if (r->service_name) {
-                               struct ndr_pull_save _relative_save;
-                               ndr_pull_save(ndr, &_relative_save);
+                               uint32_t _relative_save_offset;
+                               _relative_save_offset = ndr->offset;
                                NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->service_name));
                                _mem_save_service_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
                                NDR_PULL_SET_MEM_CTX(ndr, r->service_name, 0);
                                NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->service_name));
                                NDR_PULL_SET_MEM_CTX(ndr, _mem_save_service_name_0, 0);
-                               ndr_pull_restore(ndr, &_relative_save);
+                               ndr->offset = _relative_save_offset;
                        }
                        ndr->flags = _flags_save_string;
                }
@@ -212,14 +212,14 @@ static enum ndr_err_code ndr_pull_ENUM_SERVICE_STATUS(struct ndr_pull *ndr, int
                        uint32_t _flags_save_string = ndr->flags;
                        ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM);
                        if (r->display_name) {
-                               struct ndr_pull_save _relative_save;
-                               ndr_pull_save(ndr, &_relative_save);
+                               uint32_t _relative_save_offset;
+                               _relative_save_offset = ndr->offset;
                                NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->display_name));
                                _mem_save_display_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
                                NDR_PULL_SET_MEM_CTX(ndr, r->display_name, 0);
                                NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->display_name));
                                NDR_PULL_SET_MEM_CTX(ndr, _mem_save_display_name_0, 0);
-                               ndr_pull_restore(ndr, &_relative_save);
+                               ndr->offset = _relative_save_offset;
                        }
                        ndr->flags = _flags_save_string;
                }
index 3599fef352f1ba39f0f610feac47eabd1b010be7..c3a1f706cd4c08b6b657e918ca3d1fe15ae27564 100644 (file)
@@ -8606,6 +8606,7 @@ static enum ndr_err_code ndr_pull_wkssvc_NetrGetJoinableOus(struct ndr_pull *ndr
        TALLOC_CTX *_mem_save_unknown_0;
        TALLOC_CTX *_mem_save_num_ous_0;
        TALLOC_CTX *_mem_save_ous_1;
+       TALLOC_CTX *_mem_save_ous_2;
        if (flags & NDR_IN) {
                ZERO_STRUCT(r->out);
 
@@ -9487,6 +9488,7 @@ static enum ndr_err_code ndr_pull_wkssvc_NetrGetJoinableOus2(struct ndr_pull *nd
        TALLOC_CTX *_mem_save_EncryptedPassword_0;
        TALLOC_CTX *_mem_save_num_ous_0;
        TALLOC_CTX *_mem_save_ous_1;
+       TALLOC_CTX *_mem_save_ous_2;
        if (flags & NDR_IN) {
                ZERO_STRUCT(r->out);
 
diff --git a/source/librpc/gen_ndr/ndr_xattr.c b/source/librpc/gen_ndr/ndr_xattr.c
new file mode 100644 (file)
index 0000000..425ad81
--- /dev/null
@@ -0,0 +1,103 @@
+/* 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--;
+}
+
diff --git a/source/librpc/gen_ndr/ndr_xattr.h b/source/librpc/gen_ndr/ndr_xattr.h
new file mode 100644 (file)
index 0000000..a18477f
--- /dev/null
@@ -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 */
index 246748e89afe0020e51ab5683cf3086433ab057c..c8f3c03c792653cff94c1847db644625e1158221 100644 (file)
@@ -8,12 +8,10 @@
 #ifndef _HEADER_netlogon
 #define _HEADER_netlogon
 
-#define MSV1_0_CLEARTEXT_PASSWORD_ALLOWED      ( 0x002 )
-#define MSV1_0_ALLOW_SERVER_TRUST_ACCOUNT      ( 0x020 )
-#define MSV1_0_ALLOW_WORKSTATION_TRUST_ACCOUNT ( 0x800 )
 #define NETLOGON_NEG_ARCFOUR   ( 0x00000004 )
 #define NETLOGON_NEG_128BIT    ( 0x00004000 )
 #define NETLOGON_NEG_SCHANNEL  ( 0x40000000 )
+#define DS_GFTI_UPDATE_TDO     ( 0x1 )
 struct netr_UasInfo {
        const char *account_name;/* [unique,charset(UTF16)] */
        uint32_t priv;
@@ -44,6 +42,14 @@ struct netr_AcctLockStr {
        uint16_t *bindata;/* [unique,length_is(length/2),size_is(size/2)] */
 };
 
+/* bitmap netr_LogonParameterControl */
+#define MSV1_0_CLEARTEXT_PASSWORD_ALLOWED ( 0x00000002 )
+#define MSV1_0_UPDATE_LOGON_STATISTICS ( 0x00000004 )
+#define MSV1_0_RETURN_USER_PARAMETERS ( 0x00000008 )
+#define MSV1_0_ALLOW_SERVER_TRUST_ACCOUNT ( 0x00000020 )
+#define MSV1_0_RETURN_PROFILE_PATH ( 0x00000200 )
+#define MSV1_0_ALLOW_WORKSTATION_TRUST_ACCOUNT ( 0x00000800 )
+
 struct netr_IdentityInfo {
        struct lsa_String domain_name;
        uint32_t parameter_control;
@@ -77,11 +83,6 @@ union netr_LogonLevel {
        struct netr_NetworkInfo *network;/* [unique,case(2)] */
 }/* [public,switch_type(uint16)] */;
 
-struct netr_GroupMembership {
-       uint32_t rid;
-       uint32_t attributes;
-}/* [public] */;
-
 struct netr_UserSessionKey {
        uint8_t key[16];
 }/* [public,flag(LIBNDR_PRINT_ARRAY_HEX)] */;
@@ -91,18 +92,17 @@ struct netr_LMSessionKey {
 }/* [public,flag(LIBNDR_PRINT_ARRAY_HEX)] */;
 
 /* bitmap netr_UserFlags */
-#define NETLOGON_GUEST ( 0x0001 )
-#define NETLOGON_NOENCRYPTION ( 0x0002 )
-#define NETLOGON_CACHED_ACCOUNT ( 0x0004 )
-#define NETLOGON_USED_LM_PASSWORD ( 0x0008 )
-#define NETLOGON_EXTRA_SIDS ( 0x0020 )
-#define NETLOGON_SUBAUTH_SESSION_KEY ( 0x0040 )
-#define NETLOGON_SERVER_TRUST_ACCOUNT ( 0x0080 )
-#define NETLOGON_NTLMV2_ENABLED ( 0x0100 )
-#define NETLOGON_RESOURCE_GROUPS ( 0x0200 )
-#define NETLOGON_PROFILE_PATH_RETURNED ( 0x0400 )
-
-;
+#define NETLOGON_GUEST ( 0x00000001 )
+#define NETLOGON_NOENCRYPTION ( 0x00000002 )
+#define NETLOGON_CACHED_ACCOUNT ( 0x00000004 )
+#define NETLOGON_USED_LM_PASSWORD ( 0x00000008 )
+#define NETLOGON_EXTRA_SIDS ( 0x00000020 )
+#define NETLOGON_SUBAUTH_SESSION_KEY ( 0x00000040 )
+#define NETLOGON_SERVER_TRUST_ACCOUNT ( 0x00000080 )
+#define NETLOGON_NTLMV2_ENABLED ( 0x00000100 )
+#define NETLOGON_RESOURCE_GROUPS ( 0x00000200 )
+#define NETLOGON_PROFILE_PATH_RETURNED ( 0x00000400 )
+#define NETLOGON_GRACE_LOGON ( 0x01000000 )
 
 struct netr_SamBaseInfo {
        NTTIME last_logon;
@@ -138,7 +138,7 @@ struct netr_SamInfo2 {
 
 struct netr_SidAttr {
        struct dom_sid2 *sid;/* [unique] */
-       uint32_t attribute;
+       uint32_t attributes;
 };
 
 struct netr_SamInfo3 {
@@ -188,6 +188,10 @@ struct netr_Authenticator {
        time_t timestamp;
 }/* [public] */;
 
+enum netr_SchannelType;
+
+enum netr_SamDatabaseID;
+
 struct netr_DELTA_DELETE_USER {
        const char *account_name;/* [unique,charset(UTF16)] */
        struct lsa_String unknown1;
@@ -209,10 +213,10 @@ struct netr_USER_KEY16 {
 
 struct netr_PasswordHistory {
        uint16_t nt_length;
-       uint16_t nt_size;
+       uint16_t nt_size;/* [value(nt_length)] */
        uint32_t nt_flags;
        uint16_t lm_length;
-       uint16_t lm_size;
+       uint16_t lm_size;/* [value(lm_length)] */
        uint32_t lm_flags;
        uint8_t *nt_history;
        uint8_t *lm_history;
@@ -221,7 +225,7 @@ struct netr_PasswordHistory {
 struct netr_USER_KEYS2 {
        struct netr_USER_KEY16 lmpassword;
        struct netr_USER_KEY16 ntpassword;
-       struct netr_PasswordHistory lmhistory;
+       struct netr_PasswordHistory history;
 };
 
 struct netr_USER_KEY_UNION {
@@ -466,8 +470,9 @@ struct netr_DELTA_SECRET {
        uint32_t unknown8;
 };
 
+enum netr_DeltaEnum
 #ifndef USE_UINT_ENUMS
-enum netr_DeltaEnum {
+ {
        NETR_DELTA_DOMAIN=1,
        NETR_DELTA_GROUP=2,
        NETR_DELTA_DELETE_GROUP=3,
@@ -492,7 +497,7 @@ enum netr_DeltaEnum {
        NETR_DELTA_MODIFY_COUNT=22
 }
 #else
-enum netr_DeltaEnum { __donnot_use_enum_netr_DeltaEnum=0x7FFFFFFF}
+ { __donnot_use_enum_netr_DeltaEnum=0x7FFFFFFF}
 #define NETR_DELTA_DOMAIN ( 1 )
 #define NETR_DELTA_GROUP ( 2 )
 #define NETR_DELTA_DELETE_GROUP ( 3 )
@@ -595,15 +600,16 @@ union netr_CONTROL_QUERY_INFORMATION {
        struct netr_NETLOGON_INFO_3 *info3;/* [unique,case(3)] */
 };
 
+enum netr_LogonControlCode
 #ifndef USE_UINT_ENUMS
-enum netr_LogonControlCode {
+ {
        NETLOGON_CONTROL_REDISCOVER=5,
        NETLOGON_CONTROL_TC_QUERY=6,
        NETLOGON_CONTROL_TRANSPORT_NOTIFY=7,
        NETLOGON_CONTROL_SET_DBFLAG=65534
 }
 #else
-enum netr_LogonControlCode { __donnot_use_enum_netr_LogonControlCode=0x7FFFFFFF}
+ { __donnot_use_enum_netr_LogonControlCode=0x7FFFFFFF}
 #define NETLOGON_CONTROL_REDISCOVER ( 5 )
 #define NETLOGON_CONTROL_TC_QUERY ( 6 )
 #define NETLOGON_CONTROL_TRANSPORT_NOTIFY ( 7 )
@@ -616,10 +622,66 @@ union netr_CONTROL_DATA_INFORMATION {
        uint32_t debug_level;/* [case(NETLOGON_CONTROL_SET_DBFLAG)] */
 };
 
+struct netr_Blob {
+       uint32_t length;
+       uint8_t *data;/* [unique,size_is(length)] */
+};
+
+/* bitmap netr_DsRGetDCName_flags */
+#define DS_FORCE_REDISCOVERY ( 0x00000001 )
+#define DS_DIRECTORY_SERVICE_REQUIRED ( 0x00000010 )
+#define DS_DIRECTORY_SERVICE_PREFERRED ( 0x00000020 )
+#define DS_GC_SERVER_REQUIRED ( 0x00000040 )
+#define DS_PDC_REQUIRED ( 0x00000080 )
+#define DS_BACKGROUND_ONLY ( 0x00000100 )
+#define DS_IP_REQUIRED ( 0x00000200 )
+#define DS_KDC_REQUIRED ( 0x00000400 )
+#define DS_TIMESERV_REQUIRED ( 0x00000800 )
+#define DS_WRITABLE_REQUIRED ( 0x00001000 )
+#define DS_GOOD_TIMESERV_PREFERRED ( 0x00002000 )
+#define DS_AVOID_SELF ( 0x00004000 )
+#define DS_ONLY_LDAP_NEEDED ( 0x00008000 )
+#define DS_IS_FLAT_NAME ( 0x00010000 )
+#define DS_IS_DNS_NAME ( 0x00020000 )
+#define DS_TRY_NEXTCLOSEST_SITE ( 0x00040000 )
+#define DS_DIRECTORY_SERVICE_6_REQUIRED ( 0x00080000 )
+#define DS_RETURN_DNS_NAME ( 0x40000000 )
+#define DS_RETURN_FLAT_NAME ( 0x80000000 )
+
+enum netr_DsRGetDCNameInfo_AddressType
+#ifndef USE_UINT_ENUMS
+ {
+       DS_ADDRESS_TYPE_INET=1,
+       DS_ADDRESS_TYPE_NETBIOS=2
+}
+#else
+ { __donnot_use_enum_netr_DsRGetDCNameInfo_AddressType=0x7FFFFFFF}
+#define DS_ADDRESS_TYPE_INET ( 1 )
+#define DS_ADDRESS_TYPE_NETBIOS ( 2 )
+#endif
+;
+
+/* bitmap netr_DsR_DcFlags */
+#define DS_SERVER_PDC ( 0x00000001 )
+#define DS_SERVER_GC ( 0x00000004 )
+#define DS_SERVER_LDAP ( 0x00000008 )
+#define DS_SERVER_DS ( 0x00000010 )
+#define DS_SERVER_KDC ( 0x00000020 )
+#define DS_SERVER_TIMESERV ( 0x00000040 )
+#define DS_SERVER_CLOSEST ( 0x00000080 )
+#define DS_SERVER_WRITABLE ( 0x00000100 )
+#define DS_SERVER_GOOD_TIMESERV ( 0x00000200 )
+#define DS_SERVER_NDNC ( 0x00000400 )
+#define DS_SERVER_SELECT_SECRET_DOMAIN_6 ( 0x00000800 )
+#define DS_SERVER_FULL_SECRET_DOMAIN_6 ( 0x00001000 )
+#define DS_DNS_CONTROLLER ( 0x20000000 )
+#define DS_DNS_DOMAIN ( 0x40000000 )
+#define DS_DNS_FOREST ( 0x80000000 )
+
 struct netr_DsRGetDCNameInfo {
        const char *dc_unc;/* [unique,charset(UTF16)] */
        const char *dc_address;/* [unique,charset(UTF16)] */
-       int32_t dc_address_type;
+       enum netr_DsRGetDCNameInfo_AddressType dc_address_type;
        struct GUID domain_guid;
        const char *domain_name;/* [unique,charset(UTF16)] */
        const char *forest_name;/* [unique,charset(UTF16)] */
@@ -628,11 +690,6 @@ struct netr_DsRGetDCNameInfo {
        const char *client_site_name;/* [unique,charset(UTF16)] */
 };
 
-struct netr_Blob {
-       uint32_t length;
-       uint8_t *data;/* [unique,size_is(length)] */
-};
-
 struct netr_BinaryString {
        uint16_t length;
        uint16_t size;
@@ -684,6 +741,16 @@ struct netr_CryptPassword {
        uint32_t length;
 }/* [flag(LIBNDR_PRINT_ARRAY_HEX)] */;
 
+struct netr_DsRAddressToSitenamesWCtr {
+       uint32_t count;
+       struct lsa_String *sitename;/* [unique,size_is(count)] */
+};
+
+struct netr_DsRAddress {
+       uint8_t *buffer;/* [unique,size_is(size)] */
+       uint32_t size;
+};
+
 /* bitmap netr_TrustFlags */
 #define NETR_TRUST_FLAG_IN_FOREST ( 0x00000001 )
 #define NETR_TRUST_FLAG_OUTBOUND ( 0x00000002 )
@@ -692,17 +759,16 @@ struct netr_CryptPassword {
 #define NETR_TRUST_FLAG_NATIVE ( 0x00000010 )
 #define NETR_TRUST_FLAG_INBOUND ( 0x00000020 )
 
-;
-
+enum netr_TrustType
 #ifndef USE_UINT_ENUMS
-enum netr_TrustType {
+ {
        NETR_TRUST_TYPE_DOWNLEVEL=1,
        NETR_TRUST_TYPE_UPLEVEL=2,
        NETR_TRUST_TYPE_MIT=3,
        NETR_TRUST_TYPE_DCE=4
 }
 #else
-enum netr_TrustType { __donnot_use_enum_netr_TrustType=0x7FFFFFFF}
+ { __donnot_use_enum_netr_TrustType=0x7FFFFFFF}
 #define NETR_TRUST_TYPE_DOWNLEVEL ( 1 )
 #define NETR_TRUST_TYPE_UPLEVEL ( 2 )
 #define NETR_TRUST_TYPE_MIT ( 3 )
@@ -719,8 +785,6 @@ enum netr_TrustType { __donnot_use_enum_netr_TrustType=0x7FFFFFFF}
 #define NETR_TRUST_ATTRIBUTE_WITHIN_FOREST ( 0x00000020 )
 #define NETR_TRUST_ATTRIBUTE_TREAT_AS_EXTERNAL ( 0x00000040 )
 
-;
-
 struct netr_DomainTrust {
        const char *netbios_name;/* [unique,charset(UTF16)] */
        const char *dns_name;/* [unique,charset(UTF16)] */
@@ -732,6 +796,22 @@ struct netr_DomainTrust {
        struct GUID guid;
 };
 
+struct netr_DomainTrustList {
+       uint32_t count;
+       struct netr_DomainTrust *array;/* [unique,size_is(count)] */
+};
+
+struct netr_DsRAddressToSitenamesExWCtr {
+       uint32_t count;
+       struct lsa_String *sitename;/* [unique,size_is(count)] */
+       struct lsa_String *subnetname;/* [unique,size_is(count)] */
+};
+
+struct DcSitesCtr {
+       uint32_t num_sites;
+       struct lsa_String *sites;/* [unique,size_is(num_sites)] */
+};
+
 
 struct netr_LogonUasLogon {
        struct {
@@ -741,7 +821,7 @@ struct netr_LogonUasLogon {
        } in;
 
        struct {
-               struct netr_UasInfo *info;/* [unique] */
+               struct netr_UasInfo *info;/* [ref] */
                WERROR result;
        } out;
 
@@ -864,7 +944,7 @@ struct netr_DatabaseDeltas {
        } in;
 
        struct {
-               struct netr_DELTA_ENUM_ARRAY *delta_enum_array;/* [unique] */
+               struct netr_DELTA_ENUM_ARRAY *delta_enum_array;/* [ref] */
                struct netr_Authenticator *return_authenticator;/* [ref] */
                uint64_t *sequence_num;/* [ref] */
                NTSTATUS result;
@@ -885,7 +965,7 @@ struct netr_DatabaseSync {
        } in;
 
        struct {
-               struct netr_DELTA_ENUM_ARRAY *delta_enum_array;/* [unique] */
+               struct netr_DELTA_ENUM_ARRAY *delta_enum_array;/* [ref] */
                struct netr_Authenticator *return_authenticator;/* [ref] */
                uint32_t *sync_context;/* [ref] */
                NTSTATUS result;
@@ -951,7 +1031,7 @@ struct netr_GetDcName {
 
        struct {
                const char **dcname;/* [ref,charset(UTF16)] */
-               NTSTATUS result;
+               WERROR result;
        } out;
 
 };
@@ -1034,7 +1114,7 @@ struct netr_DatabaseSync2 {
        } in;
 
        struct {
-               struct netr_DELTA_ENUM_ARRAY *delta_enum_array;/* [unique] */
+               struct netr_DELTA_ENUM_ARRAY *delta_enum_array;/* [ref] */
                struct netr_Authenticator *return_authenticator;/* [ref] */
                uint32_t *sync_context;/* [ref] */
                NTSTATUS result;
@@ -1054,7 +1134,7 @@ struct netr_DatabaseRedo {
        } in;
 
        struct {
-               struct netr_DELTA_ENUM_ARRAY *delta_enum_array;/* [unique] */
+               struct netr_DELTA_ENUM_ARRAY *delta_enum_array;/* [ref] */
                struct netr_Authenticator *return_authenticator;/* [ref] */
                NTSTATUS result;
        } out;
@@ -1078,8 +1158,13 @@ struct netr_LogonControl2Ex {
 };
 
 
-struct netr_NETRENUMERATETRUSTEDDOMAINS {
+struct netr_NetrEnumerateTrustedDomains {
+       struct {
+               const char *server_name;/* [unique,charset(UTF16)] */
+       } in;
+
        struct {
+               struct netr_Blob *trusted_domains_blob;/* [ref] */
                WERROR result;
        } out;
 
@@ -1096,7 +1181,7 @@ struct netr_DsRGetDCName {
        } in;
 
        struct {
-               struct netr_DsRGetDCNameInfo *info;/* [unique] */
+               struct netr_DsRGetDCNameInfo *info;/* [ref] */
                WERROR result;
        } out;
 
@@ -1119,8 +1204,14 @@ struct netr_NETRLOGONSETSERVICEBITS {
 };
 
 
-struct netr_NETRLOGONGETTRUSTRID {
+struct netr_LogonGetTrustRid {
        struct {
+               const char *server_name;/* [unique,charset(UTF16)] */
+               const char *domain_name;/* [unique,charset(UTF16)] */
+       } in;
+
+       struct {
+               uint32_t *rid;/* [ref] */
                WERROR result;
        } out;
 
@@ -1173,7 +1264,7 @@ struct netr_DsRGetDCNameEx {
        } in;
 
        struct {
-               struct netr_DsRGetDCNameInfo *info;/* [unique] */
+               struct netr_DsRGetDCNameInfo **info;/* [ref] */
                WERROR result;
        } out;
 
@@ -1230,8 +1321,18 @@ struct netr_ServerPasswordSet2 {
 };
 
 
-struct netr_NETRSERVERPASSWORDGET {
+struct netr_ServerPasswordGet {
        struct {
+               const char *server_name;/* [unique,charset(UTF16)] */
+               const char *account_name;/* [charset(UTF16)] */
+               enum netr_SchannelType secure_channel_type;
+               const char *computer_name;/* [charset(UTF16)] */
+               struct netr_Authenticator *credential;/* [ref] */
+       } in;
+
+       struct {
+               struct netr_Authenticator *return_authenticator;/* [ref] */
+               struct samr_Password *password;/* [ref] */
                WERROR result;
        } out;
 
@@ -1246,8 +1347,15 @@ struct netr_NETRLOGONSENDTOSAM {
 };
 
 
-struct netr_DSRADDRESSTOSITENAMESW {
+struct netr_DsRAddressToSitenamesW {
        struct {
+               const char *server_name;/* [unique,charset(UTF16)] */
+               uint32_t count;/* [range(0 32000)] */
+               struct netr_DsRAddress *addresses;/* [ref,size_is(count)] */
+       } in;
+
+       struct {
+               struct netr_DsRAddressToSitenamesWCtr **ctr;/* [ref] */
                WERROR result;
        } out;
 
@@ -1266,7 +1374,7 @@ struct netr_DsRGetDCNameEx2 {
        } in;
 
        struct {
-               struct netr_DsRGetDCNameInfo *info;/* [unique] */
+               struct netr_DsRGetDCNameInfo **info;/* [ref] */
                WERROR result;
        } out;
 
@@ -1281,24 +1389,41 @@ struct netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN {
 };
 
 
-struct netr_NETRENUMERATETRUSTEDDOMAINSEX {
+struct netr_NetrEnumerateTrustedDomainsEx {
        struct {
+               const char *server_name;/* [unique,charset(UTF16)] */
+       } in;
+
+       struct {
+               struct netr_DomainTrustList *dom_trust_list;/* [ref] */
                WERROR result;
        } out;
 
 };
 
 
-struct netr_DSRADDRESSTOSITENAMESEXW {
+struct netr_DsRAddressToSitenamesExW {
+       struct {
+               const char *server_name;/* [unique,charset(UTF16)] */
+               uint32_t count;/* [range(0 32000)] */
+               struct netr_DsRAddress *addresses;/* [ref,size_is(count)] */
+       } in;
+
        struct {
+               struct netr_DsRAddressToSitenamesExWCtr **ctr;/* [ref] */
                WERROR result;
        } out;
 
 };
 
 
-struct netr_DSRGETDCSITECOVERAGEW {
+struct netr_DsrGetDcSiteCoverageW {
        struct {
+               const char *server_name;/* [unique,charset(UTF16)] */
+       } in;
+
+       struct {
+               struct DcSitesCtr *ctr;/* [ref] */
                WERROR result;
        } out;
 
@@ -1332,15 +1457,22 @@ struct netr_DsrEnumerateDomainTrusts {
        } in;
 
        struct {
-               uint32_t *count;/* [ref] */
-               struct netr_DomainTrust **trusts;/* [ref,size_is(count)] */
+               struct netr_DomainTrustList *trusts;/* [ref] */
                WERROR result;
        } out;
 
 };
 
 
-struct netr_DSRDEREGISTERDNSHOSTRECORDS {
+struct netr_DsrDeregisterDNSHostRecords {
+       struct {
+               const char *server_name;/* [unique,charset(UTF16)] */
+               const char *domain;/* [unique,charset(UTF16)] */
+               struct GUID *domain_guid;/* [unique] */
+               struct GUID *dsa_guid;/* [unique] */
+               const char *dns_host;/* [ref,charset(UTF16)] */
+       } in;
+
        struct {
                WERROR result;
        } out;
@@ -1348,24 +1480,51 @@ struct netr_DSRDEREGISTERDNSHOSTRECORDS {
 };
 
 
-struct netr_NETRSERVERTRUSTPASSWORDSGET {
+struct netr_ServerTrustPasswordsGet {
        struct {
-               WERROR result;
+               const char *server_name;/* [unique,charset(UTF16)] */
+               const char *account_name;/* [charset(UTF16)] */
+               enum netr_SchannelType secure_channel_type;
+               const char *computer_name;/* [charset(UTF16)] */
+               struct netr_Authenticator *credential;/* [ref] */
+       } in;
+
+       struct {
+               struct netr_Authenticator *return_authenticator;/* [ref] */
+               struct samr_Password *password;/* [ref] */
+               struct samr_Password *password2;/* [ref] */
+               NTSTATUS result;
        } out;
 
 };
 
 
-struct netr_DSRGETFORESTTRUSTINFORMATION {
+struct netr_DsRGetForestTrustInformation {
        struct {
+               const char *server_name;/* [unique,charset(UTF16)] */
+               const char *trusted_domain_name;/* [unique,charset(UTF16)] */
+               uint32_t flags;
+       } in;
+
+       struct {
+               struct lsa_ForestTrustInformation **forest_trust_info;/* [ref] */
                WERROR result;
        } out;
 
 };
 
 
-struct netr_NETRGETFORESTTRUSTINFORMATION {
+struct netr_GetForestTrustInformation {
        struct {
+               const char *server_name;/* [unique,charset(UTF16)] */
+               const char *trusted_domain_name;/* [ref,charset(UTF16)] */
+               struct netr_Authenticator *credential;/* [ref] */
+               uint32_t flags;
+       } in;
+
+       struct {
+               struct netr_Authenticator *return_authenticator;/* [ref] */
+               struct lsa_ForestTrustInformation **forest_trust_info;/* [ref] */
                WERROR result;
        } out;
 
diff --git a/source/librpc/gen_ndr/samr.h b/source/librpc/gen_ndr/samr.h
new file mode 100644 (file)
index 0000000..c6a68e8
--- /dev/null
@@ -0,0 +1,1732 @@
+/* header auto-generated by pidl */
+
+#include <stdint.h>
+
+#include "librpc/gen_ndr/misc.h"
+#include "librpc/gen_ndr/lsa.h"
+#include "librpc/gen_ndr/security.h"
+#ifndef _HEADER_samr
+#define _HEADER_samr
+
+#define SAMR_ENUM_USERS_MULTIPLIER     ( 54 )
+/* bitmap samr_AcctFlags */
+#define ACB_DISABLED ( 0x00000001 )
+#define ACB_HOMDIRREQ ( 0x00000002 )
+#define ACB_PWNOTREQ ( 0x00000004 )
+#define ACB_TEMPDUP ( 0x00000008 )
+#define ACB_NORMAL ( 0x00000010 )
+#define ACB_MNS ( 0x00000020 )
+#define ACB_DOMTRUST ( 0x00000040 )
+#define ACB_WSTRUST ( 0x00000080 )
+#define ACB_SVRTRUST ( 0x00000100 )
+#define ACB_PWNOEXP ( 0x00000200 )
+#define ACB_AUTOLOCK ( 0x00000400 )
+#define ACB_ENC_TXT_PWD_ALLOWED ( 0x00000800 )
+#define ACB_SMARTCARD_REQUIRED ( 0x00001000 )
+#define ACB_TRUSTED_FOR_DELEGATION ( 0x00002000 )
+#define ACB_NOT_DELEGATED ( 0x00004000 )
+#define ACB_USE_DES_KEY_ONLY ( 0x00008000 )
+#define ACB_DONT_REQUIRE_PREAUTH ( 0x00010000 )
+#define ACB_PW_EXPIRED ( 0x00020000 )
+#define ACB_NO_AUTH_DATA_REQD ( 0x00080000 )
+
+/* bitmap samr_ConnectAccessMask */
+#define SAMR_ACCESS_CONNECT_TO_SERVER ( 0x00000001 )
+#define SAMR_ACCESS_SHUTDOWN_SERVER ( 0x00000002 )
+#define SAMR_ACCESS_INITIALIZE_SERVER ( 0x00000004 )
+#define SAMR_ACCESS_CREATE_DOMAIN ( 0x00000008 )
+#define SAMR_ACCESS_ENUM_DOMAINS ( 0x00000010 )
+#define SAMR_ACCESS_OPEN_DOMAIN ( 0x00000020 )
+
+/* bitmap samr_UserAccessMask */
+#define SAMR_USER_ACCESS_GET_NAME_ETC ( 0x00000001 )
+#define SAMR_USER_ACCESS_GET_LOCALE ( 0x00000002 )
+#define SAMR_USER_ACCESS_SET_LOC_COM ( 0x00000004 )
+#define SAMR_USER_ACCESS_GET_LOGONINFO ( 0x00000008 )
+#define SAMR_USER_ACCESS_GET_ATTRIBUTES ( 0x00000010 )
+#define SAMR_USER_ACCESS_SET_ATTRIBUTES ( 0x00000020 )
+#define SAMR_USER_ACCESS_CHANGE_PASSWORD ( 0x00000040 )
+#define SAMR_USER_ACCESS_SET_PASSWORD ( 0x00000080 )
+#define SAMR_USER_ACCESS_GET_GROUPS ( 0x00000100 )
+#define SAMR_USER_ACCESS_GET_GROUP_MEMBERSHIP ( 0x00000200 )
+#define SAMR_USER_ACCESS_CHANGE_GROUP_MEMBERSHIP ( 0x00000400 )
+
+/* bitmap samr_DomainAccessMask */
+#define SAMR_DOMAIN_ACCESS_LOOKUP_INFO_1 ( 0x00000001 )
+#define SAMR_DOMAIN_ACCESS_SET_INFO_1 ( 0x00000002 )
+#define SAMR_DOMAIN_ACCESS_LOOKUP_INFO_2 ( 0x00000004 )
+#define SAMR_DOMAIN_ACCESS_SET_INFO_2 ( 0x00000008 )
+#define SAMR_DOMAIN_ACCESS_CREATE_USER ( 0x00000010 )
+#define SAMR_DOMAIN_ACCESS_CREATE_GROUP ( 0x00000020 )
+#define SAMR_DOMAIN_ACCESS_CREATE_ALIAS ( 0x00000040 )
+#define SAMR_DOMAIN_ACCESS_LOOKUP_ALIAS ( 0x00000080 )
+#define SAMR_DOMAIN_ACCESS_ENUM_ACCOUNTS ( 0x00000100 )
+#define SAMR_DOMAIN_ACCESS_OPEN_ACCOUNT ( 0x00000200 )
+#define SAMR_DOMAIN_ACCESS_SET_INFO_3 ( 0x00000400 )
+
+/* bitmap samr_GroupAccessMask */
+#define SAMR_GROUP_ACCESS_LOOKUP_INFO ( 0x00000001 )
+#define SAMR_GROUP_ACCESS_SET_INFO ( 0x00000002 )
+#define SAMR_GROUP_ACCESS_ADD_MEMBER ( 0x00000004 )
+#define SAMR_GROUP_ACCESS_REMOVE_MEMBER ( 0x00000008 )
+#define SAMR_GROUP_ACCESS_GET_MEMBERS ( 0x00000010 )
+
+/* bitmap samr_AliasAccessMask */
+#define SAMR_ALIAS_ACCESS_ADD_MEMBER ( 0x00000001 )
+#define SAMR_ALIAS_ACCESS_REMOVE_MEMBER ( 0x00000002 )
+#define SAMR_ALIAS_ACCESS_GET_MEMBERS ( 0x00000004 )
+#define SAMR_ALIAS_ACCESS_LOOKUP_INFO ( 0x00000008 )
+#define SAMR_ALIAS_ACCESS_SET_INFO ( 0x00000010 )
+
+struct samr_SamEntry {
+       uint32_t idx;
+       struct lsa_String name;
+};
+
+struct samr_SamArray {
+       uint32_t count;
+       struct samr_SamEntry *entries;/* [unique,size_is(count)] */
+};
+
+enum samr_Role
+#ifndef USE_UINT_ENUMS
+ {
+       SAMR_ROLE_STANDALONE=0,
+       SAMR_ROLE_DOMAIN_MEMBER=1,
+       SAMR_ROLE_DOMAIN_BDC=2,
+       SAMR_ROLE_DOMAIN_PDC=3
+}
+#else
+ { __donnot_use_enum_samr_Role=0x7FFFFFFF}
+#define SAMR_ROLE_STANDALONE ( 0 )
+#define SAMR_ROLE_DOMAIN_MEMBER ( 1 )
+#define SAMR_ROLE_DOMAIN_BDC ( 2 )
+#define SAMR_ROLE_DOMAIN_PDC ( 3 )
+#endif
+;
+
+/* bitmap samr_PasswordProperties */
+#define DOMAIN_PASSWORD_COMPLEX ( 0x00000001 )
+#define DOMAIN_PASSWORD_NO_ANON_CHANGE ( 0x00000002 )
+#define DOMAIN_PASSWORD_NO_CLEAR_CHANGE ( 0x00000004 )
+#define DOMAIN_PASSWORD_LOCKOUT_ADMINS ( 0x00000008 )
+#define DOMAIN_PASSWORD_STORE_CLEARTEXT ( 0x00000010 )
+#define DOMAIN_REFUSE_PASSWORD_CHANGE ( 0x00000020 )
+
+struct samr_DomInfo1 {
+       uint16_t min_password_length;
+       uint16_t password_history_length;
+       uint32_t password_properties;
+       int64_t max_password_age;
+       int64_t min_password_age;
+};
+
+struct samr_DomInfo2 {
+       NTTIME force_logoff_time;
+       struct lsa_String comment;
+       struct lsa_String domain_name;
+       struct lsa_String primary;
+       uint64_t sequence_num;
+       uint32_t unknown2;
+       enum samr_Role role;
+       uint32_t unknown3;
+       uint32_t num_users;
+       uint32_t num_groups;
+       uint32_t num_aliases;
+};
+
+struct samr_DomInfo3 {
+       NTTIME force_logoff_time;
+};
+
+struct samr_DomInfo4 {
+       struct lsa_String comment;
+};
+
+struct samr_DomInfo5 {
+       struct lsa_String domain_name;
+};
+
+struct samr_DomInfo6 {
+       struct lsa_String primary;
+};
+
+struct samr_DomInfo7 {
+       enum samr_Role role;
+};
+
+struct samr_DomInfo8 {
+       uint64_t sequence_num;
+       NTTIME domain_create_time;
+};
+
+struct samr_DomInfo9 {
+       uint32_t unknown;
+};
+
+struct samr_DomInfo11 {
+       struct samr_DomInfo2 info2;
+       uint64_t lockout_duration;
+       uint64_t lockout_window;
+       uint16_t lockout_threshold;
+};
+
+struct samr_DomInfo12 {
+       uint64_t lockout_duration;
+       uint64_t lockout_window;
+       uint16_t lockout_threshold;
+};
+
+struct samr_DomInfo13 {
+       uint64_t sequence_num;
+       NTTIME domain_create_time;
+       uint32_t unknown1;
+       uint32_t unknown2;
+};
+
+union samr_DomainInfo {
+       struct samr_DomInfo1 info1;/* [case] */
+       struct samr_DomInfo2 info2;/* [case(2)] */
+       struct samr_DomInfo3 info3;/* [case(3)] */
+       struct samr_DomInfo4 info4;/* [case(4)] */
+       struct samr_DomInfo5 info5;/* [case(5)] */
+       struct samr_DomInfo6 info6;/* [case(6)] */
+       struct samr_DomInfo7 info7;/* [case(7)] */
+       struct samr_DomInfo8 info8;/* [case(8)] */
+       struct samr_DomInfo9 info9;/* [case(9)] */
+       struct samr_DomInfo11 info11;/* [case(11)] */
+       struct samr_DomInfo12 info12;/* [case(12)] */
+       struct samr_DomInfo13 info13;/* [case(13)] */
+}/* [switch_type(uint16)] */;
+
+struct samr_Ids {
+       uint32_t count;/* [range(0 1024)] */
+       uint32_t *ids;/* [unique,size_is(count)] */
+};
+
+/* bitmap samr_GroupAttrs */
+#define SE_GROUP_MANDATORY ( 0x00000001 )
+#define SE_GROUP_ENABLED_BY_DEFAULT ( 0x00000002 )
+#define SE_GROUP_ENABLED ( 0x00000004 )
+#define SE_GROUP_OWNER ( 0x00000008 )
+#define SE_GROUP_USE_FOR_DENY_ONLY ( 0x00000010 )
+#define SE_GROUP_RESOURCE ( 0x20000000 )
+#define SE_GROUP_LOGON_ID ( 0xC0000000 )
+
+struct samr_GroupInfoAll {
+       struct lsa_String name;
+       uint32_t attributes;
+       uint32_t num_members;
+       struct lsa_String description;
+};
+
+struct samr_GroupInfoAttributes {
+       uint32_t attributes;
+};
+
+struct samr_GroupInfoDescription {
+       struct lsa_String description;
+};
+
+enum samr_GroupInfoEnum
+#ifndef USE_UINT_ENUMS
+ {
+       GROUPINFOALL=1,
+       GROUPINFONAME=2,
+       GROUPINFOATTRIBUTES=3,
+       GROUPINFODESCRIPTION=4,
+       GROUPINFOALL2=5
+}
+#else
+ { __donnot_use_enum_samr_GroupInfoEnum=0x7FFFFFFF}
+#define GROUPINFOALL ( 1 )
+#define GROUPINFONAME ( 2 )
+#define GROUPINFOATTRIBUTES ( 3 )
+#define GROUPINFODESCRIPTION ( 4 )
+#define GROUPINFOALL2 ( 5 )
+#endif
+;
+
+union samr_GroupInfo {
+       struct samr_GroupInfoAll all;/* [case(GROUPINFOALL)] */
+       struct lsa_String name;/* [case(GROUPINFONAME)] */
+       struct samr_GroupInfoAttributes attributes;/* [case(GROUPINFOATTRIBUTES)] */
+       struct lsa_String description;/* [case(GROUPINFODESCRIPTION)] */
+       struct samr_GroupInfoAll all2;/* [case(GROUPINFOALL2)] */
+}/* [switch_type(samr_GroupInfoEnum)] */;
+
+struct samr_RidTypeArray {
+       uint32_t count;
+       uint32_t *rids;/* [unique,size_is(count)] */
+       uint32_t *types;/* [unique,size_is(count)] */
+};
+
+struct samr_AliasInfoAll {
+       struct lsa_String name;
+       uint32_t num_members;
+       struct lsa_String description;
+};
+
+enum samr_AliasInfoEnum
+#ifndef USE_UINT_ENUMS
+ {
+       ALIASINFOALL=1,
+       ALIASINFONAME=2,
+       ALIASINFODESCRIPTION=3
+}
+#else
+ { __donnot_use_enum_samr_AliasInfoEnum=0x7FFFFFFF}
+#define ALIASINFOALL ( 1 )
+#define ALIASINFONAME ( 2 )
+#define ALIASINFODESCRIPTION ( 3 )
+#endif
+;
+
+union samr_AliasInfo {
+       struct samr_AliasInfoAll all;/* [case(ALIASINFOALL)] */
+       struct lsa_String name;/* [case(ALIASINFONAME)] */
+       struct lsa_String description;/* [case(ALIASINFODESCRIPTION)] */
+}/* [switch_type(samr_AliasInfoEnum)] */;
+
+struct samr_UserInfo1 {
+       struct lsa_String account_name;
+       struct lsa_String full_name;
+       uint32_t primary_gid;
+       struct lsa_String description;
+       struct lsa_String comment;
+};
+
+struct samr_UserInfo2 {
+       struct lsa_String comment;
+       struct lsa_String unknown;
+       uint16_t country_code;
+       uint16_t code_page;
+};
+
+struct samr_LogonHours {
+       uint16_t units_per_week;
+       uint8_t *bits;/* [unique,length_is(units_per_week/8),size_is(1260)] */
+}/* [public,flag(LIBNDR_PRINT_ARRAY_HEX)] */;
+
+struct samr_UserInfo3 {
+       struct lsa_String account_name;
+       struct lsa_String full_name;
+       uint32_t rid;
+       uint32_t primary_gid;
+       struct lsa_String home_directory;
+       struct lsa_String home_drive;
+       struct lsa_String logon_script;
+       struct lsa_String profile_path;
+       struct lsa_String workstations;
+       NTTIME last_logon;
+       NTTIME last_logoff;
+       NTTIME last_password_change;
+       NTTIME allow_password_change;
+       NTTIME force_password_change;
+       struct samr_LogonHours logon_hours;
+       uint16_t bad_password_count;
+       uint16_t logon_count;
+       uint32_t acct_flags;
+};
+
+struct samr_UserInfo4 {
+       struct samr_LogonHours logon_hours;
+};
+
+struct samr_UserInfo5 {
+       struct lsa_String account_name;
+       struct lsa_String full_name;
+       uint32_t rid;
+       uint32_t primary_gid;
+       struct lsa_String home_directory;
+       struct lsa_String home_drive;
+       struct lsa_String logon_script;
+       struct lsa_String profile_path;
+       struct lsa_String description;
+       struct lsa_String workstations;
+       NTTIME last_logon;
+       NTTIME last_logoff;
+       struct samr_LogonHours logon_hours;
+       uint16_t bad_password_count;
+       uint16_t logon_count;
+       NTTIME last_password_change;
+       NTTIME acct_expiry;
+       uint32_t acct_flags;
+};
+
+struct samr_UserInfo6 {
+       struct lsa_String account_name;
+       struct lsa_String full_name;
+};
+
+struct samr_UserInfo7 {
+       struct lsa_String account_name;
+};
+
+struct samr_UserInfo8 {
+       struct lsa_String full_name;
+};
+
+struct samr_UserInfo9 {
+       uint32_t primary_gid;
+};
+
+struct samr_UserInfo10 {
+       struct lsa_String home_directory;
+       struct lsa_String home_drive;
+};
+
+struct samr_UserInfo11 {
+       struct lsa_String logon_script;
+};
+
+struct samr_UserInfo12 {
+       struct lsa_String profile_path;
+};
+
+struct samr_UserInfo13 {
+       struct lsa_String description;
+};
+
+struct samr_UserInfo14 {
+       struct lsa_String workstations;
+};
+
+struct samr_UserInfo16 {
+       uint32_t acct_flags;
+};
+
+struct samr_UserInfo17 {
+       NTTIME acct_expiry;
+};
+
+struct samr_UserInfo20 {
+       struct lsa_String parameters;
+};
+
+/* bitmap samr_FieldsPresent */
+#define SAMR_FIELD_ACCOUNT_NAME ( 0x00000001 )
+#define SAMR_FIELD_FULL_NAME ( 0x00000002 )
+#define SAMR_FIELD_RID ( 0x00000004 )
+#define SAMR_FIELD_PRIMARY_GID ( 0x00000008 )
+#define SAMR_FIELD_DESCRIPTION ( 0x00000010 )
+#define SAMR_FIELD_COMMENT ( 0x00000020 )
+#define SAMR_FIELD_HOME_DIRECTORY ( 0x00000040 )
+#define SAMR_FIELD_HOME_DRIVE ( 0x00000080 )
+#define SAMR_FIELD_LOGON_SCRIPT ( 0x00000100 )
+#define SAMR_FIELD_PROFILE_PATH ( 0x00000200 )
+#define SAMR_FIELD_WORKSTATIONS ( 0x00000400 )
+#define SAMR_FIELD_LAST_LOGON ( 0x00000800 )
+#define SAMR_FIELD_LAST_LOGOFF ( 0x00001000 )
+#define SAMR_FIELD_LOGON_HOURS ( 0x00002000 )
+#define SAMR_FIELD_BAD_PWD_COUNT ( 0x00004000 )
+#define SAMR_FIELD_NUM_LOGONS ( 0x00008000 )
+#define SAMR_FIELD_ALLOW_PWD_CHANGE ( 0x00010000 )
+#define SAMR_FIELD_FORCE_PWD_CHANGE ( 0x00020000 )
+#define SAMR_FIELD_LAST_PWD_CHANGE ( 0x00040000 )
+#define SAMR_FIELD_ACCT_EXPIRY ( 0x00080000 )
+#define SAMR_FIELD_ACCT_FLAGS ( 0x00100000 )
+#define SAMR_FIELD_PARAMETERS ( 0x00200000 )
+#define SAMR_FIELD_COUNTRY_CODE ( 0x00400000 )
+#define SAMR_FIELD_CODE_PAGE ( 0x00800000 )
+#define SAMR_FIELD_PASSWORD ( 0x01000000 )
+#define SAMR_FIELD_PASSWORD2 ( 0x02000000 )
+#define SAMR_FIELD_PRIVATE_DATA ( 0x04000000 )
+#define SAMR_FIELD_EXPIRED_FLAG ( 0x08000000 )
+#define SAMR_FIELD_SEC_DESC ( 0x10000000 )
+#define SAMR_FIELD_OWF_PWD ( 0x20000000 )
+
+struct samr_UserInfo21 {
+       NTTIME last_logon;
+       NTTIME last_logoff;
+       NTTIME last_password_change;
+       NTTIME acct_expiry;
+       NTTIME allow_password_change;
+       NTTIME force_password_change;
+       struct lsa_String account_name;
+       struct lsa_String full_name;
+       struct lsa_String home_directory;
+       struct lsa_String home_drive;
+       struct lsa_String logon_script;
+       struct lsa_String profile_path;
+       struct lsa_String description;
+       struct lsa_String workstations;
+       struct lsa_String comment;
+       struct lsa_String parameters;
+       struct lsa_String unknown1;
+       struct lsa_String unknown2;
+       struct lsa_String unknown3;
+       uint32_t buf_count;
+       uint8_t *buffer;/* [unique,size_is(buf_count)] */
+       uint32_t rid;
+       uint32_t primary_gid;
+       uint32_t acct_flags;
+       uint32_t fields_present;
+       struct samr_LogonHours logon_hours;
+       uint16_t bad_password_count;
+       uint16_t logon_count;
+       uint16_t country_code;
+       uint16_t code_page;
+       uint8_t nt_password_set;
+       uint8_t lm_password_set;
+       uint8_t password_expired;
+       uint8_t unknown4;
+};
+
+struct samr_CryptPassword {
+       uint8_t data[516];
+}/* [public,flag(LIBNDR_PRINT_ARRAY_HEX)] */;
+
+struct samr_UserInfo23 {
+       struct samr_UserInfo21 info;
+       struct samr_CryptPassword password;
+};
+
+struct samr_UserInfo24 {
+       struct samr_CryptPassword password;
+       uint8_t pw_len;
+};
+
+struct samr_CryptPasswordEx {
+       uint8_t data[532];
+}/* [flag(LIBNDR_PRINT_ARRAY_HEX)] */;
+
+struct samr_UserInfo25 {
+       struct samr_UserInfo21 info;
+       struct samr_CryptPasswordEx password;
+};
+
+struct samr_UserInfo26 {
+       struct samr_CryptPasswordEx password;
+       uint8_t pw_len;
+};
+
+union samr_UserInfo {
+       struct samr_UserInfo1 info1;/* [case] */
+       struct samr_UserInfo2 info2;/* [case(2)] */
+       struct samr_UserInfo3 info3;/* [case(3)] */
+       struct samr_UserInfo4 info4;/* [case(4)] */
+       struct samr_UserInfo5 info5;/* [case(5)] */
+       struct samr_UserInfo6 info6;/* [case(6)] */
+       struct samr_UserInfo7 info7;/* [case(7)] */
+       struct samr_UserInfo8 info8;/* [case(8)] */
+       struct samr_UserInfo9 info9;/* [case(9)] */
+       struct samr_UserInfo10 info10;/* [case(10)] */
+       struct samr_UserInfo11 info11;/* [case(11)] */
+       struct samr_UserInfo12 info12;/* [case(12)] */
+       struct samr_UserInfo13 info13;/* [case(13)] */
+       struct samr_UserInfo14 info14;/* [case(14)] */
+       struct samr_UserInfo16 info16;/* [case(16)] */
+       struct samr_UserInfo17 info17;/* [case(17)] */
+       struct samr_UserInfo20 info20;/* [case(20)] */
+       struct samr_UserInfo21 info21;/* [case(21)] */
+       struct samr_UserInfo23 info23;/* [case(23)] */
+       struct samr_UserInfo24 info24;/* [case(24)] */
+       struct samr_UserInfo25 info25;/* [case(25)] */
+       struct samr_UserInfo26 info26;/* [case(26)] */
+}/* [switch_type(uint16)] */;
+
+struct samr_Password {
+       uint8_t hash[16];
+}/* [public,flag(LIBNDR_PRINT_ARRAY_HEX)] */;
+
+struct samr_RidWithAttribute {
+       uint32_t rid;
+       uint32_t attributes;
+}/* [public] */;
+
+struct samr_RidWithAttributeArray {
+       uint32_t count;
+       struct samr_RidWithAttribute *rids;/* [unique,size_is(count)] */
+}/* [public] */;
+
+struct samr_DispEntryGeneral {
+       uint32_t idx;
+       uint32_t rid;
+       uint32_t acct_flags;
+       struct lsa_String account_name;
+       struct lsa_String description;
+       struct lsa_String full_name;
+};
+
+struct samr_DispInfoGeneral {
+       uint32_t count;
+       struct samr_DispEntryGeneral *entries;/* [unique,size_is(count)] */
+};
+
+struct samr_DispEntryFull {
+       uint32_t idx;
+       uint32_t rid;
+       uint32_t acct_flags;
+       struct lsa_String account_name;
+       struct lsa_String description;
+};
+
+struct samr_DispInfoFull {
+       uint32_t count;
+       struct samr_DispEntryFull *entries;/* [unique,size_is(count)] */
+};
+
+struct samr_DispEntryFullGroup {
+       uint32_t idx;
+       uint32_t rid;
+       uint32_t acct_flags;
+       struct lsa_String account_name;
+       struct lsa_String description;
+};
+
+struct samr_DispInfoFullGroups {
+       uint32_t count;
+       struct samr_DispEntryFullGroup *entries;/* [unique,size_is(count)] */
+};
+
+struct samr_DispEntryAscii {
+       uint32_t idx;
+       struct lsa_AsciiString account_name;
+};
+
+struct samr_DispInfoAscii {
+       uint32_t count;
+       struct samr_DispEntryAscii *entries;/* [unique,size_is(count)] */
+};
+
+union samr_DispInfo {
+       struct samr_DispInfoGeneral info1;/* [case] */
+       struct samr_DispInfoFull info2;/* [case(2)] */
+       struct samr_DispInfoFullGroups info3;/* [case(3)] */
+       struct samr_DispInfoAscii info4;/* [case(4)] */
+       struct samr_DispInfoAscii info5;/* [case(5)] */
+}/* [switch_type(uint16)] */;
+
+struct samr_PwInfo {
+       uint16_t min_password_length;
+       uint32_t password_properties;
+};
+
+enum samr_RejectReason;
+
+struct samr_ChangeReject {
+       enum samr_RejectReason reason;
+       uint32_t unknown1;
+       uint32_t unknown2;
+};
+
+struct samr_ConnectInfo1 {
+       uint32_t unknown1;
+       uint32_t unknown2;
+};
+
+union samr_ConnectInfo {
+       struct samr_ConnectInfo1 info1;/* [case] */
+};
+
+/* bitmap samr_ValidateFieldsPresent */
+#define SAMR_VALIDATE_FIELD_PASSWORD_LAST_SET ( 0x00000001 )
+#define SAMR_VALIDATE_FIELD_BAD_PASSWORD_TIME ( 0x00000002 )
+#define SAMR_VALIDATE_FIELD_LOCKOUT_TIME ( 0x00000004 )
+#define SAMR_VALIDATE_FIELD_BAD_PASSWORD_COUNT ( 0x00000008 )
+#define SAMR_VALIDATE_FIELD_PASSWORD_HISTORY_LENGTH ( 0x00000010 )
+#define SAMR_VALIDATE_FIELD_PASSWORD_HISTORY ( 0x00000020 )
+
+enum samr_ValidatePasswordLevel
+#ifndef USE_UINT_ENUMS
+ {
+       NetValidateAuthentication=1,
+       NetValidatePasswordChange=2,
+       NetValidatePasswordReset=3
+}
+#else
+ { __donnot_use_enum_samr_ValidatePasswordLevel=0x7FFFFFFF}
+#define NetValidateAuthentication ( 1 )
+#define NetValidatePasswordChange ( 2 )
+#define NetValidatePasswordReset ( 3 )
+#endif
+;
+
+enum samr_ValidationStatus
+#ifndef USE_UINT_ENUMS
+ {
+       SAMR_VALIDATION_STATUS_SUCCESS=0,
+       SAMR_VALIDATION_STATUS_PASSWORD_MUST_CHANGE=1,
+       SAMR_VALIDATION_STATUS_ACCOUNT_LOCKED_OUT=2,
+       SAMR_VALIDATION_STATUS_BAD_PASSWORD=4,
+       SAMR_VALIDATION_STATUS_PWD_HISTORY_CONFLICT=5,
+       SAMR_VALIDATION_STATUS_PWD_TOO_SHORT=6,
+       SAMR_VALIDATION_STATUS_PWD_TOO_LONG=7,
+       SAMR_VALIDATION_STATUS_NOT_COMPLEX_ENOUGH=8,
+       SAMR_VALIDATION_STATUS_PASSWORD_TOO_RECENT=9
+}
+#else
+ { __donnot_use_enum_samr_ValidationStatus=0x7FFFFFFF}
+#define SAMR_VALIDATION_STATUS_SUCCESS ( 0 )
+#define SAMR_VALIDATION_STATUS_PASSWORD_MUST_CHANGE ( 1 )
+#define SAMR_VALIDATION_STATUS_ACCOUNT_LOCKED_OUT ( 2 )
+#define SAMR_VALIDATION_STATUS_BAD_PASSWORD ( 4 )
+#define SAMR_VALIDATION_STATUS_PWD_HISTORY_CONFLICT ( 5 )
+#define SAMR_VALIDATION_STATUS_PWD_TOO_SHORT ( 6 )
+#define SAMR_VALIDATION_STATUS_PWD_TOO_LONG ( 7 )
+#define SAMR_VALIDATION_STATUS_NOT_COMPLEX_ENOUGH ( 8 )
+#define SAMR_VALIDATION_STATUS_PASSWORD_TOO_RECENT ( 9 )
+#endif
+;
+
+struct samr_ValidationBlob {
+       uint32_t length;
+       uint8_t *data;/* [unique,size_is(length)] */
+};
+
+struct samr_ValidatePasswordInfo {
+       uint32_t fields_present;
+       NTTIME last_password_change;
+       NTTIME bad_password_time;
+       NTTIME lockout_time;
+       uint32_t bad_pwd_count;
+       uint32_t pwd_history_len;
+       struct samr_ValidationBlob *pwd_history;/* [unique,size_is(pwd_history_len)] */
+};
+
+struct samr_ValidatePasswordRepCtr {
+       struct samr_ValidatePasswordInfo info;
+       enum samr_ValidationStatus status;
+};
+
+union samr_ValidatePasswordRep {
+       struct samr_ValidatePasswordRepCtr ctr1;/* [case] */
+       struct samr_ValidatePasswordRepCtr ctr2;/* [case(2)] */
+       struct samr_ValidatePasswordRepCtr ctr3;/* [case(3)] */
+}/* [switch_type(uint16)] */;
+
+struct samr_ValidatePasswordReq3 {
+       struct samr_ValidatePasswordInfo info;
+       struct lsa_StringLarge password;
+       struct lsa_StringLarge account;
+       struct samr_ValidationBlob hash;
+       uint8_t pwd_must_change_at_next_logon;
+       uint8_t clear_lockout;
+};
+
+struct samr_ValidatePasswordReq2 {
+       struct samr_ValidatePasswordInfo info;
+       struct lsa_StringLarge password;
+       struct lsa_StringLarge account;
+       struct samr_ValidationBlob hash;
+       uint8_t password_matched;
+};
+
+struct samr_ValidatePasswordReq1 {
+       struct samr_ValidatePasswordInfo info;
+       uint8_t password_matched;
+};
+
+union samr_ValidatePasswordReq {
+       struct samr_ValidatePasswordReq1 req1;/* [case] */
+       struct samr_ValidatePasswordReq2 req2;/* [case(2)] */
+       struct samr_ValidatePasswordReq3 req3;/* [case(3)] */
+}/* [switch_type(uint16)] */;
+
+
+struct samr_Connect {
+       struct {
+               uint16_t *system_name;/* [unique] */
+               uint32_t access_mask;
+       } in;
+
+       struct {
+               struct policy_handle *connect_handle;/* [ref] */
+               NTSTATUS result;
+       } out;
+
+};
+
+
+struct samr_Close {
+       struct {
+               struct policy_handle *handle;/* [ref] */
+       } in;
+
+       struct {
+               struct policy_handle *handle;/* [ref] */
+               NTSTATUS result;
+       } out;
+
+};
+
+
+struct samr_SetSecurity {
+       struct {
+               struct policy_handle *handle;/* [ref] */
+               uint32_t sec_info;
+               struct sec_desc_buf *sdbuf;/* [ref] */
+       } in;
+
+       struct {
+               NTSTATUS result;
+       } out;
+
+};
+
+
+struct samr_QuerySecurity {
+       struct {
+               struct policy_handle *handle;/* [ref] */
+               uint32_t sec_info;
+       } in;
+
+       struct {
+               struct sec_desc_buf *sdbuf;/* [ref] */
+               NTSTATUS result;
+       } out;
+
+};
+
+
+struct samr_Shutdown {
+       struct {
+               struct policy_handle *connect_handle;/* [ref] */
+       } in;
+
+       struct {
+               NTSTATUS result;
+       } out;
+
+};
+
+
+struct samr_LookupDomain {
+       struct {
+               struct policy_handle *connect_handle;/* [ref] */
+               struct lsa_String *domain_name;/* [ref] */
+       } in;
+
+       struct {
+               struct dom_sid2 *sid;/* [ref] */
+               NTSTATUS result;
+       } out;
+
+};
+
+
+struct samr_EnumDomains {
+       struct {
+               struct policy_handle *connect_handle;/* [ref] */
+               uint32_t buf_size;
+               uint32_t *resume_handle;/* [ref] */
+       } in;
+
+       struct {
+               struct samr_SamArray *sam;/* [ref] */
+               uint32_t *num_entries;/* [ref] */
+               uint32_t *resume_handle;/* [ref] */
+               NTSTATUS result;
+       } out;
+
+};
+
+
+struct samr_OpenDomain {
+       struct {
+               struct policy_handle *connect_handle;/* [ref] */
+               uint32_t access_mask;
+               struct dom_sid2 *sid;/* [ref] */
+       } in;
+
+       struct {
+               struct policy_handle *domain_handle;/* [ref] */
+               NTSTATUS result;
+       } out;
+
+};
+
+
+struct samr_QueryDomainInfo {
+       struct {
+               struct policy_handle *domain_handle;/* [ref] */
+               uint16_t level;
+       } in;
+
+       struct {
+               union samr_DomainInfo *info;/* [ref,switch_is(level)] */
+               NTSTATUS result;
+       } out;
+
+};
+
+
+struct samr_SetDomainInfo {
+       struct {
+               struct policy_handle *domain_handle;/* [ref] */
+               uint16_t level;
+               union samr_DomainInfo *info;/* [ref,switch_is(level)] */
+       } in;
+
+       struct {
+               NTSTATUS result;
+       } out;
+
+};
+
+
+struct samr_CreateDomainGroup {
+       struct {
+               struct policy_handle *domain_handle;/* [ref] */
+               struct lsa_String *name;/* [ref] */
+               uint32_t access_mask;
+       } in;
+
+       struct {
+               struct policy_handle *group_handle;/* [ref] */
+               uint32_t *rid;/* [ref] */
+               NTSTATUS result;
+       } out;
+
+};
+
+
+struct samr_EnumDomainGroups {
+       struct {
+               struct policy_handle *domain_handle;/* [ref] */
+               uint32_t max_size;
+               uint32_t *resume_handle;/* [ref] */
+       } in;
+
+       struct {
+               struct samr_SamArray *sam;/* [ref] */
+               uint32_t *num_entries;/* [ref] */
+               uint32_t *resume_handle;/* [ref] */
+               NTSTATUS result;
+       } out;
+
+};
+
+
+struct samr_CreateUser {
+       struct {
+               struct policy_handle *domain_handle;/* [ref] */
+               struct lsa_String *account_name;/* [ref] */
+               uint32_t access_mask;
+       } in;
+
+       struct {
+               struct policy_handle *user_handle;/* [ref] */
+               uint32_t *rid;/* [ref] */
+               NTSTATUS result;
+       } out;
+
+};
+
+
+struct samr_EnumDomainUsers {
+       struct {
+               struct policy_handle *domain_handle;/* [ref] */
+               uint32_t acct_flags;
+               uint32_t max_size;
+               uint32_t *resume_handle;/* [ref] */
+       } in;
+
+       struct {
+               struct samr_SamArray *sam;/* [unique] */
+               uint32_t *num_entries;/* [ref] */
+               uint32_t *resume_handle;/* [ref] */
+               NTSTATUS result;
+       } out;
+
+};
+
+
+struct samr_CreateDomAlias {
+       struct {
+               struct policy_handle *domain_handle;/* [ref] */
+               struct lsa_String *alias_name;/* [ref] */
+               uint32_t access_mask;
+       } in;
+
+       struct {
+               struct policy_handle *alias_handle;/* [ref] */
+               uint32_t *rid;/* [ref] */
+               NTSTATUS result;
+       } out;
+
+};
+
+
+struct samr_EnumDomainAliases {
+       struct {
+               struct policy_handle *domain_handle;/* [ref] */
+               uint32_t acct_flags;
+               uint32_t *resume_handle;/* [ref] */
+       } in;
+
+       struct {
+               struct samr_SamArray *sam;/* [ref] */
+               uint32_t *num_entries;/* [ref] */
+               uint32_t *resume_handle;/* [ref] */
+               NTSTATUS result;
+       } out;
+
+};
+
+
+struct samr_GetAliasMembership {
+       struct {
+               struct policy_handle *domain_handle;/* [ref] */
+               struct lsa_SidArray *sids;/* [ref] */
+       } in;
+
+       struct {
+               struct samr_Ids *rids;/* [ref] */
+               NTSTATUS result;
+       } out;
+
+};
+
+
+struct samr_LookupNames {
+       struct {
+               struct policy_handle *domain_handle;/* [ref] */
+               uint32_t num_names;/* [range(0 1000)] */
+               struct lsa_String *names;/* [length_is(num_names),size_is(1000)] */
+       } in;
+
+       struct {
+               struct samr_Ids *rids;/* [ref] */
+               struct samr_Ids *types;/* [ref] */
+               NTSTATUS result;
+       } out;
+
+};
+
+
+struct samr_LookupRids {
+       struct {
+               struct policy_handle *domain_handle;/* [ref] */
+               uint32_t num_rids;/* [range(0 1000)] */
+               uint32_t *rids;/* [length_is(num_rids),size_is(1000)] */
+       } in;
+
+       struct {
+               struct lsa_Strings *names;/* [ref] */
+               struct samr_Ids *types;/* [ref] */
+               NTSTATUS result;
+       } out;
+
+};
+
+
+struct samr_OpenGroup {
+       struct {
+               struct policy_handle *domain_handle;/* [ref] */
+               uint32_t access_mask;
+               uint32_t rid;
+       } in;
+
+       struct {
+               struct policy_handle *group_handle;/* [ref] */
+               NTSTATUS result;
+       } out;
+
+};
+
+
+struct samr_QueryGroupInfo {
+       struct {
+               struct policy_handle *group_handle;/* [ref] */
+               enum samr_GroupInfoEnum level;
+       } in;
+
+       struct {
+               union samr_GroupInfo *info;/* [ref,switch_is(level)] */
+               NTSTATUS result;
+       } out;
+
+};
+
+
+struct samr_SetGroupInfo {
+       struct {
+               struct policy_handle *group_handle;/* [ref] */
+               enum samr_GroupInfoEnum level;
+               union samr_GroupInfo *info;/* [ref,switch_is(level)] */
+       } in;
+
+       struct {
+               NTSTATUS result;
+       } out;
+
+};
+
+
+struct samr_AddGroupMember {
+       struct {
+               struct policy_handle *group_handle;/* [ref] */
+               uint32_t rid;
+               uint32_t flags;
+       } in;
+
+       struct {
+               NTSTATUS result;
+       } out;
+
+};
+
+
+struct samr_DeleteDomainGroup {
+       struct {
+               struct policy_handle *group_handle;/* [ref] */
+       } in;
+
+       struct {
+               struct policy_handle *group_handle;/* [ref] */
+               NTSTATUS result;
+       } out;
+
+};
+
+
+struct samr_DeleteGroupMember {
+       struct {
+               struct policy_handle *group_handle;/* [ref] */
+               uint32_t rid;
+       } in;
+
+       struct {
+               NTSTATUS result;
+       } out;
+
+};
+
+
+struct samr_QueryGroupMember {
+       struct {
+               struct policy_handle *group_handle;/* [ref] */
+       } in;
+
+       struct {
+               struct samr_RidTypeArray *rids;/* [ref] */
+               NTSTATUS result;
+       } out;
+
+};
+
+
+struct samr_SetMemberAttributesOfGroup {
+       struct {
+               struct policy_handle *group_handle;/* [ref] */
+               uint32_t unknown1;
+               uint32_t unknown2;
+       } in;
+
+       struct {
+               NTSTATUS result;
+       } out;
+
+};
+
+
+struct samr_OpenAlias {
+       struct {
+               struct policy_handle *domain_handle;/* [ref] */
+               uint32_t access_mask;
+               uint32_t rid;
+       } in;
+
+       struct {
+               struct policy_handle *alias_handle;/* [ref] */
+               NTSTATUS result;
+       } out;
+
+};
+
+
+struct samr_QueryAliasInfo {
+       struct {
+               struct policy_handle *alias_handle;/* [ref] */
+               enum samr_AliasInfoEnum level;
+       } in;
+
+       struct {
+               union samr_AliasInfo *info;/* [ref,switch_is(level)] */
+               NTSTATUS result;
+       } out;
+
+};
+
+
+struct samr_SetAliasInfo {
+       struct {
+               struct policy_handle *alias_handle;/* [ref] */
+               enum samr_AliasInfoEnum level;
+               union samr_AliasInfo *info;/* [ref,switch_is(level)] */
+       } in;
+
+       struct {
+               NTSTATUS result;
+       } out;
+
+};
+
+
+struct samr_DeleteDomAlias {
+       struct {
+               struct policy_handle *alias_handle;/* [ref] */
+       } in;
+
+       struct {
+               struct policy_handle *alias_handle;/* [ref] */
+               NTSTATUS result;
+       } out;
+
+};
+
+
+struct samr_AddAliasMember {
+       struct {
+               struct policy_handle *alias_handle;/* [ref] */
+               struct dom_sid2 *sid;/* [ref] */
+       } in;
+
+       struct {
+               NTSTATUS result;
+       } out;
+
+};
+
+
+struct samr_DeleteAliasMember {
+       struct {
+               struct policy_handle *alias_handle;/* [ref] */
+               struct dom_sid2 *sid;/* [ref] */
+       } in;
+
+       struct {
+               NTSTATUS result;
+       } out;
+
+};
+
+
+struct samr_GetMembersInAlias {
+       struct {
+               struct policy_handle *alias_handle;/* [ref] */
+       } in;
+
+       struct {
+               struct lsa_SidArray *sids;/* [ref] */
+               NTSTATUS result;
+       } out;
+
+};
+
+
+struct samr_OpenUser {
+       struct {
+               struct policy_handle *domain_handle;/* [ref] */
+               uint32_t access_mask;
+               uint32_t rid;
+       } in;
+
+       struct {
+               struct policy_handle *user_handle;/* [ref] */
+               NTSTATUS result;
+       } out;
+
+};
+
+
+struct samr_DeleteUser {
+       struct {
+               struct policy_handle *user_handle;/* [ref] */
+       } in;
+
+       struct {
+               struct policy_handle *user_handle;/* [ref] */
+               NTSTATUS result;
+       } out;
+
+};
+
+
+struct samr_QueryUserInfo {
+       struct {
+               struct policy_handle *user_handle;/* [ref] */
+               uint16_t level;
+       } in;
+
+       struct {
+               union samr_UserInfo *info;/* [ref,switch_is(level)] */
+               NTSTATUS result;
+       } out;
+
+};
+
+
+struct samr_SetUserInfo {
+       struct {
+               struct policy_handle *user_handle;/* [ref] */
+               uint16_t level;
+               union samr_UserInfo *info;/* [ref,switch_is(level)] */
+       } in;
+
+       struct {
+               NTSTATUS result;
+       } out;
+
+};
+
+
+struct samr_ChangePasswordUser {
+       struct {
+               struct policy_handle *user_handle;/* [ref] */
+               uint8_t lm_present;
+               struct samr_Password *old_lm_crypted;/* [unique] */
+               struct samr_Password *new_lm_crypted;/* [unique] */
+               uint8_t nt_present;
+               struct samr_Password *old_nt_crypted;/* [unique] */
+               struct samr_Password *new_nt_crypted;/* [unique] */
+               uint8_t cross1_present;
+               struct samr_Password *nt_cross;/* [unique] */
+               uint8_t cross2_present;
+               struct samr_Password *lm_cross;/* [unique] */
+       } in;
+
+       struct {
+               NTSTATUS result;
+       } out;
+
+};
+
+
+struct samr_GetGroupsForUser {
+       struct {
+               struct policy_handle *user_handle;/* [ref] */
+       } in;
+
+       struct {
+               struct samr_RidWithAttributeArray *rids;/* [ref] */
+               NTSTATUS result;
+       } out;
+
+};
+
+
+struct samr_QueryDisplayInfo {
+       struct {
+               struct policy_handle *domain_handle;/* [ref] */
+               uint16_t level;
+               uint32_t start_idx;
+               uint32_t max_entries;
+               uint32_t buf_size;
+       } in;
+
+       struct {
+               uint32_t *total_size;/* [ref] */
+               uint32_t *returned_size;/* [ref] */
+               union samr_DispInfo *info;/* [ref,switch_is(level)] */
+               NTSTATUS result;
+       } out;
+
+};
+
+
+struct samr_GetDisplayEnumerationIndex {
+       struct {
+               struct policy_handle *domain_handle;/* [ref] */
+               uint16_t level;
+               struct lsa_String name;
+       } in;
+
+       struct {
+               uint32_t *idx;/* [ref] */
+               NTSTATUS result;
+       } out;
+
+};
+
+
+struct samr_TestPrivateFunctionsDomain {
+       struct {
+               struct policy_handle *domain_handle;/* [ref] */
+       } in;
+
+       struct {
+               NTSTATUS result;
+       } out;
+
+};
+
+
+struct samr_TestPrivateFunctionsUser {
+       struct {
+               struct policy_handle *user_handle;/* [ref] */
+       } in;
+
+       struct {
+               NTSTATUS result;
+       } out;
+
+};
+
+
+struct samr_GetUserPwInfo {
+       struct {
+               struct policy_handle *user_handle;/* [ref] */
+       } in;
+
+       struct {
+               struct samr_PwInfo *info;/* [ref] */
+               NTSTATUS result;
+       } out;
+
+};
+
+
+struct samr_RemoveMemberFromForeignDomain {
+       struct {
+               struct policy_handle *domain_handle;/* [ref] */
+               struct dom_sid2 *sid;/* [ref] */
+       } in;
+
+       struct {
+               NTSTATUS result;
+       } out;
+
+};
+
+
+struct samr_QueryDomainInfo2 {
+       struct {
+               struct policy_handle *domain_handle;/* [ref] */
+               uint16_t level;
+       } in;
+
+       struct {
+               union samr_DomainInfo *info;/* [ref,switch_is(level)] */
+               NTSTATUS result;
+       } out;
+
+};
+
+
+struct samr_QueryUserInfo2 {
+       struct {
+               struct policy_handle *user_handle;/* [ref] */
+               uint16_t level;
+       } in;
+
+       struct {
+               union samr_UserInfo *info;/* [ref,switch_is(level)] */
+               NTSTATUS result;
+       } out;
+
+};
+
+
+struct samr_QueryDisplayInfo2 {
+       struct {
+               struct policy_handle *domain_handle;/* [ref] */
+               uint16_t level;
+               uint32_t start_idx;
+               uint32_t max_entries;
+               uint32_t buf_size;
+       } in;
+
+       struct {
+               uint32_t *total_size;/* [ref] */
+               uint32_t *returned_size;/* [ref] */
+               union samr_DispInfo *info;/* [ref,switch_is(level)] */
+               NTSTATUS result;
+       } out;
+
+};
+
+
+struct samr_GetDisplayEnumerationIndex2 {
+       struct {
+               struct policy_handle *domain_handle;/* [ref] */
+               uint16_t level;
+               struct lsa_String name;
+       } in;
+
+       struct {
+               uint32_t *idx;/* [ref] */
+               NTSTATUS result;
+       } out;
+
+};
+
+
+struct samr_CreateUser2 {
+       struct {
+               struct policy_handle *domain_handle;/* [ref] */
+               struct lsa_String *account_name;/* [ref] */
+               uint32_t acct_flags;
+               uint32_t access_mask;
+       } in;
+
+       struct {
+               struct policy_handle *user_handle;/* [ref] */
+               uint32_t *access_granted;/* [ref] */
+               uint32_t *rid;/* [ref] */
+               NTSTATUS result;
+       } out;
+
+};
+
+
+struct samr_QueryDisplayInfo3 {
+       struct {
+               struct policy_handle *domain_handle;/* [ref] */
+               uint16_t level;
+               uint32_t start_idx;
+               uint32_t max_entries;
+               uint32_t buf_size;
+       } in;
+
+       struct {
+               uint32_t *total_size;/* [ref] */
+               uint32_t *returned_size;/* [ref] */
+               union samr_DispInfo *info;/* [ref,switch_is(level)] */
+               NTSTATUS result;
+       } out;
+
+};
+
+
+struct samr_AddMultipleMembersToAlias {
+       struct {
+               struct policy_handle *alias_handle;/* [ref] */
+               struct lsa_SidArray *sids;/* [ref] */
+       } in;
+
+       struct {
+               NTSTATUS result;
+       } out;
+
+};
+
+
+struct samr_RemoveMultipleMembersFromAlias {
+       struct {
+               struct policy_handle *alias_handle;/* [ref] */
+               struct lsa_SidArray *sids;/* [ref] */
+       } in;
+
+       struct {
+               NTSTATUS result;
+       } out;
+
+};
+
+
+struct samr_OemChangePasswordUser2 {
+       struct {
+               struct lsa_AsciiString *server;/* [unique] */
+               struct lsa_AsciiString *account;/* [ref] */
+               struct samr_CryptPassword *password;/* [unique] */
+               struct samr_Password *hash;/* [unique] */
+       } in;
+
+       struct {
+               NTSTATUS result;
+       } out;
+
+};
+
+
+struct samr_ChangePasswordUser2 {
+       struct {
+               struct lsa_String *server;/* [unique] */
+               struct lsa_String *account;/* [ref] */
+               struct samr_CryptPassword *nt_password;/* [unique] */
+               struct samr_Password *nt_verifier;/* [unique] */
+               uint8_t lm_change;
+               struct samr_CryptPassword *lm_password;/* [unique] */
+               struct samr_Password *lm_verifier;/* [unique] */
+       } in;
+
+       struct {
+               NTSTATUS result;
+       } out;
+
+};
+
+
+struct samr_GetDomPwInfo {
+       struct {
+               struct lsa_String *domain_name;/* [unique] */
+       } in;
+
+       struct {
+               struct samr_PwInfo *info;/* [ref] */
+               NTSTATUS result;
+       } out;
+
+};
+
+
+struct samr_Connect2 {
+       struct {
+               const char *system_name;/* [unique,charset(UTF16)] */
+               uint32_t access_mask;
+       } in;
+
+       struct {
+               struct policy_handle *connect_handle;/* [ref] */
+               NTSTATUS result;
+       } out;
+
+};
+
+
+struct samr_SetUserInfo2 {
+       struct {
+               struct policy_handle *user_handle;/* [ref] */
+               uint16_t level;
+               union samr_UserInfo *info;/* [ref,switch_is(level)] */
+       } in;
+
+       struct {
+               NTSTATUS result;
+       } out;
+
+};
+
+
+struct samr_SetBootKeyInformation {
+       struct {
+               struct policy_handle *connect_handle;/* [ref] */
+               uint32_t unknown1;
+               uint32_t unknown2;
+               uint32_t unknown3;
+       } in;
+
+       struct {
+               NTSTATUS result;
+       } out;
+
+};
+
+
+struct samr_GetBootKeyInformation {
+       struct {
+               struct policy_handle *domain_handle;/* [ref] */
+       } in;
+
+       struct {
+               uint32_t *unknown;/* [ref] */
+               NTSTATUS result;
+       } out;
+
+};
+
+
+struct samr_Connect3 {
+       struct {
+               const char *system_name;/* [unique,charset(UTF16)] */
+               uint32_t unknown;
+               uint32_t access_mask;
+       } in;
+
+       struct {
+               struct policy_handle *connect_handle;/* [ref] */
+               NTSTATUS result;
+       } out;
+
+};
+
+
+struct samr_Connect4 {
+       struct {
+               const char *system_name;/* [unique,charset(UTF16)] */
+               uint32_t unknown;
+               uint32_t access_mask;
+       } in;
+
+       struct {
+               struct policy_handle *connect_handle;/* [ref] */
+               NTSTATUS result;
+       } out;
+
+};
+
+
+struct samr_ChangePasswordUser3 {
+       struct {
+               struct lsa_String *server;/* [unique] */
+               struct lsa_String *account;/* [ref] */
+               struct samr_CryptPassword *nt_password;/* [unique] */
+               struct samr_Password *nt_verifier;/* [unique] */
+               uint8_t lm_change;
+               struct samr_CryptPassword *lm_password;/* [unique] */
+               struct samr_Password *lm_verifier;/* [unique] */
+               struct samr_CryptPassword *password3;/* [unique] */
+       } in;
+
+       struct {
+               struct samr_DomInfo1 *dominfo;/* [ref] */
+               struct samr_ChangeReject *reject;/* [ref] */
+               NTSTATUS result;
+       } out;
+
+};
+
+
+struct samr_Connect5 {
+       struct {
+               const char *system_name;/* [unique,charset(UTF16)] */
+               uint32_t access_mask;
+               uint32_t level_in;
+               union samr_ConnectInfo *info_in;/* [ref,switch_is(level_in)] */
+       } in;
+
+       struct {
+               uint32_t *level_out;/* [ref] */
+               union samr_ConnectInfo *info_out;/* [ref,switch_is(*level_out)] */
+               struct policy_handle *connect_handle;/* [ref] */
+               NTSTATUS result;
+       } out;
+
+};
+
+
+struct samr_RidToSid {
+       struct {
+               struct policy_handle *domain_handle;/* [ref] */
+               uint32_t rid;
+       } in;
+
+       struct {
+               struct dom_sid2 *sid;/* [ref] */
+               NTSTATUS result;
+       } out;
+
+};
+
+
+struct samr_SetDsrmPassword {
+       struct {
+               struct lsa_String *name;/* [unique] */
+               uint32_t unknown;
+               struct samr_Password *hash;/* [unique] */
+       } in;
+
+       struct {
+               NTSTATUS result;
+       } out;
+
+};
+
+
+struct samr_ValidatePassword {
+       struct {
+               enum samr_ValidatePasswordLevel level;
+               union samr_ValidatePasswordReq req;/* [switch_is(level)] */
+       } in;
+
+       struct {
+               union samr_ValidatePasswordRep *rep;/* [ref,switch_is(level)] */
+               NTSTATUS result;
+       } out;
+
+};
+
+#endif /* _HEADER_samr */
index 1c51af5b9ca360bb7c314ee324dba6ffa8f55707..f37b5d70f0e85e936e47478792e71e77dc677109 100644 (file)
@@ -1 +1,326 @@
-#include "ndr/security.h"
+/* header auto-generated by pidl */
+
+#include <stdint.h>
+
+#include "librpc/gen_ndr/misc.h"
+#define dom_sid2 dom_sid
+#define dom_sid28 dom_sid
+#ifndef _HEADER_security
+#define _HEADER_security
+
+#define SEC_MASK_GENERIC       ( 0xF0000000 )
+#define SEC_MASK_FLAGS ( 0x0F000000 )
+#define SEC_MASK_STANDARD      ( 0x00FF0000 )
+#define SEC_MASK_SPECIFIC      ( 0x0000FFFF )
+#define SEC_GENERIC_ALL        ( 0x10000000 )
+#define SEC_GENERIC_EXECUTE    ( 0x20000000 )
+#define SEC_GENERIC_WRITE      ( 0x40000000 )
+#define SEC_GENERIC_READ       ( 0x80000000 )
+#define SEC_FLAG_SYSTEM_SECURITY       ( 0x01000000 )
+#define SEC_FLAG_MAXIMUM_ALLOWED       ( 0x02000000 )
+#define SEC_STD_DELETE ( 0x00010000 )
+#define SEC_STD_READ_CONTROL   ( 0x00020000 )
+#define SEC_STD_WRITE_DAC      ( 0x00040000 )
+#define SEC_STD_WRITE_OWNER    ( 0x00080000 )
+#define SEC_STD_SYNCHRONIZE    ( 0x00100000 )
+#define SEC_STD_REQUIRED       ( 0x000F0000 )
+#define SEC_STD_ALL    ( 0x001F0000 )
+#define SEC_FILE_READ_DATA     ( 0x00000001 )
+#define SEC_FILE_WRITE_DATA    ( 0x00000002 )
+#define SEC_FILE_APPEND_DATA   ( 0x00000004 )
+#define SEC_FILE_READ_EA       ( 0x00000008 )
+#define SEC_FILE_WRITE_EA      ( 0x00000010 )
+#define SEC_FILE_EXECUTE       ( 0x00000020 )
+#define SEC_FILE_READ_ATTRIBUTE        ( 0x00000080 )
+#define SEC_FILE_WRITE_ATTRIBUTE       ( 0x00000100 )
+#define SEC_FILE_ALL   ( 0x000001ff )
+#define SEC_DIR_LIST   ( 0x00000001 )
+#define SEC_DIR_ADD_FILE       ( 0x00000002 )
+#define SEC_DIR_ADD_SUBDIR     ( 0x00000004 )
+#define SEC_DIR_READ_EA        ( 0x00000008 )
+#define SEC_DIR_WRITE_EA       ( 0x00000010 )
+#define SEC_DIR_TRAVERSE       ( 0x00000020 )
+#define SEC_DIR_DELETE_CHILD   ( 0x00000040 )
+#define SEC_DIR_READ_ATTRIBUTE ( 0x00000080 )
+#define SEC_DIR_WRITE_ATTRIBUTE        ( 0x00000100 )
+#define SEC_REG_QUERY_VALUE    ( 0x00000001 )
+#define SEC_REG_SET_VALUE      ( 0x00000002 )
+#define SEC_REG_CREATE_SUBKEY  ( 0x00000004 )
+#define SEC_REG_ENUM_SUBKEYS   ( 0x00000008 )
+#define SEC_REG_NOTIFY ( 0x00000010 )
+#define SEC_REG_CREATE_LINK    ( 0x00000020 )
+#define SEC_ADS_CREATE_CHILD   ( 0x00000001 )
+#define SEC_ADS_DELETE_CHILD   ( 0x00000002 )
+#define SEC_ADS_LIST   ( 0x00000004 )
+#define SEC_ADS_SELF_WRITE     ( 0x00000008 )
+#define SEC_ADS_READ_PROP      ( 0x00000010 )
+#define SEC_ADS_WRITE_PROP     ( 0x00000020 )
+#define SEC_ADS_DELETE_TREE    ( 0x00000040 )
+#define SEC_ADS_LIST_OBJECT    ( 0x00000080 )
+#define SEC_ADS_CONTROL_ACCESS ( 0x00000100 )
+#define SEC_RIGHTS_FILE_READ   ( SEC_STD_READ_CONTROL|SEC_STD_SYNCHRONIZE|SEC_FILE_READ_DATA|SEC_FILE_READ_ATTRIBUTE|SEC_FILE_READ_EA )
+#define SEC_RIGHTS_FILE_WRITE  ( SEC_STD_READ_CONTROL|SEC_STD_SYNCHRONIZE|SEC_FILE_WRITE_DATA|SEC_FILE_WRITE_ATTRIBUTE|SEC_FILE_WRITE_EA|SEC_FILE_APPEND_DATA )
+#define SEC_RIGHTS_FILE_EXECUTE        ( SEC_STD_SYNCHRONIZE|SEC_STD_READ_CONTROL|SEC_FILE_READ_ATTRIBUTE|SEC_FILE_EXECUTE )
+#define SEC_RIGHTS_FILE_ALL    ( SEC_STD_ALL|SEC_FILE_ALL )
+#define SEC_RIGHTS_DIR_READ    ( SEC_RIGHTS_FILE_READ )
+#define SEC_RIGHTS_DIR_WRITE   ( SEC_RIGHTS_FILE_WRITE )
+#define SEC_RIGHTS_DIR_EXECUTE ( SEC_RIGHTS_FILE_EXECUTE )
+#define SEC_RIGHTS_DIR_ALL     ( SEC_RIGHTS_FILE_ALL )
+#define SID_NULL       ( "S-1-0-0" )
+#define NAME_WORLD     ( "WORLD" )
+#define SID_WORLD_DOMAIN       ( "S-1-1" )
+#define SID_WORLD      ( "S-1-1-0" )
+#define SID_CREATOR_OWNER_DOMAIN       ( "S-1-3" )
+#define SID_CREATOR_OWNER      ( "S-1-3-0" )
+#define SID_CREATOR_GROUP      ( "S-1-3-1" )
+#define NAME_NT_AUTHORITY      ( "NT AUTHORITY" )
+#define SID_NT_AUTHORITY       ( "S-1-5" )
+#define SID_NT_DIALUP  ( "S-1-5-1" )
+#define SID_NT_NETWORK ( "S-1-5-2" )
+#define SID_NT_BATCH   ( "S-1-5-3" )
+#define SID_NT_INTERACTIVE     ( "S-1-5-4" )
+#define SID_NT_SERVICE ( "S-1-5-6" )
+#define SID_NT_ANONYMOUS       ( "S-1-5-7" )
+#define SID_NT_PROXY   ( "S-1-5-8" )
+#define SID_NT_ENTERPRISE_DCS  ( "S-1-5-9" )
+#define SID_NT_SELF    ( "S-1-5-10" )
+#define SID_NT_AUTHENTICATED_USERS     ( "S-1-5-11" )
+#define SID_NT_RESTRICTED      ( "S-1-5-12" )
+#define SID_NT_TERMINAL_SERVER_USERS   ( "S-1-5-13" )
+#define SID_NT_REMOTE_INTERACTIVE      ( "S-1-5-14" )
+#define SID_NT_THIS_ORGANISATION       ( "S-1-5-15" )
+#define SID_NT_SYSTEM  ( "S-1-5-18" )
+#define SID_NT_LOCAL_SERVICE   ( "S-1-5-19" )
+#define SID_NT_NETWORK_SERVICE ( "S-1-5-20" )
+#define NAME_BUILTIN   ( "BUILTIN" )
+#define SID_BUILTIN    ( "S-1-5-32" )
+#define SID_BUILTIN_ADMINISTRATORS     ( "S-1-5-32-544" )
+#define SID_BUILTIN_USERS      ( "S-1-5-32-545" )
+#define SID_BUILTIN_GUESTS     ( "S-1-5-32-546" )
+#define SID_BUILTIN_POWER_USERS        ( "S-1-5-32-547" )
+#define SID_BUILTIN_ACCOUNT_OPERATORS  ( "S-1-5-32-548" )
+#define SID_BUILTIN_SERVER_OPERATORS   ( "S-1-5-32-549" )
+#define SID_BUILTIN_PRINT_OPERATORS    ( "S-1-5-32-550" )
+#define SID_BUILTIN_BACKUP_OPERATORS   ( "S-1-5-32-551" )
+#define SID_BUILTIN_REPLICATOR ( "S-1-5-32-552" )
+#define SID_BUILTIN_RAS_SERVERS        ( "S-1-5-32-553" )
+#define SID_BUILTIN_PREW2K     ( "S-1-5-32-554" )
+#define DOMAIN_RID_LOGON       ( 9 )
+#define DOMAIN_RID_ADMINISTRATOR       ( 500 )
+#define DOMAIN_RID_GUEST       ( 501 )
+#define DOMAIN_RID_ADMINS      ( 512 )
+#define DOMAIN_RID_USERS       ( 513 )
+#define DOMAIN_RID_DOMAIN_MEMBERS      ( 515 )
+#define DOMAIN_RID_DCS ( 516 )
+#define DOMAIN_RID_CERT_ADMINS ( 517 )
+#define DOMAIN_RID_SCHEMA_ADMINS       ( 518 )
+#define DOMAIN_RID_ENTERPRISE_ADMINS   ( 519 )
+#define NT4_ACL_REVISION       ( SECURITY_ACL_REVISION_NT4 )
+#define SD_REVISION    ( SECURITY_DESCRIPTOR_REVISION_1 )
+enum sec_privilege
+#ifndef USE_UINT_ENUMS
+ {
+       SEC_PRIV_SECURITY=1,
+       SEC_PRIV_BACKUP=2,
+       SEC_PRIV_RESTORE=3,
+       SEC_PRIV_SYSTEMTIME=4,
+       SEC_PRIV_SHUTDOWN=5,
+       SEC_PRIV_REMOTE_SHUTDOWN=6,
+       SEC_PRIV_TAKE_OWNERSHIP=7,
+       SEC_PRIV_DEBUG=8,
+       SEC_PRIV_SYSTEM_ENVIRONMENT=9,
+       SEC_PRIV_SYSTEM_PROFILE=10,
+       SEC_PRIV_PROFILE_SINGLE_PROCESS=11,
+       SEC_PRIV_INCREASE_BASE_PRIORITY=12,
+       SEC_PRIV_LOAD_DRIVER=13,
+       SEC_PRIV_CREATE_PAGEFILE=14,
+       SEC_PRIV_INCREASE_QUOTA=15,
+       SEC_PRIV_CHANGE_NOTIFY=16,
+       SEC_PRIV_UNDOCK=17,
+       SEC_PRIV_MANAGE_VOLUME=18,
+       SEC_PRIV_IMPERSONATE=19,
+       SEC_PRIV_CREATE_GLOBAL=20,
+       SEC_PRIV_ENABLE_DELEGATION=21,
+       SEC_PRIV_INTERACTIVE_LOGON=22,
+       SEC_PRIV_NETWORK_LOGON=23,
+       SEC_PRIV_REMOTE_INTERACTIVE_LOGON=24
+}
+#else
+ { __donnot_use_enum_sec_privilege=0x7FFFFFFF}
+#define SEC_PRIV_SECURITY ( 1 )
+#define SEC_PRIV_BACKUP ( 2 )
+#define SEC_PRIV_RESTORE ( 3 )
+#define SEC_PRIV_SYSTEMTIME ( 4 )
+#define SEC_PRIV_SHUTDOWN ( 5 )
+#define SEC_PRIV_REMOTE_SHUTDOWN ( 6 )
+#define SEC_PRIV_TAKE_OWNERSHIP ( 7 )
+#define SEC_PRIV_DEBUG ( 8 )
+#define SEC_PRIV_SYSTEM_ENVIRONMENT ( 9 )
+#define SEC_PRIV_SYSTEM_PROFILE ( 10 )
+#define SEC_PRIV_PROFILE_SINGLE_PROCESS ( 11 )
+#define SEC_PRIV_INCREASE_BASE_PRIORITY ( 12 )
+#define SEC_PRIV_LOAD_DRIVER ( 13 )
+#define SEC_PRIV_CREATE_PAGEFILE ( 14 )
+#define SEC_PRIV_INCREASE_QUOTA ( 15 )
+#define SEC_PRIV_CHANGE_NOTIFY ( 16 )
+#define SEC_PRIV_UNDOCK ( 17 )
+#define SEC_PRIV_MANAGE_VOLUME ( 18 )
+#define SEC_PRIV_IMPERSONATE ( 19 )
+#define SEC_PRIV_CREATE_GLOBAL ( 20 )
+#define SEC_PRIV_ENABLE_DELEGATION ( 21 )
+#define SEC_PRIV_INTERACTIVE_LOGON ( 22 )
+#define SEC_PRIV_NETWORK_LOGON ( 23 )
+#define SEC_PRIV_REMOTE_INTERACTIVE_LOGON ( 24 )
+#endif
+;
+
+/* bitmap security_ace_flags */
+#define SEC_ACE_FLAG_OBJECT_INHERIT ( 0x01 )
+#define SEC_ACE_FLAG_CONTAINER_INHERIT ( 0x02 )
+#define SEC_ACE_FLAG_NO_PROPAGATE_INHERIT ( 0x04 )
+#define SEC_ACE_FLAG_INHERIT_ONLY ( 0x08 )
+#define SEC_ACE_FLAG_INHERITED_ACE ( 0x10 )
+#define SEC_ACE_FLAG_VALID_INHERIT ( 0x0f )
+#define SEC_ACE_FLAG_SUCCESSFUL_ACCESS ( 0x40 )
+#define SEC_ACE_FLAG_FAILED_ACCESS ( 0x80 )
+
+enum security_ace_type
+#ifndef USE_UINT_ENUMS
+ {
+       SEC_ACE_TYPE_ACCESS_ALLOWED=0,
+       SEC_ACE_TYPE_ACCESS_DENIED=1,
+       SEC_ACE_TYPE_SYSTEM_AUDIT=2,
+       SEC_ACE_TYPE_SYSTEM_ALARM=3,
+       SEC_ACE_TYPE_ALLOWED_COMPOUND=4,
+       SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT=5,
+       SEC_ACE_TYPE_ACCESS_DENIED_OBJECT=6,
+       SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT=7,
+       SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT=8
+}
+#else
+ { __donnot_use_enum_security_ace_type=0x7FFFFFFF}
+#define SEC_ACE_TYPE_ACCESS_ALLOWED ( 0 )
+#define SEC_ACE_TYPE_ACCESS_DENIED ( 1 )
+#define SEC_ACE_TYPE_SYSTEM_AUDIT ( 2 )
+#define SEC_ACE_TYPE_SYSTEM_ALARM ( 3 )
+#define SEC_ACE_TYPE_ALLOWED_COMPOUND ( 4 )
+#define SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT ( 5 )
+#define SEC_ACE_TYPE_ACCESS_DENIED_OBJECT ( 6 )
+#define SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT ( 7 )
+#define SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT ( 8 )
+#endif
+;
+
+/* bitmap security_ace_object_flags */
+#define SEC_ACE_OBJECT_TYPE_PRESENT ( 0x00000001 )
+#define SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT ( 0x00000002 )
+
+union security_ace_object_type {
+       struct GUID type;/* [case(SEC_ACE_OBJECT_TYPE_PRESENT)] */
+}/* [nodiscriminant] */;
+
+union security_ace_object_inherited_type {
+       struct GUID inherited_type;/* [case(SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT)] */
+}/* [nodiscriminant] */;
+
+struct security_ace_object {
+       uint32_t flags;
+       union security_ace_object_type type;/* [switch_is(flags&SEC_ACE_OBJECT_TYPE_PRESENT)] */
+       union security_ace_object_inherited_type inherited_type;/* [switch_is(flags&SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT)] */
+};
+
+union security_ace_object_ctr {
+       struct security_ace_object object;/* [case(SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT)] */
+}/* [nodiscriminant] */;
+
+struct security_ace {
+       enum security_ace_type type;
+       uint8_t flags;
+       uint16_t size;/* [value(ndr_size_security_ace(r,ndr->flags))] */
+       uint32_t access_mask;
+       union security_ace_object_ctr object;/* [switch_is(type)] */
+       struct dom_sid trustee;
+}/* [gensize,public,nosize] */;
+
+enum security_acl_revision
+#ifndef USE_UINT_ENUMS
+ {
+       SECURITY_ACL_REVISION_NT4=2,
+       SECURITY_ACL_REVISION_ADS=4
+}
+#else
+ { __donnot_use_enum_security_acl_revision=0x7FFFFFFF}
+#define SECURITY_ACL_REVISION_NT4 ( 2 )
+#define SECURITY_ACL_REVISION_ADS ( 4 )
+#endif
+;
+
+struct security_acl {
+       enum security_acl_revision revision;
+       uint16_t size;/* [value(ndr_size_security_acl(r,ndr->flags))] */
+       uint32_t num_aces;/* [range(0 1000)] */
+       struct security_ace *aces;
+}/* [gensize,public,nosize] */;
+
+enum security_descriptor_revision
+#ifndef USE_UINT_ENUMS
+ {
+       SECURITY_DESCRIPTOR_REVISION_1=1
+}
+#else
+ { __donnot_use_enum_security_descriptor_revision=0x7FFFFFFF}
+#define SECURITY_DESCRIPTOR_REVISION_1 ( 1 )
+#endif
+;
+
+/* bitmap security_descriptor_type */
+#define SEC_DESC_OWNER_DEFAULTED ( 0x0001 )
+#define SEC_DESC_GROUP_DEFAULTED ( 0x0002 )
+#define SEC_DESC_DACL_PRESENT ( 0x0004 )
+#define SEC_DESC_DACL_DEFAULTED ( 0x0008 )
+#define SEC_DESC_SACL_PRESENT ( 0x0010 )
+#define SEC_DESC_SACL_DEFAULTED ( 0x0020 )
+#define SEC_DESC_DACL_TRUSTED ( 0x0040 )
+#define SEC_DESC_SERVER_SECURITY ( 0x0080 )
+#define SEC_DESC_DACL_AUTO_INHERIT_REQ ( 0x0100 )
+#define SEC_DESC_SACL_AUTO_INHERIT_REQ ( 0x0200 )
+#define SEC_DESC_DACL_AUTO_INHERITED ( 0x0400 )
+#define SEC_DESC_SACL_AUTO_INHERITED ( 0x0800 )
+#define SEC_DESC_DACL_PROTECTED ( 0x1000 )
+#define SEC_DESC_SACL_PROTECTED ( 0x2000 )
+#define SEC_DESC_RM_CONTROL_VALID ( 0x4000 )
+#define SEC_DESC_SELF_RELATIVE ( 0x8000 )
+
+struct security_descriptor {
+       enum security_descriptor_revision revision;
+       uint16_t type;
+       struct dom_sid *owner_sid;/* [relative] */
+       struct dom_sid *group_sid;/* [relative] */
+       struct security_acl *sacl;/* [relative] */
+       struct security_acl *dacl;/* [relative] */
+}/* [gensize,public,flag(LIBNDR_FLAG_LITTLE_ENDIAN),nosize] */;
+
+struct sec_desc_buf {
+       uint32_t sd_size;/* [value(ndr_size_security_descriptor(sd,ndr->flags)),range(0 0x40000)] */
+       struct security_descriptor *sd;/* [unique,subcontext(4)] */
+}/* [public] */;
+
+struct security_token {
+       struct dom_sid *user_sid;/* [unique] */
+       struct dom_sid *group_sid;/* [unique] */
+       uint32_t num_sids;
+       struct dom_sid **sids;/* [unique,size_is(num_sids)] */
+       uint64_t privilege_mask;
+}/* [public] */;
+
+/* bitmap security_secinfo */
+#define SECINFO_OWNER ( 0x00000001 )
+#define SECINFO_GROUP ( 0x00000002 )
+#define SECINFO_DACL ( 0x00000004 )
+#define SECINFO_SACL ( 0x00000008 )
+#define SECINFO_UNPROTECTED_SACL ( 0x10000000 )
+#define SECINFO_UNPROTECTED_DACL ( 0x20000000 )
+#define SECINFO_PROTECTED_SACL ( 0x40000000 )
+#define SECINFO_PROTECTED_DACL ( 0x80000000 )
+
+#endif /* _HEADER_security */
index 4c92c438f04c0466aadb56225eac519dfe84bb8b..ad6e0af059eababc1d0b645e45bffd6a8212669c 100644 (file)
@@ -14,74 +14,76 @@ static bool api_dfs_GetManagerVersion(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct dfs_GetManagerVersion *r;
-       
+
        call = &ndr_table_netdfs.calls[NDR_DFS_GETMANAGERVERSION];
-       
+
        r = talloc(NULL, struct dfs_GetManagerVersion);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(dfs_GetManagerVersion, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.version = talloc_zero(r, enum dfs_ManagerVersion);
        if (r->out.version == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        _dfs_GetManagerVersion(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(dfs_GetManagerVersion, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_dfs_Add(pipes_struct *p)
@@ -92,67 +94,69 @@ static bool api_dfs_Add(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct dfs_Add *r;
-       
+
        call = &ndr_table_netdfs.calls[NDR_DFS_ADD];
-       
+
        r = talloc(NULL, struct dfs_Add);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(dfs_Add, r);
-       
+       }
+
        r->out.result = _dfs_Add(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(dfs_Add, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_dfs_Remove(pipes_struct *p)
@@ -163,67 +167,69 @@ static bool api_dfs_Remove(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct dfs_Remove *r;
-       
+
        call = &ndr_table_netdfs.calls[NDR_DFS_REMOVE];
-       
+
        r = talloc(NULL, struct dfs_Remove);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(dfs_Remove, r);
-       
+       }
+
        r->out.result = _dfs_Remove(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(dfs_Remove, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_dfs_SetInfo(pipes_struct *p)
@@ -234,67 +240,69 @@ static bool api_dfs_SetInfo(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct dfs_SetInfo *r;
-       
+
        call = &ndr_table_netdfs.calls[NDR_DFS_SETINFO];
-       
+
        r = talloc(NULL, struct dfs_SetInfo);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(dfs_SetInfo, r);
-       
+       }
+
        r->out.result = _dfs_SetInfo(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(dfs_SetInfo, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_dfs_GetInfo(pipes_struct *p)
@@ -305,74 +313,76 @@ static bool api_dfs_GetInfo(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct dfs_GetInfo *r;
-       
+
        call = &ndr_table_netdfs.calls[NDR_DFS_GETINFO];
-       
+
        r = talloc(NULL, struct dfs_GetInfo);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(dfs_GetInfo, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.info = talloc_zero(r, union dfs_Info);
        if (r->out.info == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _dfs_GetInfo(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(dfs_GetInfo, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_dfs_Enum(pipes_struct *p)
@@ -383,70 +393,72 @@ static bool api_dfs_Enum(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct dfs_Enum *r;
-       
+
        call = &ndr_table_netdfs.calls[NDR_DFS_ENUM];
-       
+
        r = talloc(NULL, struct dfs_Enum);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(dfs_Enum, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.info = r->in.info;
        r->out.total = r->in.total;
        r->out.result = _dfs_Enum(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(dfs_Enum, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_dfs_Rename(pipes_struct *p)
@@ -457,67 +469,69 @@ static bool api_dfs_Rename(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct dfs_Rename *r;
-       
+
        call = &ndr_table_netdfs.calls[NDR_DFS_RENAME];
-       
+
        r = talloc(NULL, struct dfs_Rename);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(dfs_Rename, r);
-       
+       }
+
        r->out.result = _dfs_Rename(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(dfs_Rename, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_dfs_Move(pipes_struct *p)
@@ -528,67 +542,69 @@ static bool api_dfs_Move(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct dfs_Move *r;
-       
+
        call = &ndr_table_netdfs.calls[NDR_DFS_MOVE];
-       
+
        r = talloc(NULL, struct dfs_Move);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(dfs_Move, r);
-       
+       }
+
        r->out.result = _dfs_Move(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(dfs_Move, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_dfs_ManagerGetConfigInfo(pipes_struct *p)
@@ -599,67 +615,69 @@ static bool api_dfs_ManagerGetConfigInfo(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct dfs_ManagerGetConfigInfo *r;
-       
+
        call = &ndr_table_netdfs.calls[NDR_DFS_MANAGERGETCONFIGINFO];
-       
+
        r = talloc(NULL, struct dfs_ManagerGetConfigInfo);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(dfs_ManagerGetConfigInfo, r);
-       
+       }
+
        r->out.result = _dfs_ManagerGetConfigInfo(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(dfs_ManagerGetConfigInfo, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_dfs_ManagerSendSiteInfo(pipes_struct *p)
@@ -670,67 +688,69 @@ static bool api_dfs_ManagerSendSiteInfo(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct dfs_ManagerSendSiteInfo *r;
-       
+
        call = &ndr_table_netdfs.calls[NDR_DFS_MANAGERSENDSITEINFO];
-       
+
        r = talloc(NULL, struct dfs_ManagerSendSiteInfo);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(dfs_ManagerSendSiteInfo, r);
-       
+       }
+
        r->out.result = _dfs_ManagerSendSiteInfo(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(dfs_ManagerSendSiteInfo, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_dfs_AddFtRoot(pipes_struct *p)
@@ -741,69 +761,71 @@ static bool api_dfs_AddFtRoot(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct dfs_AddFtRoot *r;
-       
+
        call = &ndr_table_netdfs.calls[NDR_DFS_ADDFTROOT];
-       
+
        r = talloc(NULL, struct dfs_AddFtRoot);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(dfs_AddFtRoot, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.unknown2 = r->in.unknown2;
        r->out.result = _dfs_AddFtRoot(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(dfs_AddFtRoot, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_dfs_RemoveFtRoot(pipes_struct *p)
@@ -814,69 +836,71 @@ static bool api_dfs_RemoveFtRoot(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct dfs_RemoveFtRoot *r;
-       
+
        call = &ndr_table_netdfs.calls[NDR_DFS_REMOVEFTROOT];
-       
+
        r = talloc(NULL, struct dfs_RemoveFtRoot);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(dfs_RemoveFtRoot, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.unknown = r->in.unknown;
        r->out.result = _dfs_RemoveFtRoot(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(dfs_RemoveFtRoot, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_dfs_AddStdRoot(pipes_struct *p)
@@ -887,67 +911,69 @@ static bool api_dfs_AddStdRoot(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct dfs_AddStdRoot *r;
-       
+
        call = &ndr_table_netdfs.calls[NDR_DFS_ADDSTDROOT];
-       
+
        r = talloc(NULL, struct dfs_AddStdRoot);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(dfs_AddStdRoot, r);
-       
+       }
+
        r->out.result = _dfs_AddStdRoot(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(dfs_AddStdRoot, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_dfs_RemoveStdRoot(pipes_struct *p)
@@ -958,67 +984,69 @@ static bool api_dfs_RemoveStdRoot(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct dfs_RemoveStdRoot *r;
-       
+
        call = &ndr_table_netdfs.calls[NDR_DFS_REMOVESTDROOT];
-       
+
        r = talloc(NULL, struct dfs_RemoveStdRoot);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(dfs_RemoveStdRoot, r);
-       
+       }
+
        r->out.result = _dfs_RemoveStdRoot(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(dfs_RemoveStdRoot, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_dfs_ManagerInitialize(pipes_struct *p)
@@ -1029,67 +1057,69 @@ static bool api_dfs_ManagerInitialize(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct dfs_ManagerInitialize *r;
-       
+
        call = &ndr_table_netdfs.calls[NDR_DFS_MANAGERINITIALIZE];
-       
+
        r = talloc(NULL, struct dfs_ManagerInitialize);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(dfs_ManagerInitialize, r);
-       
+       }
+
        r->out.result = _dfs_ManagerInitialize(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(dfs_ManagerInitialize, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_dfs_AddStdRootForced(pipes_struct *p)
@@ -1100,67 +1130,69 @@ static bool api_dfs_AddStdRootForced(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct dfs_AddStdRootForced *r;
-       
+
        call = &ndr_table_netdfs.calls[NDR_DFS_ADDSTDROOTFORCED];
-       
+
        r = talloc(NULL, struct dfs_AddStdRootForced);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(dfs_AddStdRootForced, r);
-       
+       }
+
        r->out.result = _dfs_AddStdRootForced(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(dfs_AddStdRootForced, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_dfs_GetDcAddress(pipes_struct *p)
@@ -1171,67 +1203,73 @@ static bool api_dfs_GetDcAddress(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct dfs_GetDcAddress *r;
-       
+
        call = &ndr_table_netdfs.calls[NDR_DFS_GETDCADDRESS];
-       
+
        r = talloc(NULL, struct dfs_GetDcAddress);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(dfs_GetDcAddress, r);
-       
+       }
+
+       ZERO_STRUCT(r->out);
+       r->out.server_fullname = r->in.server_fullname;
+       r->out.is_root = r->in.is_root;
+       r->out.ttl = r->in.ttl;
        r->out.result = _dfs_GetDcAddress(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(dfs_GetDcAddress, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_dfs_SetDcAddress(pipes_struct *p)
@@ -1242,67 +1280,69 @@ static bool api_dfs_SetDcAddress(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct dfs_SetDcAddress *r;
-       
+
        call = &ndr_table_netdfs.calls[NDR_DFS_SETDCADDRESS];
-       
+
        r = talloc(NULL, struct dfs_SetDcAddress);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(dfs_SetDcAddress, r);
-       
+       }
+
        r->out.result = _dfs_SetDcAddress(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(dfs_SetDcAddress, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_dfs_FlushFtTable(pipes_struct *p)
@@ -1313,67 +1353,69 @@ static bool api_dfs_FlushFtTable(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct dfs_FlushFtTable *r;
-       
+
        call = &ndr_table_netdfs.calls[NDR_DFS_FLUSHFTTABLE];
-       
+
        r = talloc(NULL, struct dfs_FlushFtTable);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(dfs_FlushFtTable, r);
-       
+       }
+
        r->out.result = _dfs_FlushFtTable(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(dfs_FlushFtTable, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_dfs_Add2(pipes_struct *p)
@@ -1384,67 +1426,69 @@ static bool api_dfs_Add2(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct dfs_Add2 *r;
-       
+
        call = &ndr_table_netdfs.calls[NDR_DFS_ADD2];
-       
+
        r = talloc(NULL, struct dfs_Add2);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(dfs_Add2, r);
-       
+       }
+
        r->out.result = _dfs_Add2(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(dfs_Add2, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_dfs_Remove2(pipes_struct *p)
@@ -1455,67 +1499,69 @@ static bool api_dfs_Remove2(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct dfs_Remove2 *r;
-       
+
        call = &ndr_table_netdfs.calls[NDR_DFS_REMOVE2];
-       
+
        r = talloc(NULL, struct dfs_Remove2);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(dfs_Remove2, r);
-       
+       }
+
        r->out.result = _dfs_Remove2(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(dfs_Remove2, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_dfs_EnumEx(pipes_struct *p)
@@ -1526,70 +1572,72 @@ static bool api_dfs_EnumEx(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct dfs_EnumEx *r;
-       
+
        call = &ndr_table_netdfs.calls[NDR_DFS_ENUMEX];
-       
+
        r = talloc(NULL, struct dfs_EnumEx);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(dfs_EnumEx, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.info = r->in.info;
        r->out.total = r->in.total;
        r->out.result = _dfs_EnumEx(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(dfs_EnumEx, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_dfs_SetInfo2(pipes_struct *p)
@@ -1600,67 +1648,69 @@ static bool api_dfs_SetInfo2(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct dfs_SetInfo2 *r;
-       
+
        call = &ndr_table_netdfs.calls[NDR_DFS_SETINFO2];
-       
+
        r = talloc(NULL, struct dfs_SetInfo2);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(dfs_SetInfo2, r);
-       
+       }
+
        r->out.result = _dfs_SetInfo2(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(dfs_SetInfo2, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 
diff --git a/source/librpc/gen_ndr/srv_dssetup.c b/source/librpc/gen_ndr/srv_dssetup.c
new file mode 100644 (file)
index 0000000..9043566
--- /dev/null
@@ -0,0 +1,845 @@
+/*
+ * Unix SMB/CIFS implementation.
+ * server auto-generated by pidl. DO NOT MODIFY!
+ */
+
+#include "includes.h"
+#include "librpc/gen_ndr/srv_dssetup.h"
+
+static bool api_dssetup_DsRoleGetPrimaryDomainInformation(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct dssetup_DsRoleGetPrimaryDomainInformation *r;
+
+       call = &ndr_table_dssetup.calls[NDR_DSSETUP_DSROLEGETPRIMARYDOMAININFORMATION];
+
+       r = talloc(NULL, struct dssetup_DsRoleGetPrimaryDomainInformation);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(dssetup_DsRoleGetPrimaryDomainInformation, r);
+       }
+
+       ZERO_STRUCT(r->out);
+       r->out.info = talloc_zero(r, union dssetup_DsRoleInfo);
+       if (r->out.info == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.result = _dssetup_DsRoleGetPrimaryDomainInformation(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(dssetup_DsRoleGetPrimaryDomainInformation, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_dssetup_DsRoleDnsNameToFlatName(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct dssetup_DsRoleDnsNameToFlatName *r;
+
+       call = &ndr_table_dssetup.calls[NDR_DSSETUP_DSROLEDNSNAMETOFLATNAME];
+
+       r = talloc(NULL, struct dssetup_DsRoleDnsNameToFlatName);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(dssetup_DsRoleDnsNameToFlatName, r);
+       }
+
+       r->out.result = _dssetup_DsRoleDnsNameToFlatName(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(dssetup_DsRoleDnsNameToFlatName, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_dssetup_DsRoleDcAsDc(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct dssetup_DsRoleDcAsDc *r;
+
+       call = &ndr_table_dssetup.calls[NDR_DSSETUP_DSROLEDCASDC];
+
+       r = talloc(NULL, struct dssetup_DsRoleDcAsDc);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(dssetup_DsRoleDcAsDc, r);
+       }
+
+       r->out.result = _dssetup_DsRoleDcAsDc(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(dssetup_DsRoleDcAsDc, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_dssetup_DsRoleDcAsReplica(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct dssetup_DsRoleDcAsReplica *r;
+
+       call = &ndr_table_dssetup.calls[NDR_DSSETUP_DSROLEDCASREPLICA];
+
+       r = talloc(NULL, struct dssetup_DsRoleDcAsReplica);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(dssetup_DsRoleDcAsReplica, r);
+       }
+
+       r->out.result = _dssetup_DsRoleDcAsReplica(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(dssetup_DsRoleDcAsReplica, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_dssetup_DsRoleDemoteDc(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct dssetup_DsRoleDemoteDc *r;
+
+       call = &ndr_table_dssetup.calls[NDR_DSSETUP_DSROLEDEMOTEDC];
+
+       r = talloc(NULL, struct dssetup_DsRoleDemoteDc);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(dssetup_DsRoleDemoteDc, r);
+       }
+
+       r->out.result = _dssetup_DsRoleDemoteDc(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(dssetup_DsRoleDemoteDc, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_dssetup_DsRoleGetDcOperationProgress(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct dssetup_DsRoleGetDcOperationProgress *r;
+
+       call = &ndr_table_dssetup.calls[NDR_DSSETUP_DSROLEGETDCOPERATIONPROGRESS];
+
+       r = talloc(NULL, struct dssetup_DsRoleGetDcOperationProgress);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(dssetup_DsRoleGetDcOperationProgress, r);
+       }
+
+       r->out.result = _dssetup_DsRoleGetDcOperationProgress(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(dssetup_DsRoleGetDcOperationProgress, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_dssetup_DsRoleGetDcOperationResults(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct dssetup_DsRoleGetDcOperationResults *r;
+
+       call = &ndr_table_dssetup.calls[NDR_DSSETUP_DSROLEGETDCOPERATIONRESULTS];
+
+       r = talloc(NULL, struct dssetup_DsRoleGetDcOperationResults);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(dssetup_DsRoleGetDcOperationResults, r);
+       }
+
+       r->out.result = _dssetup_DsRoleGetDcOperationResults(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(dssetup_DsRoleGetDcOperationResults, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_dssetup_DsRoleCancel(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct dssetup_DsRoleCancel *r;
+
+       call = &ndr_table_dssetup.calls[NDR_DSSETUP_DSROLECANCEL];
+
+       r = talloc(NULL, struct dssetup_DsRoleCancel);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(dssetup_DsRoleCancel, r);
+       }
+
+       r->out.result = _dssetup_DsRoleCancel(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(dssetup_DsRoleCancel, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_dssetup_DsRoleServerSaveStateForUpgrade(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct dssetup_DsRoleServerSaveStateForUpgrade *r;
+
+       call = &ndr_table_dssetup.calls[NDR_DSSETUP_DSROLESERVERSAVESTATEFORUPGRADE];
+
+       r = talloc(NULL, struct dssetup_DsRoleServerSaveStateForUpgrade);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(dssetup_DsRoleServerSaveStateForUpgrade, r);
+       }
+
+       r->out.result = _dssetup_DsRoleServerSaveStateForUpgrade(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(dssetup_DsRoleServerSaveStateForUpgrade, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_dssetup_DsRoleUpgradeDownlevelServer(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct dssetup_DsRoleUpgradeDownlevelServer *r;
+
+       call = &ndr_table_dssetup.calls[NDR_DSSETUP_DSROLEUPGRADEDOWNLEVELSERVER];
+
+       r = talloc(NULL, struct dssetup_DsRoleUpgradeDownlevelServer);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(dssetup_DsRoleUpgradeDownlevelServer, r);
+       }
+
+       r->out.result = _dssetup_DsRoleUpgradeDownlevelServer(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(dssetup_DsRoleUpgradeDownlevelServer, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_dssetup_DsRoleAbortDownlevelServerUpgrade(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct dssetup_DsRoleAbortDownlevelServerUpgrade *r;
+
+       call = &ndr_table_dssetup.calls[NDR_DSSETUP_DSROLEABORTDOWNLEVELSERVERUPGRADE];
+
+       r = talloc(NULL, struct dssetup_DsRoleAbortDownlevelServerUpgrade);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(dssetup_DsRoleAbortDownlevelServerUpgrade, r);
+       }
+
+       r->out.result = _dssetup_DsRoleAbortDownlevelServerUpgrade(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(dssetup_DsRoleAbortDownlevelServerUpgrade, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+
+/* Tables */
+static struct api_struct api_dssetup_cmds[] = 
+{
+       {"DSSETUP_DSROLEGETPRIMARYDOMAININFORMATION", NDR_DSSETUP_DSROLEGETPRIMARYDOMAININFORMATION, api_dssetup_DsRoleGetPrimaryDomainInformation},
+       {"DSSETUP_DSROLEDNSNAMETOFLATNAME", NDR_DSSETUP_DSROLEDNSNAMETOFLATNAME, api_dssetup_DsRoleDnsNameToFlatName},
+       {"DSSETUP_DSROLEDCASDC", NDR_DSSETUP_DSROLEDCASDC, api_dssetup_DsRoleDcAsDc},
+       {"DSSETUP_DSROLEDCASREPLICA", NDR_DSSETUP_DSROLEDCASREPLICA, api_dssetup_DsRoleDcAsReplica},
+       {"DSSETUP_DSROLEDEMOTEDC", NDR_DSSETUP_DSROLEDEMOTEDC, api_dssetup_DsRoleDemoteDc},
+       {"DSSETUP_DSROLEGETDCOPERATIONPROGRESS", NDR_DSSETUP_DSROLEGETDCOPERATIONPROGRESS, api_dssetup_DsRoleGetDcOperationProgress},
+       {"DSSETUP_DSROLEGETDCOPERATIONRESULTS", NDR_DSSETUP_DSROLEGETDCOPERATIONRESULTS, api_dssetup_DsRoleGetDcOperationResults},
+       {"DSSETUP_DSROLECANCEL", NDR_DSSETUP_DSROLECANCEL, api_dssetup_DsRoleCancel},
+       {"DSSETUP_DSROLESERVERSAVESTATEFORUPGRADE", NDR_DSSETUP_DSROLESERVERSAVESTATEFORUPGRADE, api_dssetup_DsRoleServerSaveStateForUpgrade},
+       {"DSSETUP_DSROLEUPGRADEDOWNLEVELSERVER", NDR_DSSETUP_DSROLEUPGRADEDOWNLEVELSERVER, api_dssetup_DsRoleUpgradeDownlevelServer},
+       {"DSSETUP_DSROLEABORTDOWNLEVELSERVERUPGRADE", NDR_DSSETUP_DSROLEABORTDOWNLEVELSERVERUPGRADE, api_dssetup_DsRoleAbortDownlevelServerUpgrade},
+};
+
+void dssetup_get_pipe_fns(struct api_struct **fns, int *n_fns)
+{
+       *fns = api_dssetup_cmds;
+       *n_fns = sizeof(api_dssetup_cmds) / sizeof(struct api_struct);
+}
+
+NTSTATUS rpc_dssetup_init(void)
+{
+       return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "dssetup", "dssetup", api_dssetup_cmds, sizeof(api_dssetup_cmds) / sizeof(struct api_struct));
+}
diff --git a/source/librpc/gen_ndr/srv_dssetup.h b/source/librpc/gen_ndr/srv_dssetup.h
new file mode 100644 (file)
index 0000000..3233899
--- /dev/null
@@ -0,0 +1,17 @@
+#include "librpc/gen_ndr/ndr_dssetup.h"
+#ifndef __SRV_DSSETUP__
+#define __SRV_DSSETUP__
+WERROR _dssetup_DsRoleGetPrimaryDomainInformation(pipes_struct *p, struct dssetup_DsRoleGetPrimaryDomainInformation *r);
+WERROR _dssetup_DsRoleDnsNameToFlatName(pipes_struct *p, struct dssetup_DsRoleDnsNameToFlatName *r);
+WERROR _dssetup_DsRoleDcAsDc(pipes_struct *p, struct dssetup_DsRoleDcAsDc *r);
+WERROR _dssetup_DsRoleDcAsReplica(pipes_struct *p, struct dssetup_DsRoleDcAsReplica *r);
+WERROR _dssetup_DsRoleDemoteDc(pipes_struct *p, struct dssetup_DsRoleDemoteDc *r);
+WERROR _dssetup_DsRoleGetDcOperationProgress(pipes_struct *p, struct dssetup_DsRoleGetDcOperationProgress *r);
+WERROR _dssetup_DsRoleGetDcOperationResults(pipes_struct *p, struct dssetup_DsRoleGetDcOperationResults *r);
+WERROR _dssetup_DsRoleCancel(pipes_struct *p, struct dssetup_DsRoleCancel *r);
+WERROR _dssetup_DsRoleServerSaveStateForUpgrade(pipes_struct *p, struct dssetup_DsRoleServerSaveStateForUpgrade *r);
+WERROR _dssetup_DsRoleUpgradeDownlevelServer(pipes_struct *p, struct dssetup_DsRoleUpgradeDownlevelServer *r);
+WERROR _dssetup_DsRoleAbortDownlevelServerUpgrade(pipes_struct *p, struct dssetup_DsRoleAbortDownlevelServerUpgrade *r);
+void dssetup_get_pipe_fns(struct api_struct **fns, int *n_fns);
+NTSTATUS rpc_dssetup_init(void);
+#endif /* __SRV_DSSETUP__ */
index 7e292985bc529b16cd6692554c98907d5e8936aa..de5fc9cd4664a46962bdcb8819e9024d29583a31 100644 (file)
@@ -14,74 +14,76 @@ static bool api_echo_AddOne(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct echo_AddOne *r;
-       
+
        call = &ndr_table_rpcecho.calls[NDR_ECHO_ADDONE];
-       
+
        r = talloc(NULL, struct echo_AddOne);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(echo_AddOne, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.out_data = talloc_zero(r, uint32_t);
        if (r->out.out_data == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        _echo_AddOne(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(echo_AddOne, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_echo_EchoData(pipes_struct *p)
@@ -92,74 +94,76 @@ static bool api_echo_EchoData(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct echo_EchoData *r;
-       
+
        call = &ndr_table_rpcecho.calls[NDR_ECHO_ECHODATA];
-       
+
        r = talloc(NULL, struct echo_EchoData);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(echo_EchoData, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.out_data = talloc_zero_array(r, uint8_t, r->in.len);
        if (r->out.out_data == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        _echo_EchoData(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(echo_EchoData, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_echo_SinkData(pipes_struct *p)
@@ -170,67 +174,69 @@ static bool api_echo_SinkData(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct echo_SinkData *r;
-       
+
        call = &ndr_table_rpcecho.calls[NDR_ECHO_SINKDATA];
-       
+
        r = talloc(NULL, struct echo_SinkData);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(echo_SinkData, r);
-       
+       }
+
        _echo_SinkData(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(echo_SinkData, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_echo_SourceData(pipes_struct *p)
@@ -241,74 +247,76 @@ static bool api_echo_SourceData(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct echo_SourceData *r;
-       
+
        call = &ndr_table_rpcecho.calls[NDR_ECHO_SOURCEDATA];
-       
+
        r = talloc(NULL, struct echo_SourceData);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(echo_SourceData, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.data = talloc_zero_array(r, uint8_t, r->in.len);
        if (r->out.data == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        _echo_SourceData(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(echo_SourceData, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_echo_TestCall(pipes_struct *p)
@@ -319,74 +327,76 @@ static bool api_echo_TestCall(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct echo_TestCall *r;
-       
+
        call = &ndr_table_rpcecho.calls[NDR_ECHO_TESTCALL];
-       
+
        r = talloc(NULL, struct echo_TestCall);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(echo_TestCall, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.s2 = talloc_zero(r, const char *);
        if (r->out.s2 == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        _echo_TestCall(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(echo_TestCall, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_echo_TestCall2(pipes_struct *p)
@@ -397,74 +407,76 @@ static bool api_echo_TestCall2(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct echo_TestCall2 *r;
-       
+
        call = &ndr_table_rpcecho.calls[NDR_ECHO_TESTCALL2];
-       
+
        r = talloc(NULL, struct echo_TestCall2);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(echo_TestCall2, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.info = talloc_zero(r, union echo_Info);
        if (r->out.info == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _echo_TestCall2(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(echo_TestCall2, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_echo_TestSleep(pipes_struct *p)
@@ -475,67 +487,69 @@ static bool api_echo_TestSleep(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct echo_TestSleep *r;
-       
+
        call = &ndr_table_rpcecho.calls[NDR_ECHO_TESTSLEEP];
-       
+
        r = talloc(NULL, struct echo_TestSleep);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(echo_TestSleep, r);
-       
+       }
+
        r->out.result = _echo_TestSleep(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(echo_TestSleep, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_echo_TestEnum(pipes_struct *p)
@@ -546,71 +560,73 @@ static bool api_echo_TestEnum(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct echo_TestEnum *r;
-       
+
        call = &ndr_table_rpcecho.calls[NDR_ECHO_TESTENUM];
-       
+
        r = talloc(NULL, struct echo_TestEnum);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(echo_TestEnum, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.foo1 = r->in.foo1;
        r->out.foo2 = r->in.foo2;
        r->out.foo3 = r->in.foo3;
        _echo_TestEnum(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(echo_TestEnum, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_echo_TestSurrounding(pipes_struct *p)
@@ -621,69 +637,71 @@ static bool api_echo_TestSurrounding(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct echo_TestSurrounding *r;
-       
+
        call = &ndr_table_rpcecho.calls[NDR_ECHO_TESTSURROUNDING];
-       
+
        r = talloc(NULL, struct echo_TestSurrounding);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(echo_TestSurrounding, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.data = r->in.data;
        _echo_TestSurrounding(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(echo_TestSurrounding, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_echo_TestDoublePointer(pipes_struct *p)
@@ -694,67 +712,69 @@ static bool api_echo_TestDoublePointer(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct echo_TestDoublePointer *r;
-       
+
        call = &ndr_table_rpcecho.calls[NDR_ECHO_TESTDOUBLEPOINTER];
-       
+
        r = talloc(NULL, struct echo_TestDoublePointer);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(echo_TestDoublePointer, r);
-       
+       }
+
        r->out.result = _echo_TestDoublePointer(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(echo_TestDoublePointer, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 
index d74a509cfb9ea41b14b69f44b83f44d8b872812c..af768d9555fb4767880c17d61084b48611d0e7ab 100644 (file)
@@ -14,67 +14,69 @@ static bool api_epm_Insert(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct epm_Insert *r;
-       
+
        call = &ndr_table_epmapper.calls[NDR_EPM_INSERT];
-       
+
        r = talloc(NULL, struct epm_Insert);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(epm_Insert, r);
-       
+       }
+
        r->out.result = _epm_Insert(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(epm_Insert, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_epm_Delete(pipes_struct *p)
@@ -85,67 +87,69 @@ static bool api_epm_Delete(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct epm_Delete *r;
-       
+
        call = &ndr_table_epmapper.calls[NDR_EPM_DELETE];
-       
+
        r = talloc(NULL, struct epm_Delete);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(epm_Delete, r);
-       
+       }
+
        r->out.result = _epm_Delete(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(epm_Delete, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_epm_Lookup(pipes_struct *p)
@@ -156,81 +160,83 @@ static bool api_epm_Lookup(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct epm_Lookup *r;
-       
+
        call = &ndr_table_epmapper.calls[NDR_EPM_LOOKUP];
-       
+
        r = talloc(NULL, struct epm_Lookup);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(epm_Lookup, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.entry_handle = r->in.entry_handle;
        r->out.num_ents = talloc_zero(r, uint32_t);
        if (r->out.num_ents == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.entries = talloc_zero_array(r, struct epm_entry_t, r->in.max_ents);
        if (r->out.entries == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _epm_Lookup(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(epm_Lookup, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_epm_Map(pipes_struct *p)
@@ -241,81 +247,83 @@ static bool api_epm_Map(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct epm_Map *r;
-       
+
        call = &ndr_table_epmapper.calls[NDR_EPM_MAP];
-       
+
        r = talloc(NULL, struct epm_Map);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(epm_Map, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.entry_handle = r->in.entry_handle;
        r->out.num_towers = talloc_zero(r, uint32_t);
        if (r->out.num_towers == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.towers = talloc_zero_array(r, struct epm_twr_p_t, r->in.max_towers);
        if (r->out.towers == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _epm_Map(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(epm_Map, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_epm_LookupHandleFree(pipes_struct *p)
@@ -326,69 +334,71 @@ static bool api_epm_LookupHandleFree(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct epm_LookupHandleFree *r;
-       
+
        call = &ndr_table_epmapper.calls[NDR_EPM_LOOKUPHANDLEFREE];
-       
+
        r = talloc(NULL, struct epm_LookupHandleFree);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(epm_LookupHandleFree, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.entry_handle = r->in.entry_handle;
        r->out.result = _epm_LookupHandleFree(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(epm_LookupHandleFree, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_epm_InqObject(pipes_struct *p)
@@ -399,67 +409,69 @@ static bool api_epm_InqObject(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct epm_InqObject *r;
-       
+
        call = &ndr_table_epmapper.calls[NDR_EPM_INQOBJECT];
-       
+
        r = talloc(NULL, struct epm_InqObject);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(epm_InqObject, r);
-       
+       }
+
        r->out.result = _epm_InqObject(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(epm_InqObject, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_epm_MgmtDelete(pipes_struct *p)
@@ -470,67 +482,69 @@ static bool api_epm_MgmtDelete(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct epm_MgmtDelete *r;
-       
+
        call = &ndr_table_epmapper.calls[NDR_EPM_MGMTDELETE];
-       
+
        r = talloc(NULL, struct epm_MgmtDelete);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(epm_MgmtDelete, r);
-       
+       }
+
        r->out.result = _epm_MgmtDelete(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(epm_MgmtDelete, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_epm_MapAuth(pipes_struct *p)
@@ -541,67 +555,69 @@ static bool api_epm_MapAuth(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct epm_MapAuth *r;
-       
+
        call = &ndr_table_epmapper.calls[NDR_EPM_MAPAUTH];
-       
+
        r = talloc(NULL, struct epm_MapAuth);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(epm_MapAuth, r);
-       
+       }
+
        r->out.result = _epm_MapAuth(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(epm_MapAuth, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 
index 784bb51d6f4a6f0b75cb254ab8beb8d4d14f3d5a..d9310a8fbb31d75f45ac9741ef8b4f084163ef83 100644 (file)
@@ -14,67 +14,69 @@ static bool api_eventlog_ClearEventLogW(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct eventlog_ClearEventLogW *r;
-       
+
        call = &ndr_table_eventlog.calls[NDR_EVENTLOG_CLEAREVENTLOGW];
-       
+
        r = talloc(NULL, struct eventlog_ClearEventLogW);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(eventlog_ClearEventLogW, r);
-       
+       }
+
        r->out.result = _eventlog_ClearEventLogW(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(eventlog_ClearEventLogW, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_eventlog_BackupEventLogW(pipes_struct *p)
@@ -85,67 +87,69 @@ static bool api_eventlog_BackupEventLogW(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct eventlog_BackupEventLogW *r;
-       
+
        call = &ndr_table_eventlog.calls[NDR_EVENTLOG_BACKUPEVENTLOGW];
-       
+
        r = talloc(NULL, struct eventlog_BackupEventLogW);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(eventlog_BackupEventLogW, r);
-       
+       }
+
        r->out.result = _eventlog_BackupEventLogW(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(eventlog_BackupEventLogW, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_eventlog_CloseEventLog(pipes_struct *p)
@@ -156,69 +160,71 @@ static bool api_eventlog_CloseEventLog(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct eventlog_CloseEventLog *r;
-       
+
        call = &ndr_table_eventlog.calls[NDR_EVENTLOG_CLOSEEVENTLOG];
-       
+
        r = talloc(NULL, struct eventlog_CloseEventLog);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(eventlog_CloseEventLog, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.handle = r->in.handle;
        r->out.result = _eventlog_CloseEventLog(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(eventlog_CloseEventLog, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_eventlog_DeregisterEventSource(pipes_struct *p)
@@ -229,67 +235,69 @@ static bool api_eventlog_DeregisterEventSource(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct eventlog_DeregisterEventSource *r;
-       
+
        call = &ndr_table_eventlog.calls[NDR_EVENTLOG_DEREGISTEREVENTSOURCE];
-       
+
        r = talloc(NULL, struct eventlog_DeregisterEventSource);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(eventlog_DeregisterEventSource, r);
-       
+       }
+
        r->out.result = _eventlog_DeregisterEventSource(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(eventlog_DeregisterEventSource, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_eventlog_GetNumRecords(pipes_struct *p)
@@ -300,74 +308,76 @@ static bool api_eventlog_GetNumRecords(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct eventlog_GetNumRecords *r;
-       
+
        call = &ndr_table_eventlog.calls[NDR_EVENTLOG_GETNUMRECORDS];
-       
+
        r = talloc(NULL, struct eventlog_GetNumRecords);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(eventlog_GetNumRecords, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.number = talloc_zero(r, uint32_t);
        if (r->out.number == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _eventlog_GetNumRecords(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(eventlog_GetNumRecords, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_eventlog_GetOldestRecord(pipes_struct *p)
@@ -378,67 +388,69 @@ static bool api_eventlog_GetOldestRecord(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct eventlog_GetOldestRecord *r;
-       
+
        call = &ndr_table_eventlog.calls[NDR_EVENTLOG_GETOLDESTRECORD];
-       
+
        r = talloc(NULL, struct eventlog_GetOldestRecord);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(eventlog_GetOldestRecord, r);
-       
+       }
+
        r->out.result = _eventlog_GetOldestRecord(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(eventlog_GetOldestRecord, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_eventlog_ChangeNotify(pipes_struct *p)
@@ -449,67 +461,69 @@ static bool api_eventlog_ChangeNotify(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct eventlog_ChangeNotify *r;
-       
+
        call = &ndr_table_eventlog.calls[NDR_EVENTLOG_CHANGENOTIFY];
-       
+
        r = talloc(NULL, struct eventlog_ChangeNotify);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(eventlog_ChangeNotify, r);
-       
+       }
+
        r->out.result = _eventlog_ChangeNotify(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(eventlog_ChangeNotify, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_eventlog_OpenEventLogW(pipes_struct *p)
@@ -520,74 +534,76 @@ static bool api_eventlog_OpenEventLogW(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct eventlog_OpenEventLogW *r;
-       
+
        call = &ndr_table_eventlog.calls[NDR_EVENTLOG_OPENEVENTLOGW];
-       
+
        r = talloc(NULL, struct eventlog_OpenEventLogW);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(eventlog_OpenEventLogW, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.handle = talloc_zero(r, struct policy_handle);
        if (r->out.handle == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _eventlog_OpenEventLogW(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(eventlog_OpenEventLogW, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_eventlog_RegisterEventSourceW(pipes_struct *p)
@@ -598,67 +614,69 @@ static bool api_eventlog_RegisterEventSourceW(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct eventlog_RegisterEventSourceW *r;
-       
+
        call = &ndr_table_eventlog.calls[NDR_EVENTLOG_REGISTEREVENTSOURCEW];
-       
+
        r = talloc(NULL, struct eventlog_RegisterEventSourceW);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(eventlog_RegisterEventSourceW, r);
-       
+       }
+
        r->out.result = _eventlog_RegisterEventSourceW(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(eventlog_RegisterEventSourceW, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_eventlog_OpenBackupEventLogW(pipes_struct *p)
@@ -669,67 +687,69 @@ static bool api_eventlog_OpenBackupEventLogW(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct eventlog_OpenBackupEventLogW *r;
-       
+
        call = &ndr_table_eventlog.calls[NDR_EVENTLOG_OPENBACKUPEVENTLOGW];
-       
+
        r = talloc(NULL, struct eventlog_OpenBackupEventLogW);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(eventlog_OpenBackupEventLogW, r);
-       
+       }
+
        r->out.result = _eventlog_OpenBackupEventLogW(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(eventlog_OpenBackupEventLogW, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_eventlog_ReadEventLogW(pipes_struct *p)
@@ -740,86 +760,88 @@ static bool api_eventlog_ReadEventLogW(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct eventlog_ReadEventLogW *r;
-       
+
        call = &ndr_table_eventlog.calls[NDR_EVENTLOG_READEVENTLOGW];
-       
+
        r = talloc(NULL, struct eventlog_ReadEventLogW);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(eventlog_ReadEventLogW, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.data = talloc_zero_array(r, uint8_t, r->in.number_of_bytes);
        if (r->out.data == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.sent_size = talloc_zero(r, uint32_t);
        if (r->out.sent_size == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.real_size = talloc_zero(r, uint32_t);
        if (r->out.real_size == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _eventlog_ReadEventLogW(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(eventlog_ReadEventLogW, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_eventlog_ReportEventW(pipes_struct *p)
@@ -830,67 +852,69 @@ static bool api_eventlog_ReportEventW(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct eventlog_ReportEventW *r;
-       
+
        call = &ndr_table_eventlog.calls[NDR_EVENTLOG_REPORTEVENTW];
-       
+
        r = talloc(NULL, struct eventlog_ReportEventW);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(eventlog_ReportEventW, r);
-       
+       }
+
        r->out.result = _eventlog_ReportEventW(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(eventlog_ReportEventW, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_eventlog_ClearEventLogA(pipes_struct *p)
@@ -901,67 +925,69 @@ static bool api_eventlog_ClearEventLogA(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct eventlog_ClearEventLogA *r;
-       
+
        call = &ndr_table_eventlog.calls[NDR_EVENTLOG_CLEAREVENTLOGA];
-       
+
        r = talloc(NULL, struct eventlog_ClearEventLogA);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(eventlog_ClearEventLogA, r);
-       
+       }
+
        r->out.result = _eventlog_ClearEventLogA(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(eventlog_ClearEventLogA, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_eventlog_BackupEventLogA(pipes_struct *p)
@@ -972,67 +998,69 @@ static bool api_eventlog_BackupEventLogA(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct eventlog_BackupEventLogA *r;
-       
+
        call = &ndr_table_eventlog.calls[NDR_EVENTLOG_BACKUPEVENTLOGA];
-       
+
        r = talloc(NULL, struct eventlog_BackupEventLogA);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(eventlog_BackupEventLogA, r);
-       
+       }
+
        r->out.result = _eventlog_BackupEventLogA(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(eventlog_BackupEventLogA, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_eventlog_OpenEventLogA(pipes_struct *p)
@@ -1043,67 +1071,69 @@ static bool api_eventlog_OpenEventLogA(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct eventlog_OpenEventLogA *r;
-       
+
        call = &ndr_table_eventlog.calls[NDR_EVENTLOG_OPENEVENTLOGA];
-       
+
        r = talloc(NULL, struct eventlog_OpenEventLogA);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(eventlog_OpenEventLogA, r);
-       
+       }
+
        r->out.result = _eventlog_OpenEventLogA(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(eventlog_OpenEventLogA, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_eventlog_RegisterEventSourceA(pipes_struct *p)
@@ -1114,67 +1144,69 @@ static bool api_eventlog_RegisterEventSourceA(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct eventlog_RegisterEventSourceA *r;
-       
+
        call = &ndr_table_eventlog.calls[NDR_EVENTLOG_REGISTEREVENTSOURCEA];
-       
+
        r = talloc(NULL, struct eventlog_RegisterEventSourceA);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(eventlog_RegisterEventSourceA, r);
-       
+       }
+
        r->out.result = _eventlog_RegisterEventSourceA(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(eventlog_RegisterEventSourceA, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_eventlog_OpenBackupEventLogA(pipes_struct *p)
@@ -1185,67 +1217,69 @@ static bool api_eventlog_OpenBackupEventLogA(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct eventlog_OpenBackupEventLogA *r;
-       
+
        call = &ndr_table_eventlog.calls[NDR_EVENTLOG_OPENBACKUPEVENTLOGA];
-       
+
        r = talloc(NULL, struct eventlog_OpenBackupEventLogA);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(eventlog_OpenBackupEventLogA, r);
-       
+       }
+
        r->out.result = _eventlog_OpenBackupEventLogA(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(eventlog_OpenBackupEventLogA, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_eventlog_ReadEventLogA(pipes_struct *p)
@@ -1256,67 +1290,69 @@ static bool api_eventlog_ReadEventLogA(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct eventlog_ReadEventLogA *r;
-       
+
        call = &ndr_table_eventlog.calls[NDR_EVENTLOG_READEVENTLOGA];
-       
+
        r = talloc(NULL, struct eventlog_ReadEventLogA);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(eventlog_ReadEventLogA, r);
-       
+       }
+
        r->out.result = _eventlog_ReadEventLogA(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(eventlog_ReadEventLogA, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_eventlog_ReportEventA(pipes_struct *p)
@@ -1327,67 +1363,69 @@ static bool api_eventlog_ReportEventA(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct eventlog_ReportEventA *r;
-       
+
        call = &ndr_table_eventlog.calls[NDR_EVENTLOG_REPORTEVENTA];
-       
+
        r = talloc(NULL, struct eventlog_ReportEventA);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(eventlog_ReportEventA, r);
-       
+       }
+
        r->out.result = _eventlog_ReportEventA(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(eventlog_ReportEventA, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_eventlog_RegisterClusterSvc(pipes_struct *p)
@@ -1398,67 +1436,69 @@ static bool api_eventlog_RegisterClusterSvc(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct eventlog_RegisterClusterSvc *r;
-       
+
        call = &ndr_table_eventlog.calls[NDR_EVENTLOG_REGISTERCLUSTERSVC];
-       
+
        r = talloc(NULL, struct eventlog_RegisterClusterSvc);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(eventlog_RegisterClusterSvc, r);
-       
+       }
+
        r->out.result = _eventlog_RegisterClusterSvc(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(eventlog_RegisterClusterSvc, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_eventlog_DeregisterClusterSvc(pipes_struct *p)
@@ -1469,67 +1509,69 @@ static bool api_eventlog_DeregisterClusterSvc(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct eventlog_DeregisterClusterSvc *r;
-       
+
        call = &ndr_table_eventlog.calls[NDR_EVENTLOG_DEREGISTERCLUSTERSVC];
-       
+
        r = talloc(NULL, struct eventlog_DeregisterClusterSvc);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(eventlog_DeregisterClusterSvc, r);
-       
+       }
+
        r->out.result = _eventlog_DeregisterClusterSvc(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(eventlog_DeregisterClusterSvc, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_eventlog_WriteClusterEvents(pipes_struct *p)
@@ -1540,67 +1582,69 @@ static bool api_eventlog_WriteClusterEvents(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct eventlog_WriteClusterEvents *r;
-       
+
        call = &ndr_table_eventlog.calls[NDR_EVENTLOG_WRITECLUSTEREVENTS];
-       
+
        r = talloc(NULL, struct eventlog_WriteClusterEvents);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(eventlog_WriteClusterEvents, r);
-       
+       }
+
        r->out.result = _eventlog_WriteClusterEvents(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(eventlog_WriteClusterEvents, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_eventlog_GetLogIntormation(pipes_struct *p)
@@ -1611,67 +1655,69 @@ static bool api_eventlog_GetLogIntormation(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct eventlog_GetLogIntormation *r;
-       
+
        call = &ndr_table_eventlog.calls[NDR_EVENTLOG_GETLOGINTORMATION];
-       
+
        r = talloc(NULL, struct eventlog_GetLogIntormation);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(eventlog_GetLogIntormation, r);
-       
+       }
+
        r->out.result = _eventlog_GetLogIntormation(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(eventlog_GetLogIntormation, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_eventlog_FlushEventLog(pipes_struct *p)
@@ -1682,67 +1728,69 @@ static bool api_eventlog_FlushEventLog(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct eventlog_FlushEventLog *r;
-       
+
        call = &ndr_table_eventlog.calls[NDR_EVENTLOG_FLUSHEVENTLOG];
-       
+
        r = talloc(NULL, struct eventlog_FlushEventLog);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(eventlog_FlushEventLog, r);
-       
+       }
+
        r->out.result = _eventlog_FlushEventLog(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(eventlog_FlushEventLog, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 
index 56fbf429571a5233b432512b623f3477a5683fb8..794adea81b57401d64e67ddfefb774bac006c69d 100644 (file)
@@ -14,67 +14,69 @@ static bool api_initshutdown_Init(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct initshutdown_Init *r;
-       
+
        call = &ndr_table_initshutdown.calls[NDR_INITSHUTDOWN_INIT];
-       
+
        r = talloc(NULL, struct initshutdown_Init);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(initshutdown_Init, r);
-       
+       }
+
        r->out.result = _initshutdown_Init(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(initshutdown_Init, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_initshutdown_Abort(pipes_struct *p)
@@ -85,67 +87,69 @@ static bool api_initshutdown_Abort(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct initshutdown_Abort *r;
-       
+
        call = &ndr_table_initshutdown.calls[NDR_INITSHUTDOWN_ABORT];
-       
+
        r = talloc(NULL, struct initshutdown_Abort);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(initshutdown_Abort, r);
-       
+       }
+
        r->out.result = _initshutdown_Abort(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(initshutdown_Abort, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_initshutdown_InitEx(pipes_struct *p)
@@ -156,67 +160,69 @@ static bool api_initshutdown_InitEx(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct initshutdown_InitEx *r;
-       
+
        call = &ndr_table_initshutdown.calls[NDR_INITSHUTDOWN_INITEX];
-       
+
        r = talloc(NULL, struct initshutdown_InitEx);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(initshutdown_InitEx, r);
-       
+       }
+
        r->out.result = _initshutdown_InitEx(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(initshutdown_InitEx, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 
index b76680969aef6839c9d11b9ba569140350195d85..8f8f985650ec277095ee79b37996075ea67ed6ce 100644 (file)
@@ -14,69 +14,71 @@ static bool api_lsa_Close(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_Close *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_CLOSE];
-       
+
        r = talloc(NULL, struct lsa_Close);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_Close, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.handle = r->in.handle;
        r->out.result = _lsa_Close(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_Close, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_Delete(pipes_struct *p)
@@ -87,67 +89,69 @@ static bool api_lsa_Delete(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_Delete *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_DELETE];
-       
+
        r = talloc(NULL, struct lsa_Delete);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_Delete, r);
-       
+       }
+
        r->out.result = _lsa_Delete(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_Delete, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_EnumPrivs(pipes_struct *p)
@@ -158,75 +162,77 @@ static bool api_lsa_EnumPrivs(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_EnumPrivs *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_ENUMPRIVS];
-       
+
        r = talloc(NULL, struct lsa_EnumPrivs);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_EnumPrivs, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.resume_handle = r->in.resume_handle;
        r->out.privs = talloc_zero(r, struct lsa_PrivArray);
        if (r->out.privs == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _lsa_EnumPrivs(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_EnumPrivs, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_QuerySecurity(pipes_struct *p)
@@ -237,74 +243,76 @@ static bool api_lsa_QuerySecurity(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_QuerySecurity *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_QUERYSECURITY];
-       
+
        r = talloc(NULL, struct lsa_QuerySecurity);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_QuerySecurity, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.sdbuf = talloc_zero(r, struct sec_desc_buf);
        if (r->out.sdbuf == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _lsa_QuerySecurity(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_QuerySecurity, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_SetSecObj(pipes_struct *p)
@@ -315,67 +323,69 @@ static bool api_lsa_SetSecObj(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_SetSecObj *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_SETSECOBJ];
-       
+
        r = talloc(NULL, struct lsa_SetSecObj);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_SetSecObj, r);
-       
+       }
+
        r->out.result = _lsa_SetSecObj(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_SetSecObj, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_ChangePassword(pipes_struct *p)
@@ -386,67 +396,69 @@ static bool api_lsa_ChangePassword(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_ChangePassword *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_CHANGEPASSWORD];
-       
+
        r = talloc(NULL, struct lsa_ChangePassword);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_ChangePassword, r);
-       
+       }
+
        r->out.result = _lsa_ChangePassword(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_ChangePassword, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_OpenPolicy(pipes_struct *p)
@@ -457,74 +469,76 @@ static bool api_lsa_OpenPolicy(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_OpenPolicy *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_OPENPOLICY];
-       
+
        r = talloc(NULL, struct lsa_OpenPolicy);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_OpenPolicy, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.handle = talloc_zero(r, struct policy_handle);
        if (r->out.handle == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _lsa_OpenPolicy(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_OpenPolicy, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_QueryInfoPolicy(pipes_struct *p)
@@ -535,74 +549,76 @@ static bool api_lsa_QueryInfoPolicy(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_QueryInfoPolicy *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_QUERYINFOPOLICY];
-       
+
        r = talloc(NULL, struct lsa_QueryInfoPolicy);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_QueryInfoPolicy, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.info = talloc_zero(r, union lsa_PolicyInformation);
        if (r->out.info == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _lsa_QueryInfoPolicy(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_QueryInfoPolicy, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_SetInfoPolicy(pipes_struct *p)
@@ -613,67 +629,69 @@ static bool api_lsa_SetInfoPolicy(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_SetInfoPolicy *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_SETINFOPOLICY];
-       
+
        r = talloc(NULL, struct lsa_SetInfoPolicy);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_SetInfoPolicy, r);
-       
+       }
+
        r->out.result = _lsa_SetInfoPolicy(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_SetInfoPolicy, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_ClearAuditLog(pipes_struct *p)
@@ -684,67 +702,69 @@ static bool api_lsa_ClearAuditLog(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_ClearAuditLog *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_CLEARAUDITLOG];
-       
+
        r = talloc(NULL, struct lsa_ClearAuditLog);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_ClearAuditLog, r);
-       
+       }
+
        r->out.result = _lsa_ClearAuditLog(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_ClearAuditLog, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_CreateAccount(pipes_struct *p)
@@ -755,74 +775,76 @@ static bool api_lsa_CreateAccount(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_CreateAccount *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_CREATEACCOUNT];
-       
+
        r = talloc(NULL, struct lsa_CreateAccount);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_CreateAccount, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.acct_handle = talloc_zero(r, struct policy_handle);
        if (r->out.acct_handle == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _lsa_CreateAccount(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_CreateAccount, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_EnumAccounts(pipes_struct *p)
@@ -833,75 +855,77 @@ static bool api_lsa_EnumAccounts(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_EnumAccounts *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_ENUMACCOUNTS];
-       
+
        r = talloc(NULL, struct lsa_EnumAccounts);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_EnumAccounts, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.resume_handle = r->in.resume_handle;
        r->out.sids = talloc_zero(r, struct lsa_SidArray);
        if (r->out.sids == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _lsa_EnumAccounts(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_EnumAccounts, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_CreateTrustedDomain(pipes_struct *p)
@@ -912,74 +936,76 @@ static bool api_lsa_CreateTrustedDomain(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_CreateTrustedDomain *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_CREATETRUSTEDDOMAIN];
-       
+
        r = talloc(NULL, struct lsa_CreateTrustedDomain);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_CreateTrustedDomain, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.trustdom_handle = talloc_zero(r, struct policy_handle);
        if (r->out.trustdom_handle == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _lsa_CreateTrustedDomain(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_CreateTrustedDomain, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_EnumTrustDom(pipes_struct *p)
@@ -990,75 +1016,77 @@ static bool api_lsa_EnumTrustDom(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_EnumTrustDom *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_ENUMTRUSTDOM];
-       
+
        r = talloc(NULL, struct lsa_EnumTrustDom);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_EnumTrustDom, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.resume_handle = r->in.resume_handle;
        r->out.domains = talloc_zero(r, struct lsa_DomainList);
        if (r->out.domains == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _lsa_EnumTrustDom(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_EnumTrustDom, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_LookupNames(pipes_struct *p)
@@ -1069,76 +1097,78 @@ static bool api_lsa_LookupNames(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_LookupNames *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_LOOKUPNAMES];
-       
+
        r = talloc(NULL, struct lsa_LookupNames);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_LookupNames, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.domains = talloc_zero(r, struct lsa_RefDomainList);
        if (r->out.domains == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.sids = r->in.sids;
        r->out.count = r->in.count;
        r->out.result = _lsa_LookupNames(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_LookupNames, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_LookupSids(pipes_struct *p)
@@ -1149,76 +1179,78 @@ static bool api_lsa_LookupSids(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_LookupSids *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_LOOKUPSIDS];
-       
+
        r = talloc(NULL, struct lsa_LookupSids);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_LookupSids, r);
-       
-       ZERO_STRUCT(r->out);
+       }
+
+       ZERO_STRUCT(r->out);
        r->out.domains = talloc_zero(r, struct lsa_RefDomainList);
        if (r->out.domains == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.names = r->in.names;
        r->out.count = r->in.count;
        r->out.result = _lsa_LookupSids(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_LookupSids, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_CreateSecret(pipes_struct *p)
@@ -1229,74 +1261,76 @@ static bool api_lsa_CreateSecret(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_CreateSecret *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_CREATESECRET];
-       
+
        r = talloc(NULL, struct lsa_CreateSecret);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_CreateSecret, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.sec_handle = talloc_zero(r, struct policy_handle);
        if (r->out.sec_handle == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _lsa_CreateSecret(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_CreateSecret, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_OpenAccount(pipes_struct *p)
@@ -1307,74 +1341,76 @@ static bool api_lsa_OpenAccount(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_OpenAccount *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_OPENACCOUNT];
-       
+
        r = talloc(NULL, struct lsa_OpenAccount);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_OpenAccount, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.acct_handle = talloc_zero(r, struct policy_handle);
        if (r->out.acct_handle == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _lsa_OpenAccount(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_OpenAccount, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_EnumPrivsAccount(pipes_struct *p)
@@ -1385,74 +1421,76 @@ static bool api_lsa_EnumPrivsAccount(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_EnumPrivsAccount *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_ENUMPRIVSACCOUNT];
-       
+
        r = talloc(NULL, struct lsa_EnumPrivsAccount);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_EnumPrivsAccount, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.privs = talloc_zero(r, struct lsa_PrivilegeSet);
        if (r->out.privs == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _lsa_EnumPrivsAccount(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_EnumPrivsAccount, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_AddPrivilegesToAccount(pipes_struct *p)
@@ -1463,67 +1501,69 @@ static bool api_lsa_AddPrivilegesToAccount(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_AddPrivilegesToAccount *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_ADDPRIVILEGESTOACCOUNT];
-       
+
        r = talloc(NULL, struct lsa_AddPrivilegesToAccount);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_AddPrivilegesToAccount, r);
-       
+       }
+
        r->out.result = _lsa_AddPrivilegesToAccount(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_AddPrivilegesToAccount, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_RemovePrivilegesFromAccount(pipes_struct *p)
@@ -1534,67 +1574,69 @@ static bool api_lsa_RemovePrivilegesFromAccount(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_RemovePrivilegesFromAccount *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_REMOVEPRIVILEGESFROMACCOUNT];
-       
+
        r = talloc(NULL, struct lsa_RemovePrivilegesFromAccount);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_RemovePrivilegesFromAccount, r);
-       
+       }
+
        r->out.result = _lsa_RemovePrivilegesFromAccount(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_RemovePrivilegesFromAccount, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_GetQuotasForAccount(pipes_struct *p)
@@ -1605,67 +1647,69 @@ static bool api_lsa_GetQuotasForAccount(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_GetQuotasForAccount *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_GETQUOTASFORACCOUNT];
-       
+
        r = talloc(NULL, struct lsa_GetQuotasForAccount);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_GetQuotasForAccount, r);
-       
+       }
+
        r->out.result = _lsa_GetQuotasForAccount(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_GetQuotasForAccount, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_SetQuotasForAccount(pipes_struct *p)
@@ -1676,67 +1720,69 @@ static bool api_lsa_SetQuotasForAccount(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_SetQuotasForAccount *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_SETQUOTASFORACCOUNT];
-       
+
        r = talloc(NULL, struct lsa_SetQuotasForAccount);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_SetQuotasForAccount, r);
-       
+       }
+
        r->out.result = _lsa_SetQuotasForAccount(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_SetQuotasForAccount, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_GetSystemAccessAccount(pipes_struct *p)
@@ -1747,67 +1793,69 @@ static bool api_lsa_GetSystemAccessAccount(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_GetSystemAccessAccount *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_GETSYSTEMACCESSACCOUNT];
-       
+
        r = talloc(NULL, struct lsa_GetSystemAccessAccount);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_GetSystemAccessAccount, r);
-       
+       }
+
        r->out.result = _lsa_GetSystemAccessAccount(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_GetSystemAccessAccount, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_SetSystemAccessAccount(pipes_struct *p)
@@ -1818,67 +1866,69 @@ static bool api_lsa_SetSystemAccessAccount(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_SetSystemAccessAccount *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_SETSYSTEMACCESSACCOUNT];
-       
+
        r = talloc(NULL, struct lsa_SetSystemAccessAccount);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_SetSystemAccessAccount, r);
-       
+       }
+
        r->out.result = _lsa_SetSystemAccessAccount(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_SetSystemAccessAccount, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_OpenTrustedDomain(pipes_struct *p)
@@ -1889,74 +1939,76 @@ static bool api_lsa_OpenTrustedDomain(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_OpenTrustedDomain *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_OPENTRUSTEDDOMAIN];
-       
+
        r = talloc(NULL, struct lsa_OpenTrustedDomain);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_OpenTrustedDomain, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.trustdom_handle = talloc_zero(r, struct policy_handle);
        if (r->out.trustdom_handle == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _lsa_OpenTrustedDomain(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_OpenTrustedDomain, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_QueryTrustedDomainInfo(pipes_struct *p)
@@ -1967,74 +2019,76 @@ static bool api_lsa_QueryTrustedDomainInfo(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_QueryTrustedDomainInfo *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_QUERYTRUSTEDDOMAININFO];
-       
+
        r = talloc(NULL, struct lsa_QueryTrustedDomainInfo);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_QueryTrustedDomainInfo, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.info = talloc_zero(r, union lsa_TrustedDomainInfo);
        if (r->out.info == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _lsa_QueryTrustedDomainInfo(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_QueryTrustedDomainInfo, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_SetInformationTrustedDomain(pipes_struct *p)
@@ -2045,67 +2099,69 @@ static bool api_lsa_SetInformationTrustedDomain(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_SetInformationTrustedDomain *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_SETINFORMATIONTRUSTEDDOMAIN];
-       
+
        r = talloc(NULL, struct lsa_SetInformationTrustedDomain);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_SetInformationTrustedDomain, r);
-       
+       }
+
        r->out.result = _lsa_SetInformationTrustedDomain(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_SetInformationTrustedDomain, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_OpenSecret(pipes_struct *p)
@@ -2116,74 +2172,76 @@ static bool api_lsa_OpenSecret(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_OpenSecret *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_OPENSECRET];
-       
+
        r = talloc(NULL, struct lsa_OpenSecret);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_OpenSecret, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.sec_handle = talloc_zero(r, struct policy_handle);
        if (r->out.sec_handle == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _lsa_OpenSecret(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_OpenSecret, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_SetSecret(pipes_struct *p)
@@ -2194,67 +2252,69 @@ static bool api_lsa_SetSecret(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_SetSecret *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_SETSECRET];
-       
+
        r = talloc(NULL, struct lsa_SetSecret);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_SetSecret, r);
-       
+       }
+
        r->out.result = _lsa_SetSecret(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_SetSecret, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_QuerySecret(pipes_struct *p)
@@ -2265,72 +2325,74 @@ static bool api_lsa_QuerySecret(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_QuerySecret *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_QUERYSECRET];
-       
+
        r = talloc(NULL, struct lsa_QuerySecret);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_QuerySecret, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.new_val = r->in.new_val;
        r->out.new_mtime = r->in.new_mtime;
        r->out.old_val = r->in.old_val;
        r->out.old_mtime = r->in.old_mtime;
        r->out.result = _lsa_QuerySecret(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_QuerySecret, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_LookupPrivValue(pipes_struct *p)
@@ -2341,74 +2403,76 @@ static bool api_lsa_LookupPrivValue(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_LookupPrivValue *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_LOOKUPPRIVVALUE];
-       
+
        r = talloc(NULL, struct lsa_LookupPrivValue);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_LookupPrivValue, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.luid = talloc_zero(r, struct lsa_LUID);
        if (r->out.luid == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _lsa_LookupPrivValue(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_LookupPrivValue, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_LookupPrivName(pipes_struct *p)
@@ -2419,74 +2483,76 @@ static bool api_lsa_LookupPrivName(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_LookupPrivName *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_LOOKUPPRIVNAME];
-       
+
        r = talloc(NULL, struct lsa_LookupPrivName);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_LookupPrivName, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.name = talloc_zero(r, struct lsa_StringLarge);
        if (r->out.name == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _lsa_LookupPrivName(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_LookupPrivName, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_LookupPrivDisplayName(pipes_struct *p)
@@ -2497,75 +2563,77 @@ static bool api_lsa_LookupPrivDisplayName(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_LookupPrivDisplayName *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_LOOKUPPRIVDISPLAYNAME];
-       
+
        r = talloc(NULL, struct lsa_LookupPrivDisplayName);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_LookupPrivDisplayName, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.disp_name = talloc_zero(r, struct lsa_StringLarge);
        if (r->out.disp_name == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.language_id = r->in.language_id;
        r->out.result = _lsa_LookupPrivDisplayName(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_LookupPrivDisplayName, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_DeleteObject(pipes_struct *p)
@@ -2576,67 +2644,69 @@ static bool api_lsa_DeleteObject(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_DeleteObject *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_DELETEOBJECT];
-       
+
        r = talloc(NULL, struct lsa_DeleteObject);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_DeleteObject, r);
-       
+       }
+
        r->out.result = _lsa_DeleteObject(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_DeleteObject, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_EnumAccountsWithUserRight(pipes_struct *p)
@@ -2647,74 +2717,76 @@ static bool api_lsa_EnumAccountsWithUserRight(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_EnumAccountsWithUserRight *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_ENUMACCOUNTSWITHUSERRIGHT];
-       
+
        r = talloc(NULL, struct lsa_EnumAccountsWithUserRight);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_EnumAccountsWithUserRight, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.sids = talloc_zero(r, struct lsa_SidArray);
        if (r->out.sids == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _lsa_EnumAccountsWithUserRight(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_EnumAccountsWithUserRight, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_EnumAccountRights(pipes_struct *p)
@@ -2725,74 +2797,76 @@ static bool api_lsa_EnumAccountRights(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_EnumAccountRights *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_ENUMACCOUNTRIGHTS];
-       
+
        r = talloc(NULL, struct lsa_EnumAccountRights);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_EnumAccountRights, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.rights = talloc_zero(r, struct lsa_RightSet);
        if (r->out.rights == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _lsa_EnumAccountRights(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_EnumAccountRights, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_AddAccountRights(pipes_struct *p)
@@ -2803,67 +2877,69 @@ static bool api_lsa_AddAccountRights(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_AddAccountRights *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_ADDACCOUNTRIGHTS];
-       
+
        r = talloc(NULL, struct lsa_AddAccountRights);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_AddAccountRights, r);
-       
+       }
+
        r->out.result = _lsa_AddAccountRights(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_AddAccountRights, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_RemoveAccountRights(pipes_struct *p)
@@ -2874,67 +2950,69 @@ static bool api_lsa_RemoveAccountRights(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_RemoveAccountRights *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_REMOVEACCOUNTRIGHTS];
-       
+
        r = talloc(NULL, struct lsa_RemoveAccountRights);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_RemoveAccountRights, r);
-       
+       }
+
        r->out.result = _lsa_RemoveAccountRights(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_RemoveAccountRights, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_QueryTrustedDomainInfoBySid(pipes_struct *p)
@@ -2945,74 +3023,76 @@ static bool api_lsa_QueryTrustedDomainInfoBySid(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_QueryTrustedDomainInfoBySid *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_QUERYTRUSTEDDOMAININFOBYSID];
-       
+
        r = talloc(NULL, struct lsa_QueryTrustedDomainInfoBySid);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_QueryTrustedDomainInfoBySid, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.info = talloc_zero(r, union lsa_TrustedDomainInfo);
        if (r->out.info == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _lsa_QueryTrustedDomainInfoBySid(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_QueryTrustedDomainInfoBySid, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_SetTrustedDomainInfo(pipes_struct *p)
@@ -3023,67 +3103,69 @@ static bool api_lsa_SetTrustedDomainInfo(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_SetTrustedDomainInfo *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_SETTRUSTEDDOMAININFO];
-       
+
        r = talloc(NULL, struct lsa_SetTrustedDomainInfo);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_SetTrustedDomainInfo, r);
-       
+       }
+
        r->out.result = _lsa_SetTrustedDomainInfo(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_SetTrustedDomainInfo, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_DeleteTrustedDomain(pipes_struct *p)
@@ -3094,67 +3176,69 @@ static bool api_lsa_DeleteTrustedDomain(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_DeleteTrustedDomain *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_DELETETRUSTEDDOMAIN];
-       
+
        r = talloc(NULL, struct lsa_DeleteTrustedDomain);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_DeleteTrustedDomain, r);
-       
+       }
+
        r->out.result = _lsa_DeleteTrustedDomain(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_DeleteTrustedDomain, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_StorePrivateData(pipes_struct *p)
@@ -3165,67 +3249,69 @@ static bool api_lsa_StorePrivateData(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_StorePrivateData *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_STOREPRIVATEDATA];
-       
+
        r = talloc(NULL, struct lsa_StorePrivateData);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_StorePrivateData, r);
-       
+       }
+
        r->out.result = _lsa_StorePrivateData(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_StorePrivateData, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_RetrievePrivateData(pipes_struct *p)
@@ -3236,67 +3322,69 @@ static bool api_lsa_RetrievePrivateData(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_RetrievePrivateData *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_RETRIEVEPRIVATEDATA];
-       
+
        r = talloc(NULL, struct lsa_RetrievePrivateData);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_RetrievePrivateData, r);
-       
+       }
+
        r->out.result = _lsa_RetrievePrivateData(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_RetrievePrivateData, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_OpenPolicy2(pipes_struct *p)
@@ -3307,74 +3395,76 @@ static bool api_lsa_OpenPolicy2(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_OpenPolicy2 *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_OPENPOLICY2];
-       
+
        r = talloc(NULL, struct lsa_OpenPolicy2);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_OpenPolicy2, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.handle = talloc_zero(r, struct policy_handle);
        if (r->out.handle == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _lsa_OpenPolicy2(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_OpenPolicy2, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_GetUserName(pipes_struct *p)
@@ -3385,70 +3475,72 @@ static bool api_lsa_GetUserName(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_GetUserName *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_GETUSERNAME];
-       
+
        r = talloc(NULL, struct lsa_GetUserName);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_GetUserName, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.account_name = r->in.account_name;
        r->out.authority_name = r->in.authority_name;
        r->out.result = _lsa_GetUserName(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_GetUserName, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_QueryInfoPolicy2(pipes_struct *p)
@@ -3459,74 +3551,76 @@ static bool api_lsa_QueryInfoPolicy2(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_QueryInfoPolicy2 *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_QUERYINFOPOLICY2];
-       
+
        r = talloc(NULL, struct lsa_QueryInfoPolicy2);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_QueryInfoPolicy2, r);
-       
-       ZERO_STRUCT(r->out);
+       }
+
+       ZERO_STRUCT(r->out);
        r->out.info = talloc_zero(r, union lsa_PolicyInformation);
        if (r->out.info == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _lsa_QueryInfoPolicy2(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_QueryInfoPolicy2, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_SetInfoPolicy2(pipes_struct *p)
@@ -3537,67 +3631,69 @@ static bool api_lsa_SetInfoPolicy2(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_SetInfoPolicy2 *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_SETINFOPOLICY2];
-       
+
        r = talloc(NULL, struct lsa_SetInfoPolicy2);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_SetInfoPolicy2, r);
-       
+       }
+
        r->out.result = _lsa_SetInfoPolicy2(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_SetInfoPolicy2, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_QueryTrustedDomainInfoByName(pipes_struct *p)
@@ -3608,74 +3704,76 @@ static bool api_lsa_QueryTrustedDomainInfoByName(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_QueryTrustedDomainInfoByName *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_QUERYTRUSTEDDOMAININFOBYNAME];
-       
+
        r = talloc(NULL, struct lsa_QueryTrustedDomainInfoByName);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_QueryTrustedDomainInfoByName, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.info = talloc_zero(r, union lsa_TrustedDomainInfo);
        if (r->out.info == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _lsa_QueryTrustedDomainInfoByName(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_QueryTrustedDomainInfoByName, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_SetTrustedDomainInfoByName(pipes_struct *p)
@@ -3686,67 +3784,69 @@ static bool api_lsa_SetTrustedDomainInfoByName(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_SetTrustedDomainInfoByName *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_SETTRUSTEDDOMAININFOBYNAME];
-       
+
        r = talloc(NULL, struct lsa_SetTrustedDomainInfoByName);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_SetTrustedDomainInfoByName, r);
-       
+       }
+
        r->out.result = _lsa_SetTrustedDomainInfoByName(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_SetTrustedDomainInfoByName, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_EnumTrustedDomainsEx(pipes_struct *p)
@@ -3757,75 +3857,77 @@ static bool api_lsa_EnumTrustedDomainsEx(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_EnumTrustedDomainsEx *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_ENUMTRUSTEDDOMAINSEX];
-       
+
        r = talloc(NULL, struct lsa_EnumTrustedDomainsEx);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_EnumTrustedDomainsEx, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.resume_handle = r->in.resume_handle;
        r->out.domains = talloc_zero(r, struct lsa_DomainListEx);
        if (r->out.domains == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _lsa_EnumTrustedDomainsEx(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_EnumTrustedDomainsEx, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_CreateTrustedDomainEx(pipes_struct *p)
@@ -3836,67 +3938,69 @@ static bool api_lsa_CreateTrustedDomainEx(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_CreateTrustedDomainEx *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_CREATETRUSTEDDOMAINEX];
-       
+
        r = talloc(NULL, struct lsa_CreateTrustedDomainEx);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_CreateTrustedDomainEx, r);
-       
+       }
+
        r->out.result = _lsa_CreateTrustedDomainEx(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_CreateTrustedDomainEx, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_CloseTrustedDomainEx(pipes_struct *p)
@@ -3907,69 +4011,71 @@ static bool api_lsa_CloseTrustedDomainEx(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_CloseTrustedDomainEx *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_CLOSETRUSTEDDOMAINEX];
-       
+
        r = talloc(NULL, struct lsa_CloseTrustedDomainEx);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_CloseTrustedDomainEx, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.handle = r->in.handle;
        r->out.result = _lsa_CloseTrustedDomainEx(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_CloseTrustedDomainEx, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_QueryDomainInformationPolicy(pipes_struct *p)
@@ -3980,74 +4086,76 @@ static bool api_lsa_QueryDomainInformationPolicy(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_QueryDomainInformationPolicy *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_QUERYDOMAININFORMATIONPOLICY];
-       
+
        r = talloc(NULL, struct lsa_QueryDomainInformationPolicy);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_QueryDomainInformationPolicy, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.info = talloc_zero(r, union lsa_DomainInformationPolicy);
        if (r->out.info == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _lsa_QueryDomainInformationPolicy(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_QueryDomainInformationPolicy, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_SetDomainInformationPolicy(pipes_struct *p)
@@ -4058,67 +4166,69 @@ static bool api_lsa_SetDomainInformationPolicy(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_SetDomainInformationPolicy *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_SETDOMAININFORMATIONPOLICY];
-       
+
        r = talloc(NULL, struct lsa_SetDomainInformationPolicy);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_SetDomainInformationPolicy, r);
-       
+       }
+
        r->out.result = _lsa_SetDomainInformationPolicy(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_SetDomainInformationPolicy, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_OpenTrustedDomainByName(pipes_struct *p)
@@ -4129,74 +4239,76 @@ static bool api_lsa_OpenTrustedDomainByName(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_OpenTrustedDomainByName *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_OPENTRUSTEDDOMAINBYNAME];
-       
+
        r = talloc(NULL, struct lsa_OpenTrustedDomainByName);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_OpenTrustedDomainByName, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.trustdom_handle = talloc_zero(r, struct policy_handle);
        if (r->out.trustdom_handle == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _lsa_OpenTrustedDomainByName(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_OpenTrustedDomainByName, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_TestCall(pipes_struct *p)
@@ -4207,67 +4319,69 @@ static bool api_lsa_TestCall(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_TestCall *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_TESTCALL];
-       
+
        r = talloc(NULL, struct lsa_TestCall);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_TestCall, r);
-       
+       }
+
        r->out.result = _lsa_TestCall(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_TestCall, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_LookupSids2(pipes_struct *p)
@@ -4278,76 +4392,78 @@ static bool api_lsa_LookupSids2(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_LookupSids2 *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_LOOKUPSIDS2];
-       
+
        r = talloc(NULL, struct lsa_LookupSids2);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_LookupSids2, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.domains = talloc_zero(r, struct lsa_RefDomainList);
        if (r->out.domains == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.names = r->in.names;
        r->out.count = r->in.count;
        r->out.result = _lsa_LookupSids2(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_LookupSids2, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_LookupNames2(pipes_struct *p)
@@ -4358,76 +4474,78 @@ static bool api_lsa_LookupNames2(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_LookupNames2 *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_LOOKUPNAMES2];
-       
+
        r = talloc(NULL, struct lsa_LookupNames2);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_LookupNames2, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.domains = talloc_zero(r, struct lsa_RefDomainList);
        if (r->out.domains == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.sids = r->in.sids;
        r->out.count = r->in.count;
        r->out.result = _lsa_LookupNames2(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_LookupNames2, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_CreateTrustedDomainEx2(pipes_struct *p)
@@ -4438,67 +4556,69 @@ static bool api_lsa_CreateTrustedDomainEx2(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_CreateTrustedDomainEx2 *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_CREATETRUSTEDDOMAINEX2];
-       
+
        r = talloc(NULL, struct lsa_CreateTrustedDomainEx2);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_CreateTrustedDomainEx2, r);
-       
+       }
+
        r->out.result = _lsa_CreateTrustedDomainEx2(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_CreateTrustedDomainEx2, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_CREDRWRITE(pipes_struct *p)
@@ -4509,67 +4629,69 @@ static bool api_lsa_CREDRWRITE(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_CREDRWRITE *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_CREDRWRITE];
-       
+
        r = talloc(NULL, struct lsa_CREDRWRITE);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_CREDRWRITE, r);
-       
+       }
+
        r->out.result = _lsa_CREDRWRITE(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_CREDRWRITE, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_CREDRREAD(pipes_struct *p)
@@ -4580,67 +4702,69 @@ static bool api_lsa_CREDRREAD(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_CREDRREAD *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_CREDRREAD];
-       
+
        r = talloc(NULL, struct lsa_CREDRREAD);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_CREDRREAD, r);
-       
+       }
+
        r->out.result = _lsa_CREDRREAD(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_CREDRREAD, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_CREDRENUMERATE(pipes_struct *p)
@@ -4651,67 +4775,69 @@ static bool api_lsa_CREDRENUMERATE(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_CREDRENUMERATE *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_CREDRENUMERATE];
-       
+
        r = talloc(NULL, struct lsa_CREDRENUMERATE);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_CREDRENUMERATE, r);
-       
+       }
+
        r->out.result = _lsa_CREDRENUMERATE(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_CREDRENUMERATE, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_CREDRWRITEDOMAINCREDENTIALS(pipes_struct *p)
@@ -4722,67 +4848,69 @@ static bool api_lsa_CREDRWRITEDOMAINCREDENTIALS(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_CREDRWRITEDOMAINCREDENTIALS *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_CREDRWRITEDOMAINCREDENTIALS];
-       
+
        r = talloc(NULL, struct lsa_CREDRWRITEDOMAINCREDENTIALS);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_CREDRWRITEDOMAINCREDENTIALS, r);
-       
+       }
+
        r->out.result = _lsa_CREDRWRITEDOMAINCREDENTIALS(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_CREDRWRITEDOMAINCREDENTIALS, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_CREDRREADDOMAINCREDENTIALS(pipes_struct *p)
@@ -4793,67 +4921,69 @@ static bool api_lsa_CREDRREADDOMAINCREDENTIALS(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_CREDRREADDOMAINCREDENTIALS *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_CREDRREADDOMAINCREDENTIALS];
-       
+
        r = talloc(NULL, struct lsa_CREDRREADDOMAINCREDENTIALS);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_CREDRREADDOMAINCREDENTIALS, r);
-       
+       }
+
        r->out.result = _lsa_CREDRREADDOMAINCREDENTIALS(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_CREDRREADDOMAINCREDENTIALS, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_CREDRDELETE(pipes_struct *p)
@@ -4864,67 +4994,69 @@ static bool api_lsa_CREDRDELETE(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_CREDRDELETE *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_CREDRDELETE];
-       
+
        r = talloc(NULL, struct lsa_CREDRDELETE);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_CREDRDELETE, r);
-       
+       }
+
        r->out.result = _lsa_CREDRDELETE(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_CREDRDELETE, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_CREDRGETTARGETINFO(pipes_struct *p)
@@ -4935,67 +5067,69 @@ static bool api_lsa_CREDRGETTARGETINFO(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_CREDRGETTARGETINFO *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_CREDRGETTARGETINFO];
-       
+
        r = talloc(NULL, struct lsa_CREDRGETTARGETINFO);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_CREDRGETTARGETINFO, r);
-       
+       }
+
        r->out.result = _lsa_CREDRGETTARGETINFO(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_CREDRGETTARGETINFO, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_CREDRPROFILELOADED(pipes_struct *p)
@@ -5006,67 +5140,69 @@ static bool api_lsa_CREDRPROFILELOADED(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_CREDRPROFILELOADED *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_CREDRPROFILELOADED];
-       
+
        r = talloc(NULL, struct lsa_CREDRPROFILELOADED);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_CREDRPROFILELOADED, r);
-       
+       }
+
        r->out.result = _lsa_CREDRPROFILELOADED(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_CREDRPROFILELOADED, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_LookupNames3(pipes_struct *p)
@@ -5077,76 +5213,78 @@ static bool api_lsa_LookupNames3(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_LookupNames3 *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_LOOKUPNAMES3];
-       
+
        r = talloc(NULL, struct lsa_LookupNames3);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_LookupNames3, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.domains = talloc_zero(r, struct lsa_RefDomainList);
        if (r->out.domains == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.sids = r->in.sids;
        r->out.count = r->in.count;
        r->out.result = _lsa_LookupNames3(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_LookupNames3, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_CREDRGETSESSIONTYPES(pipes_struct *p)
@@ -5157,67 +5295,69 @@ static bool api_lsa_CREDRGETSESSIONTYPES(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_CREDRGETSESSIONTYPES *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_CREDRGETSESSIONTYPES];
-       
+
        r = talloc(NULL, struct lsa_CREDRGETSESSIONTYPES);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_CREDRGETSESSIONTYPES, r);
-       
+       }
+
        r->out.result = _lsa_CREDRGETSESSIONTYPES(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_CREDRGETSESSIONTYPES, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_LSARREGISTERAUDITEVENT(pipes_struct *p)
@@ -5228,67 +5368,69 @@ static bool api_lsa_LSARREGISTERAUDITEVENT(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_LSARREGISTERAUDITEVENT *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_LSARREGISTERAUDITEVENT];
-       
+
        r = talloc(NULL, struct lsa_LSARREGISTERAUDITEVENT);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_LSARREGISTERAUDITEVENT, r);
-       
+       }
+
        r->out.result = _lsa_LSARREGISTERAUDITEVENT(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_LSARREGISTERAUDITEVENT, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_LSARGENAUDITEVENT(pipes_struct *p)
@@ -5299,67 +5441,69 @@ static bool api_lsa_LSARGENAUDITEVENT(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_LSARGENAUDITEVENT *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_LSARGENAUDITEVENT];
-       
+
        r = talloc(NULL, struct lsa_LSARGENAUDITEVENT);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_LSARGENAUDITEVENT, r);
-       
+       }
+
        r->out.result = _lsa_LSARGENAUDITEVENT(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_LSARGENAUDITEVENT, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_LSARUNREGISTERAUDITEVENT(pipes_struct *p)
@@ -5370,138 +5514,149 @@ static bool api_lsa_LSARUNREGISTERAUDITEVENT(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_LSARUNREGISTERAUDITEVENT *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_LSARUNREGISTERAUDITEVENT];
-       
+
        r = talloc(NULL, struct lsa_LSARUNREGISTERAUDITEVENT);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_LSARUNREGISTERAUDITEVENT, r);
-       
+       }
+
        r->out.result = _lsa_LSARUNREGISTERAUDITEVENT(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_LSARUNREGISTERAUDITEVENT, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
-static bool api_lsa_LSARQUERYFORESTTRUSTINFORMATION(pipes_struct *p)
+static bool api_lsa_lsaRQueryForestTrustInformation(pipes_struct *p)
 {
        const struct ndr_interface_call *call;
        struct ndr_pull *pull;
        struct ndr_push *push;
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
-       struct lsa_LSARQUERYFORESTTRUSTINFORMATION *r;
-       
+       struct lsa_lsaRQueryForestTrustInformation *r;
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_LSARQUERYFORESTTRUSTINFORMATION];
-       
-       r = talloc(NULL, struct lsa_LSARQUERYFORESTTRUSTINFORMATION);
+
+       r = talloc(NULL, struct lsa_lsaRQueryForestTrustInformation);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(lsa_lsaRQueryForestTrustInformation, r);
        }
-       
-       if (DEBUGLEVEL >= 10)
-               NDR_PRINT_IN_DEBUG(lsa_LSARQUERYFORESTTRUSTINFORMATION, r);
-       
-       r->out.result = _lsa_LSARQUERYFORESTTRUSTINFORMATION(p, r);
-       
+
+       ZERO_STRUCT(r->out);
+       r->out.forest_trust_info = talloc_zero(r, struct lsa_ForestTrustInformation *);
+       if (r->out.forest_trust_info == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.result = _lsa_lsaRQueryForestTrustInformation(p, r);
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(lsa_lsaRQueryForestTrustInformation, r);
        }
-       
-       if (DEBUGLEVEL >= 10)
-               NDR_PRINT_OUT_DEBUG(lsa_LSARQUERYFORESTTRUSTINFORMATION, r);
-       
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_LSARSETFORESTTRUSTINFORMATION(pipes_struct *p)
@@ -5512,67 +5667,69 @@ static bool api_lsa_LSARSETFORESTTRUSTINFORMATION(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_LSARSETFORESTTRUSTINFORMATION *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_LSARSETFORESTTRUSTINFORMATION];
-       
+
        r = talloc(NULL, struct lsa_LSARSETFORESTTRUSTINFORMATION);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_LSARSETFORESTTRUSTINFORMATION, r);
-       
+       }
+
        r->out.result = _lsa_LSARSETFORESTTRUSTINFORMATION(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_LSARSETFORESTTRUSTINFORMATION, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_CREDRRENAME(pipes_struct *p)
@@ -5583,67 +5740,69 @@ static bool api_lsa_CREDRRENAME(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_CREDRRENAME *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_CREDRRENAME];
-       
+
        r = talloc(NULL, struct lsa_CREDRRENAME);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_CREDRRENAME, r);
-       
+       }
+
        r->out.result = _lsa_CREDRRENAME(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_CREDRRENAME, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_LookupSids3(pipes_struct *p)
@@ -5654,76 +5813,78 @@ static bool api_lsa_LookupSids3(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_LookupSids3 *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_LOOKUPSIDS3];
-       
+
        r = talloc(NULL, struct lsa_LookupSids3);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_LookupSids3, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.domains = talloc_zero(r, struct lsa_RefDomainList);
        if (r->out.domains == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.names = r->in.names;
        r->out.count = r->in.count;
        r->out.result = _lsa_LookupSids3(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_LookupSids3, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_LookupNames4(pipes_struct *p)
@@ -5734,76 +5895,78 @@ static bool api_lsa_LookupNames4(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_LookupNames4 *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_LOOKUPNAMES4];
-       
+
        r = talloc(NULL, struct lsa_LookupNames4);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_LookupNames4, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.domains = talloc_zero(r, struct lsa_RefDomainList);
        if (r->out.domains == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.sids = r->in.sids;
        r->out.count = r->in.count;
        r->out.result = _lsa_LookupNames4(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_LookupNames4, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_LSAROPENPOLICYSCE(pipes_struct *p)
@@ -5814,67 +5977,69 @@ static bool api_lsa_LSAROPENPOLICYSCE(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_LSAROPENPOLICYSCE *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_LSAROPENPOLICYSCE];
-       
+
        r = talloc(NULL, struct lsa_LSAROPENPOLICYSCE);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_LSAROPENPOLICYSCE, r);
-       
+       }
+
        r->out.result = _lsa_LSAROPENPOLICYSCE(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_LSAROPENPOLICYSCE, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_LSARADTREGISTERSECURITYEVENTSOURCE(pipes_struct *p)
@@ -5885,67 +6050,69 @@ static bool api_lsa_LSARADTREGISTERSECURITYEVENTSOURCE(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_LSARADTREGISTERSECURITYEVENTSOURCE *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_LSARADTREGISTERSECURITYEVENTSOURCE];
-       
+
        r = talloc(NULL, struct lsa_LSARADTREGISTERSECURITYEVENTSOURCE);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_LSARADTREGISTERSECURITYEVENTSOURCE, r);
-       
+       }
+
        r->out.result = _lsa_LSARADTREGISTERSECURITYEVENTSOURCE(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_LSARADTREGISTERSECURITYEVENTSOURCE, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE(pipes_struct *p)
@@ -5956,67 +6123,69 @@ static bool api_lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_LSARADTUNREGISTERSECURITYEVENTSOURCE];
-       
+
        r = talloc(NULL, struct lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE, r);
-       
+       }
+
        r->out.result = _lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_lsa_LSARADTREPORTSECURITYEVENT(pipes_struct *p)
@@ -6027,67 +6196,69 @@ static bool api_lsa_LSARADTREPORTSECURITYEVENT(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct lsa_LSARADTREPORTSECURITYEVENT *r;
-       
+
        call = &ndr_table_lsarpc.calls[NDR_LSA_LSARADTREPORTSECURITYEVENT];
-       
+
        r = talloc(NULL, struct lsa_LSARADTREPORTSECURITYEVENT);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(lsa_LSARADTREPORTSECURITYEVENT, r);
-       
+       }
+
        r->out.result = _lsa_LSARADTREPORTSECURITYEVENT(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(lsa_LSARADTREPORTSECURITYEVENT, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 
@@ -6167,7 +6338,7 @@ static struct api_struct api_lsarpc_cmds[] =
        {"LSA_LSARREGISTERAUDITEVENT", NDR_LSA_LSARREGISTERAUDITEVENT, api_lsa_LSARREGISTERAUDITEVENT},
        {"LSA_LSARGENAUDITEVENT", NDR_LSA_LSARGENAUDITEVENT, api_lsa_LSARGENAUDITEVENT},
        {"LSA_LSARUNREGISTERAUDITEVENT", NDR_LSA_LSARUNREGISTERAUDITEVENT, api_lsa_LSARUNREGISTERAUDITEVENT},
-       {"LSA_LSARQUERYFORESTTRUSTINFORMATION", NDR_LSA_LSARQUERYFORESTTRUSTINFORMATION, api_lsa_LSARQUERYFORESTTRUSTINFORMATION},
+       {"LSA_LSARQUERYFORESTTRUSTINFORMATION", NDR_LSA_LSARQUERYFORESTTRUSTINFORMATION, api_lsa_lsaRQueryForestTrustInformation},
        {"LSA_LSARSETFORESTTRUSTINFORMATION", NDR_LSA_LSARSETFORESTTRUSTINFORMATION, api_lsa_LSARSETFORESTTRUSTINFORMATION},
        {"LSA_CREDRRENAME", NDR_LSA_CREDRRENAME, api_lsa_CREDRRENAME},
        {"LSA_LOOKUPSIDS3", NDR_LSA_LOOKUPSIDS3, api_lsa_LookupSids3},
index e3decb2862454fc1291a9a2815ff21fa54904c3c..223ee5e97090a5244f2fb2566a54c812cb23e491 100644 (file)
@@ -74,7 +74,7 @@ NTSTATUS _lsa_CREDRGETSESSIONTYPES(pipes_struct *p, struct lsa_CREDRGETSESSIONTY
 NTSTATUS _lsa_LSARREGISTERAUDITEVENT(pipes_struct *p, struct lsa_LSARREGISTERAUDITEVENT *r);
 NTSTATUS _lsa_LSARGENAUDITEVENT(pipes_struct *p, struct lsa_LSARGENAUDITEVENT *r);
 NTSTATUS _lsa_LSARUNREGISTERAUDITEVENT(pipes_struct *p, struct lsa_LSARUNREGISTERAUDITEVENT *r);
-NTSTATUS _lsa_LSARQUERYFORESTTRUSTINFORMATION(pipes_struct *p, struct lsa_LSARQUERYFORESTTRUSTINFORMATION *r);
+NTSTATUS _lsa_lsaRQueryForestTrustInformation(pipes_struct *p, struct lsa_lsaRQueryForestTrustInformation *r);
 NTSTATUS _lsa_LSARSETFORESTTRUSTINFORMATION(pipes_struct *p, struct lsa_LSARSETFORESTTRUSTINFORMATION *r);
 NTSTATUS _lsa_CREDRRENAME(pipes_struct *p, struct lsa_CREDRRENAME *r);
 NTSTATUS _lsa_LookupSids3(pipes_struct *p, struct lsa_LookupSids3 *r);
index 899e1bf6b0bb291cb9986ff358af5089e0fc9dc7..b9e6ae69b1761d6ba3fa038ecf1dcaeed5fbe734 100644 (file)
@@ -14,74 +14,76 @@ static bool api_netr_LogonUasLogon(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct netr_LogonUasLogon *r;
-       
+
        call = &ndr_table_netlogon.calls[NDR_NETR_LOGONUASLOGON];
-       
+
        r = talloc(NULL, struct netr_LogonUasLogon);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_LogonUasLogon, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.info = talloc_zero(r, struct netr_UasInfo);
        if (r->out.info == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _netr_LogonUasLogon(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_LogonUasLogon, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_netr_LogonUasLogoff(pipes_struct *p)
@@ -92,74 +94,76 @@ static bool api_netr_LogonUasLogoff(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct netr_LogonUasLogoff *r;
-       
+
        call = &ndr_table_netlogon.calls[NDR_NETR_LOGONUASLOGOFF];
-       
+
        r = talloc(NULL, struct netr_LogonUasLogoff);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_LogonUasLogoff, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.info = talloc_zero(r, struct netr_UasLogoffInfo);
        if (r->out.info == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _netr_LogonUasLogoff(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_LogonUasLogoff, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_netr_LogonSamLogon(pipes_struct *p)
@@ -170,81 +174,83 @@ static bool api_netr_LogonSamLogon(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct netr_LogonSamLogon *r;
-       
+
        call = &ndr_table_netlogon.calls[NDR_NETR_LOGONSAMLOGON];
-       
+
        r = talloc(NULL, struct netr_LogonSamLogon);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_LogonSamLogon, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.return_authenticator = r->in.return_authenticator;
        r->out.validation = talloc_zero(r, union netr_Validation);
        if (r->out.validation == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.authoritative = talloc_zero(r, uint8_t);
        if (r->out.authoritative == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _netr_LogonSamLogon(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_LogonSamLogon, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_netr_LogonSamLogoff(pipes_struct *p)
@@ -255,69 +261,71 @@ static bool api_netr_LogonSamLogoff(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct netr_LogonSamLogoff *r;
-       
+
        call = &ndr_table_netlogon.calls[NDR_NETR_LOGONSAMLOGOFF];
-       
+
        r = talloc(NULL, struct netr_LogonSamLogoff);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_LogonSamLogoff, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.return_authenticator = r->in.return_authenticator;
        r->out.result = _netr_LogonSamLogoff(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_LogonSamLogoff, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_netr_ServerReqChallenge(pipes_struct *p)
@@ -328,69 +336,71 @@ static bool api_netr_ServerReqChallenge(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct netr_ServerReqChallenge *r;
-       
+
        call = &ndr_table_netlogon.calls[NDR_NETR_SERVERREQCHALLENGE];
-       
+
        r = talloc(NULL, struct netr_ServerReqChallenge);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_ServerReqChallenge, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.credentials = r->in.credentials;
        r->out.result = _netr_ServerReqChallenge(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_ServerReqChallenge, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_netr_ServerAuthenticate(pipes_struct *p)
@@ -401,69 +411,71 @@ static bool api_netr_ServerAuthenticate(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct netr_ServerAuthenticate *r;
-       
+
        call = &ndr_table_netlogon.calls[NDR_NETR_SERVERAUTHENTICATE];
-       
+
        r = talloc(NULL, struct netr_ServerAuthenticate);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_ServerAuthenticate, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.credentials = r->in.credentials;
        r->out.result = _netr_ServerAuthenticate(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_ServerAuthenticate, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_netr_ServerPasswordSet(pipes_struct *p)
@@ -474,74 +486,76 @@ static bool api_netr_ServerPasswordSet(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct netr_ServerPasswordSet *r;
-       
+
        call = &ndr_table_netlogon.calls[NDR_NETR_SERVERPASSWORDSET];
-       
+
        r = talloc(NULL, struct netr_ServerPasswordSet);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_ServerPasswordSet, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.return_authenticator = talloc_zero(r, struct netr_Authenticator);
        if (r->out.return_authenticator == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _netr_ServerPasswordSet(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_ServerPasswordSet, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_netr_DatabaseDeltas(pipes_struct *p)
@@ -552,76 +566,78 @@ static bool api_netr_DatabaseDeltas(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct netr_DatabaseDeltas *r;
-       
+
        call = &ndr_table_netlogon.calls[NDR_NETR_DATABASEDELTAS];
-       
+
        r = talloc(NULL, struct netr_DatabaseDeltas);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_DatabaseDeltas, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.return_authenticator = r->in.return_authenticator;
        r->out.sequence_num = r->in.sequence_num;
        r->out.delta_enum_array = talloc_zero(r, struct netr_DELTA_ENUM_ARRAY);
        if (r->out.delta_enum_array == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _netr_DatabaseDeltas(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_DatabaseDeltas, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_netr_DatabaseSync(pipes_struct *p)
@@ -632,76 +648,78 @@ static bool api_netr_DatabaseSync(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct netr_DatabaseSync *r;
-       
+
        call = &ndr_table_netlogon.calls[NDR_NETR_DATABASESYNC];
-       
+
        r = talloc(NULL, struct netr_DatabaseSync);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_DatabaseSync, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.return_authenticator = r->in.return_authenticator;
        r->out.sync_context = r->in.sync_context;
        r->out.delta_enum_array = talloc_zero(r, struct netr_DELTA_ENUM_ARRAY);
        if (r->out.delta_enum_array == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _netr_DatabaseSync(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_DatabaseSync, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_netr_AccountDeltas(pipes_struct *p)
@@ -712,93 +730,95 @@ static bool api_netr_AccountDeltas(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct netr_AccountDeltas *r;
-       
+
        call = &ndr_table_netlogon.calls[NDR_NETR_ACCOUNTDELTAS];
-       
+
        r = talloc(NULL, struct netr_AccountDeltas);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_AccountDeltas, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.return_authenticator = r->in.return_authenticator;
        r->out.buffer = talloc_zero(r, struct netr_AccountBuffer);
        if (r->out.buffer == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.count_returned = talloc_zero(r, uint32_t);
        if (r->out.count_returned == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.total_entries = talloc_zero(r, uint32_t);
        if (r->out.total_entries == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.recordid = talloc_zero(r, struct netr_UAS_INFO_0);
        if (r->out.recordid == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _netr_AccountDeltas(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_AccountDeltas, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_netr_AccountSync(pipes_struct *p)
@@ -809,94 +829,96 @@ static bool api_netr_AccountSync(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct netr_AccountSync *r;
-       
+
        call = &ndr_table_netlogon.calls[NDR_NETR_ACCOUNTSYNC];
-       
+
        r = talloc(NULL, struct netr_AccountSync);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_AccountSync, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.return_authenticator = r->in.return_authenticator;
        r->out.buffer = talloc_zero(r, struct netr_AccountBuffer);
        if (r->out.buffer == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.count_returned = talloc_zero(r, uint32_t);
        if (r->out.count_returned == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.total_entries = talloc_zero(r, uint32_t);
        if (r->out.total_entries == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.next_reference = talloc_zero(r, uint32_t);
        if (r->out.next_reference == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.recordid = r->in.recordid;
        r->out.result = _netr_AccountSync(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_AccountSync, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_netr_GetDcName(pipes_struct *p)
@@ -907,74 +929,76 @@ static bool api_netr_GetDcName(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct netr_GetDcName *r;
-       
+
        call = &ndr_table_netlogon.calls[NDR_NETR_GETDCNAME];
-       
+
        r = talloc(NULL, struct netr_GetDcName);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_GetDcName, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.dcname = talloc_zero(r, const char *);
        if (r->out.dcname == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _netr_GetDcName(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_GetDcName, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_netr_LogonControl(pipes_struct *p)
@@ -985,74 +1009,76 @@ static bool api_netr_LogonControl(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct netr_LogonControl *r;
-       
+
        call = &ndr_table_netlogon.calls[NDR_NETR_LOGONCONTROL];
-       
+
        r = talloc(NULL, struct netr_LogonControl);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_LogonControl, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.info = talloc_zero(r, union netr_CONTROL_QUERY_INFORMATION);
        if (r->out.info == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _netr_LogonControl(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_LogonControl, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_netr_GetAnyDCName(pipes_struct *p)
@@ -1063,74 +1089,76 @@ static bool api_netr_GetAnyDCName(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct netr_GetAnyDCName *r;
-       
+
        call = &ndr_table_netlogon.calls[NDR_NETR_GETANYDCNAME];
-       
+
        r = talloc(NULL, struct netr_GetAnyDCName);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_GetAnyDCName, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.dcname = talloc_zero(r, const char *);
        if (r->out.dcname == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _netr_GetAnyDCName(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_GetAnyDCName, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_netr_LogonControl2(pipes_struct *p)
@@ -1141,74 +1169,76 @@ static bool api_netr_LogonControl2(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct netr_LogonControl2 *r;
-       
+
        call = &ndr_table_netlogon.calls[NDR_NETR_LOGONCONTROL2];
-       
+
        r = talloc(NULL, struct netr_LogonControl2);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_LogonControl2, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.query = talloc_zero(r, union netr_CONTROL_QUERY_INFORMATION);
        if (r->out.query == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _netr_LogonControl2(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_LogonControl2, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_netr_ServerAuthenticate2(pipes_struct *p)
@@ -1219,70 +1249,72 @@ static bool api_netr_ServerAuthenticate2(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct netr_ServerAuthenticate2 *r;
-       
+
        call = &ndr_table_netlogon.calls[NDR_NETR_SERVERAUTHENTICATE2];
-       
+
        r = talloc(NULL, struct netr_ServerAuthenticate2);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_ServerAuthenticate2, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.credentials = r->in.credentials;
        r->out.negotiate_flags = r->in.negotiate_flags;
        r->out.result = _netr_ServerAuthenticate2(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_ServerAuthenticate2, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_netr_DatabaseSync2(pipes_struct *p)
@@ -1293,76 +1325,78 @@ static bool api_netr_DatabaseSync2(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct netr_DatabaseSync2 *r;
-       
+
        call = &ndr_table_netlogon.calls[NDR_NETR_DATABASESYNC2];
-       
+
        r = talloc(NULL, struct netr_DatabaseSync2);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_DatabaseSync2, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.return_authenticator = r->in.return_authenticator;
        r->out.sync_context = r->in.sync_context;
        r->out.delta_enum_array = talloc_zero(r, struct netr_DELTA_ENUM_ARRAY);
        if (r->out.delta_enum_array == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _netr_DatabaseSync2(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_DatabaseSync2, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_netr_DatabaseRedo(pipes_struct *p)
@@ -1373,75 +1407,77 @@ static bool api_netr_DatabaseRedo(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct netr_DatabaseRedo *r;
-       
+
        call = &ndr_table_netlogon.calls[NDR_NETR_DATABASEREDO];
-       
+
        r = talloc(NULL, struct netr_DatabaseRedo);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_DatabaseRedo, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.return_authenticator = r->in.return_authenticator;
        r->out.delta_enum_array = talloc_zero(r, struct netr_DELTA_ENUM_ARRAY);
        if (r->out.delta_enum_array == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _netr_DatabaseRedo(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_DatabaseRedo, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_netr_LogonControl2Ex(pipes_struct *p)
@@ -1452,145 +1488,156 @@ static bool api_netr_LogonControl2Ex(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct netr_LogonControl2Ex *r;
-       
+
        call = &ndr_table_netlogon.calls[NDR_NETR_LOGONCONTROL2EX];
-       
+
        r = talloc(NULL, struct netr_LogonControl2Ex);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_LogonControl2Ex, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.query = talloc_zero(r, union netr_CONTROL_QUERY_INFORMATION);
        if (r->out.query == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _netr_LogonControl2Ex(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_LogonControl2Ex, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
-static bool api_netr_NETRENUMERATETRUSTEDDOMAINS(pipes_struct *p)
+static bool api_netr_NetrEnumerateTrustedDomains(pipes_struct *p)
 {
        const struct ndr_interface_call *call;
        struct ndr_pull *pull;
        struct ndr_push *push;
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
-       struct netr_NETRENUMERATETRUSTEDDOMAINS *r;
-       
+       struct netr_NetrEnumerateTrustedDomains *r;
+
        call = &ndr_table_netlogon.calls[NDR_NETR_NETRENUMERATETRUSTEDDOMAINS];
-       
-       r = talloc(NULL, struct netr_NETRENUMERATETRUSTEDDOMAINS);
+
+       r = talloc(NULL, struct netr_NetrEnumerateTrustedDomains);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(netr_NetrEnumerateTrustedDomains, r);
+       }
+
+       ZERO_STRUCT(r->out);
+       r->out.trusted_domains_blob = talloc_zero(r, struct netr_Blob);
+       if (r->out.trusted_domains_blob == NULL) {
+               talloc_free(r);
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
-               NDR_PRINT_IN_DEBUG(netr_NETRENUMERATETRUSTEDDOMAINS, r);
-       
-       r->out.result = _netr_NETRENUMERATETRUSTEDDOMAINS(p, r);
-       
+
+       r->out.result = _netr_NetrEnumerateTrustedDomains(p, r);
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(netr_NetrEnumerateTrustedDomains, r);
        }
-       
-       if (DEBUGLEVEL >= 10)
-               NDR_PRINT_OUT_DEBUG(netr_NETRENUMERATETRUSTEDDOMAINS, r);
-       
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_netr_DsRGetDCName(pipes_struct *p)
@@ -1601,74 +1648,76 @@ static bool api_netr_DsRGetDCName(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct netr_DsRGetDCName *r;
-       
+
        call = &ndr_table_netlogon.calls[NDR_NETR_DSRGETDCNAME];
-       
+
        r = talloc(NULL, struct netr_DsRGetDCName);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_DsRGetDCName, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.info = talloc_zero(r, struct netr_DsRGetDCNameInfo);
        if (r->out.info == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _netr_DsRGetDCName(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_DsRGetDCName, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_netr_NETRLOGONDUMMYROUTINE1(pipes_struct *p)
@@ -1679,67 +1728,69 @@ static bool api_netr_NETRLOGONDUMMYROUTINE1(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct netr_NETRLOGONDUMMYROUTINE1 *r;
-       
+
        call = &ndr_table_netlogon.calls[NDR_NETR_NETRLOGONDUMMYROUTINE1];
-       
+
        r = talloc(NULL, struct netr_NETRLOGONDUMMYROUTINE1);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_NETRLOGONDUMMYROUTINE1, r);
-       
+       }
+
        r->out.result = _netr_NETRLOGONDUMMYROUTINE1(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_NETRLOGONDUMMYROUTINE1, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_netr_NETRLOGONSETSERVICEBITS(pipes_struct *p)
@@ -1750,138 +1801,149 @@ static bool api_netr_NETRLOGONSETSERVICEBITS(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct netr_NETRLOGONSETSERVICEBITS *r;
-       
+
        call = &ndr_table_netlogon.calls[NDR_NETR_NETRLOGONSETSERVICEBITS];
-       
+
        r = talloc(NULL, struct netr_NETRLOGONSETSERVICEBITS);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_NETRLOGONSETSERVICEBITS, r);
-       
+       }
+
        r->out.result = _netr_NETRLOGONSETSERVICEBITS(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_NETRLOGONSETSERVICEBITS, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
-static bool api_netr_NETRLOGONGETTRUSTRID(pipes_struct *p)
+static bool api_netr_LogonGetTrustRid(pipes_struct *p)
 {
        const struct ndr_interface_call *call;
        struct ndr_pull *pull;
        struct ndr_push *push;
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
-       struct netr_NETRLOGONGETTRUSTRID *r;
-       
-       call = &ndr_table_netlogon.calls[NDR_NETR_NETRLOGONGETTRUSTRID];
-       
-       r = talloc(NULL, struct netr_NETRLOGONGETTRUSTRID);
+       struct netr_LogonGetTrustRid *r;
+
+       call = &ndr_table_netlogon.calls[NDR_NETR_LOGONGETTRUSTRID];
+
+       r = talloc(NULL, struct netr_LogonGetTrustRid);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
-               NDR_PRINT_IN_DEBUG(netr_NETRLOGONGETTRUSTRID, r);
-       
-       r->out.result = _netr_NETRLOGONGETTRUSTRID(p, r);
-       
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(netr_LogonGetTrustRid, r);
+       }
+
+       ZERO_STRUCT(r->out);
+       r->out.rid = talloc_zero(r, uint32_t);
+       if (r->out.rid == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.result = _netr_LogonGetTrustRid(p, r);
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(netr_LogonGetTrustRid, r);
        }
-       
-       if (DEBUGLEVEL >= 10)
-               NDR_PRINT_OUT_DEBUG(netr_NETRLOGONGETTRUSTRID, r);
-       
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_netr_NETRLOGONCOMPUTESERVERDIGEST(pipes_struct *p)
@@ -1892,67 +1954,69 @@ static bool api_netr_NETRLOGONCOMPUTESERVERDIGEST(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct netr_NETRLOGONCOMPUTESERVERDIGEST *r;
-       
+
        call = &ndr_table_netlogon.calls[NDR_NETR_NETRLOGONCOMPUTESERVERDIGEST];
-       
+
        r = talloc(NULL, struct netr_NETRLOGONCOMPUTESERVERDIGEST);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_NETRLOGONCOMPUTESERVERDIGEST, r);
-       
+       }
+
        r->out.result = _netr_NETRLOGONCOMPUTESERVERDIGEST(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_NETRLOGONCOMPUTESERVERDIGEST, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_netr_NETRLOGONCOMPUTECLIENTDIGEST(pipes_struct *p)
@@ -1963,67 +2027,69 @@ static bool api_netr_NETRLOGONCOMPUTECLIENTDIGEST(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct netr_NETRLOGONCOMPUTECLIENTDIGEST *r;
-       
+
        call = &ndr_table_netlogon.calls[NDR_NETR_NETRLOGONCOMPUTECLIENTDIGEST];
-       
+
        r = talloc(NULL, struct netr_NETRLOGONCOMPUTECLIENTDIGEST);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_NETRLOGONCOMPUTECLIENTDIGEST, r);
-       
+       }
+
        r->out.result = _netr_NETRLOGONCOMPUTECLIENTDIGEST(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_NETRLOGONCOMPUTECLIENTDIGEST, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_netr_ServerAuthenticate3(pipes_struct *p)
@@ -2034,76 +2100,78 @@ static bool api_netr_ServerAuthenticate3(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct netr_ServerAuthenticate3 *r;
-       
+
        call = &ndr_table_netlogon.calls[NDR_NETR_SERVERAUTHENTICATE3];
-       
+
        r = talloc(NULL, struct netr_ServerAuthenticate3);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_ServerAuthenticate3, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.credentials = r->in.credentials;
        r->out.negotiate_flags = r->in.negotiate_flags;
        r->out.rid = talloc_zero(r, uint32_t);
        if (r->out.rid == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _netr_ServerAuthenticate3(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_ServerAuthenticate3, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_netr_DsRGetDCNameEx(pipes_struct *p)
@@ -2114,74 +2182,76 @@ static bool api_netr_DsRGetDCNameEx(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct netr_DsRGetDCNameEx *r;
-       
+
        call = &ndr_table_netlogon.calls[NDR_NETR_DSRGETDCNAMEEX];
-       
+
        r = talloc(NULL, struct netr_DsRGetDCNameEx);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_DsRGetDCNameEx, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
-       r->out.info = talloc_zero(r, struct netr_DsRGetDCNameInfo);
+       r->out.info = talloc_zero(r, struct netr_DsRGetDCNameInfo *);
        if (r->out.info == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _netr_DsRGetDCNameEx(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_DsRGetDCNameEx, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_netr_DsRGetSiteName(pipes_struct *p)
@@ -2192,74 +2262,76 @@ static bool api_netr_DsRGetSiteName(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct netr_DsRGetSiteName *r;
-       
+
        call = &ndr_table_netlogon.calls[NDR_NETR_DSRGETSITENAME];
-       
+
        r = talloc(NULL, struct netr_DsRGetSiteName);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_DsRGetSiteName, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.site = talloc_zero(r, const char *);
        if (r->out.site == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _netr_DsRGetSiteName(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_DsRGetSiteName, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_netr_LogonGetDomainInfo(pipes_struct *p)
@@ -2270,75 +2342,77 @@ static bool api_netr_LogonGetDomainInfo(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct netr_LogonGetDomainInfo *r;
-       
+
        call = &ndr_table_netlogon.calls[NDR_NETR_LOGONGETDOMAININFO];
-       
+
        r = talloc(NULL, struct netr_LogonGetDomainInfo);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_LogonGetDomainInfo, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.return_authenticator = r->in.return_authenticator;
        r->out.info = talloc_zero(r, union netr_DomainInfo);
        if (r->out.info == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _netr_LogonGetDomainInfo(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_LogonGetDomainInfo, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_netr_ServerPasswordSet2(pipes_struct *p)
@@ -2349,145 +2423,162 @@ static bool api_netr_ServerPasswordSet2(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct netr_ServerPasswordSet2 *r;
-       
+
        call = &ndr_table_netlogon.calls[NDR_NETR_SERVERPASSWORDSET2];
-       
+
        r = talloc(NULL, struct netr_ServerPasswordSet2);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_ServerPasswordSet2, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.return_authenticator = talloc_zero(r, struct netr_Authenticator);
        if (r->out.return_authenticator == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _netr_ServerPasswordSet2(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_ServerPasswordSet2, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
-static bool api_netr_NETRSERVERPASSWORDGET(pipes_struct *p)
+static bool api_netr_ServerPasswordGet(pipes_struct *p)
 {
        const struct ndr_interface_call *call;
        struct ndr_pull *pull;
        struct ndr_push *push;
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
-       struct netr_NETRSERVERPASSWORDGET *r;
-       
-       call = &ndr_table_netlogon.calls[NDR_NETR_NETRSERVERPASSWORDGET];
-       
-       r = talloc(NULL, struct netr_NETRSERVERPASSWORDGET);
+       struct netr_ServerPasswordGet *r;
+
+       call = &ndr_table_netlogon.calls[NDR_NETR_SERVERPASSWORDGET];
+
+       r = talloc(NULL, struct netr_ServerPasswordGet);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
-               NDR_PRINT_IN_DEBUG(netr_NETRSERVERPASSWORDGET, r);
-       
-       r->out.result = _netr_NETRSERVERPASSWORDGET(p, r);
-       
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(netr_ServerPasswordGet, r);
+       }
+
+       ZERO_STRUCT(r->out);
+       r->out.return_authenticator = talloc_zero(r, struct netr_Authenticator);
+       if (r->out.return_authenticator == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.password = talloc_zero(r, struct samr_Password);
+       if (r->out.password == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.result = _netr_ServerPasswordGet(p, r);
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(netr_ServerPasswordGet, r);
        }
-       
-       if (DEBUGLEVEL >= 10)
-               NDR_PRINT_OUT_DEBUG(netr_NETRSERVERPASSWORDGET, r);
-       
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_netr_NETRLOGONSENDTOSAM(pipes_struct *p)
@@ -2498,138 +2589,149 @@ static bool api_netr_NETRLOGONSENDTOSAM(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct netr_NETRLOGONSENDTOSAM *r;
-       
+
        call = &ndr_table_netlogon.calls[NDR_NETR_NETRLOGONSENDTOSAM];
-       
+
        r = talloc(NULL, struct netr_NETRLOGONSENDTOSAM);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_NETRLOGONSENDTOSAM, r);
-       
+       }
+
        r->out.result = _netr_NETRLOGONSENDTOSAM(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_NETRLOGONSENDTOSAM, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
-static bool api_netr_DSRADDRESSTOSITENAMESW(pipes_struct *p)
+static bool api_netr_DsRAddressToSitenamesW(pipes_struct *p)
 {
        const struct ndr_interface_call *call;
        struct ndr_pull *pull;
        struct ndr_push *push;
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
-       struct netr_DSRADDRESSTOSITENAMESW *r;
-       
+       struct netr_DsRAddressToSitenamesW *r;
+
        call = &ndr_table_netlogon.calls[NDR_NETR_DSRADDRESSTOSITENAMESW];
-       
-       r = talloc(NULL, struct netr_DSRADDRESSTOSITENAMESW);
+
+       r = talloc(NULL, struct netr_DsRAddressToSitenamesW);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(netr_DsRAddressToSitenamesW, r);
+       }
+
+       ZERO_STRUCT(r->out);
+       r->out.ctr = talloc_zero(r, struct netr_DsRAddressToSitenamesWCtr *);
+       if (r->out.ctr == NULL) {
+               talloc_free(r);
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
-               NDR_PRINT_IN_DEBUG(netr_DSRADDRESSTOSITENAMESW, r);
-       
-       r->out.result = _netr_DSRADDRESSTOSITENAMESW(p, r);
-       
+
+       r->out.result = _netr_DsRAddressToSitenamesW(p, r);
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
-               NDR_PRINT_OUT_DEBUG(netr_DSRADDRESSTOSITENAMESW, r);
-       
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(netr_DsRAddressToSitenamesW, r);
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_netr_DsRGetDCNameEx2(pipes_struct *p)
@@ -2640,74 +2742,76 @@ static bool api_netr_DsRGetDCNameEx2(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct netr_DsRGetDCNameEx2 *r;
-       
+
        call = &ndr_table_netlogon.calls[NDR_NETR_DSRGETDCNAMEEX2];
-       
+
        r = talloc(NULL, struct netr_DsRGetDCNameEx2);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_DsRGetDCNameEx2, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
-       r->out.info = talloc_zero(r, struct netr_DsRGetDCNameInfo);
+       r->out.info = talloc_zero(r, struct netr_DsRGetDCNameInfo *);
        if (r->out.info == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _netr_DsRGetDCNameEx2(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_DsRGetDCNameEx2, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN(pipes_struct *p)
@@ -2718,280 +2822,309 @@ static bool api_netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN *r;
-       
+
        call = &ndr_table_netlogon.calls[NDR_NETR_NETRLOGONGETTIMESERVICEPARENTDOMAIN];
-       
+
        r = talloc(NULL, struct netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN, r);
-       
+       }
+
        r->out.result = _netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
-static bool api_netr_NETRENUMERATETRUSTEDDOMAINSEX(pipes_struct *p)
+static bool api_netr_NetrEnumerateTrustedDomainsEx(pipes_struct *p)
 {
        const struct ndr_interface_call *call;
        struct ndr_pull *pull;
        struct ndr_push *push;
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
-       struct netr_NETRENUMERATETRUSTEDDOMAINSEX *r;
-       
+       struct netr_NetrEnumerateTrustedDomainsEx *r;
+
        call = &ndr_table_netlogon.calls[NDR_NETR_NETRENUMERATETRUSTEDDOMAINSEX];
-       
-       r = talloc(NULL, struct netr_NETRENUMERATETRUSTEDDOMAINSEX);
+
+       r = talloc(NULL, struct netr_NetrEnumerateTrustedDomainsEx);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(netr_NetrEnumerateTrustedDomainsEx, r);
+       }
+
+       ZERO_STRUCT(r->out);
+       r->out.dom_trust_list = talloc_zero(r, struct netr_DomainTrustList);
+       if (r->out.dom_trust_list == NULL) {
+               talloc_free(r);
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
-               NDR_PRINT_IN_DEBUG(netr_NETRENUMERATETRUSTEDDOMAINSEX, r);
-       
-       r->out.result = _netr_NETRENUMERATETRUSTEDDOMAINSEX(p, r);
-       
+
+       r->out.result = _netr_NetrEnumerateTrustedDomainsEx(p, r);
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(netr_NetrEnumerateTrustedDomainsEx, r);
        }
-       
-       if (DEBUGLEVEL >= 10)
-               NDR_PRINT_OUT_DEBUG(netr_NETRENUMERATETRUSTEDDOMAINSEX, r);
-       
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
-static bool api_netr_DSRADDRESSTOSITENAMESEXW(pipes_struct *p)
+static bool api_netr_DsRAddressToSitenamesExW(pipes_struct *p)
 {
        const struct ndr_interface_call *call;
        struct ndr_pull *pull;
        struct ndr_push *push;
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
-       struct netr_DSRADDRESSTOSITENAMESEXW *r;
-       
+       struct netr_DsRAddressToSitenamesExW *r;
+
        call = &ndr_table_netlogon.calls[NDR_NETR_DSRADDRESSTOSITENAMESEXW];
-       
-       r = talloc(NULL, struct netr_DSRADDRESSTOSITENAMESEXW);
+
+       r = talloc(NULL, struct netr_DsRAddressToSitenamesExW);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(netr_DsRAddressToSitenamesExW, r);
+       }
+
+       ZERO_STRUCT(r->out);
+       r->out.ctr = talloc_zero(r, struct netr_DsRAddressToSitenamesExWCtr *);
+       if (r->out.ctr == NULL) {
+               talloc_free(r);
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
-               NDR_PRINT_IN_DEBUG(netr_DSRADDRESSTOSITENAMESEXW, r);
-       
-       r->out.result = _netr_DSRADDRESSTOSITENAMESEXW(p, r);
-       
+
+       r->out.result = _netr_DsRAddressToSitenamesExW(p, r);
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
-               NDR_PRINT_OUT_DEBUG(netr_DSRADDRESSTOSITENAMESEXW, r);
-       
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(netr_DsRAddressToSitenamesExW, r);
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
-static bool api_netr_DSRGETDCSITECOVERAGEW(pipes_struct *p)
+static bool api_netr_DsrGetDcSiteCoverageW(pipes_struct *p)
 {
        const struct ndr_interface_call *call;
        struct ndr_pull *pull;
        struct ndr_push *push;
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
-       struct netr_DSRGETDCSITECOVERAGEW *r;
-       
+       struct netr_DsrGetDcSiteCoverageW *r;
+
        call = &ndr_table_netlogon.calls[NDR_NETR_DSRGETDCSITECOVERAGEW];
-       
-       r = talloc(NULL, struct netr_DSRGETDCSITECOVERAGEW);
+
+       r = talloc(NULL, struct netr_DsrGetDcSiteCoverageW);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(netr_DsrGetDcSiteCoverageW, r);
+       }
+
+       ZERO_STRUCT(r->out);
+       r->out.ctr = talloc_zero(r, struct DcSitesCtr);
+       if (r->out.ctr == NULL) {
+               talloc_free(r);
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
-               NDR_PRINT_IN_DEBUG(netr_DSRGETDCSITECOVERAGEW, r);
-       
-       r->out.result = _netr_DSRGETDCSITECOVERAGEW(p, r);
-       
+
+       r->out.result = _netr_DsrGetDcSiteCoverageW(p, r);
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(netr_DsrGetDcSiteCoverageW, r);
        }
-       
-       if (DEBUGLEVEL >= 10)
-               NDR_PRINT_OUT_DEBUG(netr_DSRGETDCSITECOVERAGEW, r);
-       
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_netr_LogonSamLogonEx(pipes_struct *p)
@@ -3002,81 +3135,83 @@ static bool api_netr_LogonSamLogonEx(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct netr_LogonSamLogonEx *r;
-       
+
        call = &ndr_table_netlogon.calls[NDR_NETR_LOGONSAMLOGONEX];
-       
+
        r = talloc(NULL, struct netr_LogonSamLogonEx);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_LogonSamLogonEx, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.validation = talloc_zero(r, union netr_Validation);
        if (r->out.validation == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.authoritative = talloc_zero(r, uint8_t);
        if (r->out.authoritative == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.flags = r->in.flags;
        r->out.result = _netr_LogonSamLogonEx(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_LogonSamLogonEx, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_netr_DsrEnumerateDomainTrusts(pipes_struct *p)
@@ -3087,364 +3222,407 @@ static bool api_netr_DsrEnumerateDomainTrusts(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct netr_DsrEnumerateDomainTrusts *r;
-       
+
        call = &ndr_table_netlogon.calls[NDR_NETR_DSRENUMERATEDOMAINTRUSTS];
-       
+
        r = talloc(NULL, struct netr_DsrEnumerateDomainTrusts);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_DsrEnumerateDomainTrusts, r);
-       
-       ZERO_STRUCT(r->out);
-       r->out.count = talloc_zero(r, uint32_t);
-       if (r->out.count == NULL) {
-               talloc_free(r);
-               return False;
        }
-       
-       r->out.trusts = talloc_zero_array(r, struct netr_DomainTrust *, r->out.count);
+
+       ZERO_STRUCT(r->out);
+       r->out.trusts = talloc_zero(r, struct netr_DomainTrustList);
        if (r->out.trusts == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _netr_DsrEnumerateDomainTrusts(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_DsrEnumerateDomainTrusts, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
-static bool api_netr_DSRDEREGISTERDNSHOSTRECORDS(pipes_struct *p)
+static bool api_netr_DsrDeregisterDNSHostRecords(pipes_struct *p)
 {
        const struct ndr_interface_call *call;
        struct ndr_pull *pull;
        struct ndr_push *push;
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
-       struct netr_DSRDEREGISTERDNSHOSTRECORDS *r;
-       
+       struct netr_DsrDeregisterDNSHostRecords *r;
+
        call = &ndr_table_netlogon.calls[NDR_NETR_DSRDEREGISTERDNSHOSTRECORDS];
-       
-       r = talloc(NULL, struct netr_DSRDEREGISTERDNSHOSTRECORDS);
+
+       r = talloc(NULL, struct netr_DsrDeregisterDNSHostRecords);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
-               NDR_PRINT_IN_DEBUG(netr_DSRDEREGISTERDNSHOSTRECORDS, r);
-       
-       r->out.result = _netr_DSRDEREGISTERDNSHOSTRECORDS(p, r);
-       
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(netr_DsrDeregisterDNSHostRecords, r);
+       }
+
+       r->out.result = _netr_DsrDeregisterDNSHostRecords(p, r);
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(netr_DsrDeregisterDNSHostRecords, r);
        }
-       
-       if (DEBUGLEVEL >= 10)
-               NDR_PRINT_OUT_DEBUG(netr_DSRDEREGISTERDNSHOSTRECORDS, r);
-       
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
-static bool api_netr_NETRSERVERTRUSTPASSWORDSGET(pipes_struct *p)
+static bool api_netr_ServerTrustPasswordsGet(pipes_struct *p)
 {
        const struct ndr_interface_call *call;
        struct ndr_pull *pull;
        struct ndr_push *push;
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
-       struct netr_NETRSERVERTRUSTPASSWORDSGET *r;
-       
-       call = &ndr_table_netlogon.calls[NDR_NETR_NETRSERVERTRUSTPASSWORDSGET];
-       
-       r = talloc(NULL, struct netr_NETRSERVERTRUSTPASSWORDSGET);
+       struct netr_ServerTrustPasswordsGet *r;
+
+       call = &ndr_table_netlogon.calls[NDR_NETR_SERVERTRUSTPASSWORDSGET];
+
+       r = talloc(NULL, struct netr_ServerTrustPasswordsGet);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(netr_ServerTrustPasswordsGet, r);
+       }
+
+       ZERO_STRUCT(r->out);
+       r->out.return_authenticator = talloc_zero(r, struct netr_Authenticator);
+       if (r->out.return_authenticator == NULL) {
+               talloc_free(r);
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
-               NDR_PRINT_IN_DEBUG(netr_NETRSERVERTRUSTPASSWORDSGET, r);
-       
-       r->out.result = _netr_NETRSERVERTRUSTPASSWORDSGET(p, r);
-       
+
+       r->out.password = talloc_zero(r, struct samr_Password);
+       if (r->out.password == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.password2 = talloc_zero(r, struct samr_Password);
+       if (r->out.password2 == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.result = _netr_ServerTrustPasswordsGet(p, r);
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(netr_ServerTrustPasswordsGet, r);
        }
-       
-       if (DEBUGLEVEL >= 10)
-               NDR_PRINT_OUT_DEBUG(netr_NETRSERVERTRUSTPASSWORDSGET, r);
-       
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
-static bool api_netr_DSRGETFORESTTRUSTINFORMATION(pipes_struct *p)
+static bool api_netr_DsRGetForestTrustInformation(pipes_struct *p)
 {
        const struct ndr_interface_call *call;
        struct ndr_pull *pull;
        struct ndr_push *push;
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
-       struct netr_DSRGETFORESTTRUSTINFORMATION *r;
-       
+       struct netr_DsRGetForestTrustInformation *r;
+
        call = &ndr_table_netlogon.calls[NDR_NETR_DSRGETFORESTTRUSTINFORMATION];
-       
-       r = talloc(NULL, struct netr_DSRGETFORESTTRUSTINFORMATION);
+
+       r = talloc(NULL, struct netr_DsRGetForestTrustInformation);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
-               NDR_PRINT_IN_DEBUG(netr_DSRGETFORESTTRUSTINFORMATION, r);
-       
-       r->out.result = _netr_DSRGETFORESTTRUSTINFORMATION(p, r);
-       
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(netr_DsRGetForestTrustInformation, r);
+       }
+
+       ZERO_STRUCT(r->out);
+       r->out.forest_trust_info = talloc_zero(r, struct lsa_ForestTrustInformation *);
+       if (r->out.forest_trust_info == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.result = _netr_DsRGetForestTrustInformation(p, r);
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
-               NDR_PRINT_OUT_DEBUG(netr_DSRGETFORESTTRUSTINFORMATION, r);
-       
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(netr_DsRGetForestTrustInformation, r);
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
-static bool api_netr_NETRGETFORESTTRUSTINFORMATION(pipes_struct *p)
+static bool api_netr_GetForestTrustInformation(pipes_struct *p)
 {
        const struct ndr_interface_call *call;
        struct ndr_pull *pull;
        struct ndr_push *push;
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
-       struct netr_NETRGETFORESTTRUSTINFORMATION *r;
-       
-       call = &ndr_table_netlogon.calls[NDR_NETR_NETRGETFORESTTRUSTINFORMATION];
-       
-       r = talloc(NULL, struct netr_NETRGETFORESTTRUSTINFORMATION);
+       struct netr_GetForestTrustInformation *r;
+
+       call = &ndr_table_netlogon.calls[NDR_NETR_GETFORESTTRUSTINFORMATION];
+
+       r = talloc(NULL, struct netr_GetForestTrustInformation);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(netr_GetForestTrustInformation, r);
        }
-       
-       if (DEBUGLEVEL >= 10)
-               NDR_PRINT_IN_DEBUG(netr_NETRGETFORESTTRUSTINFORMATION, r);
-       
-       r->out.result = _netr_NETRGETFORESTTRUSTINFORMATION(p, r);
-       
+
+       ZERO_STRUCT(r->out);
+       r->out.return_authenticator = talloc_zero(r, struct netr_Authenticator);
+       if (r->out.return_authenticator == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.forest_trust_info = talloc_zero(r, struct lsa_ForestTrustInformation *);
+       if (r->out.forest_trust_info == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.result = _netr_GetForestTrustInformation(p, r);
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(netr_GetForestTrustInformation, r);
        }
-       
-       if (DEBUGLEVEL >= 10)
-               NDR_PRINT_OUT_DEBUG(netr_NETRGETFORESTTRUSTINFORMATION, r);
-       
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_netr_LogonSamLogonWithFlags(pipes_struct *p)
@@ -3455,82 +3633,84 @@ static bool api_netr_LogonSamLogonWithFlags(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct netr_LogonSamLogonWithFlags *r;
-       
+
        call = &ndr_table_netlogon.calls[NDR_NETR_LOGONSAMLOGONWITHFLAGS];
-       
+
        r = talloc(NULL, struct netr_LogonSamLogonWithFlags);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_LogonSamLogonWithFlags, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.return_authenticator = r->in.return_authenticator;
        r->out.validation = talloc_zero(r, union netr_Validation);
        if (r->out.validation == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.authoritative = talloc_zero(r, uint8_t);
        if (r->out.authoritative == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.flags = r->in.flags;
        r->out.result = _netr_LogonSamLogonWithFlags(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_LogonSamLogonWithFlags, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_netr_NETRSERVERGETTRUSTINFO(pipes_struct *p)
@@ -3541,67 +3721,69 @@ static bool api_netr_NETRSERVERGETTRUSTINFO(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct netr_NETRSERVERGETTRUSTINFO *r;
-       
+
        call = &ndr_table_netlogon.calls[NDR_NETR_NETRSERVERGETTRUSTINFO];
-       
+
        r = talloc(NULL, struct netr_NETRSERVERGETTRUSTINFO);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(netr_NETRSERVERGETTRUSTINFO, r);
-       
+       }
+
        r->out.result = _netr_NETRSERVERGETTRUSTINFO(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(netr_NETRSERVERGETTRUSTINFO, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 
@@ -3627,11 +3809,11 @@ static struct api_struct api_netlogon_cmds[] =
        {"NETR_DATABASESYNC2", NDR_NETR_DATABASESYNC2, api_netr_DatabaseSync2},
        {"NETR_DATABASEREDO", NDR_NETR_DATABASEREDO, api_netr_DatabaseRedo},
        {"NETR_LOGONCONTROL2EX", NDR_NETR_LOGONCONTROL2EX, api_netr_LogonControl2Ex},
-       {"NETR_NETRENUMERATETRUSTEDDOMAINS", NDR_NETR_NETRENUMERATETRUSTEDDOMAINS, api_netr_NETRENUMERATETRUSTEDDOMAINS},
+       {"NETR_NETRENUMERATETRUSTEDDOMAINS", NDR_NETR_NETRENUMERATETRUSTEDDOMAINS, api_netr_NetrEnumerateTrustedDomains},
        {"NETR_DSRGETDCNAME", NDR_NETR_DSRGETDCNAME, api_netr_DsRGetDCName},
        {"NETR_NETRLOGONDUMMYROUTINE1", NDR_NETR_NETRLOGONDUMMYROUTINE1, api_netr_NETRLOGONDUMMYROUTINE1},
        {"NETR_NETRLOGONSETSERVICEBITS", NDR_NETR_NETRLOGONSETSERVICEBITS, api_netr_NETRLOGONSETSERVICEBITS},
-       {"NETR_NETRLOGONGETTRUSTRID", NDR_NETR_NETRLOGONGETTRUSTRID, api_netr_NETRLOGONGETTRUSTRID},
+       {"NETR_LOGONGETTRUSTRID", NDR_NETR_LOGONGETTRUSTRID, api_netr_LogonGetTrustRid},
        {"NETR_NETRLOGONCOMPUTESERVERDIGEST", NDR_NETR_NETRLOGONCOMPUTESERVERDIGEST, api_netr_NETRLOGONCOMPUTESERVERDIGEST},
        {"NETR_NETRLOGONCOMPUTECLIENTDIGEST", NDR_NETR_NETRLOGONCOMPUTECLIENTDIGEST, api_netr_NETRLOGONCOMPUTECLIENTDIGEST},
        {"NETR_SERVERAUTHENTICATE3", NDR_NETR_SERVERAUTHENTICATE3, api_netr_ServerAuthenticate3},
@@ -3639,20 +3821,20 @@ static struct api_struct api_netlogon_cmds[] =
        {"NETR_DSRGETSITENAME", NDR_NETR_DSRGETSITENAME, api_netr_DsRGetSiteName},
        {"NETR_LOGONGETDOMAININFO", NDR_NETR_LOGONGETDOMAININFO, api_netr_LogonGetDomainInfo},
        {"NETR_SERVERPASSWORDSET2", NDR_NETR_SERVERPASSWORDSET2, api_netr_ServerPasswordSet2},
-       {"NETR_NETRSERVERPASSWORDGET", NDR_NETR_NETRSERVERPASSWORDGET, api_netr_NETRSERVERPASSWORDGET},
+       {"NETR_SERVERPASSWORDGET", NDR_NETR_SERVERPASSWORDGET, api_netr_ServerPasswordGet},
        {"NETR_NETRLOGONSENDTOSAM", NDR_NETR_NETRLOGONSENDTOSAM, api_netr_NETRLOGONSENDTOSAM},
-       {"NETR_DSRADDRESSTOSITENAMESW", NDR_NETR_DSRADDRESSTOSITENAMESW, api_netr_DSRADDRESSTOSITENAMESW},
+       {"NETR_DSRADDRESSTOSITENAMESW", NDR_NETR_DSRADDRESSTOSITENAMESW, api_netr_DsRAddressToSitenamesW},
        {"NETR_DSRGETDCNAMEEX2", NDR_NETR_DSRGETDCNAMEEX2, api_netr_DsRGetDCNameEx2},
        {"NETR_NETRLOGONGETTIMESERVICEPARENTDOMAIN", NDR_NETR_NETRLOGONGETTIMESERVICEPARENTDOMAIN, api_netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN},
-       {"NETR_NETRENUMERATETRUSTEDDOMAINSEX", NDR_NETR_NETRENUMERATETRUSTEDDOMAINSEX, api_netr_NETRENUMERATETRUSTEDDOMAINSEX},
-       {"NETR_DSRADDRESSTOSITENAMESEXW", NDR_NETR_DSRADDRESSTOSITENAMESEXW, api_netr_DSRADDRESSTOSITENAMESEXW},
-       {"NETR_DSRGETDCSITECOVERAGEW", NDR_NETR_DSRGETDCSITECOVERAGEW, api_netr_DSRGETDCSITECOVERAGEW},
+       {"NETR_NETRENUMERATETRUSTEDDOMAINSEX", NDR_NETR_NETRENUMERATETRUSTEDDOMAINSEX, api_netr_NetrEnumerateTrustedDomainsEx},
+       {"NETR_DSRADDRESSTOSITENAMESEXW", NDR_NETR_DSRADDRESSTOSITENAMESEXW, api_netr_DsRAddressToSitenamesExW},
+       {"NETR_DSRGETDCSITECOVERAGEW", NDR_NETR_DSRGETDCSITECOVERAGEW, api_netr_DsrGetDcSiteCoverageW},
        {"NETR_LOGONSAMLOGONEX", NDR_NETR_LOGONSAMLOGONEX, api_netr_LogonSamLogonEx},
        {"NETR_DSRENUMERATEDOMAINTRUSTS", NDR_NETR_DSRENUMERATEDOMAINTRUSTS, api_netr_DsrEnumerateDomainTrusts},
-       {"NETR_DSRDEREGISTERDNSHOSTRECORDS", NDR_NETR_DSRDEREGISTERDNSHOSTRECORDS, api_netr_DSRDEREGISTERDNSHOSTRECORDS},
-       {"NETR_NETRSERVERTRUSTPASSWORDSGET", NDR_NETR_NETRSERVERTRUSTPASSWORDSGET, api_netr_NETRSERVERTRUSTPASSWORDSGET},
-       {"NETR_DSRGETFORESTTRUSTINFORMATION", NDR_NETR_DSRGETFORESTTRUSTINFORMATION, api_netr_DSRGETFORESTTRUSTINFORMATION},
-       {"NETR_NETRGETFORESTTRUSTINFORMATION", NDR_NETR_NETRGETFORESTTRUSTINFORMATION, api_netr_NETRGETFORESTTRUSTINFORMATION},
+       {"NETR_DSRDEREGISTERDNSHOSTRECORDS", NDR_NETR_DSRDEREGISTERDNSHOSTRECORDS, api_netr_DsrDeregisterDNSHostRecords},
+       {"NETR_SERVERTRUSTPASSWORDSGET", NDR_NETR_SERVERTRUSTPASSWORDSGET, api_netr_ServerTrustPasswordsGet},
+       {"NETR_DSRGETFORESTTRUSTINFORMATION", NDR_NETR_DSRGETFORESTTRUSTINFORMATION, api_netr_DsRGetForestTrustInformation},
+       {"NETR_GETFORESTTRUSTINFORMATION", NDR_NETR_GETFORESTTRUSTINFORMATION, api_netr_GetForestTrustInformation},
        {"NETR_LOGONSAMLOGONWITHFLAGS", NDR_NETR_LOGONSAMLOGONWITHFLAGS, api_netr_LogonSamLogonWithFlags},
        {"NETR_NETRSERVERGETTRUSTINFO", NDR_NETR_NETRSERVERGETTRUSTINFO, api_netr_NETRSERVERGETTRUSTINFO},
 };
index 8350f437cdd46f06b948b9b5825dde3dc675dbaf..1fe16c603be3d0b3d93b5d413773609e453cb509 100644 (file)
@@ -12,7 +12,7 @@ NTSTATUS _netr_DatabaseDeltas(pipes_struct *p, struct netr_DatabaseDeltas *r);
 NTSTATUS _netr_DatabaseSync(pipes_struct *p, struct netr_DatabaseSync *r);
 NTSTATUS _netr_AccountDeltas(pipes_struct *p, struct netr_AccountDeltas *r);
 NTSTATUS _netr_AccountSync(pipes_struct *p, struct netr_AccountSync *r);
-NTSTATUS _netr_GetDcName(pipes_struct *p, struct netr_GetDcName *r);
+WERROR _netr_GetDcName(pipes_struct *p, struct netr_GetDcName *r);
 WERROR _netr_LogonControl(pipes_struct *p, struct netr_LogonControl *r);
 WERROR _netr_GetAnyDCName(pipes_struct *p, struct netr_GetAnyDCName *r);
 WERROR _netr_LogonControl2(pipes_struct *p, struct netr_LogonControl2 *r);
@@ -20,11 +20,11 @@ NTSTATUS _netr_ServerAuthenticate2(pipes_struct *p, struct netr_ServerAuthentica
 NTSTATUS _netr_DatabaseSync2(pipes_struct *p, struct netr_DatabaseSync2 *r);
 NTSTATUS _netr_DatabaseRedo(pipes_struct *p, struct netr_DatabaseRedo *r);
 WERROR _netr_LogonControl2Ex(pipes_struct *p, struct netr_LogonControl2Ex *r);
-WERROR _netr_NETRENUMERATETRUSTEDDOMAINS(pipes_struct *p, struct netr_NETRENUMERATETRUSTEDDOMAINS *r);
+WERROR _netr_NetrEnumerateTrustedDomains(pipes_struct *p, struct netr_NetrEnumerateTrustedDomains *r);
 WERROR _netr_DsRGetDCName(pipes_struct *p, struct netr_DsRGetDCName *r);
 WERROR _netr_NETRLOGONDUMMYROUTINE1(pipes_struct *p, struct netr_NETRLOGONDUMMYROUTINE1 *r);
 WERROR _netr_NETRLOGONSETSERVICEBITS(pipes_struct *p, struct netr_NETRLOGONSETSERVICEBITS *r);
-WERROR _netr_NETRLOGONGETTRUSTRID(pipes_struct *p, struct netr_NETRLOGONGETTRUSTRID *r);
+WERROR _netr_LogonGetTrustRid(pipes_struct *p, struct netr_LogonGetTrustRid *r);
 WERROR _netr_NETRLOGONCOMPUTESERVERDIGEST(pipes_struct *p, struct netr_NETRLOGONCOMPUTESERVERDIGEST *r);
 WERROR _netr_NETRLOGONCOMPUTECLIENTDIGEST(pipes_struct *p, struct netr_NETRLOGONCOMPUTECLIENTDIGEST *r);
 NTSTATUS _netr_ServerAuthenticate3(pipes_struct *p, struct netr_ServerAuthenticate3 *r);
@@ -32,20 +32,20 @@ WERROR _netr_DsRGetDCNameEx(pipes_struct *p, struct netr_DsRGetDCNameEx *r);
 WERROR _netr_DsRGetSiteName(pipes_struct *p, struct netr_DsRGetSiteName *r);
 NTSTATUS _netr_LogonGetDomainInfo(pipes_struct *p, struct netr_LogonGetDomainInfo *r);
 NTSTATUS _netr_ServerPasswordSet2(pipes_struct *p, struct netr_ServerPasswordSet2 *r);
-WERROR _netr_NETRSERVERPASSWORDGET(pipes_struct *p, struct netr_NETRSERVERPASSWORDGET *r);
+WERROR _netr_ServerPasswordGet(pipes_struct *p, struct netr_ServerPasswordGet *r);
 WERROR _netr_NETRLOGONSENDTOSAM(pipes_struct *p, struct netr_NETRLOGONSENDTOSAM *r);
-WERROR _netr_DSRADDRESSTOSITENAMESW(pipes_struct *p, struct netr_DSRADDRESSTOSITENAMESW *r);
+WERROR _netr_DsRAddressToSitenamesW(pipes_struct *p, struct netr_DsRAddressToSitenamesW *r);
 WERROR _netr_DsRGetDCNameEx2(pipes_struct *p, struct netr_DsRGetDCNameEx2 *r);
 WERROR _netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN(pipes_struct *p, struct netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN *r);
-WERROR _netr_NETRENUMERATETRUSTEDDOMAINSEX(pipes_struct *p, struct netr_NETRENUMERATETRUSTEDDOMAINSEX *r);
-WERROR _netr_DSRADDRESSTOSITENAMESEXW(pipes_struct *p, struct netr_DSRADDRESSTOSITENAMESEXW *r);
-WERROR _netr_DSRGETDCSITECOVERAGEW(pipes_struct *p, struct netr_DSRGETDCSITECOVERAGEW *r);
+WERROR _netr_NetrEnumerateTrustedDomainsEx(pipes_struct *p, struct netr_NetrEnumerateTrustedDomainsEx *r);
+WERROR _netr_DsRAddressToSitenamesExW(pipes_struct *p, struct netr_DsRAddressToSitenamesExW *r);
+WERROR _netr_DsrGetDcSiteCoverageW(pipes_struct *p, struct netr_DsrGetDcSiteCoverageW *r);
 NTSTATUS _netr_LogonSamLogonEx(pipes_struct *p, struct netr_LogonSamLogonEx *r);
 WERROR _netr_DsrEnumerateDomainTrusts(pipes_struct *p, struct netr_DsrEnumerateDomainTrusts *r);
-WERROR _netr_DSRDEREGISTERDNSHOSTRECORDS(pipes_struct *p, struct netr_DSRDEREGISTERDNSHOSTRECORDS *r);
-WERROR _netr_NETRSERVERTRUSTPASSWORDSGET(pipes_struct *p, struct netr_NETRSERVERTRUSTPASSWORDSGET *r);
-WERROR _netr_DSRGETFORESTTRUSTINFORMATION(pipes_struct *p, struct netr_DSRGETFORESTTRUSTINFORMATION *r);
-WERROR _netr_NETRGETFORESTTRUSTINFORMATION(pipes_struct *p, struct netr_NETRGETFORESTTRUSTINFORMATION *r);
+WERROR _netr_DsrDeregisterDNSHostRecords(pipes_struct *p, struct netr_DsrDeregisterDNSHostRecords *r);
+NTSTATUS _netr_ServerTrustPasswordsGet(pipes_struct *p, struct netr_ServerTrustPasswordsGet *r);
+WERROR _netr_DsRGetForestTrustInformation(pipes_struct *p, struct netr_DsRGetForestTrustInformation *r);
+WERROR _netr_GetForestTrustInformation(pipes_struct *p, struct netr_GetForestTrustInformation *r);
 NTSTATUS _netr_LogonSamLogonWithFlags(pipes_struct *p, struct netr_LogonSamLogonWithFlags *r);
 WERROR _netr_NETRSERVERGETTRUSTINFO(pipes_struct *p, struct netr_NETRSERVERGETTRUSTINFO *r);
 void netlogon_get_pipe_fns(struct api_struct **fns, int *n_fns);
diff --git a/source/librpc/gen_ndr/srv_samr.c b/source/librpc/gen_ndr/srv_samr.c
new file mode 100644 (file)
index 0000000..72116f3
--- /dev/null
@@ -0,0 +1,5482 @@
+/*
+ * Unix SMB/CIFS implementation.
+ * server auto-generated by pidl. DO NOT MODIFY!
+ */
+
+#include "includes.h"
+#include "librpc/gen_ndr/srv_samr.h"
+
+static bool api_samr_Connect(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct samr_Connect *r;
+
+       call = &ndr_table_samr.calls[NDR_SAMR_CONNECT];
+
+       r = talloc(NULL, struct samr_Connect);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_Connect, r);
+       }
+
+       ZERO_STRUCT(r->out);
+       r->out.connect_handle = talloc_zero(r, struct policy_handle);
+       if (r->out.connect_handle == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.result = _samr_Connect(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_Connect, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_samr_Close(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct samr_Close *r;
+
+       call = &ndr_table_samr.calls[NDR_SAMR_CLOSE];
+
+       r = talloc(NULL, struct samr_Close);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_Close, r);
+       }
+
+       ZERO_STRUCT(r->out);
+       r->out.handle = r->in.handle;
+       r->out.result = _samr_Close(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_Close, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_samr_SetSecurity(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct samr_SetSecurity *r;
+
+       call = &ndr_table_samr.calls[NDR_SAMR_SETSECURITY];
+
+       r = talloc(NULL, struct samr_SetSecurity);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_SetSecurity, r);
+       }
+
+       r->out.result = _samr_SetSecurity(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_SetSecurity, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_samr_QuerySecurity(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct samr_QuerySecurity *r;
+
+       call = &ndr_table_samr.calls[NDR_SAMR_QUERYSECURITY];
+
+       r = talloc(NULL, struct samr_QuerySecurity);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_QuerySecurity, r);
+       }
+
+       ZERO_STRUCT(r->out);
+       r->out.sdbuf = talloc_zero(r, struct sec_desc_buf);
+       if (r->out.sdbuf == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.result = _samr_QuerySecurity(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_QuerySecurity, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_samr_Shutdown(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct samr_Shutdown *r;
+
+       call = &ndr_table_samr.calls[NDR_SAMR_SHUTDOWN];
+
+       r = talloc(NULL, struct samr_Shutdown);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_Shutdown, r);
+       }
+
+       r->out.result = _samr_Shutdown(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_Shutdown, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_samr_LookupDomain(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct samr_LookupDomain *r;
+
+       call = &ndr_table_samr.calls[NDR_SAMR_LOOKUPDOMAIN];
+
+       r = talloc(NULL, struct samr_LookupDomain);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_LookupDomain, r);
+       }
+
+       ZERO_STRUCT(r->out);
+       r->out.sid = talloc_zero(r, struct dom_sid2);
+       if (r->out.sid == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.result = _samr_LookupDomain(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_LookupDomain, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_samr_EnumDomains(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct samr_EnumDomains *r;
+
+       call = &ndr_table_samr.calls[NDR_SAMR_ENUMDOMAINS];
+
+       r = talloc(NULL, struct samr_EnumDomains);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_EnumDomains, r);
+       }
+
+       ZERO_STRUCT(r->out);
+       r->out.resume_handle = r->in.resume_handle;
+       r->out.sam = talloc_zero(r, struct samr_SamArray);
+       if (r->out.sam == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.num_entries = talloc_zero(r, uint32_t);
+       if (r->out.num_entries == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.result = _samr_EnumDomains(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_EnumDomains, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_samr_OpenDomain(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct samr_OpenDomain *r;
+
+       call = &ndr_table_samr.calls[NDR_SAMR_OPENDOMAIN];
+
+       r = talloc(NULL, struct samr_OpenDomain);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_OpenDomain, r);
+       }
+
+       ZERO_STRUCT(r->out);
+       r->out.domain_handle = talloc_zero(r, struct policy_handle);
+       if (r->out.domain_handle == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.result = _samr_OpenDomain(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_OpenDomain, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_samr_QueryDomainInfo(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct samr_QueryDomainInfo *r;
+
+       call = &ndr_table_samr.calls[NDR_SAMR_QUERYDOMAININFO];
+
+       r = talloc(NULL, struct samr_QueryDomainInfo);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_QueryDomainInfo, r);
+       }
+
+       ZERO_STRUCT(r->out);
+       r->out.info = talloc_zero(r, union samr_DomainInfo);
+       if (r->out.info == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.result = _samr_QueryDomainInfo(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_QueryDomainInfo, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_samr_SetDomainInfo(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct samr_SetDomainInfo *r;
+
+       call = &ndr_table_samr.calls[NDR_SAMR_SETDOMAININFO];
+
+       r = talloc(NULL, struct samr_SetDomainInfo);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_SetDomainInfo, r);
+       }
+
+       r->out.result = _samr_SetDomainInfo(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_SetDomainInfo, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_samr_CreateDomainGroup(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct samr_CreateDomainGroup *r;
+
+       call = &ndr_table_samr.calls[NDR_SAMR_CREATEDOMAINGROUP];
+
+       r = talloc(NULL, struct samr_CreateDomainGroup);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_CreateDomainGroup, r);
+       }
+
+       ZERO_STRUCT(r->out);
+       r->out.group_handle = talloc_zero(r, struct policy_handle);
+       if (r->out.group_handle == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.rid = talloc_zero(r, uint32_t);
+       if (r->out.rid == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.result = _samr_CreateDomainGroup(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_CreateDomainGroup, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_samr_EnumDomainGroups(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct samr_EnumDomainGroups *r;
+
+       call = &ndr_table_samr.calls[NDR_SAMR_ENUMDOMAINGROUPS];
+
+       r = talloc(NULL, struct samr_EnumDomainGroups);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_EnumDomainGroups, r);
+       }
+
+       ZERO_STRUCT(r->out);
+       r->out.resume_handle = r->in.resume_handle;
+       r->out.sam = talloc_zero(r, struct samr_SamArray);
+       if (r->out.sam == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.num_entries = talloc_zero(r, uint32_t);
+       if (r->out.num_entries == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.result = _samr_EnumDomainGroups(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_EnumDomainGroups, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_samr_CreateUser(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct samr_CreateUser *r;
+
+       call = &ndr_table_samr.calls[NDR_SAMR_CREATEUSER];
+
+       r = talloc(NULL, struct samr_CreateUser);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_CreateUser, r);
+       }
+
+       ZERO_STRUCT(r->out);
+       r->out.user_handle = talloc_zero(r, struct policy_handle);
+       if (r->out.user_handle == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.rid = talloc_zero(r, uint32_t);
+       if (r->out.rid == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.result = _samr_CreateUser(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_CreateUser, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_samr_EnumDomainUsers(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct samr_EnumDomainUsers *r;
+
+       call = &ndr_table_samr.calls[NDR_SAMR_ENUMDOMAINUSERS];
+
+       r = talloc(NULL, struct samr_EnumDomainUsers);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_EnumDomainUsers, r);
+       }
+
+       ZERO_STRUCT(r->out);
+       r->out.resume_handle = r->in.resume_handle;
+       r->out.sam = talloc_zero(r, struct samr_SamArray);
+       if (r->out.sam == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.num_entries = talloc_zero(r, uint32_t);
+       if (r->out.num_entries == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.result = _samr_EnumDomainUsers(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_EnumDomainUsers, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_samr_CreateDomAlias(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct samr_CreateDomAlias *r;
+
+       call = &ndr_table_samr.calls[NDR_SAMR_CREATEDOMALIAS];
+
+       r = talloc(NULL, struct samr_CreateDomAlias);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_CreateDomAlias, r);
+       }
+
+       ZERO_STRUCT(r->out);
+       r->out.alias_handle = talloc_zero(r, struct policy_handle);
+       if (r->out.alias_handle == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.rid = talloc_zero(r, uint32_t);
+       if (r->out.rid == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.result = _samr_CreateDomAlias(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_CreateDomAlias, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_samr_EnumDomainAliases(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct samr_EnumDomainAliases *r;
+
+       call = &ndr_table_samr.calls[NDR_SAMR_ENUMDOMAINALIASES];
+
+       r = talloc(NULL, struct samr_EnumDomainAliases);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_EnumDomainAliases, r);
+       }
+
+       ZERO_STRUCT(r->out);
+       r->out.resume_handle = r->in.resume_handle;
+       r->out.sam = talloc_zero(r, struct samr_SamArray);
+       if (r->out.sam == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.num_entries = talloc_zero(r, uint32_t);
+       if (r->out.num_entries == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.result = _samr_EnumDomainAliases(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_EnumDomainAliases, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_samr_GetAliasMembership(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct samr_GetAliasMembership *r;
+
+       call = &ndr_table_samr.calls[NDR_SAMR_GETALIASMEMBERSHIP];
+
+       r = talloc(NULL, struct samr_GetAliasMembership);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_GetAliasMembership, r);
+       }
+
+       ZERO_STRUCT(r->out);
+       r->out.rids = talloc_zero(r, struct samr_Ids);
+       if (r->out.rids == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.result = _samr_GetAliasMembership(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_GetAliasMembership, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_samr_LookupNames(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct samr_LookupNames *r;
+
+       call = &ndr_table_samr.calls[NDR_SAMR_LOOKUPNAMES];
+
+       r = talloc(NULL, struct samr_LookupNames);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_LookupNames, r);
+       }
+
+       ZERO_STRUCT(r->out);
+       r->out.rids = talloc_zero(r, struct samr_Ids);
+       if (r->out.rids == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.types = talloc_zero(r, struct samr_Ids);
+       if (r->out.types == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.result = _samr_LookupNames(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_LookupNames, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_samr_LookupRids(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct samr_LookupRids *r;
+
+       call = &ndr_table_samr.calls[NDR_SAMR_LOOKUPRIDS];
+
+       r = talloc(NULL, struct samr_LookupRids);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_LookupRids, r);
+       }
+
+       ZERO_STRUCT(r->out);
+       r->out.names = talloc_zero(r, struct lsa_Strings);
+       if (r->out.names == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.types = talloc_zero(r, struct samr_Ids);
+       if (r->out.types == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.result = _samr_LookupRids(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_LookupRids, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_samr_OpenGroup(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct samr_OpenGroup *r;
+
+       call = &ndr_table_samr.calls[NDR_SAMR_OPENGROUP];
+
+       r = talloc(NULL, struct samr_OpenGroup);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_OpenGroup, r);
+       }
+
+       ZERO_STRUCT(r->out);
+       r->out.group_handle = talloc_zero(r, struct policy_handle);
+       if (r->out.group_handle == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.result = _samr_OpenGroup(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_OpenGroup, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_samr_QueryGroupInfo(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct samr_QueryGroupInfo *r;
+
+       call = &ndr_table_samr.calls[NDR_SAMR_QUERYGROUPINFO];
+
+       r = talloc(NULL, struct samr_QueryGroupInfo);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_QueryGroupInfo, r);
+       }
+
+       ZERO_STRUCT(r->out);
+       r->out.info = talloc_zero(r, union samr_GroupInfo);
+       if (r->out.info == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.result = _samr_QueryGroupInfo(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_QueryGroupInfo, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_samr_SetGroupInfo(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct samr_SetGroupInfo *r;
+
+       call = &ndr_table_samr.calls[NDR_SAMR_SETGROUPINFO];
+
+       r = talloc(NULL, struct samr_SetGroupInfo);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_SetGroupInfo, r);
+       }
+
+       r->out.result = _samr_SetGroupInfo(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_SetGroupInfo, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_samr_AddGroupMember(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct samr_AddGroupMember *r;
+
+       call = &ndr_table_samr.calls[NDR_SAMR_ADDGROUPMEMBER];
+
+       r = talloc(NULL, struct samr_AddGroupMember);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_AddGroupMember, r);
+       }
+
+       r->out.result = _samr_AddGroupMember(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_AddGroupMember, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_samr_DeleteDomainGroup(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct samr_DeleteDomainGroup *r;
+
+       call = &ndr_table_samr.calls[NDR_SAMR_DELETEDOMAINGROUP];
+
+       r = talloc(NULL, struct samr_DeleteDomainGroup);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_DeleteDomainGroup, r);
+       }
+
+       ZERO_STRUCT(r->out);
+       r->out.group_handle = r->in.group_handle;
+       r->out.result = _samr_DeleteDomainGroup(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_DeleteDomainGroup, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_samr_DeleteGroupMember(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct samr_DeleteGroupMember *r;
+
+       call = &ndr_table_samr.calls[NDR_SAMR_DELETEGROUPMEMBER];
+
+       r = talloc(NULL, struct samr_DeleteGroupMember);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_DeleteGroupMember, r);
+       }
+
+       r->out.result = _samr_DeleteGroupMember(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_DeleteGroupMember, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_samr_QueryGroupMember(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct samr_QueryGroupMember *r;
+
+       call = &ndr_table_samr.calls[NDR_SAMR_QUERYGROUPMEMBER];
+
+       r = talloc(NULL, struct samr_QueryGroupMember);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_QueryGroupMember, r);
+       }
+
+       ZERO_STRUCT(r->out);
+       r->out.rids = talloc_zero(r, struct samr_RidTypeArray);
+       if (r->out.rids == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.result = _samr_QueryGroupMember(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_QueryGroupMember, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_samr_SetMemberAttributesOfGroup(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct samr_SetMemberAttributesOfGroup *r;
+
+       call = &ndr_table_samr.calls[NDR_SAMR_SETMEMBERATTRIBUTESOFGROUP];
+
+       r = talloc(NULL, struct samr_SetMemberAttributesOfGroup);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_SetMemberAttributesOfGroup, r);
+       }
+
+       r->out.result = _samr_SetMemberAttributesOfGroup(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_SetMemberAttributesOfGroup, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_samr_OpenAlias(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct samr_OpenAlias *r;
+
+       call = &ndr_table_samr.calls[NDR_SAMR_OPENALIAS];
+
+       r = talloc(NULL, struct samr_OpenAlias);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_OpenAlias, r);
+       }
+
+       ZERO_STRUCT(r->out);
+       r->out.alias_handle = talloc_zero(r, struct policy_handle);
+       if (r->out.alias_handle == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.result = _samr_OpenAlias(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_OpenAlias, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_samr_QueryAliasInfo(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct samr_QueryAliasInfo *r;
+
+       call = &ndr_table_samr.calls[NDR_SAMR_QUERYALIASINFO];
+
+       r = talloc(NULL, struct samr_QueryAliasInfo);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_QueryAliasInfo, r);
+       }
+
+       ZERO_STRUCT(r->out);
+       r->out.info = talloc_zero(r, union samr_AliasInfo);
+       if (r->out.info == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.result = _samr_QueryAliasInfo(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_QueryAliasInfo, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_samr_SetAliasInfo(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct samr_SetAliasInfo *r;
+
+       call = &ndr_table_samr.calls[NDR_SAMR_SETALIASINFO];
+
+       r = talloc(NULL, struct samr_SetAliasInfo);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_SetAliasInfo, r);
+       }
+
+       r->out.result = _samr_SetAliasInfo(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_SetAliasInfo, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_samr_DeleteDomAlias(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct samr_DeleteDomAlias *r;
+
+       call = &ndr_table_samr.calls[NDR_SAMR_DELETEDOMALIAS];
+
+       r = talloc(NULL, struct samr_DeleteDomAlias);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_DeleteDomAlias, r);
+       }
+
+       ZERO_STRUCT(r->out);
+       r->out.alias_handle = r->in.alias_handle;
+       r->out.result = _samr_DeleteDomAlias(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_DeleteDomAlias, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_samr_AddAliasMember(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct samr_AddAliasMember *r;
+
+       call = &ndr_table_samr.calls[NDR_SAMR_ADDALIASMEMBER];
+
+       r = talloc(NULL, struct samr_AddAliasMember);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_AddAliasMember, r);
+       }
+
+       r->out.result = _samr_AddAliasMember(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_AddAliasMember, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_samr_DeleteAliasMember(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct samr_DeleteAliasMember *r;
+
+       call = &ndr_table_samr.calls[NDR_SAMR_DELETEALIASMEMBER];
+
+       r = talloc(NULL, struct samr_DeleteAliasMember);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_DeleteAliasMember, r);
+       }
+
+       r->out.result = _samr_DeleteAliasMember(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_DeleteAliasMember, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_samr_GetMembersInAlias(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct samr_GetMembersInAlias *r;
+
+       call = &ndr_table_samr.calls[NDR_SAMR_GETMEMBERSINALIAS];
+
+       r = talloc(NULL, struct samr_GetMembersInAlias);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_GetMembersInAlias, r);
+       }
+
+       ZERO_STRUCT(r->out);
+       r->out.sids = talloc_zero(r, struct lsa_SidArray);
+       if (r->out.sids == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.result = _samr_GetMembersInAlias(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_GetMembersInAlias, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_samr_OpenUser(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct samr_OpenUser *r;
+
+       call = &ndr_table_samr.calls[NDR_SAMR_OPENUSER];
+
+       r = talloc(NULL, struct samr_OpenUser);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_OpenUser, r);
+       }
+
+       ZERO_STRUCT(r->out);
+       r->out.user_handle = talloc_zero(r, struct policy_handle);
+       if (r->out.user_handle == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.result = _samr_OpenUser(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_OpenUser, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_samr_DeleteUser(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct samr_DeleteUser *r;
+
+       call = &ndr_table_samr.calls[NDR_SAMR_DELETEUSER];
+
+       r = talloc(NULL, struct samr_DeleteUser);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_DeleteUser, r);
+       }
+
+       ZERO_STRUCT(r->out);
+       r->out.user_handle = r->in.user_handle;
+       r->out.result = _samr_DeleteUser(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_DeleteUser, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_samr_QueryUserInfo(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct samr_QueryUserInfo *r;
+
+       call = &ndr_table_samr.calls[NDR_SAMR_QUERYUSERINFO];
+
+       r = talloc(NULL, struct samr_QueryUserInfo);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_QueryUserInfo, r);
+       }
+
+       ZERO_STRUCT(r->out);
+       r->out.info = talloc_zero(r, union samr_UserInfo);
+       if (r->out.info == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.result = _samr_QueryUserInfo(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_QueryUserInfo, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_samr_SetUserInfo(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct samr_SetUserInfo *r;
+
+       call = &ndr_table_samr.calls[NDR_SAMR_SETUSERINFO];
+
+       r = talloc(NULL, struct samr_SetUserInfo);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_SetUserInfo, r);
+       }
+
+       r->out.result = _samr_SetUserInfo(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_SetUserInfo, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_samr_ChangePasswordUser(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct samr_ChangePasswordUser *r;
+
+       call = &ndr_table_samr.calls[NDR_SAMR_CHANGEPASSWORDUSER];
+
+       r = talloc(NULL, struct samr_ChangePasswordUser);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_ChangePasswordUser, r);
+       }
+
+       r->out.result = _samr_ChangePasswordUser(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_ChangePasswordUser, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_samr_GetGroupsForUser(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct samr_GetGroupsForUser *r;
+
+       call = &ndr_table_samr.calls[NDR_SAMR_GETGROUPSFORUSER];
+
+       r = talloc(NULL, struct samr_GetGroupsForUser);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_GetGroupsForUser, r);
+       }
+
+       ZERO_STRUCT(r->out);
+       r->out.rids = talloc_zero(r, struct samr_RidWithAttributeArray);
+       if (r->out.rids == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.result = _samr_GetGroupsForUser(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_GetGroupsForUser, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_samr_QueryDisplayInfo(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct samr_QueryDisplayInfo *r;
+
+       call = &ndr_table_samr.calls[NDR_SAMR_QUERYDISPLAYINFO];
+
+       r = talloc(NULL, struct samr_QueryDisplayInfo);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_QueryDisplayInfo, r);
+       }
+
+       ZERO_STRUCT(r->out);
+       r->out.total_size = talloc_zero(r, uint32_t);
+       if (r->out.total_size == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.returned_size = talloc_zero(r, uint32_t);
+       if (r->out.returned_size == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.info = talloc_zero(r, union samr_DispInfo);
+       if (r->out.info == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.result = _samr_QueryDisplayInfo(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_QueryDisplayInfo, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_samr_GetDisplayEnumerationIndex(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct samr_GetDisplayEnumerationIndex *r;
+
+       call = &ndr_table_samr.calls[NDR_SAMR_GETDISPLAYENUMERATIONINDEX];
+
+       r = talloc(NULL, struct samr_GetDisplayEnumerationIndex);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_GetDisplayEnumerationIndex, r);
+       }
+
+       ZERO_STRUCT(r->out);
+       r->out.idx = talloc_zero(r, uint32_t);
+       if (r->out.idx == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.result = _samr_GetDisplayEnumerationIndex(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_GetDisplayEnumerationIndex, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_samr_TestPrivateFunctionsDomain(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct samr_TestPrivateFunctionsDomain *r;
+
+       call = &ndr_table_samr.calls[NDR_SAMR_TESTPRIVATEFUNCTIONSDOMAIN];
+
+       r = talloc(NULL, struct samr_TestPrivateFunctionsDomain);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_TestPrivateFunctionsDomain, r);
+       }
+
+       r->out.result = _samr_TestPrivateFunctionsDomain(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_TestPrivateFunctionsDomain, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_samr_TestPrivateFunctionsUser(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct samr_TestPrivateFunctionsUser *r;
+
+       call = &ndr_table_samr.calls[NDR_SAMR_TESTPRIVATEFUNCTIONSUSER];
+
+       r = talloc(NULL, struct samr_TestPrivateFunctionsUser);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_TestPrivateFunctionsUser, r);
+       }
+
+       r->out.result = _samr_TestPrivateFunctionsUser(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_TestPrivateFunctionsUser, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_samr_GetUserPwInfo(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct samr_GetUserPwInfo *r;
+
+       call = &ndr_table_samr.calls[NDR_SAMR_GETUSERPWINFO];
+
+       r = talloc(NULL, struct samr_GetUserPwInfo);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_GetUserPwInfo, r);
+       }
+
+       ZERO_STRUCT(r->out);
+       r->out.info = talloc_zero(r, struct samr_PwInfo);
+       if (r->out.info == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.result = _samr_GetUserPwInfo(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_GetUserPwInfo, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_samr_RemoveMemberFromForeignDomain(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct samr_RemoveMemberFromForeignDomain *r;
+
+       call = &ndr_table_samr.calls[NDR_SAMR_REMOVEMEMBERFROMFOREIGNDOMAIN];
+
+       r = talloc(NULL, struct samr_RemoveMemberFromForeignDomain);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_RemoveMemberFromForeignDomain, r);
+       }
+
+       r->out.result = _samr_RemoveMemberFromForeignDomain(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_RemoveMemberFromForeignDomain, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_samr_QueryDomainInfo2(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct samr_QueryDomainInfo2 *r;
+
+       call = &ndr_table_samr.calls[NDR_SAMR_QUERYDOMAININFO2];
+
+       r = talloc(NULL, struct samr_QueryDomainInfo2);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_QueryDomainInfo2, r);
+       }
+
+       ZERO_STRUCT(r->out);
+       r->out.info = talloc_zero(r, union samr_DomainInfo);
+       if (r->out.info == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.result = _samr_QueryDomainInfo2(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_QueryDomainInfo2, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_samr_QueryUserInfo2(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct samr_QueryUserInfo2 *r;
+
+       call = &ndr_table_samr.calls[NDR_SAMR_QUERYUSERINFO2];
+
+       r = talloc(NULL, struct samr_QueryUserInfo2);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_QueryUserInfo2, r);
+       }
+
+       ZERO_STRUCT(r->out);
+       r->out.info = talloc_zero(r, union samr_UserInfo);
+       if (r->out.info == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.result = _samr_QueryUserInfo2(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_QueryUserInfo2, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_samr_QueryDisplayInfo2(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct samr_QueryDisplayInfo2 *r;
+
+       call = &ndr_table_samr.calls[NDR_SAMR_QUERYDISPLAYINFO2];
+
+       r = talloc(NULL, struct samr_QueryDisplayInfo2);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_QueryDisplayInfo2, r);
+       }
+
+       ZERO_STRUCT(r->out);
+       r->out.total_size = talloc_zero(r, uint32_t);
+       if (r->out.total_size == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.returned_size = talloc_zero(r, uint32_t);
+       if (r->out.returned_size == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.info = talloc_zero(r, union samr_DispInfo);
+       if (r->out.info == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.result = _samr_QueryDisplayInfo2(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_QueryDisplayInfo2, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_samr_GetDisplayEnumerationIndex2(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct samr_GetDisplayEnumerationIndex2 *r;
+
+       call = &ndr_table_samr.calls[NDR_SAMR_GETDISPLAYENUMERATIONINDEX2];
+
+       r = talloc(NULL, struct samr_GetDisplayEnumerationIndex2);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_GetDisplayEnumerationIndex2, r);
+       }
+
+       ZERO_STRUCT(r->out);
+       r->out.idx = talloc_zero(r, uint32_t);
+       if (r->out.idx == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.result = _samr_GetDisplayEnumerationIndex2(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_GetDisplayEnumerationIndex2, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_samr_CreateUser2(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct samr_CreateUser2 *r;
+
+       call = &ndr_table_samr.calls[NDR_SAMR_CREATEUSER2];
+
+       r = talloc(NULL, struct samr_CreateUser2);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_CreateUser2, r);
+       }
+
+       ZERO_STRUCT(r->out);
+       r->out.user_handle = talloc_zero(r, struct policy_handle);
+       if (r->out.user_handle == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.access_granted = talloc_zero(r, uint32_t);
+       if (r->out.access_granted == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.rid = talloc_zero(r, uint32_t);
+       if (r->out.rid == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.result = _samr_CreateUser2(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_CreateUser2, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_samr_QueryDisplayInfo3(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct samr_QueryDisplayInfo3 *r;
+
+       call = &ndr_table_samr.calls[NDR_SAMR_QUERYDISPLAYINFO3];
+
+       r = talloc(NULL, struct samr_QueryDisplayInfo3);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_QueryDisplayInfo3, r);
+       }
+
+       ZERO_STRUCT(r->out);
+       r->out.total_size = talloc_zero(r, uint32_t);
+       if (r->out.total_size == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.returned_size = talloc_zero(r, uint32_t);
+       if (r->out.returned_size == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.info = talloc_zero(r, union samr_DispInfo);
+       if (r->out.info == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.result = _samr_QueryDisplayInfo3(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_QueryDisplayInfo3, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_samr_AddMultipleMembersToAlias(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct samr_AddMultipleMembersToAlias *r;
+
+       call = &ndr_table_samr.calls[NDR_SAMR_ADDMULTIPLEMEMBERSTOALIAS];
+
+       r = talloc(NULL, struct samr_AddMultipleMembersToAlias);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_AddMultipleMembersToAlias, r);
+       }
+
+       r->out.result = _samr_AddMultipleMembersToAlias(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_AddMultipleMembersToAlias, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_samr_RemoveMultipleMembersFromAlias(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct samr_RemoveMultipleMembersFromAlias *r;
+
+       call = &ndr_table_samr.calls[NDR_SAMR_REMOVEMULTIPLEMEMBERSFROMALIAS];
+
+       r = talloc(NULL, struct samr_RemoveMultipleMembersFromAlias);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_RemoveMultipleMembersFromAlias, r);
+       }
+
+       r->out.result = _samr_RemoveMultipleMembersFromAlias(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_RemoveMultipleMembersFromAlias, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_samr_OemChangePasswordUser2(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct samr_OemChangePasswordUser2 *r;
+
+       call = &ndr_table_samr.calls[NDR_SAMR_OEMCHANGEPASSWORDUSER2];
+
+       r = talloc(NULL, struct samr_OemChangePasswordUser2);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_OemChangePasswordUser2, r);
+       }
+
+       r->out.result = _samr_OemChangePasswordUser2(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_OemChangePasswordUser2, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_samr_ChangePasswordUser2(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct samr_ChangePasswordUser2 *r;
+
+       call = &ndr_table_samr.calls[NDR_SAMR_CHANGEPASSWORDUSER2];
+
+       r = talloc(NULL, struct samr_ChangePasswordUser2);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_ChangePasswordUser2, r);
+       }
+
+       r->out.result = _samr_ChangePasswordUser2(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_ChangePasswordUser2, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_samr_GetDomPwInfo(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct samr_GetDomPwInfo *r;
+
+       call = &ndr_table_samr.calls[NDR_SAMR_GETDOMPWINFO];
+
+       r = talloc(NULL, struct samr_GetDomPwInfo);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_GetDomPwInfo, r);
+       }
+
+       ZERO_STRUCT(r->out);
+       r->out.info = talloc_zero(r, struct samr_PwInfo);
+       if (r->out.info == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.result = _samr_GetDomPwInfo(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_GetDomPwInfo, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_samr_Connect2(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct samr_Connect2 *r;
+
+       call = &ndr_table_samr.calls[NDR_SAMR_CONNECT2];
+
+       r = talloc(NULL, struct samr_Connect2);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_Connect2, r);
+       }
+
+       ZERO_STRUCT(r->out);
+       r->out.connect_handle = talloc_zero(r, struct policy_handle);
+       if (r->out.connect_handle == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.result = _samr_Connect2(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_Connect2, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_samr_SetUserInfo2(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct samr_SetUserInfo2 *r;
+
+       call = &ndr_table_samr.calls[NDR_SAMR_SETUSERINFO2];
+
+       r = talloc(NULL, struct samr_SetUserInfo2);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_SetUserInfo2, r);
+       }
+
+       r->out.result = _samr_SetUserInfo2(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_SetUserInfo2, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_samr_SetBootKeyInformation(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct samr_SetBootKeyInformation *r;
+
+       call = &ndr_table_samr.calls[NDR_SAMR_SETBOOTKEYINFORMATION];
+
+       r = talloc(NULL, struct samr_SetBootKeyInformation);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_SetBootKeyInformation, r);
+       }
+
+       r->out.result = _samr_SetBootKeyInformation(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_SetBootKeyInformation, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_samr_GetBootKeyInformation(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct samr_GetBootKeyInformation *r;
+
+       call = &ndr_table_samr.calls[NDR_SAMR_GETBOOTKEYINFORMATION];
+
+       r = talloc(NULL, struct samr_GetBootKeyInformation);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_GetBootKeyInformation, r);
+       }
+
+       ZERO_STRUCT(r->out);
+       r->out.unknown = talloc_zero(r, uint32_t);
+       if (r->out.unknown == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.result = _samr_GetBootKeyInformation(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_GetBootKeyInformation, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_samr_Connect3(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct samr_Connect3 *r;
+
+       call = &ndr_table_samr.calls[NDR_SAMR_CONNECT3];
+
+       r = talloc(NULL, struct samr_Connect3);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_Connect3, r);
+       }
+
+       ZERO_STRUCT(r->out);
+       r->out.connect_handle = talloc_zero(r, struct policy_handle);
+       if (r->out.connect_handle == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.result = _samr_Connect3(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_Connect3, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_samr_Connect4(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct samr_Connect4 *r;
+
+       call = &ndr_table_samr.calls[NDR_SAMR_CONNECT4];
+
+       r = talloc(NULL, struct samr_Connect4);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_Connect4, r);
+       }
+
+       ZERO_STRUCT(r->out);
+       r->out.connect_handle = talloc_zero(r, struct policy_handle);
+       if (r->out.connect_handle == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.result = _samr_Connect4(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_Connect4, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_samr_ChangePasswordUser3(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct samr_ChangePasswordUser3 *r;
+
+       call = &ndr_table_samr.calls[NDR_SAMR_CHANGEPASSWORDUSER3];
+
+       r = talloc(NULL, struct samr_ChangePasswordUser3);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_ChangePasswordUser3, r);
+       }
+
+       ZERO_STRUCT(r->out);
+       r->out.dominfo = talloc_zero(r, struct samr_DomInfo1);
+       if (r->out.dominfo == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.reject = talloc_zero(r, struct samr_ChangeReject);
+       if (r->out.reject == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.result = _samr_ChangePasswordUser3(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_ChangePasswordUser3, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_samr_Connect5(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct samr_Connect5 *r;
+
+       call = &ndr_table_samr.calls[NDR_SAMR_CONNECT5];
+
+       r = talloc(NULL, struct samr_Connect5);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_Connect5, r);
+       }
+
+       ZERO_STRUCT(r->out);
+       r->out.level_out = talloc_zero(r, uint32_t);
+       if (r->out.level_out == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.info_out = talloc_zero(r, union samr_ConnectInfo);
+       if (r->out.info_out == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.connect_handle = talloc_zero(r, struct policy_handle);
+       if (r->out.connect_handle == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.result = _samr_Connect5(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_Connect5, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_samr_RidToSid(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct samr_RidToSid *r;
+
+       call = &ndr_table_samr.calls[NDR_SAMR_RIDTOSID];
+
+       r = talloc(NULL, struct samr_RidToSid);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_RidToSid, r);
+       }
+
+       ZERO_STRUCT(r->out);
+       r->out.sid = talloc_zero(r, struct dom_sid2);
+       if (r->out.sid == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.result = _samr_RidToSid(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_RidToSid, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_samr_SetDsrmPassword(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct samr_SetDsrmPassword *r;
+
+       call = &ndr_table_samr.calls[NDR_SAMR_SETDSRMPASSWORD];
+
+       r = talloc(NULL, struct samr_SetDsrmPassword);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_SetDsrmPassword, r);
+       }
+
+       r->out.result = _samr_SetDsrmPassword(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_SetDsrmPassword, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+static bool api_samr_ValidatePassword(pipes_struct *p)
+{
+       const struct ndr_interface_call *call;
+       struct ndr_pull *pull;
+       struct ndr_push *push;
+       enum ndr_err_code ndr_err;
+       DATA_BLOB blob;
+       struct samr_ValidatePassword *r;
+
+       call = &ndr_table_samr.calls[NDR_SAMR_VALIDATEPASSWORD];
+
+       r = talloc(NULL, struct samr_ValidatePassword);
+       if (r == NULL) {
+               return false;
+       }
+
+       if (!prs_data_blob(&p->in_data.data, &blob, r)) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull = ndr_pull_init_blob(&blob, r);
+       if (pull == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       pull->flags |= LIBNDR_FLAG_REF_ALLOC;
+       ndr_err = call->ndr_pull(pull, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_IN_DEBUG(samr_ValidatePassword, r);
+       }
+
+       ZERO_STRUCT(r->out);
+       r->out.rep = talloc_zero(r, union samr_ValidatePasswordRep);
+       if (r->out.rep == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.result = _samr_ValidatePassword(p, r);
+
+       if (p->rng_fault_state) {
+               talloc_free(r);
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               NDR_PRINT_OUT_DEBUG(samr_ValidatePassword, r);
+       }
+
+       push = ndr_push_init_ctx(r);
+       if (push == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       ndr_err = call->ndr_push(push, NDR_OUT, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(r);
+               return false;
+       }
+
+       blob = ndr_push_blob(push);
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
+               talloc_free(r);
+               return false;
+       }
+
+       talloc_free(r);
+
+       return true;
+}
+
+
+/* Tables */
+static struct api_struct api_samr_cmds[] = 
+{
+       {"SAMR_CONNECT", NDR_SAMR_CONNECT, api_samr_Connect},
+       {"SAMR_CLOSE", NDR_SAMR_CLOSE, api_samr_Close},
+       {"SAMR_SETSECURITY", NDR_SAMR_SETSECURITY, api_samr_SetSecurity},
+       {"SAMR_QUERYSECURITY", NDR_SAMR_QUERYSECURITY, api_samr_QuerySecurity},
+       {"SAMR_SHUTDOWN", NDR_SAMR_SHUTDOWN, api_samr_Shutdown},
+       {"SAMR_LOOKUPDOMAIN", NDR_SAMR_LOOKUPDOMAIN, api_samr_LookupDomain},
+       {"SAMR_ENUMDOMAINS", NDR_SAMR_ENUMDOMAINS, api_samr_EnumDomains},
+       {"SAMR_OPENDOMAIN", NDR_SAMR_OPENDOMAIN, api_samr_OpenDomain},
+       {"SAMR_QUERYDOMAININFO", NDR_SAMR_QUERYDOMAININFO, api_samr_QueryDomainInfo},
+       {"SAMR_SETDOMAININFO", NDR_SAMR_SETDOMAININFO, api_samr_SetDomainInfo},
+       {"SAMR_CREATEDOMAINGROUP", NDR_SAMR_CREATEDOMAINGROUP, api_samr_CreateDomainGroup},
+       {"SAMR_ENUMDOMAINGROUPS", NDR_SAMR_ENUMDOMAINGROUPS, api_samr_EnumDomainGroups},
+       {"SAMR_CREATEUSER", NDR_SAMR_CREATEUSER, api_samr_CreateUser},
+       {"SAMR_ENUMDOMAINUSERS", NDR_SAMR_ENUMDOMAINUSERS, api_samr_EnumDomainUsers},
+       {"SAMR_CREATEDOMALIAS", NDR_SAMR_CREATEDOMALIAS, api_samr_CreateDomAlias},
+       {"SAMR_ENUMDOMAINALIASES", NDR_SAMR_ENUMDOMAINALIASES, api_samr_EnumDomainAliases},
+       {"SAMR_GETALIASMEMBERSHIP", NDR_SAMR_GETALIASMEMBERSHIP, api_samr_GetAliasMembership},
+       {"SAMR_LOOKUPNAMES", NDR_SAMR_LOOKUPNAMES, api_samr_LookupNames},
+       {"SAMR_LOOKUPRIDS", NDR_SAMR_LOOKUPRIDS, api_samr_LookupRids},
+       {"SAMR_OPENGROUP", NDR_SAMR_OPENGROUP, api_samr_OpenGroup},
+       {"SAMR_QUERYGROUPINFO", NDR_SAMR_QUERYGROUPINFO, api_samr_QueryGroupInfo},
+       {"SAMR_SETGROUPINFO", NDR_SAMR_SETGROUPINFO, api_samr_SetGroupInfo},
+       {"SAMR_ADDGROUPMEMBER", NDR_SAMR_ADDGROUPMEMBER, api_samr_AddGroupMember},
+       {"SAMR_DELETEDOMAINGROUP", NDR_SAMR_DELETEDOMAINGROUP, api_samr_DeleteDomainGroup},
+       {"SAMR_DELETEGROUPMEMBER", NDR_SAMR_DELETEGROUPMEMBER, api_samr_DeleteGroupMember},
+       {"SAMR_QUERYGROUPMEMBER", NDR_SAMR_QUERYGROUPMEMBER, api_samr_QueryGroupMember},
+       {"SAMR_SETMEMBERATTRIBUTESOFGROUP", NDR_SAMR_SETMEMBERATTRIBUTESOFGROUP, api_samr_SetMemberAttributesOfGroup},
+       {"SAMR_OPENALIAS", NDR_SAMR_OPENALIAS, api_samr_OpenAlias},
+       {"SAMR_QUERYALIASINFO", NDR_SAMR_QUERYALIASINFO, api_samr_QueryAliasInfo},
+       {"SAMR_SETALIASINFO", NDR_SAMR_SETALIASINFO, api_samr_SetAliasInfo},
+       {"SAMR_DELETEDOMALIAS", NDR_SAMR_DELETEDOMALIAS, api_samr_DeleteDomAlias},
+       {"SAMR_ADDALIASMEMBER", NDR_SAMR_ADDALIASMEMBER, api_samr_AddAliasMember},
+       {"SAMR_DELETEALIASMEMBER", NDR_SAMR_DELETEALIASMEMBER, api_samr_DeleteAliasMember},
+       {"SAMR_GETMEMBERSINALIAS", NDR_SAMR_GETMEMBERSINALIAS, api_samr_GetMembersInAlias},
+       {"SAMR_OPENUSER", NDR_SAMR_OPENUSER, api_samr_OpenUser},
+       {"SAMR_DELETEUSER", NDR_SAMR_DELETEUSER, api_samr_DeleteUser},
+       {"SAMR_QUERYUSERINFO", NDR_SAMR_QUERYUSERINFO, api_samr_QueryUserInfo},
+       {"SAMR_SETUSERINFO", NDR_SAMR_SETUSERINFO, api_samr_SetUserInfo},
+       {"SAMR_CHANGEPASSWORDUSER", NDR_SAMR_CHANGEPASSWORDUSER, api_samr_ChangePasswordUser},
+       {"SAMR_GETGROUPSFORUSER", NDR_SAMR_GETGROUPSFORUSER, api_samr_GetGroupsForUser},
+       {"SAMR_QUERYDISPLAYINFO", NDR_SAMR_QUERYDISPLAYINFO, api_samr_QueryDisplayInfo},
+       {"SAMR_GETDISPLAYENUMERATIONINDEX", NDR_SAMR_GETDISPLAYENUMERATIONINDEX, api_samr_GetDisplayEnumerationIndex},
+       {"SAMR_TESTPRIVATEFUNCTIONSDOMAIN", NDR_SAMR_TESTPRIVATEFUNCTIONSDOMAIN, api_samr_TestPrivateFunctionsDomain},
+       {"SAMR_TESTPRIVATEFUNCTIONSUSER", NDR_SAMR_TESTPRIVATEFUNCTIONSUSER, api_samr_TestPrivateFunctionsUser},
+       {"SAMR_GETUSERPWINFO", NDR_SAMR_GETUSERPWINFO, api_samr_GetUserPwInfo},
+       {"SAMR_REMOVEMEMBERFROMFOREIGNDOMAIN", NDR_SAMR_REMOVEMEMBERFROMFOREIGNDOMAIN, api_samr_RemoveMemberFromForeignDomain},
+       {"SAMR_QUERYDOMAININFO2", NDR_SAMR_QUERYDOMAININFO2, api_samr_QueryDomainInfo2},
+       {"SAMR_QUERYUSERINFO2", NDR_SAMR_QUERYUSERINFO2, api_samr_QueryUserInfo2},
+       {"SAMR_QUERYDISPLAYINFO2", NDR_SAMR_QUERYDISPLAYINFO2, api_samr_QueryDisplayInfo2},
+       {"SAMR_GETDISPLAYENUMERATIONINDEX2", NDR_SAMR_GETDISPLAYENUMERATIONINDEX2, api_samr_GetDisplayEnumerationIndex2},
+       {"SAMR_CREATEUSER2", NDR_SAMR_CREATEUSER2, api_samr_CreateUser2},
+       {"SAMR_QUERYDISPLAYINFO3", NDR_SAMR_QUERYDISPLAYINFO3, api_samr_QueryDisplayInfo3},
+       {"SAMR_ADDMULTIPLEMEMBERSTOALIAS", NDR_SAMR_ADDMULTIPLEMEMBERSTOALIAS, api_samr_AddMultipleMembersToAlias},
+       {"SAMR_REMOVEMULTIPLEMEMBERSFROMALIAS", NDR_SAMR_REMOVEMULTIPLEMEMBERSFROMALIAS, api_samr_RemoveMultipleMembersFromAlias},
+       {"SAMR_OEMCHANGEPASSWORDUSER2", NDR_SAMR_OEMCHANGEPASSWORDUSER2, api_samr_OemChangePasswordUser2},
+       {"SAMR_CHANGEPASSWORDUSER2", NDR_SAMR_CHANGEPASSWORDUSER2, api_samr_ChangePasswordUser2},
+       {"SAMR_GETDOMPWINFO", NDR_SAMR_GETDOMPWINFO, api_samr_GetDomPwInfo},
+       {"SAMR_CONNECT2", NDR_SAMR_CONNECT2, api_samr_Connect2},
+       {"SAMR_SETUSERINFO2", NDR_SAMR_SETUSERINFO2, api_samr_SetUserInfo2},
+       {"SAMR_SETBOOTKEYINFORMATION", NDR_SAMR_SETBOOTKEYINFORMATION, api_samr_SetBootKeyInformation},
+       {"SAMR_GETBOOTKEYINFORMATION", NDR_SAMR_GETBOOTKEYINFORMATION, api_samr_GetBootKeyInformation},
+       {"SAMR_CONNECT3", NDR_SAMR_CONNECT3, api_samr_Connect3},
+       {"SAMR_CONNECT4", NDR_SAMR_CONNECT4, api_samr_Connect4},
+       {"SAMR_CHANGEPASSWORDUSER3", NDR_SAMR_CHANGEPASSWORDUSER3, api_samr_ChangePasswordUser3},
+       {"SAMR_CONNECT5", NDR_SAMR_CONNECT5, api_samr_Connect5},
+       {"SAMR_RIDTOSID", NDR_SAMR_RIDTOSID, api_samr_RidToSid},
+       {"SAMR_SETDSRMPASSWORD", NDR_SAMR_SETDSRMPASSWORD, api_samr_SetDsrmPassword},
+       {"SAMR_VALIDATEPASSWORD", NDR_SAMR_VALIDATEPASSWORD, api_samr_ValidatePassword},
+};
+
+void samr_get_pipe_fns(struct api_struct **fns, int *n_fns)
+{
+       *fns = api_samr_cmds;
+       *n_fns = sizeof(api_samr_cmds) / sizeof(struct api_struct);
+}
+
+NTSTATUS rpc_samr_init(void)
+{
+       return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "samr", "samr", api_samr_cmds, sizeof(api_samr_cmds) / sizeof(struct api_struct));
+}
diff --git a/source/librpc/gen_ndr/srv_samr.h b/source/librpc/gen_ndr/srv_samr.h
new file mode 100644 (file)
index 0000000..7d5cdd7
--- /dev/null
@@ -0,0 +1,74 @@
+#include "librpc/gen_ndr/ndr_samr.h"
+#ifndef __SRV_SAMR__
+#define __SRV_SAMR__
+NTSTATUS _samr_Connect(pipes_struct *p, struct samr_Connect *r);
+NTSTATUS _samr_Close(pipes_struct *p, struct samr_Close *r);
+NTSTATUS _samr_SetSecurity(pipes_struct *p, struct samr_SetSecurity *r);
+NTSTATUS _samr_QuerySecurity(pipes_struct *p, struct samr_QuerySecurity *r);
+NTSTATUS _samr_Shutdown(pipes_struct *p, struct samr_Shutdown *r);
+NTSTATUS _samr_LookupDomain(pipes_struct *p, struct samr_LookupDomain *r);
+NTSTATUS _samr_EnumDomains(pipes_struct *p, struct samr_EnumDomains *r);
+NTSTATUS _samr_OpenDomain(pipes_struct *p, struct samr_OpenDomain *r);
+NTSTATUS _samr_QueryDomainInfo(pipes_struct *p, struct samr_QueryDomainInfo *r);
+NTSTATUS _samr_SetDomainInfo(pipes_struct *p, struct samr_SetDomainInfo *r);
+NTSTATUS _samr_CreateDomainGroup(pipes_struct *p, struct samr_CreateDomainGroup *r);
+NTSTATUS _samr_EnumDomainGroups(pipes_struct *p, struct samr_EnumDomainGroups *r);
+NTSTATUS _samr_CreateUser(pipes_struct *p, struct samr_CreateUser *r);
+NTSTATUS _samr_EnumDomainUsers(pipes_struct *p, struct samr_EnumDomainUsers *r);
+NTSTATUS _samr_CreateDomAlias(pipes_struct *p, struct samr_CreateDomAlias *r);
+NTSTATUS _samr_EnumDomainAliases(pipes_struct *p, struct samr_EnumDomainAliases *r);
+NTSTATUS _samr_GetAliasMembership(pipes_struct *p, struct samr_GetAliasMembership *r);
+NTSTATUS _samr_LookupNames(pipes_struct *p, struct samr_LookupNames *r);
+NTSTATUS _samr_LookupRids(pipes_struct *p, struct samr_LookupRids *r);
+NTSTATUS _samr_OpenGroup(pipes_struct *p, struct samr_OpenGroup *r);
+NTSTATUS _samr_QueryGroupInfo(pipes_struct *p, struct samr_QueryGroupInfo *r);
+NTSTATUS _samr_SetGroupInfo(pipes_struct *p, struct samr_SetGroupInfo *r);
+NTSTATUS _samr_AddGroupMember(pipes_struct *p, struct samr_AddGroupMember *r);
+NTSTATUS _samr_DeleteDomainGroup(pipes_struct *p, struct samr_DeleteDomainGroup *r);
+NTSTATUS _samr_DeleteGroupMember(pipes_struct *p, struct samr_DeleteGroupMember *r);
+NTSTATUS _samr_QueryGroupMember(pipes_struct *p, struct samr_QueryGroupMember *r);
+NTSTATUS _samr_SetMemberAttributesOfGroup(pipes_struct *p, struct samr_SetMemberAttributesOfGroup *r);
+NTSTATUS _samr_OpenAlias(pipes_struct *p, struct samr_OpenAlias *r);
+NTSTATUS _samr_QueryAliasInfo(pipes_struct *p, struct samr_QueryAliasInfo *r);
+NTSTATUS _samr_SetAliasInfo(pipes_struct *p, struct samr_SetAliasInfo *r);
+NTSTATUS _samr_DeleteDomAlias(pipes_struct *p, struct samr_DeleteDomAlias *r);
+NTSTATUS _samr_AddAliasMember(pipes_struct *p, struct samr_AddAliasMember *r);
+NTSTATUS _samr_DeleteAliasMember(pipes_struct *p, struct samr_DeleteAliasMember *r);
+NTSTATUS _samr_GetMembersInAlias(pipes_struct *p, struct samr_GetMembersInAlias *r);
+NTSTATUS _samr_OpenUser(pipes_struct *p, struct samr_OpenUser *r);
+NTSTATUS _samr_DeleteUser(pipes_struct *p, struct samr_DeleteUser *r);
+NTSTATUS _samr_QueryUserInfo(pipes_struct *p, struct samr_QueryUserInfo *r);
+NTSTATUS _samr_SetUserInfo(pipes_struct *p, struct samr_SetUserInfo *r);
+NTSTATUS _samr_ChangePasswordUser(pipes_struct *p, struct samr_ChangePasswordUser *r);
+NTSTATUS _samr_GetGroupsForUser(pipes_struct *p, struct samr_GetGroupsForUser *r);
+NTSTATUS _samr_QueryDisplayInfo(pipes_struct *p, struct samr_QueryDisplayInfo *r);
+NTSTATUS _samr_GetDisplayEnumerationIndex(pipes_struct *p, struct samr_GetDisplayEnumerationIndex *r);
+NTSTATUS _samr_TestPrivateFunctionsDomain(pipes_struct *p, struct samr_TestPrivateFunctionsDomain *r);
+NTSTATUS _samr_TestPrivateFunctionsUser(pipes_struct *p, struct samr_TestPrivateFunctionsUser *r);
+NTSTATUS _samr_GetUserPwInfo(pipes_struct *p, struct samr_GetUserPwInfo *r);
+NTSTATUS _samr_RemoveMemberFromForeignDomain(pipes_struct *p, struct samr_RemoveMemberFromForeignDomain *r);
+NTSTATUS _samr_QueryDomainInfo2(pipes_struct *p, struct samr_QueryDomainInfo2 *r);
+NTSTATUS _samr_QueryUserInfo2(pipes_struct *p, struct samr_QueryUserInfo2 *r);
+NTSTATUS _samr_QueryDisplayInfo2(pipes_struct *p, struct samr_QueryDisplayInfo2 *r);
+NTSTATUS _samr_GetDisplayEnumerationIndex2(pipes_struct *p, struct samr_GetDisplayEnumerationIndex2 *r);
+NTSTATUS _samr_CreateUser2(pipes_struct *p, struct samr_CreateUser2 *r);
+NTSTATUS _samr_QueryDisplayInfo3(pipes_struct *p, struct samr_QueryDisplayInfo3 *r);
+NTSTATUS _samr_AddMultipleMembersToAlias(pipes_struct *p, struct samr_AddMultipleMembersToAlias *r);
+NTSTATUS _samr_RemoveMultipleMembersFromAlias(pipes_struct *p, struct samr_RemoveMultipleMembersFromAlias *r);
+NTSTATUS _samr_OemChangePasswordUser2(pipes_struct *p, struct samr_OemChangePasswordUser2 *r);
+NTSTATUS _samr_ChangePasswordUser2(pipes_struct *p, struct samr_ChangePasswordUser2 *r);
+NTSTATUS _samr_GetDomPwInfo(pipes_struct *p, struct samr_GetDomPwInfo *r);
+NTSTATUS _samr_Connect2(pipes_struct *p, struct samr_Connect2 *r);
+NTSTATUS _samr_SetUserInfo2(pipes_struct *p, struct samr_SetUserInfo2 *r);
+NTSTATUS _samr_SetBootKeyInformation(pipes_struct *p, struct samr_SetBootKeyInformation *r);
+NTSTATUS _samr_GetBootKeyInformation(pipes_struct *p, struct samr_GetBootKeyInformation *r);
+NTSTATUS _samr_Connect3(pipes_struct *p, struct samr_Connect3 *r);
+NTSTATUS _samr_Connect4(pipes_struct *p, struct samr_Connect4 *r);
+NTSTATUS _samr_ChangePasswordUser3(pipes_struct *p, struct samr_ChangePasswordUser3 *r);
+NTSTATUS _samr_Connect5(pipes_struct *p, struct samr_Connect5 *r);
+NTSTATUS _samr_RidToSid(pipes_struct *p, struct samr_RidToSid *r);
+NTSTATUS _samr_SetDsrmPassword(pipes_struct *p, struct samr_SetDsrmPassword *r);
+NTSTATUS _samr_ValidatePassword(pipes_struct *p, struct samr_ValidatePassword *r);
+void samr_get_pipe_fns(struct api_struct **fns, int *n_fns);
+NTSTATUS rpc_samr_init(void);
+#endif /* __SRV_SAMR__ */
index 88a3f272c78d945fa4e2196f6c4831ff6a9d3834..44fe358a84593ecf38526ca00cd1a2885b1dd33a 100644 (file)
@@ -14,77 +14,79 @@ static bool api_srvsvc_NetCharDevEnum(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct srvsvc_NetCharDevEnum *r;
-       
+
        call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETCHARDEVENUM];
-       
+
        r = talloc(NULL, struct srvsvc_NetCharDevEnum);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetCharDevEnum, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.level = r->in.level;
        r->out.ctr = r->in.ctr;
        r->out.totalentries = talloc_zero(r, uint32_t);
        if (r->out.totalentries == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.resume_handle = r->in.resume_handle;
        r->out.result = _srvsvc_NetCharDevEnum(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetCharDevEnum, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_srvsvc_NetCharDevGetInfo(pipes_struct *p)
@@ -95,74 +97,76 @@ static bool api_srvsvc_NetCharDevGetInfo(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct srvsvc_NetCharDevGetInfo *r;
-       
+
        call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETCHARDEVGETINFO];
-       
+
        r = talloc(NULL, struct srvsvc_NetCharDevGetInfo);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetCharDevGetInfo, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.info = talloc_zero(r, union srvsvc_NetCharDevInfo);
        if (r->out.info == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _srvsvc_NetCharDevGetInfo(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetCharDevGetInfo, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_srvsvc_NetCharDevControl(pipes_struct *p)
@@ -173,67 +177,69 @@ static bool api_srvsvc_NetCharDevControl(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct srvsvc_NetCharDevControl *r;
-       
+
        call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETCHARDEVCONTROL];
-       
+
        r = talloc(NULL, struct srvsvc_NetCharDevControl);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetCharDevControl, r);
-       
+       }
+
        r->out.result = _srvsvc_NetCharDevControl(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetCharDevControl, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_srvsvc_NetCharDevQEnum(pipes_struct *p)
@@ -244,77 +250,79 @@ static bool api_srvsvc_NetCharDevQEnum(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct srvsvc_NetCharDevQEnum *r;
-       
+
        call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETCHARDEVQENUM];
-       
+
        r = talloc(NULL, struct srvsvc_NetCharDevQEnum);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetCharDevQEnum, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.level = r->in.level;
        r->out.ctr = r->in.ctr;
        r->out.totalentries = talloc_zero(r, uint32_t);
        if (r->out.totalentries == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.resume_handle = r->in.resume_handle;
        r->out.result = _srvsvc_NetCharDevQEnum(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetCharDevQEnum, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_srvsvc_NetCharDevQGetInfo(pipes_struct *p)
@@ -325,74 +333,76 @@ static bool api_srvsvc_NetCharDevQGetInfo(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct srvsvc_NetCharDevQGetInfo *r;
-       
+
        call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETCHARDEVQGETINFO];
-       
+
        r = talloc(NULL, struct srvsvc_NetCharDevQGetInfo);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetCharDevQGetInfo, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.info = talloc_zero(r, union srvsvc_NetCharDevQInfo);
        if (r->out.info == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _srvsvc_NetCharDevQGetInfo(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetCharDevQGetInfo, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_srvsvc_NetCharDevQSetInfo(pipes_struct *p)
@@ -403,69 +413,71 @@ static bool api_srvsvc_NetCharDevQSetInfo(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct srvsvc_NetCharDevQSetInfo *r;
-       
+
        call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETCHARDEVQSETINFO];
-       
+
        r = talloc(NULL, struct srvsvc_NetCharDevQSetInfo);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetCharDevQSetInfo, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.parm_error = r->in.parm_error;
        r->out.result = _srvsvc_NetCharDevQSetInfo(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetCharDevQSetInfo, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_srvsvc_NetCharDevQPurge(pipes_struct *p)
@@ -476,67 +488,69 @@ static bool api_srvsvc_NetCharDevQPurge(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct srvsvc_NetCharDevQPurge *r;
-       
+
        call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETCHARDEVQPURGE];
-       
+
        r = talloc(NULL, struct srvsvc_NetCharDevQPurge);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetCharDevQPurge, r);
-       
+       }
+
        r->out.result = _srvsvc_NetCharDevQPurge(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetCharDevQPurge, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_srvsvc_NetCharDevQPurgeSelf(pipes_struct *p)
@@ -547,67 +561,69 @@ static bool api_srvsvc_NetCharDevQPurgeSelf(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct srvsvc_NetCharDevQPurgeSelf *r;
-       
+
        call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETCHARDEVQPURGESELF];
-       
+
        r = talloc(NULL, struct srvsvc_NetCharDevQPurgeSelf);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetCharDevQPurgeSelf, r);
-       
+       }
+
        r->out.result = _srvsvc_NetCharDevQPurgeSelf(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetCharDevQPurgeSelf, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_srvsvc_NetConnEnum(pipes_struct *p)
@@ -618,77 +634,79 @@ static bool api_srvsvc_NetConnEnum(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct srvsvc_NetConnEnum *r;
-       
+
        call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETCONNENUM];
-       
+
        r = talloc(NULL, struct srvsvc_NetConnEnum);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetConnEnum, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.level = r->in.level;
        r->out.ctr = r->in.ctr;
        r->out.totalentries = talloc_zero(r, uint32_t);
        if (r->out.totalentries == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.resume_handle = r->in.resume_handle;
        r->out.result = _srvsvc_NetConnEnum(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetConnEnum, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_srvsvc_NetFileEnum(pipes_struct *p)
@@ -699,77 +717,79 @@ static bool api_srvsvc_NetFileEnum(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct srvsvc_NetFileEnum *r;
-       
+
        call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETFILEENUM];
-       
+
        r = talloc(NULL, struct srvsvc_NetFileEnum);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetFileEnum, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.level = r->in.level;
        r->out.ctr = r->in.ctr;
        r->out.totalentries = talloc_zero(r, uint32_t);
        if (r->out.totalentries == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.resume_handle = r->in.resume_handle;
        r->out.result = _srvsvc_NetFileEnum(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetFileEnum, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_srvsvc_NetFileGetInfo(pipes_struct *p)
@@ -780,74 +800,76 @@ static bool api_srvsvc_NetFileGetInfo(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct srvsvc_NetFileGetInfo *r;
-       
+
        call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETFILEGETINFO];
-       
+
        r = talloc(NULL, struct srvsvc_NetFileGetInfo);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetFileGetInfo, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.info = talloc_zero(r, union srvsvc_NetFileInfo);
        if (r->out.info == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _srvsvc_NetFileGetInfo(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetFileGetInfo, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_srvsvc_NetFileClose(pipes_struct *p)
@@ -858,67 +880,69 @@ static bool api_srvsvc_NetFileClose(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct srvsvc_NetFileClose *r;
-       
+
        call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETFILECLOSE];
-       
+
        r = talloc(NULL, struct srvsvc_NetFileClose);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetFileClose, r);
-       
+       }
+
        r->out.result = _srvsvc_NetFileClose(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetFileClose, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_srvsvc_NetSessEnum(pipes_struct *p)
@@ -929,77 +953,79 @@ static bool api_srvsvc_NetSessEnum(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct srvsvc_NetSessEnum *r;
-       
+
        call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETSESSENUM];
-       
+
        r = talloc(NULL, struct srvsvc_NetSessEnum);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetSessEnum, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.level = r->in.level;
        r->out.ctr = r->in.ctr;
        r->out.totalentries = talloc_zero(r, uint32_t);
        if (r->out.totalentries == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.resume_handle = r->in.resume_handle;
        r->out.result = _srvsvc_NetSessEnum(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetSessEnum, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_srvsvc_NetSessDel(pipes_struct *p)
@@ -1010,67 +1036,69 @@ static bool api_srvsvc_NetSessDel(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct srvsvc_NetSessDel *r;
-       
+
        call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETSESSDEL];
-       
+
        r = talloc(NULL, struct srvsvc_NetSessDel);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetSessDel, r);
-       
+       }
+
        r->out.result = _srvsvc_NetSessDel(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetSessDel, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_srvsvc_NetShareAdd(pipes_struct *p)
@@ -1081,69 +1109,71 @@ static bool api_srvsvc_NetShareAdd(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct srvsvc_NetShareAdd *r;
-       
+
        call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETSHAREADD];
-       
+
        r = talloc(NULL, struct srvsvc_NetShareAdd);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetShareAdd, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.parm_error = r->in.parm_error;
        r->out.result = _srvsvc_NetShareAdd(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetShareAdd, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_srvsvc_NetShareEnumAll(pipes_struct *p)
@@ -1154,77 +1184,79 @@ static bool api_srvsvc_NetShareEnumAll(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct srvsvc_NetShareEnumAll *r;
-       
+
        call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETSHAREENUMALL];
-       
+
        r = talloc(NULL, struct srvsvc_NetShareEnumAll);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetShareEnumAll, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.level = r->in.level;
        r->out.ctr = r->in.ctr;
        r->out.totalentries = talloc_zero(r, uint32_t);
        if (r->out.totalentries == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.resume_handle = r->in.resume_handle;
        r->out.result = _srvsvc_NetShareEnumAll(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetShareEnumAll, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_srvsvc_NetShareGetInfo(pipes_struct *p)
@@ -1235,74 +1267,76 @@ static bool api_srvsvc_NetShareGetInfo(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct srvsvc_NetShareGetInfo *r;
-       
+
        call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETSHAREGETINFO];
-       
+
        r = talloc(NULL, struct srvsvc_NetShareGetInfo);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetShareGetInfo, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.info = talloc_zero(r, union srvsvc_NetShareInfo);
        if (r->out.info == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _srvsvc_NetShareGetInfo(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetShareGetInfo, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_srvsvc_NetShareSetInfo(pipes_struct *p)
@@ -1313,69 +1347,71 @@ static bool api_srvsvc_NetShareSetInfo(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct srvsvc_NetShareSetInfo *r;
-       
+
        call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETSHARESETINFO];
-       
+
        r = talloc(NULL, struct srvsvc_NetShareSetInfo);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetShareSetInfo, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.parm_error = r->in.parm_error;
        r->out.result = _srvsvc_NetShareSetInfo(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetShareSetInfo, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_srvsvc_NetShareDel(pipes_struct *p)
@@ -1386,67 +1422,69 @@ static bool api_srvsvc_NetShareDel(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct srvsvc_NetShareDel *r;
-       
+
        call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETSHAREDEL];
-       
+
        r = talloc(NULL, struct srvsvc_NetShareDel);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetShareDel, r);
-       
+       }
+
        r->out.result = _srvsvc_NetShareDel(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetShareDel, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_srvsvc_NetShareDelSticky(pipes_struct *p)
@@ -1457,67 +1495,69 @@ static bool api_srvsvc_NetShareDelSticky(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct srvsvc_NetShareDelSticky *r;
-       
+
        call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETSHAREDELSTICKY];
-       
+
        r = talloc(NULL, struct srvsvc_NetShareDelSticky);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetShareDelSticky, r);
-       
+       }
+
        r->out.result = _srvsvc_NetShareDelSticky(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetShareDelSticky, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_srvsvc_NetShareCheck(pipes_struct *p)
@@ -1528,74 +1568,76 @@ static bool api_srvsvc_NetShareCheck(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct srvsvc_NetShareCheck *r;
-       
+
        call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETSHARECHECK];
-       
+
        r = talloc(NULL, struct srvsvc_NetShareCheck);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetShareCheck, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.type = talloc_zero(r, enum srvsvc_ShareType);
        if (r->out.type == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _srvsvc_NetShareCheck(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetShareCheck, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_srvsvc_NetSrvGetInfo(pipes_struct *p)
@@ -1606,74 +1648,76 @@ static bool api_srvsvc_NetSrvGetInfo(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct srvsvc_NetSrvGetInfo *r;
-       
+
        call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETSRVGETINFO];
-       
+
        r = talloc(NULL, struct srvsvc_NetSrvGetInfo);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetSrvGetInfo, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.info = talloc_zero(r, union srvsvc_NetSrvInfo);
        if (r->out.info == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _srvsvc_NetSrvGetInfo(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetSrvGetInfo, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_srvsvc_NetSrvSetInfo(pipes_struct *p)
@@ -1684,69 +1728,71 @@ static bool api_srvsvc_NetSrvSetInfo(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct srvsvc_NetSrvSetInfo *r;
-       
+
        call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETSRVSETINFO];
-       
+
        r = talloc(NULL, struct srvsvc_NetSrvSetInfo);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetSrvSetInfo, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.parm_error = r->in.parm_error;
        r->out.result = _srvsvc_NetSrvSetInfo(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetSrvSetInfo, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_srvsvc_NetDiskEnum(pipes_struct *p)
@@ -1757,76 +1803,78 @@ static bool api_srvsvc_NetDiskEnum(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct srvsvc_NetDiskEnum *r;
-       
+
        call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETDISKENUM];
-       
+
        r = talloc(NULL, struct srvsvc_NetDiskEnum);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetDiskEnum, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.info = r->in.info;
        r->out.totalentries = talloc_zero(r, uint32_t);
        if (r->out.totalentries == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.resume_handle = r->in.resume_handle;
        r->out.result = _srvsvc_NetDiskEnum(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetDiskEnum, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_srvsvc_NetServerStatisticsGet(pipes_struct *p)
@@ -1837,74 +1885,76 @@ static bool api_srvsvc_NetServerStatisticsGet(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct srvsvc_NetServerStatisticsGet *r;
-       
+
        call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETSERVERSTATISTICSGET];
-       
+
        r = talloc(NULL, struct srvsvc_NetServerStatisticsGet);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetServerStatisticsGet, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.stats = talloc_zero(r, struct srvsvc_Statistics);
        if (r->out.stats == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _srvsvc_NetServerStatisticsGet(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetServerStatisticsGet, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_srvsvc_NetTransportAdd(pipes_struct *p)
@@ -1915,67 +1965,69 @@ static bool api_srvsvc_NetTransportAdd(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct srvsvc_NetTransportAdd *r;
-       
+
        call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETTRANSPORTADD];
-       
+
        r = talloc(NULL, struct srvsvc_NetTransportAdd);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetTransportAdd, r);
-       
+       }
+
        r->out.result = _srvsvc_NetTransportAdd(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetTransportAdd, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_srvsvc_NetTransportEnum(pipes_struct *p)
@@ -1986,77 +2038,79 @@ static bool api_srvsvc_NetTransportEnum(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct srvsvc_NetTransportEnum *r;
-       
+
        call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETTRANSPORTENUM];
-       
+
        r = talloc(NULL, struct srvsvc_NetTransportEnum);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetTransportEnum, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.level = r->in.level;
        r->out.transports = r->in.transports;
        r->out.totalentries = talloc_zero(r, uint32_t);
        if (r->out.totalentries == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.resume_handle = r->in.resume_handle;
        r->out.result = _srvsvc_NetTransportEnum(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetTransportEnum, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_srvsvc_NetTransportDel(pipes_struct *p)
@@ -2067,67 +2121,69 @@ static bool api_srvsvc_NetTransportDel(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct srvsvc_NetTransportDel *r;
-       
+
        call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETTRANSPORTDEL];
-       
+
        r = talloc(NULL, struct srvsvc_NetTransportDel);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetTransportDel, r);
-       
+       }
+
        r->out.result = _srvsvc_NetTransportDel(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetTransportDel, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_srvsvc_NetRemoteTOD(pipes_struct *p)
@@ -2138,74 +2194,76 @@ static bool api_srvsvc_NetRemoteTOD(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct srvsvc_NetRemoteTOD *r;
-       
+
        call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETREMOTETOD];
-       
+
        r = talloc(NULL, struct srvsvc_NetRemoteTOD);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetRemoteTOD, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.info = talloc_zero(r, struct srvsvc_NetRemoteTODInfo);
        if (r->out.info == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _srvsvc_NetRemoteTOD(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetRemoteTOD, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_srvsvc_NetSetServiceBits(pipes_struct *p)
@@ -2216,67 +2274,69 @@ static bool api_srvsvc_NetSetServiceBits(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct srvsvc_NetSetServiceBits *r;
-       
+
        call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETSETSERVICEBITS];
-       
+
        r = talloc(NULL, struct srvsvc_NetSetServiceBits);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetSetServiceBits, r);
-       
+       }
+
        r->out.result = _srvsvc_NetSetServiceBits(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetSetServiceBits, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_srvsvc_NetPathType(pipes_struct *p)
@@ -2287,74 +2347,76 @@ static bool api_srvsvc_NetPathType(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct srvsvc_NetPathType *r;
-       
+
        call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETPATHTYPE];
-       
+
        r = talloc(NULL, struct srvsvc_NetPathType);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetPathType, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.pathtype = talloc_zero(r, uint32_t);
        if (r->out.pathtype == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _srvsvc_NetPathType(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetPathType, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_srvsvc_NetPathCanonicalize(pipes_struct *p)
@@ -2365,75 +2427,77 @@ static bool api_srvsvc_NetPathCanonicalize(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct srvsvc_NetPathCanonicalize *r;
-       
+
        call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETPATHCANONICALIZE];
-       
+
        r = talloc(NULL, struct srvsvc_NetPathCanonicalize);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetPathCanonicalize, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.can_path = talloc_zero_array(r, uint8_t, r->in.maxbuf);
        if (r->out.can_path == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.pathtype = r->in.pathtype;
        r->out.result = _srvsvc_NetPathCanonicalize(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetPathCanonicalize, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_srvsvc_NetPathCompare(pipes_struct *p)
@@ -2444,67 +2508,69 @@ static bool api_srvsvc_NetPathCompare(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct srvsvc_NetPathCompare *r;
-       
+
        call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETPATHCOMPARE];
-       
+
        r = talloc(NULL, struct srvsvc_NetPathCompare);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetPathCompare, r);
-       
+       }
+
        r->out.result = _srvsvc_NetPathCompare(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetPathCompare, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_srvsvc_NetNameValidate(pipes_struct *p)
@@ -2515,67 +2581,69 @@ static bool api_srvsvc_NetNameValidate(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct srvsvc_NetNameValidate *r;
-       
+
        call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETNAMEVALIDATE];
-       
+
        r = talloc(NULL, struct srvsvc_NetNameValidate);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetNameValidate, r);
-       
+       }
+
        r->out.result = _srvsvc_NetNameValidate(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetNameValidate, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_srvsvc_NETRPRNAMECANONICALIZE(pipes_struct *p)
@@ -2586,67 +2654,69 @@ static bool api_srvsvc_NETRPRNAMECANONICALIZE(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct srvsvc_NETRPRNAMECANONICALIZE *r;
-       
+
        call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETRPRNAMECANONICALIZE];
-       
+
        r = talloc(NULL, struct srvsvc_NETRPRNAMECANONICALIZE);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NETRPRNAMECANONICALIZE, r);
-       
+       }
+
        r->out.result = _srvsvc_NETRPRNAMECANONICALIZE(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NETRPRNAMECANONICALIZE, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_srvsvc_NetPRNameCompare(pipes_struct *p)
@@ -2657,67 +2727,69 @@ static bool api_srvsvc_NetPRNameCompare(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct srvsvc_NetPRNameCompare *r;
-       
+
        call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETPRNAMECOMPARE];
-       
+
        r = talloc(NULL, struct srvsvc_NetPRNameCompare);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetPRNameCompare, r);
-       
+       }
+
        r->out.result = _srvsvc_NetPRNameCompare(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetPRNameCompare, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_srvsvc_NetShareEnum(pipes_struct *p)
@@ -2728,77 +2800,79 @@ static bool api_srvsvc_NetShareEnum(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct srvsvc_NetShareEnum *r;
-       
+
        call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETSHAREENUM];
-       
+
        r = talloc(NULL, struct srvsvc_NetShareEnum);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetShareEnum, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.level = r->in.level;
        r->out.ctr = r->in.ctr;
        r->out.totalentries = talloc_zero(r, uint32_t);
        if (r->out.totalentries == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.resume_handle = r->in.resume_handle;
        r->out.result = _srvsvc_NetShareEnum(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetShareEnum, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_srvsvc_NetShareDelStart(pipes_struct *p)
@@ -2809,74 +2883,76 @@ static bool api_srvsvc_NetShareDelStart(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct srvsvc_NetShareDelStart *r;
-       
+
        call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETSHAREDELSTART];
-       
+
        r = talloc(NULL, struct srvsvc_NetShareDelStart);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetShareDelStart, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.hnd = talloc_zero(r, struct policy_handle);
        if (r->out.hnd == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _srvsvc_NetShareDelStart(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetShareDelStart, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_srvsvc_NetShareDelCommit(pipes_struct *p)
@@ -2887,69 +2963,71 @@ static bool api_srvsvc_NetShareDelCommit(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct srvsvc_NetShareDelCommit *r;
-       
+
        call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETSHAREDELCOMMIT];
-       
+
        r = talloc(NULL, struct srvsvc_NetShareDelCommit);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetShareDelCommit, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.hnd = r->in.hnd;
        r->out.result = _srvsvc_NetShareDelCommit(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetShareDelCommit, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_srvsvc_NetGetFileSecurity(pipes_struct *p)
@@ -2960,74 +3038,76 @@ static bool api_srvsvc_NetGetFileSecurity(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct srvsvc_NetGetFileSecurity *r;
-       
+
        call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETGETFILESECURITY];
-       
+
        r = talloc(NULL, struct srvsvc_NetGetFileSecurity);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetGetFileSecurity, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.sd_buf = talloc_zero(r, struct sec_desc_buf);
        if (r->out.sd_buf == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _srvsvc_NetGetFileSecurity(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetGetFileSecurity, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_srvsvc_NetSetFileSecurity(pipes_struct *p)
@@ -3038,67 +3118,69 @@ static bool api_srvsvc_NetSetFileSecurity(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct srvsvc_NetSetFileSecurity *r;
-       
+
        call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETSETFILESECURITY];
-       
+
        r = talloc(NULL, struct srvsvc_NetSetFileSecurity);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetSetFileSecurity, r);
-       
+       }
+
        r->out.result = _srvsvc_NetSetFileSecurity(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetSetFileSecurity, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_srvsvc_NetServerTransportAddEx(pipes_struct *p)
@@ -3109,67 +3191,69 @@ static bool api_srvsvc_NetServerTransportAddEx(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct srvsvc_NetServerTransportAddEx *r;
-       
+
        call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETSERVERTRANSPORTADDEX];
-       
+
        r = talloc(NULL, struct srvsvc_NetServerTransportAddEx);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetServerTransportAddEx, r);
-       
+       }
+
        r->out.result = _srvsvc_NetServerTransportAddEx(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetServerTransportAddEx, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_srvsvc_NetServerSetServiceBitsEx(pipes_struct *p)
@@ -3180,67 +3264,69 @@ static bool api_srvsvc_NetServerSetServiceBitsEx(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct srvsvc_NetServerSetServiceBitsEx *r;
-       
+
        call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETSERVERSETSERVICEBITSEX];
-       
+
        r = talloc(NULL, struct srvsvc_NetServerSetServiceBitsEx);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NetServerSetServiceBitsEx, r);
-       
+       }
+
        r->out.result = _srvsvc_NetServerSetServiceBitsEx(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NetServerSetServiceBitsEx, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_srvsvc_NETRDFSGETVERSION(pipes_struct *p)
@@ -3251,67 +3337,69 @@ static bool api_srvsvc_NETRDFSGETVERSION(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct srvsvc_NETRDFSGETVERSION *r;
-       
+
        call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETRDFSGETVERSION];
-       
+
        r = talloc(NULL, struct srvsvc_NETRDFSGETVERSION);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NETRDFSGETVERSION, r);
-       
+       }
+
        r->out.result = _srvsvc_NETRDFSGETVERSION(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSGETVERSION, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_srvsvc_NETRDFSCREATELOCALPARTITION(pipes_struct *p)
@@ -3322,67 +3410,69 @@ static bool api_srvsvc_NETRDFSCREATELOCALPARTITION(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct srvsvc_NETRDFSCREATELOCALPARTITION *r;
-       
+
        call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETRDFSCREATELOCALPARTITION];
-       
+
        r = talloc(NULL, struct srvsvc_NETRDFSCREATELOCALPARTITION);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NETRDFSCREATELOCALPARTITION, r);
-       
+       }
+
        r->out.result = _srvsvc_NETRDFSCREATELOCALPARTITION(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSCREATELOCALPARTITION, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_srvsvc_NETRDFSDELETELOCALPARTITION(pipes_struct *p)
@@ -3393,67 +3483,69 @@ static bool api_srvsvc_NETRDFSDELETELOCALPARTITION(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct srvsvc_NETRDFSDELETELOCALPARTITION *r;
-       
+
        call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETRDFSDELETELOCALPARTITION];
-       
+
        r = talloc(NULL, struct srvsvc_NETRDFSDELETELOCALPARTITION);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NETRDFSDELETELOCALPARTITION, r);
-       
+       }
+
        r->out.result = _srvsvc_NETRDFSDELETELOCALPARTITION(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSDELETELOCALPARTITION, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_srvsvc_NETRDFSSETLOCALVOLUMESTATE(pipes_struct *p)
@@ -3464,67 +3556,69 @@ static bool api_srvsvc_NETRDFSSETLOCALVOLUMESTATE(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct srvsvc_NETRDFSSETLOCALVOLUMESTATE *r;
-       
+
        call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETRDFSSETLOCALVOLUMESTATE];
-       
+
        r = talloc(NULL, struct srvsvc_NETRDFSSETLOCALVOLUMESTATE);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NETRDFSSETLOCALVOLUMESTATE, r);
-       
+       }
+
        r->out.result = _srvsvc_NETRDFSSETLOCALVOLUMESTATE(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSSETLOCALVOLUMESTATE, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_srvsvc_NETRDFSSETSERVERINFO(pipes_struct *p)
@@ -3535,67 +3629,69 @@ static bool api_srvsvc_NETRDFSSETSERVERINFO(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct srvsvc_NETRDFSSETSERVERINFO *r;
-       
+
        call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETRDFSSETSERVERINFO];
-       
+
        r = talloc(NULL, struct srvsvc_NETRDFSSETSERVERINFO);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NETRDFSSETSERVERINFO, r);
-       
+       }
+
        r->out.result = _srvsvc_NETRDFSSETSERVERINFO(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSSETSERVERINFO, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_srvsvc_NETRDFSCREATEEXITPOINT(pipes_struct *p)
@@ -3606,67 +3702,69 @@ static bool api_srvsvc_NETRDFSCREATEEXITPOINT(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct srvsvc_NETRDFSCREATEEXITPOINT *r;
-       
+
        call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETRDFSCREATEEXITPOINT];
-       
+
        r = talloc(NULL, struct srvsvc_NETRDFSCREATEEXITPOINT);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NETRDFSCREATEEXITPOINT, r);
-       
+       }
+
        r->out.result = _srvsvc_NETRDFSCREATEEXITPOINT(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSCREATEEXITPOINT, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_srvsvc_NETRDFSDELETEEXITPOINT(pipes_struct *p)
@@ -3677,67 +3775,69 @@ static bool api_srvsvc_NETRDFSDELETEEXITPOINT(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct srvsvc_NETRDFSDELETEEXITPOINT *r;
-       
+
        call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETRDFSDELETEEXITPOINT];
-       
+
        r = talloc(NULL, struct srvsvc_NETRDFSDELETEEXITPOINT);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NETRDFSDELETEEXITPOINT, r);
-       
+       }
+
        r->out.result = _srvsvc_NETRDFSDELETEEXITPOINT(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSDELETEEXITPOINT, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_srvsvc_NETRDFSMODIFYPREFIX(pipes_struct *p)
@@ -3748,67 +3848,69 @@ static bool api_srvsvc_NETRDFSMODIFYPREFIX(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct srvsvc_NETRDFSMODIFYPREFIX *r;
-       
+
        call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETRDFSMODIFYPREFIX];
-       
+
        r = talloc(NULL, struct srvsvc_NETRDFSMODIFYPREFIX);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NETRDFSMODIFYPREFIX, r);
-       
+       }
+
        r->out.result = _srvsvc_NETRDFSMODIFYPREFIX(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSMODIFYPREFIX, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_srvsvc_NETRDFSFIXLOCALVOLUME(pipes_struct *p)
@@ -3819,67 +3921,69 @@ static bool api_srvsvc_NETRDFSFIXLOCALVOLUME(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct srvsvc_NETRDFSFIXLOCALVOLUME *r;
-       
+
        call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETRDFSFIXLOCALVOLUME];
-       
+
        r = talloc(NULL, struct srvsvc_NETRDFSFIXLOCALVOLUME);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NETRDFSFIXLOCALVOLUME, r);
-       
+       }
+
        r->out.result = _srvsvc_NETRDFSFIXLOCALVOLUME(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSFIXLOCALVOLUME, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_srvsvc_NETRDFSMANAGERREPORTSITEINFO(pipes_struct *p)
@@ -3890,67 +3994,69 @@ static bool api_srvsvc_NETRDFSMANAGERREPORTSITEINFO(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct srvsvc_NETRDFSMANAGERREPORTSITEINFO *r;
-       
+
        call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETRDFSMANAGERREPORTSITEINFO];
-       
+
        r = talloc(NULL, struct srvsvc_NETRDFSMANAGERREPORTSITEINFO);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NETRDFSMANAGERREPORTSITEINFO, r);
-       
+       }
+
        r->out.result = _srvsvc_NETRDFSMANAGERREPORTSITEINFO(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSMANAGERREPORTSITEINFO, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_srvsvc_NETRSERVERTRANSPORTDELEX(pipes_struct *p)
@@ -3961,67 +4067,69 @@ static bool api_srvsvc_NETRSERVERTRANSPORTDELEX(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct srvsvc_NETRSERVERTRANSPORTDELEX *r;
-       
+
        call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETRSERVERTRANSPORTDELEX];
-       
+
        r = talloc(NULL, struct srvsvc_NETRSERVERTRANSPORTDELEX);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(srvsvc_NETRSERVERTRANSPORTDELEX, r);
-       
+       }
+
        r->out.result = _srvsvc_NETRSERVERTRANSPORTDELEX(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(srvsvc_NETRSERVERTRANSPORTDELEX, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 
index 1d4719858ddfc9a88a573cf788fd96d8d6a1152b..4a0a2591abbe919efd9dba62189fd1a3f2948d61 100644 (file)
@@ -14,69 +14,71 @@ static bool api_svcctl_CloseServiceHandle(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct svcctl_CloseServiceHandle *r;
-       
+
        call = &ndr_table_svcctl.calls[NDR_SVCCTL_CLOSESERVICEHANDLE];
-       
+
        r = talloc(NULL, struct svcctl_CloseServiceHandle);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_CloseServiceHandle, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.handle = r->in.handle;
        r->out.result = _svcctl_CloseServiceHandle(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_CloseServiceHandle, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_svcctl_ControlService(pipes_struct *p)
@@ -87,74 +89,76 @@ static bool api_svcctl_ControlService(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct svcctl_ControlService *r;
-       
+
        call = &ndr_table_svcctl.calls[NDR_SVCCTL_CONTROLSERVICE];
-       
+
        r = talloc(NULL, struct svcctl_ControlService);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_ControlService, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.service_status = talloc_zero(r, struct SERVICE_STATUS);
        if (r->out.service_status == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _svcctl_ControlService(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_ControlService, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_svcctl_DeleteService(pipes_struct *p)
@@ -165,67 +169,69 @@ static bool api_svcctl_DeleteService(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct svcctl_DeleteService *r;
-       
+
        call = &ndr_table_svcctl.calls[NDR_SVCCTL_DELETESERVICE];
-       
+
        r = talloc(NULL, struct svcctl_DeleteService);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_DeleteService, r);
-       
+       }
+
        r->out.result = _svcctl_DeleteService(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_DeleteService, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_svcctl_LockServiceDatabase(pipes_struct *p)
@@ -236,74 +242,76 @@ static bool api_svcctl_LockServiceDatabase(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct svcctl_LockServiceDatabase *r;
-       
+
        call = &ndr_table_svcctl.calls[NDR_SVCCTL_LOCKSERVICEDATABASE];
-       
+
        r = talloc(NULL, struct svcctl_LockServiceDatabase);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_LockServiceDatabase, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.lock = talloc_zero(r, struct policy_handle);
        if (r->out.lock == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _svcctl_LockServiceDatabase(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_LockServiceDatabase, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_svcctl_QueryServiceObjectSecurity(pipes_struct *p)
@@ -314,67 +322,69 @@ static bool api_svcctl_QueryServiceObjectSecurity(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct svcctl_QueryServiceObjectSecurity *r;
-       
+
        call = &ndr_table_svcctl.calls[NDR_SVCCTL_QUERYSERVICEOBJECTSECURITY];
-       
+
        r = talloc(NULL, struct svcctl_QueryServiceObjectSecurity);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_QueryServiceObjectSecurity, r);
-       
+       }
+
        r->out.result = _svcctl_QueryServiceObjectSecurity(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceObjectSecurity, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_svcctl_SetServiceObjectSecurity(pipes_struct *p)
@@ -385,67 +395,69 @@ static bool api_svcctl_SetServiceObjectSecurity(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct svcctl_SetServiceObjectSecurity *r;
-       
+
        call = &ndr_table_svcctl.calls[NDR_SVCCTL_SETSERVICEOBJECTSECURITY];
-       
+
        r = talloc(NULL, struct svcctl_SetServiceObjectSecurity);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_SetServiceObjectSecurity, r);
-       
+       }
+
        r->out.result = _svcctl_SetServiceObjectSecurity(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_SetServiceObjectSecurity, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_svcctl_QueryServiceStatus(pipes_struct *p)
@@ -456,74 +468,76 @@ static bool api_svcctl_QueryServiceStatus(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct svcctl_QueryServiceStatus *r;
-       
+
        call = &ndr_table_svcctl.calls[NDR_SVCCTL_QUERYSERVICESTATUS];
-       
+
        r = talloc(NULL, struct svcctl_QueryServiceStatus);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_QueryServiceStatus, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.service_status = talloc_zero(r, struct SERVICE_STATUS);
        if (r->out.service_status == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _svcctl_QueryServiceStatus(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceStatus, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_svcctl_SetServiceStatus(pipes_struct *p)
@@ -534,67 +548,69 @@ static bool api_svcctl_SetServiceStatus(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct svcctl_SetServiceStatus *r;
-       
+
        call = &ndr_table_svcctl.calls[NDR_SVCCTL_SETSERVICESTATUS];
-       
+
        r = talloc(NULL, struct svcctl_SetServiceStatus);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_SetServiceStatus, r);
-       
+       }
+
        r->out.result = _svcctl_SetServiceStatus(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_SetServiceStatus, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_svcctl_UnlockServiceDatabase(pipes_struct *p)
@@ -605,69 +621,71 @@ static bool api_svcctl_UnlockServiceDatabase(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct svcctl_UnlockServiceDatabase *r;
-       
+
        call = &ndr_table_svcctl.calls[NDR_SVCCTL_UNLOCKSERVICEDATABASE];
-       
+
        r = talloc(NULL, struct svcctl_UnlockServiceDatabase);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_UnlockServiceDatabase, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.lock = r->in.lock;
        r->out.result = _svcctl_UnlockServiceDatabase(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_UnlockServiceDatabase, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_svcctl_NotifyBootConfigStatus(pipes_struct *p)
@@ -678,67 +696,69 @@ static bool api_svcctl_NotifyBootConfigStatus(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct svcctl_NotifyBootConfigStatus *r;
-       
+
        call = &ndr_table_svcctl.calls[NDR_SVCCTL_NOTIFYBOOTCONFIGSTATUS];
-       
+
        r = talloc(NULL, struct svcctl_NotifyBootConfigStatus);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_NotifyBootConfigStatus, r);
-       
+       }
+
        r->out.result = _svcctl_NotifyBootConfigStatus(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_NotifyBootConfigStatus, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_svcctl_SCSetServiceBitsW(pipes_struct *p)
@@ -749,67 +769,69 @@ static bool api_svcctl_SCSetServiceBitsW(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct svcctl_SCSetServiceBitsW *r;
-       
+
        call = &ndr_table_svcctl.calls[NDR_SVCCTL_SCSETSERVICEBITSW];
-       
+
        r = talloc(NULL, struct svcctl_SCSetServiceBitsW);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_SCSetServiceBitsW, r);
-       
+       }
+
        r->out.result = _svcctl_SCSetServiceBitsW(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_SCSetServiceBitsW, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_svcctl_ChangeServiceConfigW(pipes_struct *p)
@@ -820,74 +842,76 @@ static bool api_svcctl_ChangeServiceConfigW(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct svcctl_ChangeServiceConfigW *r;
-       
+
        call = &ndr_table_svcctl.calls[NDR_SVCCTL_CHANGESERVICECONFIGW];
-       
+
        r = talloc(NULL, struct svcctl_ChangeServiceConfigW);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_ChangeServiceConfigW, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.tag_id = talloc_zero(r, uint32_t);
        if (r->out.tag_id == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _svcctl_ChangeServiceConfigW(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_ChangeServiceConfigW, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_svcctl_CreateServiceW(pipes_struct *p)
@@ -898,75 +922,77 @@ static bool api_svcctl_CreateServiceW(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct svcctl_CreateServiceW *r;
-       
+
        call = &ndr_table_svcctl.calls[NDR_SVCCTL_CREATESERVICEW];
-       
+
        r = talloc(NULL, struct svcctl_CreateServiceW);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_CreateServiceW, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.TagId = r->in.TagId;
        r->out.handle = talloc_zero(r, struct policy_handle);
        if (r->out.handle == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _svcctl_CreateServiceW(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_CreateServiceW, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_svcctl_EnumDependentServicesW(pipes_struct *p)
@@ -977,86 +1003,88 @@ static bool api_svcctl_EnumDependentServicesW(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct svcctl_EnumDependentServicesW *r;
-       
+
        call = &ndr_table_svcctl.calls[NDR_SVCCTL_ENUMDEPENDENTSERVICESW];
-       
+
        r = talloc(NULL, struct svcctl_EnumDependentServicesW);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_EnumDependentServicesW, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.service_status = talloc_zero(r, struct ENUM_SERVICE_STATUS);
        if (r->out.service_status == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.bytes_needed = talloc_zero(r, uint32_t);
        if (r->out.bytes_needed == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.services_returned = talloc_zero(r, uint32_t);
        if (r->out.services_returned == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _svcctl_EnumDependentServicesW(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_EnumDependentServicesW, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_svcctl_EnumServicesStatusW(pipes_struct *p)
@@ -1067,87 +1095,89 @@ static bool api_svcctl_EnumServicesStatusW(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct svcctl_EnumServicesStatusW *r;
-       
+
        call = &ndr_table_svcctl.calls[NDR_SVCCTL_ENUMSERVICESSTATUSW];
-       
+
        r = talloc(NULL, struct svcctl_EnumServicesStatusW);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_EnumServicesStatusW, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.service = talloc_zero_array(r, uint8_t, r->in.buf_size);
        if (r->out.service == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.bytes_needed = talloc_zero(r, uint32_t);
        if (r->out.bytes_needed == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.services_returned = talloc_zero(r, uint32_t);
        if (r->out.services_returned == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.resume_handle = r->in.resume_handle;
        r->out.result = _svcctl_EnumServicesStatusW(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_EnumServicesStatusW, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_svcctl_OpenSCManagerW(pipes_struct *p)
@@ -1158,74 +1188,76 @@ static bool api_svcctl_OpenSCManagerW(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct svcctl_OpenSCManagerW *r;
-       
+
        call = &ndr_table_svcctl.calls[NDR_SVCCTL_OPENSCMANAGERW];
-       
+
        r = talloc(NULL, struct svcctl_OpenSCManagerW);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_OpenSCManagerW, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.handle = talloc_zero(r, struct policy_handle);
        if (r->out.handle == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _svcctl_OpenSCManagerW(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_OpenSCManagerW, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_svcctl_OpenServiceW(pipes_struct *p)
@@ -1236,74 +1268,76 @@ static bool api_svcctl_OpenServiceW(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct svcctl_OpenServiceW *r;
-       
+
        call = &ndr_table_svcctl.calls[NDR_SVCCTL_OPENSERVICEW];
-       
+
        r = talloc(NULL, struct svcctl_OpenServiceW);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_OpenServiceW, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.handle = talloc_zero(r, struct policy_handle);
        if (r->out.handle == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _svcctl_OpenServiceW(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_OpenServiceW, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_svcctl_QueryServiceConfigW(pipes_struct *p)
@@ -1314,80 +1348,82 @@ static bool api_svcctl_QueryServiceConfigW(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct svcctl_QueryServiceConfigW *r;
-       
+
        call = &ndr_table_svcctl.calls[NDR_SVCCTL_QUERYSERVICECONFIGW];
-       
+
        r = talloc(NULL, struct svcctl_QueryServiceConfigW);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_QueryServiceConfigW, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.query = talloc_zero_array(r, uint8_t, r->in.buf_size);
        if (r->out.query == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.bytes_needed = talloc_zero(r, uint32_t);
        if (r->out.bytes_needed == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _svcctl_QueryServiceConfigW(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceConfigW, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_svcctl_QueryServiceLockStatusW(pipes_struct *p)
@@ -1398,80 +1434,82 @@ static bool api_svcctl_QueryServiceLockStatusW(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct svcctl_QueryServiceLockStatusW *r;
-       
+
        call = &ndr_table_svcctl.calls[NDR_SVCCTL_QUERYSERVICELOCKSTATUSW];
-       
+
        r = talloc(NULL, struct svcctl_QueryServiceLockStatusW);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_QueryServiceLockStatusW, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.lock_status = talloc_zero(r, struct SERVICE_LOCK_STATUS);
        if (r->out.lock_status == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.required_buf_size = talloc_zero(r, uint32_t);
        if (r->out.required_buf_size == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _svcctl_QueryServiceLockStatusW(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceLockStatusW, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_svcctl_StartServiceW(pipes_struct *p)
@@ -1482,67 +1520,69 @@ static bool api_svcctl_StartServiceW(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct svcctl_StartServiceW *r;
-       
+
        call = &ndr_table_svcctl.calls[NDR_SVCCTL_STARTSERVICEW];
-       
+
        r = talloc(NULL, struct svcctl_StartServiceW);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_StartServiceW, r);
-       
+       }
+
        r->out.result = _svcctl_StartServiceW(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_StartServiceW, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_svcctl_GetServiceDisplayNameW(pipes_struct *p)
@@ -1553,75 +1593,77 @@ static bool api_svcctl_GetServiceDisplayNameW(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct svcctl_GetServiceDisplayNameW *r;
-       
+
        call = &ndr_table_svcctl.calls[NDR_SVCCTL_GETSERVICEDISPLAYNAMEW];
-       
+
        r = talloc(NULL, struct svcctl_GetServiceDisplayNameW);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_GetServiceDisplayNameW, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.display_name = talloc_zero(r, const char *);
        if (r->out.display_name == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.display_name_length = r->in.display_name_length;
        r->out.result = _svcctl_GetServiceDisplayNameW(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_GetServiceDisplayNameW, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_svcctl_GetServiceKeyNameW(pipes_struct *p)
@@ -1632,75 +1674,77 @@ static bool api_svcctl_GetServiceKeyNameW(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct svcctl_GetServiceKeyNameW *r;
-       
+
        call = &ndr_table_svcctl.calls[NDR_SVCCTL_GETSERVICEKEYNAMEW];
-       
+
        r = talloc(NULL, struct svcctl_GetServiceKeyNameW);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_GetServiceKeyNameW, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.key_name = talloc_zero(r, const char *);
        if (r->out.key_name == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.display_name_length = r->in.display_name_length;
        r->out.result = _svcctl_GetServiceKeyNameW(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_GetServiceKeyNameW, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_svcctl_SCSetServiceBitsA(pipes_struct *p)
@@ -1711,67 +1755,69 @@ static bool api_svcctl_SCSetServiceBitsA(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct svcctl_SCSetServiceBitsA *r;
-       
+
        call = &ndr_table_svcctl.calls[NDR_SVCCTL_SCSETSERVICEBITSA];
-       
+
        r = talloc(NULL, struct svcctl_SCSetServiceBitsA);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_SCSetServiceBitsA, r);
-       
+       }
+
        r->out.result = _svcctl_SCSetServiceBitsA(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_SCSetServiceBitsA, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_svcctl_ChangeServiceConfigA(pipes_struct *p)
@@ -1782,74 +1828,76 @@ static bool api_svcctl_ChangeServiceConfigA(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct svcctl_ChangeServiceConfigA *r;
-       
+
        call = &ndr_table_svcctl.calls[NDR_SVCCTL_CHANGESERVICECONFIGA];
-       
+
        r = talloc(NULL, struct svcctl_ChangeServiceConfigA);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_ChangeServiceConfigA, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.tag_id = talloc_zero(r, uint32_t);
        if (r->out.tag_id == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _svcctl_ChangeServiceConfigA(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_ChangeServiceConfigA, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_svcctl_CreateServiceA(pipes_struct *p)
@@ -1860,74 +1908,76 @@ static bool api_svcctl_CreateServiceA(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct svcctl_CreateServiceA *r;
-       
+
        call = &ndr_table_svcctl.calls[NDR_SVCCTL_CREATESERVICEA];
-       
+
        r = talloc(NULL, struct svcctl_CreateServiceA);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_CreateServiceA, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.TagId = talloc_zero(r, uint32_t);
        if (r->out.TagId == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _svcctl_CreateServiceA(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_CreateServiceA, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_svcctl_EnumDependentServicesA(pipes_struct *p)
@@ -1938,86 +1988,88 @@ static bool api_svcctl_EnumDependentServicesA(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct svcctl_EnumDependentServicesA *r;
-       
+
        call = &ndr_table_svcctl.calls[NDR_SVCCTL_ENUMDEPENDENTSERVICESA];
-       
+
        r = talloc(NULL, struct svcctl_EnumDependentServicesA);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_EnumDependentServicesA, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.service_status = talloc_zero(r, struct ENUM_SERVICE_STATUS);
        if (r->out.service_status == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.bytes_needed = talloc_zero(r, uint32_t);
        if (r->out.bytes_needed == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.services_returned = talloc_zero(r, uint32_t);
        if (r->out.services_returned == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _svcctl_EnumDependentServicesA(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_EnumDependentServicesA, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_svcctl_EnumServicesStatusA(pipes_struct *p)
@@ -2028,87 +2080,89 @@ static bool api_svcctl_EnumServicesStatusA(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct svcctl_EnumServicesStatusA *r;
-       
+
        call = &ndr_table_svcctl.calls[NDR_SVCCTL_ENUMSERVICESSTATUSA];
-       
+
        r = talloc(NULL, struct svcctl_EnumServicesStatusA);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_EnumServicesStatusA, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.service = talloc_zero_array(r, uint8_t, r->in.buf_size);
        if (r->out.service == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.bytes_needed = talloc_zero(r, uint32_t);
        if (r->out.bytes_needed == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.services_returned = talloc_zero(r, uint32_t);
        if (r->out.services_returned == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.resume_handle = r->in.resume_handle;
        r->out.result = _svcctl_EnumServicesStatusA(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_EnumServicesStatusA, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_svcctl_OpenSCManagerA(pipes_struct *p)
@@ -2119,74 +2173,76 @@ static bool api_svcctl_OpenSCManagerA(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct svcctl_OpenSCManagerA *r;
-       
+
        call = &ndr_table_svcctl.calls[NDR_SVCCTL_OPENSCMANAGERA];
-       
+
        r = talloc(NULL, struct svcctl_OpenSCManagerA);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_OpenSCManagerA, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.handle = talloc_zero(r, struct policy_handle);
        if (r->out.handle == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _svcctl_OpenSCManagerA(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_OpenSCManagerA, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_svcctl_OpenServiceA(pipes_struct *p)
@@ -2197,67 +2253,69 @@ static bool api_svcctl_OpenServiceA(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct svcctl_OpenServiceA *r;
-       
+
        call = &ndr_table_svcctl.calls[NDR_SVCCTL_OPENSERVICEA];
-       
+
        r = talloc(NULL, struct svcctl_OpenServiceA);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_OpenServiceA, r);
-       
+       }
+
        r->out.result = _svcctl_OpenServiceA(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_OpenServiceA, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_svcctl_QueryServiceConfigA(pipes_struct *p)
@@ -2268,80 +2326,82 @@ static bool api_svcctl_QueryServiceConfigA(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct svcctl_QueryServiceConfigA *r;
-       
+
        call = &ndr_table_svcctl.calls[NDR_SVCCTL_QUERYSERVICECONFIGA];
-       
+
        r = talloc(NULL, struct svcctl_QueryServiceConfigA);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_QueryServiceConfigA, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.query = talloc_zero_array(r, uint8_t, r->in.buf_size);
        if (r->out.query == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.bytes_needed = talloc_zero(r, uint32_t);
        if (r->out.bytes_needed == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _svcctl_QueryServiceConfigA(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceConfigA, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_svcctl_QueryServiceLockStatusA(pipes_struct *p)
@@ -2352,80 +2412,82 @@ static bool api_svcctl_QueryServiceLockStatusA(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct svcctl_QueryServiceLockStatusA *r;
-       
+
        call = &ndr_table_svcctl.calls[NDR_SVCCTL_QUERYSERVICELOCKSTATUSA];
-       
+
        r = talloc(NULL, struct svcctl_QueryServiceLockStatusA);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_QueryServiceLockStatusA, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.lock_status = talloc_zero(r, struct SERVICE_LOCK_STATUS);
        if (r->out.lock_status == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.required_buf_size = talloc_zero(r, uint32_t);
        if (r->out.required_buf_size == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _svcctl_QueryServiceLockStatusA(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceLockStatusA, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_svcctl_StartServiceA(pipes_struct *p)
@@ -2436,67 +2498,69 @@ static bool api_svcctl_StartServiceA(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct svcctl_StartServiceA *r;
-       
+
        call = &ndr_table_svcctl.calls[NDR_SVCCTL_STARTSERVICEA];
-       
+
        r = talloc(NULL, struct svcctl_StartServiceA);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_StartServiceA, r);
-       
+       }
+
        r->out.result = _svcctl_StartServiceA(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_StartServiceA, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_svcctl_GetServiceDisplayNameA(pipes_struct *p)
@@ -2507,75 +2571,77 @@ static bool api_svcctl_GetServiceDisplayNameA(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct svcctl_GetServiceDisplayNameA *r;
-       
+
        call = &ndr_table_svcctl.calls[NDR_SVCCTL_GETSERVICEDISPLAYNAMEA];
-       
+
        r = talloc(NULL, struct svcctl_GetServiceDisplayNameA);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_GetServiceDisplayNameA, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.display_name = talloc_zero(r, const char *);
        if (r->out.display_name == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.display_name_length = r->in.display_name_length;
        r->out.result = _svcctl_GetServiceDisplayNameA(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_GetServiceDisplayNameA, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_svcctl_GetServiceKeyNameA(pipes_struct *p)
@@ -2586,75 +2652,77 @@ static bool api_svcctl_GetServiceKeyNameA(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct svcctl_GetServiceKeyNameA *r;
-       
+
        call = &ndr_table_svcctl.calls[NDR_SVCCTL_GETSERVICEKEYNAMEA];
-       
+
        r = talloc(NULL, struct svcctl_GetServiceKeyNameA);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_GetServiceKeyNameA, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.key_name = talloc_zero(r, const char *);
        if (r->out.key_name == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.display_name_length = r->in.display_name_length;
        r->out.result = _svcctl_GetServiceKeyNameA(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_GetServiceKeyNameA, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_svcctl_GetCurrentGroupeStateW(pipes_struct *p)
@@ -2665,67 +2733,69 @@ static bool api_svcctl_GetCurrentGroupeStateW(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct svcctl_GetCurrentGroupeStateW *r;
-       
+
        call = &ndr_table_svcctl.calls[NDR_SVCCTL_GETCURRENTGROUPESTATEW];
-       
+
        r = talloc(NULL, struct svcctl_GetCurrentGroupeStateW);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_GetCurrentGroupeStateW, r);
-       
+       }
+
        r->out.result = _svcctl_GetCurrentGroupeStateW(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_GetCurrentGroupeStateW, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_svcctl_EnumServiceGroupW(pipes_struct *p)
@@ -2736,67 +2806,69 @@ static bool api_svcctl_EnumServiceGroupW(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct svcctl_EnumServiceGroupW *r;
-       
+
        call = &ndr_table_svcctl.calls[NDR_SVCCTL_ENUMSERVICEGROUPW];
-       
+
        r = talloc(NULL, struct svcctl_EnumServiceGroupW);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_EnumServiceGroupW, r);
-       
+       }
+
        r->out.result = _svcctl_EnumServiceGroupW(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_EnumServiceGroupW, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_svcctl_ChangeServiceConfig2A(pipes_struct *p)
@@ -2807,67 +2879,69 @@ static bool api_svcctl_ChangeServiceConfig2A(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct svcctl_ChangeServiceConfig2A *r;
-       
+
        call = &ndr_table_svcctl.calls[NDR_SVCCTL_CHANGESERVICECONFIG2A];
-       
+
        r = talloc(NULL, struct svcctl_ChangeServiceConfig2A);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_ChangeServiceConfig2A, r);
-       
+       }
+
        r->out.result = _svcctl_ChangeServiceConfig2A(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_ChangeServiceConfig2A, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_svcctl_ChangeServiceConfig2W(pipes_struct *p)
@@ -2878,67 +2952,69 @@ static bool api_svcctl_ChangeServiceConfig2W(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct svcctl_ChangeServiceConfig2W *r;
-       
+
        call = &ndr_table_svcctl.calls[NDR_SVCCTL_CHANGESERVICECONFIG2W];
-       
+
        r = talloc(NULL, struct svcctl_ChangeServiceConfig2W);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_ChangeServiceConfig2W, r);
-       
+       }
+
        r->out.result = _svcctl_ChangeServiceConfig2W(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_ChangeServiceConfig2W, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_svcctl_QueryServiceConfig2A(pipes_struct *p)
@@ -2949,80 +3025,82 @@ static bool api_svcctl_QueryServiceConfig2A(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct svcctl_QueryServiceConfig2A *r;
-       
+
        call = &ndr_table_svcctl.calls[NDR_SVCCTL_QUERYSERVICECONFIG2A];
-       
+
        r = talloc(NULL, struct svcctl_QueryServiceConfig2A);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_QueryServiceConfig2A, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.buffer = talloc_zero_array(r, uint8_t, r->in.buf_size);
        if (r->out.buffer == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.bytes_needed = talloc_zero(r, uint32_t);
        if (r->out.bytes_needed == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _svcctl_QueryServiceConfig2A(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceConfig2A, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_svcctl_QueryServiceConfig2W(pipes_struct *p)
@@ -3033,80 +3111,82 @@ static bool api_svcctl_QueryServiceConfig2W(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct svcctl_QueryServiceConfig2W *r;
-       
+
        call = &ndr_table_svcctl.calls[NDR_SVCCTL_QUERYSERVICECONFIG2W];
-       
+
        r = talloc(NULL, struct svcctl_QueryServiceConfig2W);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_QueryServiceConfig2W, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.buffer = talloc_zero_array(r, uint8_t, r->in.buf_size);
        if (r->out.buffer == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.bytes_needed = talloc_zero(r, uint32_t);
        if (r->out.bytes_needed == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _svcctl_QueryServiceConfig2W(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceConfig2W, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_svcctl_QueryServiceStatusEx(pipes_struct *p)
@@ -3117,80 +3197,82 @@ static bool api_svcctl_QueryServiceStatusEx(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct svcctl_QueryServiceStatusEx *r;
-       
+
        call = &ndr_table_svcctl.calls[NDR_SVCCTL_QUERYSERVICESTATUSEX];
-       
+
        r = talloc(NULL, struct svcctl_QueryServiceStatusEx);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_QueryServiceStatusEx, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.buffer = talloc_zero_array(r, uint8_t, r->in.buf_size);
        if (r->out.buffer == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.bytes_needed = talloc_zero(r, uint32_t);
        if (r->out.bytes_needed == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _svcctl_QueryServiceStatusEx(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceStatusEx, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_EnumServicesStatusExA(pipes_struct *p)
@@ -3201,93 +3283,95 @@ static bool api_EnumServicesStatusExA(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct EnumServicesStatusExA *r;
-       
+
        call = &ndr_table_svcctl.calls[NDR_ENUMSERVICESSTATUSEXA];
-       
+
        r = talloc(NULL, struct EnumServicesStatusExA);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(EnumServicesStatusExA, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.services = talloc_zero_array(r, uint8_t, r->in.buf_size);
        if (r->out.services == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.bytes_needed = talloc_zero(r, uint32_t);
        if (r->out.bytes_needed == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.service_returned = talloc_zero(r, uint32_t);
        if (r->out.service_returned == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.resume_handle = r->in.resume_handle;
        r->out.group_name = talloc_zero(r, const char *);
        if (r->out.group_name == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _EnumServicesStatusExA(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(EnumServicesStatusExA, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_EnumServicesStatusExW(pipes_struct *p)
@@ -3298,93 +3382,95 @@ static bool api_EnumServicesStatusExW(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct EnumServicesStatusExW *r;
-       
+
        call = &ndr_table_svcctl.calls[NDR_ENUMSERVICESSTATUSEXW];
-       
+
        r = talloc(NULL, struct EnumServicesStatusExW);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(EnumServicesStatusExW, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.services = talloc_zero_array(r, uint8_t, r->in.buf_size);
        if (r->out.services == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.bytes_needed = talloc_zero(r, uint32_t);
        if (r->out.bytes_needed == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.service_returned = talloc_zero(r, uint32_t);
        if (r->out.service_returned == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.resume_handle = r->in.resume_handle;
        r->out.group_name = talloc_zero(r, const char *);
        if (r->out.group_name == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _EnumServicesStatusExW(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(EnumServicesStatusExW, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_svcctl_SCSendTSMessage(pipes_struct *p)
@@ -3395,67 +3481,69 @@ static bool api_svcctl_SCSendTSMessage(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct svcctl_SCSendTSMessage *r;
-       
+
        call = &ndr_table_svcctl.calls[NDR_SVCCTL_SCSENDTSMESSAGE];
-       
+
        r = talloc(NULL, struct svcctl_SCSendTSMessage);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(svcctl_SCSendTSMessage, r);
-       
+       }
+
        r->out.result = _svcctl_SCSendTSMessage(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(svcctl_SCSendTSMessage, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 
index 19863d798fc651b542778a0084ceea5b04a775df..36a6250ad00b7c6c7c17fdc7e7090e676e32258e 100644 (file)
@@ -14,74 +14,76 @@ static bool api_unixinfo_SidToUid(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct unixinfo_SidToUid *r;
-       
+
        call = &ndr_table_unixinfo.calls[NDR_UNIXINFO_SIDTOUID];
-       
+
        r = talloc(NULL, struct unixinfo_SidToUid);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(unixinfo_SidToUid, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.uid = talloc_zero(r, uint64_t);
        if (r->out.uid == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _unixinfo_SidToUid(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(unixinfo_SidToUid, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_unixinfo_UidToSid(pipes_struct *p)
@@ -92,74 +94,76 @@ static bool api_unixinfo_UidToSid(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct unixinfo_UidToSid *r;
-       
+
        call = &ndr_table_unixinfo.calls[NDR_UNIXINFO_UIDTOSID];
-       
+
        r = talloc(NULL, struct unixinfo_UidToSid);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(unixinfo_UidToSid, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.sid = talloc_zero(r, struct dom_sid);
        if (r->out.sid == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _unixinfo_UidToSid(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(unixinfo_UidToSid, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_unixinfo_SidToGid(pipes_struct *p)
@@ -170,74 +174,76 @@ static bool api_unixinfo_SidToGid(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct unixinfo_SidToGid *r;
-       
+
        call = &ndr_table_unixinfo.calls[NDR_UNIXINFO_SIDTOGID];
-       
+
        r = talloc(NULL, struct unixinfo_SidToGid);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(unixinfo_SidToGid, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.gid = talloc_zero(r, uint64_t);
        if (r->out.gid == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _unixinfo_SidToGid(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(unixinfo_SidToGid, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_unixinfo_GidToSid(pipes_struct *p)
@@ -248,74 +254,76 @@ static bool api_unixinfo_GidToSid(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct unixinfo_GidToSid *r;
-       
+
        call = &ndr_table_unixinfo.calls[NDR_UNIXINFO_GIDTOSID];
-       
+
        r = talloc(NULL, struct unixinfo_GidToSid);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(unixinfo_GidToSid, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.sid = talloc_zero(r, struct dom_sid);
        if (r->out.sid == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _unixinfo_GidToSid(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(unixinfo_GidToSid, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_unixinfo_GetPWUid(pipes_struct *p)
@@ -326,75 +334,77 @@ static bool api_unixinfo_GetPWUid(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct unixinfo_GetPWUid *r;
-       
+
        call = &ndr_table_unixinfo.calls[NDR_UNIXINFO_GETPWUID];
-       
+
        r = talloc(NULL, struct unixinfo_GetPWUid);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(unixinfo_GetPWUid, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.count = r->in.count;
        r->out.infos = talloc_zero_array(r, struct unixinfo_GetPWUidInfo, *r->out.count);
        if (r->out.infos == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _unixinfo_GetPWUid(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(unixinfo_GetPWUid, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 
index 51918bcb9761b7979767c20968306668a68486ad..ecce99f67a359bd0df2b552fbb4937090644ab77 100644 (file)
@@ -14,74 +14,76 @@ static bool api_winreg_OpenHKCR(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct winreg_OpenHKCR *r;
-       
+
        call = &ndr_table_winreg.calls[NDR_WINREG_OPENHKCR];
-       
+
        r = talloc(NULL, struct winreg_OpenHKCR);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_OpenHKCR, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.handle = talloc_zero(r, struct policy_handle);
        if (r->out.handle == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _winreg_OpenHKCR(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_OpenHKCR, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_winreg_OpenHKCU(pipes_struct *p)
@@ -92,74 +94,76 @@ static bool api_winreg_OpenHKCU(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct winreg_OpenHKCU *r;
-       
+
        call = &ndr_table_winreg.calls[NDR_WINREG_OPENHKCU];
-       
+
        r = talloc(NULL, struct winreg_OpenHKCU);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_OpenHKCU, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.handle = talloc_zero(r, struct policy_handle);
        if (r->out.handle == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _winreg_OpenHKCU(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_OpenHKCU, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_winreg_OpenHKLM(pipes_struct *p)
@@ -170,74 +174,76 @@ static bool api_winreg_OpenHKLM(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct winreg_OpenHKLM *r;
-       
+
        call = &ndr_table_winreg.calls[NDR_WINREG_OPENHKLM];
-       
+
        r = talloc(NULL, struct winreg_OpenHKLM);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_OpenHKLM, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.handle = talloc_zero(r, struct policy_handle);
        if (r->out.handle == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _winreg_OpenHKLM(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_OpenHKLM, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_winreg_OpenHKPD(pipes_struct *p)
@@ -248,74 +254,76 @@ static bool api_winreg_OpenHKPD(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct winreg_OpenHKPD *r;
-       
+
        call = &ndr_table_winreg.calls[NDR_WINREG_OPENHKPD];
-       
+
        r = talloc(NULL, struct winreg_OpenHKPD);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_OpenHKPD, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.handle = talloc_zero(r, struct policy_handle);
        if (r->out.handle == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _winreg_OpenHKPD(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_OpenHKPD, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_winreg_OpenHKU(pipes_struct *p)
@@ -326,74 +334,76 @@ static bool api_winreg_OpenHKU(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct winreg_OpenHKU *r;
-       
+
        call = &ndr_table_winreg.calls[NDR_WINREG_OPENHKU];
-       
+
        r = talloc(NULL, struct winreg_OpenHKU);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_OpenHKU, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.handle = talloc_zero(r, struct policy_handle);
        if (r->out.handle == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _winreg_OpenHKU(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_OpenHKU, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_winreg_CloseKey(pipes_struct *p)
@@ -404,69 +414,71 @@ static bool api_winreg_CloseKey(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct winreg_CloseKey *r;
-       
+
        call = &ndr_table_winreg.calls[NDR_WINREG_CLOSEKEY];
-       
+
        r = talloc(NULL, struct winreg_CloseKey);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_CloseKey, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.handle = r->in.handle;
        r->out.result = _winreg_CloseKey(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_CloseKey, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_winreg_CreateKey(pipes_struct *p)
@@ -477,75 +489,77 @@ static bool api_winreg_CreateKey(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct winreg_CreateKey *r;
-       
+
        call = &ndr_table_winreg.calls[NDR_WINREG_CREATEKEY];
-       
+
        r = talloc(NULL, struct winreg_CreateKey);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_CreateKey, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.new_handle = talloc_zero(r, struct policy_handle);
        if (r->out.new_handle == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.action_taken = r->in.action_taken;
        r->out.result = _winreg_CreateKey(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_CreateKey, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_winreg_DeleteKey(pipes_struct *p)
@@ -556,67 +570,69 @@ static bool api_winreg_DeleteKey(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct winreg_DeleteKey *r;
-       
+
        call = &ndr_table_winreg.calls[NDR_WINREG_DELETEKEY];
-       
+
        r = talloc(NULL, struct winreg_DeleteKey);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_DeleteKey, r);
-       
+       }
+
        r->out.result = _winreg_DeleteKey(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_DeleteKey, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_winreg_DeleteValue(pipes_struct *p)
@@ -627,67 +643,69 @@ static bool api_winreg_DeleteValue(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct winreg_DeleteValue *r;
-       
+
        call = &ndr_table_winreg.calls[NDR_WINREG_DELETEVALUE];
-       
+
        r = talloc(NULL, struct winreg_DeleteValue);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_DeleteValue, r);
-       
+       }
+
        r->out.result = _winreg_DeleteValue(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_DeleteValue, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_winreg_EnumKey(pipes_struct *p)
@@ -698,71 +716,73 @@ static bool api_winreg_EnumKey(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct winreg_EnumKey *r;
-       
+
        call = &ndr_table_winreg.calls[NDR_WINREG_ENUMKEY];
-       
+
        r = talloc(NULL, struct winreg_EnumKey);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_EnumKey, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.name = r->in.name;
        r->out.keyclass = r->in.keyclass;
        r->out.last_changed_time = r->in.last_changed_time;
        r->out.result = _winreg_EnumKey(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_EnumKey, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_winreg_EnumValue(pipes_struct *p)
@@ -773,35 +793,36 @@ static bool api_winreg_EnumValue(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct winreg_EnumValue *r;
-       
+
        call = &ndr_table_winreg.calls[NDR_WINREG_ENUMVALUE];
-       
+
        r = talloc(NULL, struct winreg_EnumValue);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_EnumValue, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.name = r->in.name;
        r->out.type = r->in.type;
@@ -809,37 +830,38 @@ static bool api_winreg_EnumValue(pipes_struct *p)
        r->out.size = r->in.size;
        r->out.length = r->in.length;
        r->out.result = _winreg_EnumValue(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_EnumValue, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_winreg_FlushKey(pipes_struct *p)
@@ -850,67 +872,69 @@ static bool api_winreg_FlushKey(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct winreg_FlushKey *r;
-       
+
        call = &ndr_table_winreg.calls[NDR_WINREG_FLUSHKEY];
-       
+
        r = talloc(NULL, struct winreg_FlushKey);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_FlushKey, r);
-       
+       }
+
        r->out.result = _winreg_FlushKey(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_FlushKey, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_winreg_GetKeySecurity(pipes_struct *p)
@@ -921,69 +945,71 @@ static bool api_winreg_GetKeySecurity(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct winreg_GetKeySecurity *r;
-       
+
        call = &ndr_table_winreg.calls[NDR_WINREG_GETKEYSECURITY];
-       
+
        r = talloc(NULL, struct winreg_GetKeySecurity);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_GetKeySecurity, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.sd = r->in.sd;
        r->out.result = _winreg_GetKeySecurity(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_GetKeySecurity, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_winreg_LoadKey(pipes_struct *p)
@@ -994,67 +1020,69 @@ static bool api_winreg_LoadKey(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct winreg_LoadKey *r;
-       
+
        call = &ndr_table_winreg.calls[NDR_WINREG_LOADKEY];
-       
+
        r = talloc(NULL, struct winreg_LoadKey);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_LoadKey, r);
-       
+       }
+
        r->out.result = _winreg_LoadKey(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_LoadKey, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_winreg_NotifyChangeKeyValue(pipes_struct *p)
@@ -1065,67 +1093,69 @@ static bool api_winreg_NotifyChangeKeyValue(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct winreg_NotifyChangeKeyValue *r;
-       
+
        call = &ndr_table_winreg.calls[NDR_WINREG_NOTIFYCHANGEKEYVALUE];
-       
+
        r = talloc(NULL, struct winreg_NotifyChangeKeyValue);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_NotifyChangeKeyValue, r);
-       
+       }
+
        r->out.result = _winreg_NotifyChangeKeyValue(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_NotifyChangeKeyValue, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_winreg_OpenKey(pipes_struct *p)
@@ -1136,74 +1166,76 @@ static bool api_winreg_OpenKey(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct winreg_OpenKey *r;
-       
+
        call = &ndr_table_winreg.calls[NDR_WINREG_OPENKEY];
-       
+
        r = talloc(NULL, struct winreg_OpenKey);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_OpenKey, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.handle = talloc_zero(r, struct policy_handle);
        if (r->out.handle == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _winreg_OpenKey(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_OpenKey, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_winreg_QueryInfoKey(pipes_struct *p)
@@ -1214,117 +1246,119 @@ static bool api_winreg_QueryInfoKey(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct winreg_QueryInfoKey *r;
-       
+
        call = &ndr_table_winreg.calls[NDR_WINREG_QUERYINFOKEY];
-       
+
        r = talloc(NULL, struct winreg_QueryInfoKey);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_QueryInfoKey, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.classname = r->in.classname;
        r->out.num_subkeys = talloc_zero(r, uint32_t);
        if (r->out.num_subkeys == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.max_subkeylen = talloc_zero(r, uint32_t);
        if (r->out.max_subkeylen == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.max_classlen = talloc_zero(r, uint32_t);
        if (r->out.max_classlen == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.num_values = talloc_zero(r, uint32_t);
        if (r->out.num_values == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.max_valnamelen = talloc_zero(r, uint32_t);
        if (r->out.max_valnamelen == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.max_valbufsize = talloc_zero(r, uint32_t);
        if (r->out.max_valbufsize == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.secdescsize = talloc_zero(r, uint32_t);
        if (r->out.secdescsize == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.last_changed_time = talloc_zero(r, NTTIME);
        if (r->out.last_changed_time == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _winreg_QueryInfoKey(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_QueryInfoKey, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_winreg_QueryValue(pipes_struct *p)
@@ -1335,72 +1369,74 @@ static bool api_winreg_QueryValue(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct winreg_QueryValue *r;
-       
+
        call = &ndr_table_winreg.calls[NDR_WINREG_QUERYVALUE];
-       
+
        r = talloc(NULL, struct winreg_QueryValue);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_QueryValue, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.type = r->in.type;
        r->out.data = r->in.data;
        r->out.data_size = r->in.data_size;
        r->out.value_length = r->in.value_length;
        r->out.result = _winreg_QueryValue(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_QueryValue, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_winreg_ReplaceKey(pipes_struct *p)
@@ -1411,67 +1447,69 @@ static bool api_winreg_ReplaceKey(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct winreg_ReplaceKey *r;
-       
+
        call = &ndr_table_winreg.calls[NDR_WINREG_REPLACEKEY];
-       
+
        r = talloc(NULL, struct winreg_ReplaceKey);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_ReplaceKey, r);
-       
+       }
+
        r->out.result = _winreg_ReplaceKey(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_ReplaceKey, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_winreg_RestoreKey(pipes_struct *p)
@@ -1482,67 +1520,69 @@ static bool api_winreg_RestoreKey(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct winreg_RestoreKey *r;
-       
+
        call = &ndr_table_winreg.calls[NDR_WINREG_RESTOREKEY];
-       
+
        r = talloc(NULL, struct winreg_RestoreKey);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_RestoreKey, r);
-       
+       }
+
        r->out.result = _winreg_RestoreKey(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_RestoreKey, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_winreg_SaveKey(pipes_struct *p)
@@ -1553,67 +1593,69 @@ static bool api_winreg_SaveKey(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct winreg_SaveKey *r;
-       
+
        call = &ndr_table_winreg.calls[NDR_WINREG_SAVEKEY];
-       
+
        r = talloc(NULL, struct winreg_SaveKey);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_SaveKey, r);
-       
+       }
+
        r->out.result = _winreg_SaveKey(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_SaveKey, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_winreg_SetKeySecurity(pipes_struct *p)
@@ -1624,67 +1666,69 @@ static bool api_winreg_SetKeySecurity(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct winreg_SetKeySecurity *r;
-       
+
        call = &ndr_table_winreg.calls[NDR_WINREG_SETKEYSECURITY];
-       
+
        r = talloc(NULL, struct winreg_SetKeySecurity);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_SetKeySecurity, r);
-       
+       }
+
        r->out.result = _winreg_SetKeySecurity(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_SetKeySecurity, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_winreg_SetValue(pipes_struct *p)
@@ -1695,67 +1739,69 @@ static bool api_winreg_SetValue(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct winreg_SetValue *r;
-       
+
        call = &ndr_table_winreg.calls[NDR_WINREG_SETVALUE];
-       
+
        r = talloc(NULL, struct winreg_SetValue);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_SetValue, r);
-       
+       }
+
        r->out.result = _winreg_SetValue(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_SetValue, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_winreg_UnLoadKey(pipes_struct *p)
@@ -1766,67 +1812,69 @@ static bool api_winreg_UnLoadKey(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct winreg_UnLoadKey *r;
-       
+
        call = &ndr_table_winreg.calls[NDR_WINREG_UNLOADKEY];
-       
+
        r = talloc(NULL, struct winreg_UnLoadKey);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_UnLoadKey, r);
-       
+       }
+
        r->out.result = _winreg_UnLoadKey(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_UnLoadKey, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_winreg_InitiateSystemShutdown(pipes_struct *p)
@@ -1837,67 +1885,69 @@ static bool api_winreg_InitiateSystemShutdown(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct winreg_InitiateSystemShutdown *r;
-       
+
        call = &ndr_table_winreg.calls[NDR_WINREG_INITIATESYSTEMSHUTDOWN];
-       
+
        r = talloc(NULL, struct winreg_InitiateSystemShutdown);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_InitiateSystemShutdown, r);
-       
+       }
+
        r->out.result = _winreg_InitiateSystemShutdown(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_InitiateSystemShutdown, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_winreg_AbortSystemShutdown(pipes_struct *p)
@@ -1908,67 +1958,69 @@ static bool api_winreg_AbortSystemShutdown(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct winreg_AbortSystemShutdown *r;
-       
+
        call = &ndr_table_winreg.calls[NDR_WINREG_ABORTSYSTEMSHUTDOWN];
-       
+
        r = talloc(NULL, struct winreg_AbortSystemShutdown);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_AbortSystemShutdown, r);
-       
+       }
+
        r->out.result = _winreg_AbortSystemShutdown(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_AbortSystemShutdown, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_winreg_GetVersion(pipes_struct *p)
@@ -1979,74 +2031,76 @@ static bool api_winreg_GetVersion(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct winreg_GetVersion *r;
-       
+
        call = &ndr_table_winreg.calls[NDR_WINREG_GETVERSION];
-       
+
        r = talloc(NULL, struct winreg_GetVersion);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_GetVersion, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.version = talloc_zero(r, uint32_t);
        if (r->out.version == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _winreg_GetVersion(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_GetVersion, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_winreg_OpenHKCC(pipes_struct *p)
@@ -2057,74 +2111,76 @@ static bool api_winreg_OpenHKCC(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct winreg_OpenHKCC *r;
-       
+
        call = &ndr_table_winreg.calls[NDR_WINREG_OPENHKCC];
-       
+
        r = talloc(NULL, struct winreg_OpenHKCC);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_OpenHKCC, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.handle = talloc_zero(r, struct policy_handle);
        if (r->out.handle == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _winreg_OpenHKCC(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_OpenHKCC, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_winreg_OpenHKDD(pipes_struct *p)
@@ -2135,74 +2191,76 @@ static bool api_winreg_OpenHKDD(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct winreg_OpenHKDD *r;
-       
+
        call = &ndr_table_winreg.calls[NDR_WINREG_OPENHKDD];
-       
+
        r = talloc(NULL, struct winreg_OpenHKDD);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_OpenHKDD, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.handle = talloc_zero(r, struct policy_handle);
        if (r->out.handle == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _winreg_OpenHKDD(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_OpenHKDD, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_winreg_QueryMultipleValues(pipes_struct *p)
@@ -2213,71 +2271,73 @@ static bool api_winreg_QueryMultipleValues(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct winreg_QueryMultipleValues *r;
-       
+
        call = &ndr_table_winreg.calls[NDR_WINREG_QUERYMULTIPLEVALUES];
-       
+
        r = talloc(NULL, struct winreg_QueryMultipleValues);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_QueryMultipleValues, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.values = r->in.values;
        r->out.buffer = r->in.buffer;
        r->out.buffer_size = r->in.buffer_size;
        r->out.result = _winreg_QueryMultipleValues(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_QueryMultipleValues, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_winreg_InitiateSystemShutdownEx(pipes_struct *p)
@@ -2288,67 +2348,69 @@ static bool api_winreg_InitiateSystemShutdownEx(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct winreg_InitiateSystemShutdownEx *r;
-       
+
        call = &ndr_table_winreg.calls[NDR_WINREG_INITIATESYSTEMSHUTDOWNEX];
-       
+
        r = talloc(NULL, struct winreg_InitiateSystemShutdownEx);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_InitiateSystemShutdownEx, r);
-       
+       }
+
        r->out.result = _winreg_InitiateSystemShutdownEx(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_InitiateSystemShutdownEx, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_winreg_SaveKeyEx(pipes_struct *p)
@@ -2359,67 +2421,69 @@ static bool api_winreg_SaveKeyEx(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct winreg_SaveKeyEx *r;
-       
+
        call = &ndr_table_winreg.calls[NDR_WINREG_SAVEKEYEX];
-       
+
        r = talloc(NULL, struct winreg_SaveKeyEx);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_SaveKeyEx, r);
-       
+       }
+
        r->out.result = _winreg_SaveKeyEx(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_SaveKeyEx, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_winreg_OpenHKPT(pipes_struct *p)
@@ -2430,74 +2494,76 @@ static bool api_winreg_OpenHKPT(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct winreg_OpenHKPT *r;
-       
+
        call = &ndr_table_winreg.calls[NDR_WINREG_OPENHKPT];
-       
+
        r = talloc(NULL, struct winreg_OpenHKPT);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_OpenHKPT, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.handle = talloc_zero(r, struct policy_handle);
        if (r->out.handle == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _winreg_OpenHKPT(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_OpenHKPT, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_winreg_OpenHKPN(pipes_struct *p)
@@ -2508,74 +2574,76 @@ static bool api_winreg_OpenHKPN(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct winreg_OpenHKPN *r;
-       
+
        call = &ndr_table_winreg.calls[NDR_WINREG_OPENHKPN];
-       
+
        r = talloc(NULL, struct winreg_OpenHKPN);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_OpenHKPN, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.handle = talloc_zero(r, struct policy_handle);
        if (r->out.handle == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _winreg_OpenHKPN(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_OpenHKPN, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_winreg_QueryMultipleValues2(pipes_struct *p)
@@ -2586,67 +2654,69 @@ static bool api_winreg_QueryMultipleValues2(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct winreg_QueryMultipleValues2 *r;
-       
+
        call = &ndr_table_winreg.calls[NDR_WINREG_QUERYMULTIPLEVALUES2];
-       
+
        r = talloc(NULL, struct winreg_QueryMultipleValues2);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(winreg_QueryMultipleValues2, r);
-       
+       }
+
        r->out.result = _winreg_QueryMultipleValues2(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(winreg_QueryMultipleValues2, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 
index ff8c1e26039ef5f8f29ae4d79c0c4de766dbf260..ddbf3aa373f5898a4d5f775923dda381cce0ad9b 100644 (file)
@@ -14,74 +14,76 @@ static bool api_wkssvc_NetWkstaGetInfo(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct wkssvc_NetWkstaGetInfo *r;
-       
+
        call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETWKSTAGETINFO];
-       
+
        r = talloc(NULL, struct wkssvc_NetWkstaGetInfo);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(wkssvc_NetWkstaGetInfo, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.info = talloc_zero(r, union wkssvc_NetWkstaInfo);
        if (r->out.info == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _wkssvc_NetWkstaGetInfo(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(wkssvc_NetWkstaGetInfo, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_wkssvc_NetWkstaSetInfo(pipes_struct *p)
@@ -92,69 +94,71 @@ static bool api_wkssvc_NetWkstaSetInfo(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct wkssvc_NetWkstaSetInfo *r;
-       
+
        call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETWKSTASETINFO];
-       
+
        r = talloc(NULL, struct wkssvc_NetWkstaSetInfo);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(wkssvc_NetWkstaSetInfo, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.parm_error = r->in.parm_error;
        r->out.result = _wkssvc_NetWkstaSetInfo(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(wkssvc_NetWkstaSetInfo, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_wkssvc_NetWkstaEnumUsers(pipes_struct *p)
@@ -165,76 +169,78 @@ static bool api_wkssvc_NetWkstaEnumUsers(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct wkssvc_NetWkstaEnumUsers *r;
-       
+
        call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETWKSTAENUMUSERS];
-       
+
        r = talloc(NULL, struct wkssvc_NetWkstaEnumUsers);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(wkssvc_NetWkstaEnumUsers, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.info = r->in.info;
        r->out.entries_read = talloc_zero(r, uint32_t);
        if (r->out.entries_read == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.resume_handle = r->in.resume_handle;
        r->out.result = _wkssvc_NetWkstaEnumUsers(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(wkssvc_NetWkstaEnumUsers, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_wkssvc_NetrWkstaUserGetInfo(pipes_struct *p)
@@ -245,74 +251,76 @@ static bool api_wkssvc_NetrWkstaUserGetInfo(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct wkssvc_NetrWkstaUserGetInfo *r;
-       
+
        call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRWKSTAUSERGETINFO];
-       
+
        r = talloc(NULL, struct wkssvc_NetrWkstaUserGetInfo);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(wkssvc_NetrWkstaUserGetInfo, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.info = talloc_zero(r, union wkssvc_NetrWkstaUserInfo);
        if (r->out.info == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _wkssvc_NetrWkstaUserGetInfo(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(wkssvc_NetrWkstaUserGetInfo, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_wkssvc_NetrWkstaUserSetInfo(pipes_struct *p)
@@ -323,69 +331,71 @@ static bool api_wkssvc_NetrWkstaUserSetInfo(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct wkssvc_NetrWkstaUserSetInfo *r;
-       
+
        call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRWKSTAUSERSETINFO];
-       
+
        r = talloc(NULL, struct wkssvc_NetrWkstaUserSetInfo);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(wkssvc_NetrWkstaUserSetInfo, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.parm_err = r->in.parm_err;
        r->out.result = _wkssvc_NetrWkstaUserSetInfo(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(wkssvc_NetrWkstaUserSetInfo, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_wkssvc_NetWkstaTransportEnum(pipes_struct *p)
@@ -396,76 +406,78 @@ static bool api_wkssvc_NetWkstaTransportEnum(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct wkssvc_NetWkstaTransportEnum *r;
-       
+
        call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETWKSTATRANSPORTENUM];
-       
+
        r = talloc(NULL, struct wkssvc_NetWkstaTransportEnum);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(wkssvc_NetWkstaTransportEnum, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.info = r->in.info;
        r->out.total_entries = talloc_zero(r, uint32_t);
        if (r->out.total_entries == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.resume_handle = r->in.resume_handle;
        r->out.result = _wkssvc_NetWkstaTransportEnum(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(wkssvc_NetWkstaTransportEnum, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_wkssvc_NetrWkstaTransportAdd(pipes_struct *p)
@@ -476,69 +488,71 @@ static bool api_wkssvc_NetrWkstaTransportAdd(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct wkssvc_NetrWkstaTransportAdd *r;
-       
+
        call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRWKSTATRANSPORTADD];
-       
+
        r = talloc(NULL, struct wkssvc_NetrWkstaTransportAdd);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(wkssvc_NetrWkstaTransportAdd, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.parm_err = r->in.parm_err;
        r->out.result = _wkssvc_NetrWkstaTransportAdd(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(wkssvc_NetrWkstaTransportAdd, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_wkssvc_NetrWkstaTransportDel(pipes_struct *p)
@@ -549,67 +563,69 @@ static bool api_wkssvc_NetrWkstaTransportDel(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct wkssvc_NetrWkstaTransportDel *r;
-       
+
        call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRWKSTATRANSPORTDEL];
-       
+
        r = talloc(NULL, struct wkssvc_NetrWkstaTransportDel);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(wkssvc_NetrWkstaTransportDel, r);
-       
+       }
+
        r->out.result = _wkssvc_NetrWkstaTransportDel(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(wkssvc_NetrWkstaTransportDel, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_wkssvc_NetrUseAdd(pipes_struct *p)
@@ -620,69 +636,71 @@ static bool api_wkssvc_NetrUseAdd(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct wkssvc_NetrUseAdd *r;
-       
+
        call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRUSEADD];
-       
+
        r = talloc(NULL, struct wkssvc_NetrUseAdd);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(wkssvc_NetrUseAdd, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.parm_err = r->in.parm_err;
        r->out.result = _wkssvc_NetrUseAdd(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(wkssvc_NetrUseAdd, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_wkssvc_NetrUseGetInfo(pipes_struct *p)
@@ -693,74 +711,76 @@ static bool api_wkssvc_NetrUseGetInfo(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct wkssvc_NetrUseGetInfo *r;
-       
+
        call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRUSEGETINFO];
-       
+
        r = talloc(NULL, struct wkssvc_NetrUseGetInfo);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(wkssvc_NetrUseGetInfo, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.ctr = talloc_zero(r, union wkssvc_NetrUseGetInfoCtr);
        if (r->out.ctr == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _wkssvc_NetrUseGetInfo(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(wkssvc_NetrUseGetInfo, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_wkssvc_NetrUseDel(pipes_struct *p)
@@ -771,67 +791,69 @@ static bool api_wkssvc_NetrUseDel(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct wkssvc_NetrUseDel *r;
-       
+
        call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRUSEDEL];
-       
+
        r = talloc(NULL, struct wkssvc_NetrUseDel);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(wkssvc_NetrUseDel, r);
-       
+       }
+
        r->out.result = _wkssvc_NetrUseDel(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(wkssvc_NetrUseDel, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_wkssvc_NetrUseEnum(pipes_struct *p)
@@ -842,76 +864,78 @@ static bool api_wkssvc_NetrUseEnum(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct wkssvc_NetrUseEnum *r;
-       
+
        call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRUSEENUM];
-       
+
        r = talloc(NULL, struct wkssvc_NetrUseEnum);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(wkssvc_NetrUseEnum, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.info = r->in.info;
        r->out.entries_read = talloc_zero(r, uint32_t);
        if (r->out.entries_read == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.resume_handle = r->in.resume_handle;
        r->out.result = _wkssvc_NetrUseEnum(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(wkssvc_NetrUseEnum, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_wkssvc_NetrMessageBufferSend(pipes_struct *p)
@@ -922,67 +946,69 @@ static bool api_wkssvc_NetrMessageBufferSend(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct wkssvc_NetrMessageBufferSend *r;
-       
+
        call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRMESSAGEBUFFERSEND];
-       
+
        r = talloc(NULL, struct wkssvc_NetrMessageBufferSend);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(wkssvc_NetrMessageBufferSend, r);
-       
+       }
+
        r->out.result = _wkssvc_NetrMessageBufferSend(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(wkssvc_NetrMessageBufferSend, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_wkssvc_NetrWorkstationStatisticsGet(pipes_struct *p)
@@ -993,74 +1019,76 @@ static bool api_wkssvc_NetrWorkstationStatisticsGet(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct wkssvc_NetrWorkstationStatisticsGet *r;
-       
+
        call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRWORKSTATIONSTATISTICSGET];
-       
+
        r = talloc(NULL, struct wkssvc_NetrWorkstationStatisticsGet);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(wkssvc_NetrWorkstationStatisticsGet, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.info = talloc_zero(r, struct wkssvc_NetrWorkstationStatistics *);
        if (r->out.info == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _wkssvc_NetrWorkstationStatisticsGet(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(wkssvc_NetrWorkstationStatisticsGet, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_wkssvc_NetrLogonDomainNameAdd(pipes_struct *p)
@@ -1071,67 +1099,69 @@ static bool api_wkssvc_NetrLogonDomainNameAdd(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct wkssvc_NetrLogonDomainNameAdd *r;
-       
+
        call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRLOGONDOMAINNAMEADD];
-       
+
        r = talloc(NULL, struct wkssvc_NetrLogonDomainNameAdd);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(wkssvc_NetrLogonDomainNameAdd, r);
-       
+       }
+
        r->out.result = _wkssvc_NetrLogonDomainNameAdd(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(wkssvc_NetrLogonDomainNameAdd, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_wkssvc_NetrLogonDomainNameDel(pipes_struct *p)
@@ -1142,67 +1172,69 @@ static bool api_wkssvc_NetrLogonDomainNameDel(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct wkssvc_NetrLogonDomainNameDel *r;
-       
+
        call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRLOGONDOMAINNAMEDEL];
-       
+
        r = talloc(NULL, struct wkssvc_NetrLogonDomainNameDel);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(wkssvc_NetrLogonDomainNameDel, r);
-       
+       }
+
        r->out.result = _wkssvc_NetrLogonDomainNameDel(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(wkssvc_NetrLogonDomainNameDel, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_wkssvc_NetrJoinDomain(pipes_struct *p)
@@ -1213,67 +1245,69 @@ static bool api_wkssvc_NetrJoinDomain(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct wkssvc_NetrJoinDomain *r;
-       
+
        call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRJOINDOMAIN];
-       
+
        r = talloc(NULL, struct wkssvc_NetrJoinDomain);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(wkssvc_NetrJoinDomain, r);
-       
+       }
+
        r->out.result = _wkssvc_NetrJoinDomain(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(wkssvc_NetrJoinDomain, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_wkssvc_NetrUnjoinDomain(pipes_struct *p)
@@ -1284,67 +1318,69 @@ static bool api_wkssvc_NetrUnjoinDomain(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct wkssvc_NetrUnjoinDomain *r;
-       
+
        call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRUNJOINDOMAIN];
-       
+
        r = talloc(NULL, struct wkssvc_NetrUnjoinDomain);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(wkssvc_NetrUnjoinDomain, r);
-       
+       }
+
        r->out.result = _wkssvc_NetrUnjoinDomain(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(wkssvc_NetrUnjoinDomain, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_wkssvc_NetrRenameMachineInDomain(pipes_struct *p)
@@ -1355,67 +1391,69 @@ static bool api_wkssvc_NetrRenameMachineInDomain(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct wkssvc_NetrRenameMachineInDomain *r;
-       
+
        call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRRENAMEMACHINEINDOMAIN];
-       
+
        r = talloc(NULL, struct wkssvc_NetrRenameMachineInDomain);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(wkssvc_NetrRenameMachineInDomain, r);
-       
+       }
+
        r->out.result = _wkssvc_NetrRenameMachineInDomain(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(wkssvc_NetrRenameMachineInDomain, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_wkssvc_NetrValidateName(pipes_struct *p)
@@ -1426,67 +1464,69 @@ static bool api_wkssvc_NetrValidateName(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct wkssvc_NetrValidateName *r;
-       
+
        call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRVALIDATENAME];
-       
+
        r = talloc(NULL, struct wkssvc_NetrValidateName);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(wkssvc_NetrValidateName, r);
-       
+       }
+
        r->out.result = _wkssvc_NetrValidateName(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(wkssvc_NetrValidateName, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_wkssvc_NetrGetJoinInformation(pipes_struct *p)
@@ -1497,75 +1537,77 @@ static bool api_wkssvc_NetrGetJoinInformation(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct wkssvc_NetrGetJoinInformation *r;
-       
+
        call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRGETJOININFORMATION];
-       
+
        r = talloc(NULL, struct wkssvc_NetrGetJoinInformation);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(wkssvc_NetrGetJoinInformation, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.name_buffer = r->in.name_buffer;
        r->out.name_type = talloc_zero(r, enum wkssvc_NetJoinStatus);
        if (r->out.name_type == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _wkssvc_NetrGetJoinInformation(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(wkssvc_NetrGetJoinInformation, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_wkssvc_NetrGetJoinableOus(pipes_struct *p)
@@ -1576,75 +1618,77 @@ static bool api_wkssvc_NetrGetJoinableOus(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct wkssvc_NetrGetJoinableOus *r;
-       
+
        call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRGETJOINABLEOUS];
-       
+
        r = talloc(NULL, struct wkssvc_NetrGetJoinableOus);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(wkssvc_NetrGetJoinableOus, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.num_ous = r->in.num_ous;
        r->out.ous = talloc_zero_array(r, const char **, *r->out.num_ous);
        if (r->out.ous == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _wkssvc_NetrGetJoinableOus(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(wkssvc_NetrGetJoinableOus, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_wkssvc_NetrJoinDomain2(pipes_struct *p)
@@ -1655,67 +1699,69 @@ static bool api_wkssvc_NetrJoinDomain2(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct wkssvc_NetrJoinDomain2 *r;
-       
+
        call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRJOINDOMAIN2];
-       
+
        r = talloc(NULL, struct wkssvc_NetrJoinDomain2);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(wkssvc_NetrJoinDomain2, r);
-       
+       }
+
        r->out.result = _wkssvc_NetrJoinDomain2(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(wkssvc_NetrJoinDomain2, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_wkssvc_NetrUnjoinDomain2(pipes_struct *p)
@@ -1726,67 +1772,69 @@ static bool api_wkssvc_NetrUnjoinDomain2(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct wkssvc_NetrUnjoinDomain2 *r;
-       
+
        call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRUNJOINDOMAIN2];
-       
+
        r = talloc(NULL, struct wkssvc_NetrUnjoinDomain2);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(wkssvc_NetrUnjoinDomain2, r);
-       
+       }
+
        r->out.result = _wkssvc_NetrUnjoinDomain2(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(wkssvc_NetrUnjoinDomain2, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_wkssvc_NetrRenameMachineInDomain2(pipes_struct *p)
@@ -1797,67 +1845,69 @@ static bool api_wkssvc_NetrRenameMachineInDomain2(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct wkssvc_NetrRenameMachineInDomain2 *r;
-       
+
        call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRRENAMEMACHINEINDOMAIN2];
-       
+
        r = talloc(NULL, struct wkssvc_NetrRenameMachineInDomain2);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(wkssvc_NetrRenameMachineInDomain2, r);
-       
+       }
+
        r->out.result = _wkssvc_NetrRenameMachineInDomain2(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(wkssvc_NetrRenameMachineInDomain2, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_wkssvc_NetrValidateName2(pipes_struct *p)
@@ -1868,67 +1918,69 @@ static bool api_wkssvc_NetrValidateName2(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct wkssvc_NetrValidateName2 *r;
-       
+
        call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRVALIDATENAME2];
-       
+
        r = talloc(NULL, struct wkssvc_NetrValidateName2);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(wkssvc_NetrValidateName2, r);
-       
+       }
+
        r->out.result = _wkssvc_NetrValidateName2(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(wkssvc_NetrValidateName2, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_wkssvc_NetrGetJoinableOus2(pipes_struct *p)
@@ -1939,75 +1991,77 @@ static bool api_wkssvc_NetrGetJoinableOus2(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct wkssvc_NetrGetJoinableOus2 *r;
-       
+
        call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRGETJOINABLEOUS2];
-       
+
        r = talloc(NULL, struct wkssvc_NetrGetJoinableOus2);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(wkssvc_NetrGetJoinableOus2, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.num_ous = r->in.num_ous;
        r->out.ous = talloc_zero_array(r, const char **, *r->out.num_ous);
        if (r->out.ous == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _wkssvc_NetrGetJoinableOus2(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(wkssvc_NetrGetJoinableOus2, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_wkssvc_NetrAddAlternateComputerName(pipes_struct *p)
@@ -2018,67 +2072,69 @@ static bool api_wkssvc_NetrAddAlternateComputerName(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct wkssvc_NetrAddAlternateComputerName *r;
-       
+
        call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRADDALTERNATECOMPUTERNAME];
-       
+
        r = talloc(NULL, struct wkssvc_NetrAddAlternateComputerName);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(wkssvc_NetrAddAlternateComputerName, r);
-       
+       }
+
        r->out.result = _wkssvc_NetrAddAlternateComputerName(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(wkssvc_NetrAddAlternateComputerName, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_wkssvc_NetrRemoveAlternateComputerName(pipes_struct *p)
@@ -2089,67 +2145,69 @@ static bool api_wkssvc_NetrRemoveAlternateComputerName(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct wkssvc_NetrRemoveAlternateComputerName *r;
-       
+
        call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRREMOVEALTERNATECOMPUTERNAME];
-       
+
        r = talloc(NULL, struct wkssvc_NetrRemoveAlternateComputerName);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(wkssvc_NetrRemoveAlternateComputerName, r);
-       
+       }
+
        r->out.result = _wkssvc_NetrRemoveAlternateComputerName(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(wkssvc_NetrRemoveAlternateComputerName, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_wkssvc_NetrSetPrimaryComputername(pipes_struct *p)
@@ -2160,67 +2218,69 @@ static bool api_wkssvc_NetrSetPrimaryComputername(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct wkssvc_NetrSetPrimaryComputername *r;
-       
+
        call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRSETPRIMARYCOMPUTERNAME];
-       
+
        r = talloc(NULL, struct wkssvc_NetrSetPrimaryComputername);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(wkssvc_NetrSetPrimaryComputername, r);
-       
+       }
+
        r->out.result = _wkssvc_NetrSetPrimaryComputername(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(wkssvc_NetrSetPrimaryComputername, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 static bool api_wkssvc_NetrEnumerateComputerNames(pipes_struct *p)
@@ -2231,74 +2291,76 @@ static bool api_wkssvc_NetrEnumerateComputerNames(pipes_struct *p)
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
        struct wkssvc_NetrEnumerateComputerNames *r;
-       
+
        call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRENUMERATECOMPUTERNAMES];
-       
+
        r = talloc(NULL, struct wkssvc_NetrEnumerateComputerNames);
        if (r == NULL) {
-               return False;
+               return false;
        }
-       
+
        if (!prs_data_blob(&p->in_data.data, &blob, r)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull = ndr_pull_init_blob(&blob, r);
        if (pull == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
        ndr_err = call->ndr_pull(pull, NDR_IN, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_IN_DEBUG(wkssvc_NetrEnumerateComputerNames, r);
-       
+       }
+
        ZERO_STRUCT(r->out);
        r->out.ctr = talloc_zero(r, struct wkssvc_ComputerNamesCtr *);
        if (r->out.ctr == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        r->out.result = _wkssvc_NetrEnumerateComputerNames(p, r);
-       
+
        if (p->rng_fault_state) {
                talloc_free(r);
-               /* Return True here, srv_pipe_hnd.c will take care */
-               return True;
+               /* Return true here, srv_pipe_hnd.c will take care */
+               return true;
        }
-       
-       if (DEBUGLEVEL >= 10)
+
+       if (DEBUGLEVEL >= 10) {
                NDR_PRINT_OUT_DEBUG(wkssvc_NetrEnumerateComputerNames, r);
-       
+       }
+
        push = ndr_push_init_ctx(r);
        if (push == NULL) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        ndr_err = call->ndr_push(push, NDR_OUT, r);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        blob = ndr_push_blob(push);
-       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) {
+       if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
                talloc_free(r);
-               return False;
+               return false;
        }
-       
+
        talloc_free(r);
-       
-       return True;
+
+       return true;
 }
 
 
index da9715072dcaf079028b2513ec29ac48b0d95360..6e6c7829a0674492f349ea92b1d0550c1813c435 100644 (file)
@@ -209,8 +209,9 @@ union srvsvc_NetSessCtr {
        struct srvsvc_NetSessCtr502 *ctr502;/* [unique,case(502)] */
 };
 
+enum srvsvc_ShareType
 #ifndef USE_UINT_ENUMS
-enum srvsvc_ShareType {
+ {
        STYPE_DISKTREE=0,
        STYPE_DISKTREE_TEMPORARY=STYPE_DISKTREE|STYPE_TEMPORARY,
        STYPE_DISKTREE_HIDDEN=STYPE_DISKTREE|STYPE_HIDDEN,
@@ -225,7 +226,7 @@ enum srvsvc_ShareType {
        STYPE_IPC_HIDDEN=STYPE_IPC|STYPE_HIDDEN
 }
 #else
-enum srvsvc_ShareType { __donnot_use_enum_srvsvc_ShareType=0x7FFFFFFF}
+ { __donnot_use_enum_srvsvc_ShareType=0x7FFFFFFF}
 #define STYPE_DISKTREE ( 0 )
 #define STYPE_DISKTREE_TEMPORARY ( STYPE_DISKTREE|STYPE_TEMPORARY )
 #define STYPE_DISKTREE_HIDDEN ( STYPE_DISKTREE|STYPE_HIDDEN )
@@ -320,8 +321,6 @@ struct srvsvc_NetShareCtr1004 {
 #define SHARE_1005_IN_DFS ( 0x00000001 )
 #define SHARE_1005_DFS_ROOT ( 0x00000002 )
 
-;
-
 struct srvsvc_NetShareInfo1005 {
        uint32_t dfs_flags;
 };
@@ -381,8 +380,9 @@ union srvsvc_NetShareCtr {
        struct srvsvc_NetShareCtr1501 *ctr1501;/* [unique,case(1501)] */
 };
 
+enum srvsvc_PlatformId
 #ifndef USE_UINT_ENUMS
-enum srvsvc_PlatformId {
+ {
        PLATFORM_ID_DOS=300,
        PLATFORM_ID_OS2=400,
        PLATFORM_ID_NT=500,
@@ -390,7 +390,7 @@ enum srvsvc_PlatformId {
        PLATFORM_ID_VMS=700
 }
 #else
-enum srvsvc_PlatformId { __donnot_use_enum_srvsvc_PlatformId=0x7FFFFFFF}
+ { __donnot_use_enum_srvsvc_PlatformId=0x7FFFFFFF}
 #define PLATFORM_ID_DOS ( 300 )
 #define PLATFORM_ID_OS2 ( 400 )
 #define PLATFORM_ID_NT ( 500 )
index e728d51f231f0ea308398b5e4bd884d010feb273..7314be0a33ee4a444e0fa7cafbefab44964ebca0 100644 (file)
@@ -68,14 +68,13 @@ struct ENUM_SERVICE_STATUS {
 #define SV_TYPE_LOCAL_LIST_ONLY ( 0x40000000 )
 #define SV_TYPE_DOMAIN_ENUM ( 0x80000000 )
 
-;
-
+enum SERVICE_CONTROL
 #ifndef USE_UINT_ENUMS
-enum SERVICE_CONTROL {
+ {
        FIXME=1
 }
 #else
-enum SERVICE_CONTROL { __donnot_use_enum_SERVICE_CONTROL=0x7FFFFFFF}
+ { __donnot_use_enum_SERVICE_CONTROL=0x7FFFFFFF}
 #define FIXME ( 1 )
 #endif
 ;
index 37a472814af6680cceea0a5fb0f80ca5806be3ad..5570b310cd04decd5b78d057e08fc8109095dcaf 100644 (file)
 #define KEY_WOW64_64KEY ( 0x00100 )
 #define KEY_WOW64_32KEY ( 0x00200 )
 
-;
-
+enum winreg_Type
 #ifndef USE_UINT_ENUMS
-enum winreg_Type {
+ {
        REG_NONE=0,
        REG_SZ=1,
        REG_EXPAND_SZ=2,
@@ -36,7 +35,7 @@ enum winreg_Type {
        REG_QWORD=11
 }
 #else
-enum winreg_Type { __donnot_use_enum_winreg_Type=0x7FFFFFFF}
+ { __donnot_use_enum_winreg_Type=0x7FFFFFFF}
 #define REG_NONE ( 0 )
 #define REG_SZ ( 1 )
 #define REG_EXPAND_SZ ( 2 )
@@ -70,14 +69,15 @@ struct winreg_SecBuf {
        uint8_t inherit;
 };
 
+enum winreg_CreateAction
 #ifndef USE_UINT_ENUMS
-enum winreg_CreateAction {
+ {
        REG_ACTION_NONE=0,
        REG_CREATED_NEW_KEY=1,
        REG_OPENED_EXISTING_KEY=2
 }
 #else
-enum winreg_CreateAction { __donnot_use_enum_winreg_CreateAction=0x7FFFFFFF}
+ { __donnot_use_enum_winreg_CreateAction=0x7FFFFFFF}
 #define REG_ACTION_NONE ( 0 )
 #define REG_CREATED_NEW_KEY ( 1 )
 #define REG_OPENED_EXISTING_KEY ( 2 )
index 43f9ae6d635d0edd6131802e4b0a2f70e28dc59d..cdbf8516716e08bc82acfd1c22ea4f83da5a7129 100644 (file)
@@ -7,6 +7,8 @@
 #ifndef _HEADER_wkssvc
 #define _HEADER_wkssvc
 
+enum srvsvc_PlatformId;
+
 struct wkssvc_NetWkstaInfo100 {
        enum srvsvc_PlatformId platform_id;
        const char *server_name;/* [unique,charset(UTF16)] */
@@ -413,10 +415,9 @@ struct wkssvc_NetrWorkstationStatistics {
 /* bitmap wkssvc_renameflags */
 #define WKSSVC_JOIN_FLAGS_ACCOUNT_CREATE ( 0x00000002 )
 
-;
-
+enum wkssvc_NetValidateNameType
 #ifndef USE_UINT_ENUMS
-enum wkssvc_NetValidateNameType {
+ {
        NetSetupUnknown=0,
        NetSetupMachine=1,
        NetSetupWorkgroup=2,
@@ -425,7 +426,7 @@ enum wkssvc_NetValidateNameType {
        NetSetupDnsMachine=5
 }
 #else
-enum wkssvc_NetValidateNameType { __donnot_use_enum_wkssvc_NetValidateNameType=0x7FFFFFFF}
+ { __donnot_use_enum_wkssvc_NetValidateNameType=0x7FFFFFFF}
 #define NetSetupUnknown ( 0 )
 #define NetSetupMachine ( 1 )
 #define NetSetupWorkgroup ( 2 )
@@ -435,15 +436,16 @@ enum wkssvc_NetValidateNameType { __donnot_use_enum_wkssvc_NetValidateNameType=0
 #endif
 ;
 
+enum wkssvc_NetJoinStatus
 #ifndef USE_UINT_ENUMS
-enum wkssvc_NetJoinStatus {
+ {
        NetSetupUnknownStatus=0,
        NetSetupUnjoined=1,
        NetSetupWorkgroupName=2,
        NetSetupDomainName=3
 }
 #else
-enum wkssvc_NetJoinStatus { __donnot_use_enum_wkssvc_NetJoinStatus=0x7FFFFFFF}
+ { __donnot_use_enum_wkssvc_NetJoinStatus=0x7FFFFFFF}
 #define NetSetupUnknownStatus ( 0 )
 #define NetSetupUnjoined ( 1 )
 #define NetSetupWorkgroupName ( 2 )
@@ -467,17 +469,16 @@ struct wkssvc_PasswordBuffer {
 #define WKSSVC_JOIN_FLAGS_ACCOUNT_CREATE ( 0x00000002 )
 #define WKSSVC_JOIN_FLAGS_JOIN_TYPE ( 0x00000001 )
 
-;
-
+enum wkssvc_ComputerNameType
 #ifndef USE_UINT_ENUMS
-enum wkssvc_ComputerNameType {
+ {
        NetPrimaryComputerName=0,
        NetAlternateComputerNames=1,
        NetAllComputerNames=2,
        NetComputerNameTypeMax=3
 }
 #else
-enum wkssvc_ComputerNameType { __donnot_use_enum_wkssvc_ComputerNameType=0x7FFFFFFF}
+ { __donnot_use_enum_wkssvc_ComputerNameType=0x7FFFFFFF}
 #define NetPrimaryComputerName ( 0 )
 #define NetAlternateComputerNames ( 1 )
 #define NetAllComputerNames ( 2 )
diff --git a/source/librpc/gen_ndr/xattr.h b/source/librpc/gen_ndr/xattr.h
new file mode 100644 (file)
index 0000000..ee30376
--- /dev/null
@@ -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 */
index 2b519b15d5b11cdd5393da51160f043df1476427..d4c05f9936a33b68d0e04f0b95ce7fc1c55e4891 100644 (file)
@@ -5,7 +5,8 @@
 [ uuid("4fc742e0-4a10-11cf-8273-00aa004ae673"),
   version(3.0),
   pointer_default(unique),
-  helpstring("Settings for Microsoft Distributed File System")
+  helpstring("Settings for Microsoft Distributed File System"),
+  endpoint("ncacn_np:[\\pipe\\netdfs]", "ncacn_ip_tcp:", "ncalrpc:")
 ] interface netdfs
 {
        /******************/
                [string,charset(UTF16)] uint16 *path;
        } dfs_Info1;
 
-       /* first 4 bits unverified yet */
        typedef [public,bitmap32bit] bitmap {
                DFS_VOLUME_STATE_OK             = 0x1,
                DFS_VOLUME_STATE_INCONSISTENT   = 0x2,
-               DFS_VOLUME_STATE_OFFLINE        = 0x4,
-               DFS_VOLUME_STATE_ONLINE         = 0x8,
+               DFS_VOLUME_STATE_OFFLINE        = 0x3,
+               DFS_VOLUME_STATE_ONLINE         = 0x4,
                DFS_VOLUME_STATE_STANDALONE     = DFS_VOLUME_FLAVOR_STANDALONE,
                DFS_VOLUME_STATE_AD_BLOB        = DFS_VOLUME_FLAVOR_AD_BLOB
        } dfs_VolumeState;
                [size_is(count)] dfs_Info4 *s;
        } dfs_EnumArray4;
 
+       typedef struct {
+               uint32 count;
+               [size_is(count)] dfs_Info5 *s;
+       } dfs_EnumArray5;
+
+       typedef struct {
+               uint32 count;
+               [size_is(count)] dfs_Info6 *s;
+       } dfs_EnumArray6;
+
        typedef struct {
                uint32 count;
                [size_is(count)] dfs_Info200 *s;
                [case(2)] dfs_EnumArray2 *info2;
                [case(3)] dfs_EnumArray3 *info3;
                [case(4)] dfs_EnumArray4 *info4;
+               [case(5)] dfs_EnumArray5 *info5;
+               [case(6)] dfs_EnumArray6 *info6;
                [case(200)] dfs_EnumArray200 *info200;
                [case(300)] dfs_EnumArray300 *info300;
        } dfs_EnumInfo;
                );
 
        /* Function 0x10 */
-       WERROR dfs_GetDcAddress();
+       WERROR dfs_GetDcAddress(
+               [in]            [string,charset(UTF16)] uint16 servername[],
+               [in,out,ref]    [string,charset(UTF16)] uint16 **server_fullname,
+               [in,out,ref]    boolean8 *is_root,
+               [in,out,ref]    uint32 *ttl
+               );
 
        /* Function 0x11 */
-       WERROR dfs_SetDcAddress();
+       WERROR dfs_SetDcAddress(
+               [in]            [string,charset(UTF16)] uint16 servername[],
+               [in]            [string,charset(UTF16)] uint16 server_fullname[],
+               [in]            uint32  flags,
+               [in]            uint32  ttl
+               );
 
        /* Function 0x12 */
        WERROR dfs_FlushFtTable(
diff --git a/source/librpc/idl/dssetup.idl b/source/librpc/idl/dssetup.idl
new file mode 100644 (file)
index 0000000..af6350c
--- /dev/null
@@ -0,0 +1,101 @@
+/*
+  dssetup interface definition
+*/
+
+import "misc.idl";
+
+[
+       uuid("3919286a-b10c-11d0-9ba8-00c04fd92ef5"),
+       version(0.0),
+       endpoint("ncacn_np:[\\pipe\\lsarpc]", "ncacn_np:[\\pipe\\lsass]", "ncacn_ip_tcp:", "ncalrpc:"),
+       pointer_default(unique),
+       helpstring("Active Directory Setup")
+] interface dssetup
+{
+       /**********************************************/
+       /* Function 0x00                              */
+
+       typedef enum {
+               DS_ROLE_STANDALONE_WORKSTATION = 0,
+               DS_ROLE_MEMBER_WORKSTATION     = 1,
+               DS_ROLE_STANDALONE_SERVER      = 2,
+               DS_ROLE_MEMBER_SERVER          = 3,
+               DS_ROLE_BACKUP_DC              = 4,
+               DS_ROLE_PRIMARY_DC             = 5
+       } dssetup_DsRole;
+
+       typedef [bitmap32bit] bitmap {
+               DS_ROLE_PRIMARY_DS_RUNNING              = 0x00000001,
+               DS_ROLE_PRIMARY_DS_MIXED_MODE           = 0x00000002,
+               DS_ROLE_UPGRADE_IN_PROGRESS             = 0x00000004,
+               DS_ROLE_PRIMARY_DOMAIN_GUID_PRESENT     = 0x01000000
+       } dssetup_DsRoleFlags;
+
+       typedef struct {
+               dssetup_DsRole          role;
+               dssetup_DsRoleFlags     flags;
+               [charset(UTF16),string] uint16                  *domain;
+               [charset(UTF16),string] uint16                  *dns_domain;
+               [charset(UTF16),string] uint16                  *forest;
+               GUID                    domain_guid;
+       } dssetup_DsRolePrimaryDomInfoBasic;
+
+       typedef [v1_enum] enum {
+               DS_ROLE_NOT_UPGRADING = 0,
+               DS_ROLE_UPGRADING     = 1
+       } dssetup_DsUpgrade;
+
+       typedef enum {
+               DS_ROLE_PREVIOUS_UNKNOWN = 0,
+               DS_ROLE_PREVIOUS_PRIMARY = 1,
+               DS_ROLE_PREVIOUS_BACKUP  = 2
+       } dssetup_DsPrevious;
+
+       typedef struct {
+               dssetup_DsUpgrade       upgrading;
+               dssetup_DsPrevious      previous_role;
+       } dssetup_DsRoleUpgradeStatus;
+
+       typedef enum {
+               DS_ROLE_OP_IDLE         = 0,
+               DS_ROLE_OP_ACTIVE       = 1,
+               DS_ROLE_OP_NEEDS_REBOOT = 2
+       } dssetup_DsRoleOp;
+
+       typedef struct {
+               dssetup_DsRoleOp status;
+       } dssetup_DsRoleOpStatus;
+
+       typedef enum {
+               DS_ROLE_BASIC_INFORMATION       = 1,
+               DS_ROLE_UPGRADE_STATUS          = 2,
+               DS_ROLE_OP_STATUS               = 3
+       } dssetup_DsRoleInfoLevel;
+
+       typedef [switch_type(dssetup_DsRoleInfoLevel)] union {
+               [case(DS_ROLE_BASIC_INFORMATION)] dssetup_DsRolePrimaryDomInfoBasic     basic;
+               [case(DS_ROLE_UPGRADE_STATUS)]    dssetup_DsRoleUpgradeStatus           upgrade;
+               [case(DS_ROLE_OP_STATUS)]         dssetup_DsRoleOpStatus                opstatus;
+       } dssetup_DsRoleInfo;
+
+       WERROR dssetup_DsRoleGetPrimaryDomainInformation(
+               [in] dssetup_DsRoleInfoLevel level,
+               [out,switch_is(level),unique] dssetup_DsRoleInfo *info
+               );
+
+       /*
+         w2k3 has removed all the calls below from their implementation.
+         These stubs are left here only as a way of documenting the names
+         of the calls in case they ever turn up on the wire.
+       */
+       WERROR dssetup_DsRoleDnsNameToFlatName();
+       WERROR dssetup_DsRoleDcAsDc();
+       WERROR dssetup_DsRoleDcAsReplica();
+       WERROR dssetup_DsRoleDemoteDc();
+       WERROR dssetup_DsRoleGetDcOperationProgress();
+       WERROR dssetup_DsRoleGetDcOperationResults();
+       WERROR dssetup_DsRoleCancel();
+       WERROR dssetup_DsRoleServerSaveStateForUpgrade();
+       WERROR dssetup_DsRoleUpgradeDownlevelServer();
+       WERROR dssetup_DsRoleAbortDownlevelServerUpgrade();
+}
index fa030be761c8557db970861a9379f37b95e07eaa..5ea37f1ac1940cc22d0801f87b8075f15154826e 100644 (file)
@@ -50,9 +50,9 @@ interface rpcecho
                uint32 v;
        } echo_info3;
 
-       typedef struct {
+       struct echo_info4 {
                hyper v;
-       } echo_info4;
+       };
 
        typedef struct {
                uint8 v1;
@@ -66,14 +66,14 @@ interface rpcecho
 
        typedef struct {
                uint8 v1;
-               echo_info4 info4;
+               struct echo_info4 info4;
        } echo_info7;
 
        typedef [switch_type(uint16)] union {
                [case(1)]  echo_info1 info1;
                [case(2)]  echo_info2 info2;
                [case(3)]  echo_info3 info3;
-               [case(4)]  echo_info4 info4;
+               [case(4)]  struct echo_info4 info4;
                [case(5)]  echo_info5 info5;
                [case(6)]  echo_info6 info6;
                [case(7)]  echo_info7 info7;
index e088137ccfaabbf344b6634e0c3f5a3606cf74c3..3defd99400bcba78d58ef4658ac197217d91bc49 100644 (file)
@@ -3,6 +3,7 @@
 /*
   eventlog interface definition
 */
+
 import "lsa.idl", "security.idl";
 
 [ uuid("82273fdc-e32a-18c3-3f78-827929dc23ea"),
@@ -80,7 +81,7 @@ import "lsa.idl", "security.idl";
        /* Function: 0x04 */
        NTSTATUS eventlog_GetNumRecords(
                [in] policy_handle *handle,
-               [out,ref] uint32 *number
+               [out] uint32 *number
        );
 
        /******************/
@@ -118,8 +119,8 @@ import "lsa.idl", "security.idl";
                [in] uint32 offset,
                [in] uint32 number_of_bytes,
                [out,size_is(number_of_bytes)] uint8 *data,
-               [out,ref] uint32 *sent_size,
-               [out,ref] uint32 *real_size
+               [out] uint32 *sent_size,
+               [out] uint32 *real_size
        );
 
        /*****************/
index 50d49637c2e65d87234c022b902fe6888afbcbef..868e48e28a9efcce4683d10e92c8d54b94d4ea90 100644 (file)
@@ -18,8 +18,8 @@
        } initshutdown_String_sub;
 
        typedef [public] struct {
-               [value(strlen_m(r->name->name)*2)] uint16 name_len;
-               [value(strlen_m_term(r->name->name)*2)] uint16 name_size;
+               [value(strlen_m(name->name)*2)] uint16 name_len;
+               [value(strlen_m_term(name->name)*2)] uint16 name_size;
                initshutdown_String_sub *name;
        } initshutdown_String;
 
diff --git a/source/librpc/idl/libnet_join.idl b/source/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 556ab21af48dfd80fa43a7c65263ce8552e90db9..8d26ec0aad2719dd6316c6ac1eefb0f750b6afc3 100644 (file)
@@ -13,7 +13,7 @@ import "security.idl";
   helpstring("Local Security Authority")
 ] interface lsarpc
 {
-       declare bitmap security_secinfo;
+       typedef bitmap security_secinfo security_secinfo;
 
        typedef [public,noejs] struct {
                [value(2*strlen_m(string))] uint16 length;
@@ -47,7 +47,7 @@ import "security.idl";
 
        /******************/
        /* Function: 0x01 */
-       NTSTATUS lsa_Delete (
+       [public] NTSTATUS lsa_Delete (
                [in]     policy_handle *handle
                );
 
@@ -69,7 +69,7 @@ import "security.idl";
                [size_is(count)] lsa_PrivEntry *privs;
        } lsa_PrivArray;
 
-       NTSTATUS lsa_EnumPrivs (
+       [public] NTSTATUS lsa_EnumPrivs (
                [in]     policy_handle *handle,
                [in,out] uint32 *resume_handle,
                [in]         uint32 max_count,
@@ -116,7 +116,7 @@ import "security.idl";
 
        /* notice the screwup with the system_name - thats why MS created
           OpenPolicy2 */
-       NTSTATUS lsa_OpenPolicy (
+       [public] NTSTATUS lsa_OpenPolicy (
                [in,unique]       uint16 *system_name,
                [in]   lsa_ObjectAttribute *attr,
                [in]       uint32 access_mask,
@@ -138,9 +138,29 @@ import "security.idl";
                uint32 unknown;
        } lsa_AuditLogInfo;
 
+       typedef [v1_enum] enum {
+               LSA_AUDIT_POLICY_NONE=0,
+               LSA_AUDIT_POLICY_SUCCESS=1,
+               LSA_AUDIT_POLICY_FAILURE=2,
+               LSA_AUDIT_POLICY_ALL=(LSA_AUDIT_POLICY_SUCCESS|LSA_AUDIT_POLICY_FAILURE),
+               LSA_AUDIT_POLICY_CLEAR=4
+       } lsa_PolicyAuditPolicy;
+
+       typedef enum {
+               LSA_AUDIT_CATEGORY_SYSTEM = 0,
+               LSA_AUDIT_CATEGORY_LOGON = 1,
+               LSA_AUDIT_CATEGORY_FILE_AND_OBJECT_ACCESS = 2,
+               LSA_AUDIT_CATEGORY_USE_OF_USER_RIGHTS = 3,
+               LSA_AUDIT_CATEGORY_PROCCESS_TRACKING = 4,
+               LSA_AUDIT_CATEGORY_SECURITY_POLICY_CHANGES = 5,
+               LSA_AUDIT_CATEGORY_ACCOUNT_MANAGEMENT = 6,
+               LSA_AUDIT_CATEGORY_DIRECTORY_SERVICE_ACCESS = 7,        /* only in win2k/2k3 */
+               LSA_AUDIT_CATEGORY_ACCOUNT_LOGON = 8                    /* only in win2k/2k3 */
+       } lsa_PolicyAuditEventType;
+
        typedef struct {
                uint32 auditing_mode;
-               [size_is(count)] uint32 *settings;
+               [size_is(count)] lsa_PolicyAuditPolicy *settings;
                uint32 count;
        } lsa_AuditEventsInfo;
 
@@ -214,7 +234,7 @@ import "security.idl";
                LSA_POLICY_INFO_AUDIT_FULL_SET=10,
                LSA_POLICY_INFO_AUDIT_FULL_QUERY=11,
                LSA_POLICY_INFO_DNS=12
-       } lsaPolicyInfo;
+       } lsa_PolicyInfo;
 
        typedef [switch_type(uint16)] union {
                [case(LSA_POLICY_INFO_AUDIT_LOG)]        lsa_AuditLogInfo       audit_log;
@@ -233,13 +253,17 @@ import "security.idl";
 
        NTSTATUS lsa_QueryInfoPolicy (
                [in]                            policy_handle *handle,
-               [in]                            uint16 level,
+               [in]                            lsa_PolicyInfo level,
                [out,unique,switch_is(level)]   lsa_PolicyInformation *info
                );
 
        /******************/
        /* Function:       0x08 */
-       NTSTATUS lsa_SetInfoPolicy ();
+       NTSTATUS lsa_SetInfoPolicy (
+               [in]                            policy_handle *handle,
+               [in]                            lsa_PolicyInfo level,
+               [in,switch_is(level)]           lsa_PolicyInformation *info
+               );
 
        /******************/
        /* Function:       0x09 */
@@ -247,7 +271,7 @@ import "security.idl";
 
        /******************/
        /* Function: 0x0a */
-       NTSTATUS lsa_CreateAccount (
+       [public] NTSTATUS lsa_CreateAccount (
                [in]    policy_handle *handle,
                [in]    dom_sid2 *sid,
                [in]    uint32 access_mask,
@@ -268,7 +292,7 @@ import "security.idl";
                [size_is(num_sids)] lsa_SidPtr *sids;
        } lsa_SidArray;
 
-       NTSTATUS lsa_EnumAccounts (
+       [public] NTSTATUS lsa_EnumAccounts (
                [in]         policy_handle *handle,
                [in,out]     uint32 *resume_handle,
                [in,range(0,8192)] uint32 num_entries,
@@ -279,7 +303,7 @@ import "security.idl";
        /*************************************************/
        /* Function: 0x0c                                */
 
-       NTSTATUS lsa_CreateTrustedDomain(
+       [public] NTSTATUS lsa_CreateTrustedDomain(
                [in]         policy_handle *handle,
                [in]         lsa_DomainInfo *info,
                [in]         uint32 access_mask,
@@ -301,7 +325,7 @@ import "security.idl";
        NTSTATUS lsa_EnumTrustDom (
                [in]               policy_handle *handle,
                [in,out]           uint32 *resume_handle,
-               [in,range(0,1000)] uint32 max_size,
+               [in]               uint32 max_size,
                [out]              lsa_DomainList *domains
                );
 
@@ -339,13 +363,30 @@ import "security.idl";
                uint32 max_size;
        } lsa_RefDomainList;
 
-       NTSTATUS lsa_LookupNames (
+       /* Level 1: Ask everywhere
+        * Level 2: Ask domain and trusted domains, no builtin and wkn
+        * Level 3: Only ask domain
+        * Level 4: W2k3ad: Only ask AD trusts
+        * Level 5: Only ask transitive forest trusts
+        * Level 6: Like 4
+        */
+
+       typedef enum {
+               LSA_LOOKUP_NAMES_ALL = 1,
+               LSA_LOOKUP_NAMES_DOMAINS_ONLY = 2,
+               LSA_LOOKUP_NAMES_PRIMARY_DOMAIN_ONLY = 3,
+               LSA_LOOKUP_NAMES_UPLEVEL_TRUSTS_ONLY = 4,
+               LSA_LOOKUP_NAMES_FOREST_TRUSTS_ONLY = 5,
+               LSA_LOOKUP_NAMES_UPLEVEL_TRUSTS_ONLY2 = 6
+       } lsa_LookupNamesLevel;
+
+       [public] NTSTATUS lsa_LookupNames (
                [in]         policy_handle *handle,
                [in,range(0,1000)] uint32 num_names,
                [in,size_is(num_names)]  lsa_String names[],
                [out,unique] lsa_RefDomainList *domains,
                [in,out]     lsa_TransSidArray *sids,
-               [in]         uint16 level,
+               [in]         lsa_LookupNamesLevel level,
                [in,out]     uint32 *count
                );
 
@@ -364,7 +405,7 @@ import "security.idl";
                [size_is(count)] lsa_TranslatedName *names;
        } lsa_TransNameArray;
 
-       NTSTATUS lsa_LookupSids (
+       [public] NTSTATUS lsa_LookupSids (
                [in]         policy_handle *handle,
                [in]         lsa_SidArray *sids,
                [out,unique]        lsa_RefDomainList *domains,
@@ -375,7 +416,7 @@ import "security.idl";
 
 
        /* Function:        0x10 */
-       NTSTATUS lsa_CreateSecret(
+       [public] NTSTATUS lsa_CreateSecret(
                [in]         policy_handle *handle,
                [in]         lsa_String       name,
                [in]         uint32         access_mask,
@@ -555,7 +596,7 @@ import "security.idl";
        NTSTATUS lsa_SetInformationTrustedDomain();
 
        /* Function:          0x1c */
-       NTSTATUS lsa_OpenSecret(
+       [public] NTSTATUS lsa_OpenSecret(
                [in]     policy_handle    *handle,
                [in]         lsa_String        name,
                [in]         uint32            access_mask,
@@ -564,7 +605,7 @@ import "security.idl";
 
        /* Function:           0x1d */
 
-       NTSTATUS lsa_SetSecret(
+       [public] NTSTATUS lsa_SetSecret(
                [in]     policy_handle    *sec_handle,
                [in,unique]         lsa_DATA_BUF     *new_val,
                [in,unique]         lsa_DATA_BUF     *old_val
@@ -575,7 +616,7 @@ import "security.idl";
        } lsa_DATA_BUF_PTR;
 
        /* Function:         0x1e */
-       NTSTATUS lsa_QuerySecret (
+       [public] NTSTATUS lsa_QuerySecret (
                [in]     policy_handle     *sec_handle,
                [in,out,unique]     lsa_DATA_BUF_PTR  *new_val,
                [in,out,unique]     NTTIME_hyper      *new_mtime,
@@ -681,7 +722,7 @@ import "security.idl";
 
        /**********************/
        /* Function:     0x2c */
-       NTSTATUS lsa_OpenPolicy2 (
+       [public] NTSTATUS lsa_OpenPolicy2 (
                [in,unique]      [string,charset(UTF16)] uint16 *system_name,
                [in]  lsa_ObjectAttribute *attr,
                [in]      uint32 access_mask,
@@ -705,12 +746,16 @@ import "security.idl";
 
        NTSTATUS lsa_QueryInfoPolicy2(
                [in]                 policy_handle *handle,
-               [in]                     uint16 level,
+               [in]                     lsa_PolicyInfo level,
                [out,unique,switch_is(level)]   lsa_PolicyInformation *info
                );
 
        /* Function 0x2f */
-       NTSTATUS lsa_SetInfoPolicy2();
+       NTSTATUS lsa_SetInfoPolicy2(
+               [in]                            policy_handle *handle,
+               [in]                            lsa_PolicyInfo level,
+               [in,switch_is(level)]           lsa_PolicyInformation *info
+               );
 
        /**********************/
        /* Function 0x30 */
@@ -824,7 +869,7 @@ import "security.idl";
                [size_is(count)] lsa_TranslatedName2 *names;
        } lsa_TransNameArray2;
 
-       NTSTATUS lsa_LookupSids2(
+       [public] NTSTATUS lsa_LookupSids2(
                [in]     policy_handle *handle,
                [in]     lsa_SidArray *sids,
                [out,unique]        lsa_RefDomainList *domains,
@@ -850,13 +895,13 @@ import "security.idl";
                [size_is(count)] lsa_TranslatedSid2 *sids;
        } lsa_TransSidArray2;
 
-       NTSTATUS lsa_LookupNames2 (
+       [public] NTSTATUS lsa_LookupNames2 (
                [in]     policy_handle *handle,
                [in,range(0,1000)] uint32 num_names,
                [in,size_is(num_names)]  lsa_String names[],
                [out,unique]        lsa_RefDomainList *domains,
                [in,out] lsa_TransSidArray2 *sids,
-               [in]         uint16 level,
+               [in]         lsa_LookupNamesLevel level,
                [in,out] uint32 *count,
                [in]         uint32 unknown1,
                [in]         uint32 unknown2
@@ -903,13 +948,13 @@ import "security.idl";
                [size_is(count)] lsa_TranslatedSid3 *sids;
        } lsa_TransSidArray3;
 
-       NTSTATUS lsa_LookupNames3 (
+       [public] NTSTATUS lsa_LookupNames3 (
                [in]     policy_handle *handle,
                [in,range(0,1000)] uint32 num_names,
                [in,size_is(num_names)]  lsa_String names[],
                [out,unique]        lsa_RefDomainList *domains,
                [in,out] lsa_TransSidArray3 *sids,
-               [in]         uint16 level,
+               [in]         lsa_LookupNamesLevel level,
                [in,out] uint32 *count,
                [in]         uint32 unknown1,
                [in]         uint32 unknown2
@@ -928,7 +973,49 @@ import "security.idl";
        NTSTATUS lsa_LSARUNREGISTERAUDITEVENT();
 
        /* Function 0x49 */
-       NTSTATUS lsa_LSARQUERYFORESTTRUSTINFORMATION();
+       typedef struct {
+               [range(0,131072)] uint32 length;
+               [size_is(length)] uint8 *data;
+       } lsa_ForestTrustBinaryData;
+
+       typedef struct {
+               dom_sid2 *domain_sid;
+               lsa_StringLarge dns_domain_name;
+               lsa_StringLarge netbios_domain_name;
+       } lsa_ForestTrustDomainInfo;
+
+       typedef [switch_type(uint32)] union {
+               [case(LSA_FOREST_TRUST_TOP_LEVEL_NAME)] lsa_String top_level_name;
+               [case(LSA_FOREST_TRUST_TOP_LEVEL_NAME_EX)] lsa_StringLarge top_level_name_ex;
+               [case(LSA_FOREST_TRUST_DOMAIN_INFO)] lsa_ForestTrustDomainInfo domain_info;
+               [default] lsa_ForestTrustBinaryData data;
+       } lsa_ForestTrustData;
+
+       typedef [v1_enum] enum {
+               LSA_FOREST_TRUST_TOP_LEVEL_NAME = 0,
+               LSA_FOREST_TRUST_TOP_LEVEL_NAME_EX = 1,
+               LSA_FOREST_TRUST_DOMAIN_INFO = 2,
+               LSA_FOREST_TRUST_RECORD_TYPE_LAST = 3
+       } lsa_ForestTrustRecordType;
+
+       typedef struct {
+               uint32 flags;
+               lsa_ForestTrustRecordType level;
+               hyper unknown;
+               [switch_is(level)] lsa_ForestTrustData forest_trust_data;
+       } lsa_ForestTrustRecord;
+
+       typedef [public] struct {
+               [range(0,4000)] uint32 count;
+               [size_is(count)] lsa_ForestTrustRecord **entries;
+       } lsa_ForestTrustInformation;
+
+       NTSTATUS lsa_lsaRQueryForestTrustInformation(
+               [in] policy_handle *handle,
+               [in,ref] lsa_String *trusted_domain_name,
+               [in] uint16 unknown, /* level ? */
+               [out,ref] lsa_ForestTrustInformation **forest_trust_info
+               );
 
        /* Function 0x4a */
        NTSTATUS lsa_LSARSETFORESTTRUSTINFORMATION();
@@ -939,7 +1026,7 @@ import "security.idl";
        /*****************/
        /* Function 0x4c */
 
-       NTSTATUS lsa_LookupSids3(
+       [public] NTSTATUS lsa_LookupSids3(
                [in]         lsa_SidArray *sids,
                [out,unique] lsa_RefDomainList *domains,
                [in,out]     lsa_TransNameArray2 *names,
@@ -955,7 +1042,7 @@ import "security.idl";
                [in,size_is(num_names)]  lsa_String names[],
                [out,unique]        lsa_RefDomainList *domains,
                [in,out] lsa_TransSidArray3 *sids,
-               [in]         uint16 level,
+               [in]         lsa_LookupNamesLevel level,
                [in,out] uint32 *count,
                [in]         uint32 unknown1,
                [in]         uint32 unknown2
index ae098d09acaf5125eee48c905c3a4b52bb61b98b..132a81f138399b4c010fc0cdd5d60596f958120c 100644 (file)
@@ -45,8 +45,7 @@ interface misc
        typedef [public,v1_enum] enum {
                SAMR_REJECT_OTHER      = 0,
                SAMR_REJECT_TOO_SHORT  = 1,
-               SAMR_REJECT_COMPLEXITY = 2
+               SAMR_REJECT_IN_HISTORY = 2,
+               SAMR_REJECT_COMPLEXITY = 5
        } samr_RejectReason;
-
-
 }
index 139975fe12840f6d3cf3f80e38d2cdd9a476aec4..4eb1bff94f96df78630f9ec2090d113e26686773 100644 (file)
@@ -4,10 +4,9 @@
   who contributed!
 */
 
-#include "idl_types.h"
-
 import "lsa.idl", "samr.idl", "security.idl";
 
+#include "idl_types.h"
 
 [
   uuid("12345678-1234-abcd-ef00-01234567cffb"),
@@ -19,7 +18,8 @@ import "lsa.idl", "samr.idl", "security.idl";
 
 interface netlogon
 {
-       declare bitmap samr_AcctFlags;
+       typedef bitmap samr_AcctFlags samr_AcctFlags;
+       typedef bitmap samr_GroupAttrs samr_GroupAttrs;
 
        /*****************/
        /* Function 0x00 */
@@ -47,7 +47,7 @@ interface netlogon
                [in]   [string,charset(UTF16)] uint16 *server_name,
                [in]   [string,charset(UTF16)] uint16 account_name[],
                [in]   [string,charset(UTF16)] uint16 workstation[],
-               [out]  netr_UasInfo *info
+               [out,ref]  netr_UasInfo *info
                );
 
 
@@ -87,13 +87,18 @@ interface netlogon
                [size_is(size/2),length_is(length/2)] uint16 *bindata;
        } netr_AcctLockStr;
 
-       const int MSV1_0_CLEARTEXT_PASSWORD_ALLOWED = 0x002;
-       const int MSV1_0_ALLOW_SERVER_TRUST_ACCOUNT = 0x020;
-       const int MSV1_0_ALLOW_WORKSTATION_TRUST_ACCOUNT = 0x800;
+       typedef [public,bitmap32bit] bitmap {
+               MSV1_0_CLEARTEXT_PASSWORD_ALLOWED       = 0x00000002,
+               MSV1_0_UPDATE_LOGON_STATISTICS          = 0x00000004,
+               MSV1_0_RETURN_USER_PARAMETERS           = 0x00000008,
+               MSV1_0_ALLOW_SERVER_TRUST_ACCOUNT       = 0x00000020,
+               MSV1_0_RETURN_PROFILE_PATH              = 0x00000200,
+               MSV1_0_ALLOW_WORKSTATION_TRUST_ACCOUNT  = 0x00000800
+       } netr_LogonParameterControl;
 
        typedef struct {
                lsa_String  domain_name;
-               uint32      parameter_control; /* see MSV1_0_* */
+               netr_LogonParameterControl parameter_control; /* see MSV1_0_* */
                uint32      logon_id_low;
                uint32      logon_id_high;
                lsa_String  account_name;
@@ -127,11 +132,6 @@ interface netlogon
                [case(6)] netr_NetworkInfo  *network;
        } netr_LogonLevel;
 
-       typedef [public] struct {
-               uint32 rid;
-               uint32 attributes;
-       } netr_GroupMembership;
-
        typedef [public,flag(NDR_PAHEX)] struct {
                uint8 key[16];
        } netr_UserSessionKey;
@@ -142,16 +142,17 @@ interface netlogon
 
        /* Flags for user_flags below */
        typedef [public,bitmap32bit] bitmap {
-               NETLOGON_GUEST                  = 0x0001,
-               NETLOGON_NOENCRYPTION           = 0x0002,
-               NETLOGON_CACHED_ACCOUNT         = 0x0004,
-               NETLOGON_USED_LM_PASSWORD       = 0x0008,
-               NETLOGON_EXTRA_SIDS             = 0x0020,
-               NETLOGON_SUBAUTH_SESSION_KEY    = 0x0040,
-               NETLOGON_SERVER_TRUST_ACCOUNT   = 0x0080,
-               NETLOGON_NTLMV2_ENABLED         = 0x0100,
-               NETLOGON_RESOURCE_GROUPS        = 0x0200,
-               NETLOGON_PROFILE_PATH_RETURNED  = 0x0400
+               NETLOGON_GUEST                  = 0x00000001,
+               NETLOGON_NOENCRYPTION           = 0x00000002,
+               NETLOGON_CACHED_ACCOUNT         = 0x00000004,
+               NETLOGON_USED_LM_PASSWORD       = 0x00000008,
+               NETLOGON_EXTRA_SIDS             = 0x00000020,
+               NETLOGON_SUBAUTH_SESSION_KEY    = 0x00000040,
+               NETLOGON_SERVER_TRUST_ACCOUNT   = 0x00000080,
+               NETLOGON_NTLMV2_ENABLED         = 0x00000100,
+               NETLOGON_RESOURCE_GROUPS        = 0x00000200,
+               NETLOGON_PROFILE_PATH_RETURNED  = 0x00000400,
+               NETLOGON_GRACE_LOGON            = 0x01000000
        } netr_UserFlags;
 
        typedef struct {
@@ -188,7 +189,7 @@ interface netlogon
 
        typedef struct {
                dom_sid2 *sid;
-               uint32 attribute;
+               samr_GroupAttrs attributes;
        } netr_SidAttr;
 
        typedef [public] struct {
@@ -279,7 +280,7 @@ interface netlogon
        /*****************/
        /* Function 0x05 */
 
-       declare enum netr_SchannelType;
+       typedef enum netr_SchannelType netr_SchannelType;
 
        NTSTATUS netr_ServerAuthenticate(
                [in,string,charset(UTF16)] uint16 *server_name,
@@ -307,7 +308,7 @@ interface netlogon
        /*****************/
        /* Function 0x07 */
 
-       declare enum netr_SamDatabaseID;
+       typedef enum netr_SamDatabaseID netr_SamDatabaseID;
 
        typedef struct {
                [string,charset(UTF16)] uint16 *account_name;
@@ -330,10 +331,10 @@ interface netlogon
 
        typedef struct {
                uint16 nt_length;
-               uint16 nt_size;
+               [value(nt_length)] uint16 nt_size;
                uint32 nt_flags;
                uint16 lm_length;
-               uint16 lm_size;
+               [value(lm_length)] uint16 lm_size;
                uint32 lm_flags;
                uint8 nt_history[nt_length];
                uint8 lm_history[lm_length];
@@ -342,10 +343,10 @@ interface netlogon
        typedef struct {
                netr_USER_KEY16 lmpassword;
                netr_USER_KEY16 ntpassword;
-               netr_PasswordHistory lmhistory;
+               netr_PasswordHistory history;
        } netr_USER_KEYS2;
 
-       typedef struct {
+       typedef struct { /* TODO: make this a union! */
                netr_USER_KEYS2 keys2;
        } netr_USER_KEY_UNION;
 
@@ -685,7 +686,7 @@ interface netlogon
                [in]      netr_SamDatabaseID database_id,
                [in,out,ref]  udlong *sequence_num,
                [in]      uint32 preferredmaximumlength,
-               [out]     netr_DELTA_ENUM_ARRAY *delta_enum_array
+               [out,ref]     netr_DELTA_ENUM_ARRAY *delta_enum_array
                );
 
 
@@ -700,7 +701,7 @@ interface netlogon
                [in]     netr_SamDatabaseID database_id,
                [in,out,ref] uint32 *sync_context,
                [in]     uint32 preferredmaximumlength,
-               [out]    netr_DELTA_ENUM_ARRAY *delta_enum_array
+               [out,ref]    netr_DELTA_ENUM_ARRAY *delta_enum_array
                );
 
 
@@ -757,7 +758,7 @@ interface netlogon
        /*****************/
        /* Function 0x0B */
 
-       NTSTATUS netr_GetDcName(
+       WERROR netr_GetDcName(
                [in]  [string,charset(UTF16)] uint16 logon_server[],
                [in]  [string,charset(UTF16)] uint16 *domainname,
                [out,ref] [string,charset(UTF16)] uint16 **dcname
@@ -871,7 +872,7 @@ interface netlogon
                [in]     uint16 restart_state,
                [in,out,ref] uint32 *sync_context,
                [in]     uint32 preferredmaximumlength,
-               [out]    netr_DELTA_ENUM_ARRAY *delta_enum_array
+               [out,ref]    netr_DELTA_ENUM_ARRAY *delta_enum_array
                );
 
 
@@ -887,7 +888,7 @@ interface netlogon
                [in,out,ref] netr_Authenticator *return_authenticator,
                [in][size_is(change_log_entry_size)] uint8 *change_log_entry,
                [in]     uint32 change_log_entry_size,
-               [out]    netr_DELTA_ENUM_ARRAY *delta_enum_array
+               [out,ref]    netr_DELTA_ENUM_ARRAY *delta_enum_array
                );
 
 
@@ -899,23 +900,79 @@ interface netlogon
                [in]   uint32 function_code,
                [in]   uint32 level,
                [in][switch_is(function_code)] netr_CONTROL_DATA_INFORMATION  data,
-               [out,ref][switch_is(level)]        netr_CONTROL_QUERY_INFORMATION *query
+               [out,ref][switch_is(level)]     netr_CONTROL_QUERY_INFORMATION *query
                );
 
        /*****************/
        /* Function 0x13 */
-       WERROR netr_NETRENUMERATETRUSTEDDOMAINS() ;
+       typedef struct {
+               uint32 length;
+               [size_is(length)] uint8 *data;
+       } netr_Blob;
+
+       WERROR netr_NetrEnumerateTrustedDomains(
+               [in] [string,charset(UTF16)] uint16 *server_name,
+               [out,ref] netr_Blob *trusted_domains_blob
+               );
 
        /*****************/
-       /* Function 0x14 */             
+       /* Function 0x14 */
+
+       /* one unkown bit still: DS_IP_VERSION_AGNOSTIC - gd*/
+
+       typedef [bitmap32bit] bitmap {
+               DS_FORCE_REDISCOVERY            = 0x00000001,
+               DS_DIRECTORY_SERVICE_REQUIRED   = 0x00000010,
+               DS_DIRECTORY_SERVICE_PREFERRED  = 0x00000020,
+               DS_GC_SERVER_REQUIRED           = 0x00000040,
+               DS_PDC_REQUIRED                 = 0x00000080,
+               DS_BACKGROUND_ONLY              = 0x00000100,
+               DS_IP_REQUIRED                  = 0x00000200,
+               DS_KDC_REQUIRED                 = 0x00000400,
+               DS_TIMESERV_REQUIRED            = 0x00000800,
+               DS_WRITABLE_REQUIRED            = 0x00001000,
+               DS_GOOD_TIMESERV_PREFERRED      = 0x00002000,
+               DS_AVOID_SELF                   = 0x00004000,
+               DS_ONLY_LDAP_NEEDED             = 0x00008000,
+               DS_IS_FLAT_NAME                 = 0x00010000,
+               DS_IS_DNS_NAME                  = 0x00020000,
+               DS_TRY_NEXTCLOSEST_SITE         = 0x00040000,
+               DS_DIRECTORY_SERVICE_6_REQUIRED = 0x00080000,
+               DS_RETURN_DNS_NAME              = 0x40000000,
+               DS_RETURN_FLAT_NAME             = 0x80000000
+       } netr_DsRGetDCName_flags;
+
+       typedef [v1_enum] enum {
+               DS_ADDRESS_TYPE_INET            = 1,
+               DS_ADDRESS_TYPE_NETBIOS         = 2
+       } netr_DsRGetDCNameInfo_AddressType;
+
+       typedef [bitmap32bit] bitmap {
+               DS_SERVER_PDC                    = 0x00000001 /* NBT_SERVER_PDC */,
+               DS_SERVER_GC                     = 0x00000004 /* NBT_SERVER_GC */,
+               DS_SERVER_LDAP                   = 0x00000008 /* NBT_SERVER_LDAP */,
+               DS_SERVER_DS                     = 0x00000010 /* NBT_SERVER_DS */,
+               DS_SERVER_KDC                    = 0x00000020 /* NBT_SERVER_KDC */,
+               DS_SERVER_TIMESERV               = 0x00000040 /* NBT_SERVER_TIMESERV */,
+               DS_SERVER_CLOSEST                = 0x00000080 /* NBT_SERVER_CLOSEST */,
+               DS_SERVER_WRITABLE               = 0x00000100 /* NBT_SERVER_WRITABLE */,
+               DS_SERVER_GOOD_TIMESERV          = 0x00000200 /* NBT_SERVER_GOOD_TIMESERV */,
+               DS_SERVER_NDNC                   = 0x00000400,
+               DS_SERVER_SELECT_SECRET_DOMAIN_6 = 0x00000800,
+               DS_SERVER_FULL_SECRET_DOMAIN_6   = 0x00001000,
+               DS_DNS_CONTROLLER                = 0x20000000,
+               DS_DNS_DOMAIN                    = 0x40000000,
+               DS_DNS_FOREST                    = 0x80000000
+       } netr_DsR_DcFlags;
+
        typedef struct {
                [string,charset(UTF16)] uint16 *dc_unc;
                [string,charset(UTF16)] uint16 *dc_address;
-               int32 dc_address_type;
+               netr_DsRGetDCNameInfo_AddressType dc_address_type;
                GUID domain_guid;
                [string,charset(UTF16)] uint16 *domain_name;
                [string,charset(UTF16)] uint16 *forest_name;
-               uint32 dc_flags;
+               netr_DsR_DcFlags dc_flags;
                [string,charset(UTF16)] uint16 *dc_site_name;
                [string,charset(UTF16)] uint16 *client_site_name;
        } netr_DsRGetDCNameInfo;
@@ -925,8 +982,8 @@ interface netlogon
                [in] [string,charset(UTF16)] uint16 *domain_name,
                [in] GUID *domain_guid,
                [in] GUID *site_guid,
-               [in] uint32 flags,
-               [out] netr_DsRGetDCNameInfo *info
+               [in] netr_DsRGetDCName_flags flags,
+               [out,ref] netr_DsRGetDCNameInfo *info
                );
 
        /*****************/
@@ -939,7 +996,11 @@ interface netlogon
 
        /****************/
        /* Function 0x17 */
-       WERROR netr_NETRLOGONGETTRUSTRID();
+       WERROR netr_LogonGetTrustRid(
+               [in] [string,charset(UTF16)] uint16 *server_name,
+               [in] [string,charset(UTF16)] uint16 *domain_name,
+               [out,ref] uint32 *rid
+       );
 
        /****************/
        /* Function 0x18 */
@@ -969,8 +1030,8 @@ interface netlogon
                [in] [string,charset(UTF16)] uint16 *domain_name,
                [in] GUID *domain_guid,
                [in] [string,charset(UTF16)] uint16 *site_name,
-               [in] uint32 flags,
-               [out] netr_DsRGetDCNameInfo *info
+               [in] netr_DsRGetDCName_flags flags,
+               [out,ref] netr_DsRGetDCNameInfo **info
                );
 
        /****************/
@@ -983,11 +1044,6 @@ interface netlogon
        /****************/
        /* Function 0x1d */
 
-       typedef struct {
-               uint32 length;
-               [size_is(length)] uint8 *data;
-       } netr_Blob;
-
        typedef [flag(NDR_PAHEX)] struct {
                uint16 length;
                uint16 size;
@@ -1065,7 +1121,15 @@ interface netlogon
 
        /****************/
        /* Function 0x1f */
-       WERROR netr_NETRSERVERPASSWORDGET();
+       WERROR netr_ServerPasswordGet(
+               [in]  [string,charset(UTF16)] uint16 *server_name,
+               [in]  [string,charset(UTF16)] uint16 account_name[],
+               [in]  netr_SchannelType secure_channel_type,
+               [in]  [string,charset(UTF16)] uint16 computer_name[],
+               [in,ref] netr_Authenticator *credential,
+               [out,ref] netr_Authenticator *return_authenticator,
+               [out,ref] samr_Password *password
+               );
 
        /****************/
        /* Function 0x20 */
@@ -1073,19 +1137,34 @@ interface netlogon
 
        /****************/
        /* Function 0x21 */
-       WERROR netr_DSRADDRESSTOSITENAMESW();
+       typedef struct {
+               uint32 count;
+               [size_is(count)] lsa_String *sitename;
+       } netr_DsRAddressToSitenamesWCtr;
+
+       typedef struct {
+               [size_is(size)] uint8 *buffer;
+               uint32 size;
+       } netr_DsRAddress;
+
+       WERROR netr_DsRAddressToSitenamesW(
+               [in] [string,charset(UTF16)] uint16 *server_name,
+               [in] [range(0,32000)] uint32 count,
+               [in] [size_is(count)] [ref] netr_DsRAddress *addresses,
+               [out] [ref] netr_DsRAddressToSitenamesWCtr **ctr
+               );
 
        /****************/
        /* Function 0x22 */
        WERROR netr_DsRGetDCNameEx2(
                [in] [string,charset(UTF16)] uint16 *server_unc,
                [in] [string,charset(UTF16)] uint16 *client_account,
-               [in] uint32 mask,
+               [in] samr_AcctFlags mask,
                [in] [string,charset(UTF16)] uint16 *domain_name,
                [in] GUID *domain_guid,
                [in] [string,charset(UTF16)] uint16 *site_name,
-               [in] uint32 flags,
-               [out] netr_DsRGetDCNameInfo *info
+               [in] netr_DsRGetDCName_flags flags,
+               [out,ref] netr_DsRGetDCNameInfo **info
                );
 
        /****************/
@@ -1094,32 +1173,6 @@ interface netlogon
 
        /****************/
        /* Function 0x24 */
-       WERROR netr_NETRENUMERATETRUSTEDDOMAINSEX();
-
-       /****************/
-       /* Function 0x25 */
-       WERROR netr_DSRADDRESSTOSITENAMESEXW();
-
-       /****************/
-       /* Function 0x26 */
-       WERROR netr_DSRGETDCSITECOVERAGEW();
-
-       /****************/
-       /* Function 0x27 */
-       NTSTATUS netr_LogonSamLogonEx(
-               [in] [string,charset(UTF16)] uint16 *server_name,
-               [in] [string,charset(UTF16)] uint16 *computer_name,
-               [in]  uint16 logon_level,
-               [in]  [switch_is(logon_level)] netr_LogonLevel logon,
-               [in]  uint16 validation_level,
-               [out,ref] [switch_is(validation_level)] netr_Validation *validation,
-               [out,ref] uint8 *authoritative,
-               [in,out,ref] uint32 *flags
-               );
-
-       /****************/
-       /* Function 0x28 */
-
        typedef [bitmap32bit] bitmap {
                NETR_TRUST_FLAG_IN_FOREST = 0x00000001,
                NETR_TRUST_FLAG_OUTBOUND  = 0x00000002,
@@ -1157,29 +1210,112 @@ interface netlogon
                GUID                    guid;
        } netr_DomainTrust;
 
+        typedef struct {
+                uint32 count;
+                [size_is(count)] netr_DomainTrust *array;
+        } netr_DomainTrustList;
+
+       WERROR netr_NetrEnumerateTrustedDomainsEx(
+               [in] [string,charset(UTF16)] uint16 *server_name,
+               [out,ref] netr_DomainTrustList *dom_trust_list
+       );
+
+       /****************/
+       /* Function 0x25 */
+       typedef struct {
+               uint32 count;
+               [size_is(count)] lsa_String *sitename;
+               [size_is(count)] lsa_String *subnetname;
+       } netr_DsRAddressToSitenamesExWCtr;
+
+       WERROR netr_DsRAddressToSitenamesExW(
+               [in] [string,charset(UTF16)] uint16 *server_name,
+               [in] [range(0,32000)] uint32 count,
+               [in] [size_is(count)] [ref] netr_DsRAddress *addresses,
+               [out] [ref] netr_DsRAddressToSitenamesExWCtr **ctr
+               );
+
+       /****************/
+       /* Function 0x26 */
+
+       typedef struct {
+               uint32 num_sites;
+               [size_is(num_sites)] [unique] lsa_String *sites;
+       } DcSitesCtr;
+
+       WERROR netr_DsrGetDcSiteCoverageW(
+               [in] [string,charset(UTF16)] uint16 *server_name,
+               [out,ref] DcSitesCtr *ctr
+               );
+
+       /****************/
+       /* Function 0x27 */
+       NTSTATUS netr_LogonSamLogonEx(
+               [in] [string,charset(UTF16)] uint16 *server_name,
+               [in] [string,charset(UTF16)] uint16 *computer_name,
+               [in]  uint16 logon_level,
+               [in]  [switch_is(logon_level)] netr_LogonLevel logon,
+               [in]  uint16 validation_level,
+               [out,ref] [switch_is(validation_level)] netr_Validation *validation,
+               [out,ref] uint8 *authoritative,
+               [in,out,ref] uint32 *flags
+               );
+
+       /****************/
+       /* Function 0x28 */
+
        WERROR netr_DsrEnumerateDomainTrusts(
                [in]                 [string,charset(UTF16)] uint16           *server_name,
                [in]                 netr_TrustFlags  trust_flags,
-               [out,ref]                uint32           *count,
-               [out,ref,size_is(count)] netr_DomainTrust **trusts
+               [out,ref]            netr_DomainTrustList *trusts
                );
 
 
        /****************/
        /* Function 0x29 */
-       WERROR netr_DSRDEREGISTERDNSHOSTRECORDS();
+       WERROR netr_DsrDeregisterDNSHostRecords(
+               [in] [string,charset(UTF16)] uint16 *server_name,
+               [in] [string,charset(UTF16)] uint16 *domain,
+               [in] GUID *domain_guid,
+               [in] GUID *dsa_guid,
+               [in,ref] [string,charset(UTF16)] uint16 *dns_host
+               );
 
        /****************/
        /* Function 0x2a */
-       WERROR netr_NETRSERVERTRUSTPASSWORDSGET();
+       NTSTATUS netr_ServerTrustPasswordsGet(
+               [in]  [string,charset(UTF16)] uint16 *server_name,
+               [in]  [string,charset(UTF16)] uint16 account_name[],
+               [in]  netr_SchannelType secure_channel_type,
+               [in]  [string,charset(UTF16)] uint16 computer_name[],
+               [in,ref] netr_Authenticator *credential,
+               [out,ref] netr_Authenticator *return_authenticator,
+               [out,ref] samr_Password *password,
+               [out,ref] samr_Password *password2
+       );
 
        /****************/
        /* Function 0x2b */
-       WERROR netr_DSRGETFORESTTRUSTINFORMATION();
+
+       const int DS_GFTI_UPDATE_TDO = 0x1;
+
+       WERROR netr_DsRGetForestTrustInformation(
+               [in] [string,charset(UTF16)] uint16 *server_name,
+               [in] [string,charset(UTF16)] uint16 *trusted_domain_name,
+               [in] uint32 flags,
+               [out,ref] lsa_ForestTrustInformation **forest_trust_info
+               );
 
        /****************/
        /* Function 0x2c */
-       WERROR netr_NETRGETFORESTTRUSTINFORMATION();
+       WERROR netr_GetForestTrustInformation(
+               [in] [string,charset(UTF16)] uint16 *server_name,
+               [in,ref] [string,charset(UTF16)] uint16 *trusted_domain_name,
+               [in,ref] netr_Authenticator *credential,
+               [out,ref] netr_Authenticator *return_authenticator,
+               [in] uint32 flags,
+               [out,ref] lsa_ForestTrustInformation **forest_trust_info
+               );
 
        /****************/
        /* Function 0x2d */
index 74081a7bf3d26560ba876f8e3f97cdd7007e8c2a..2c4fef5a7ddfefb7bb1504682418a8bf52d4d14d 100644 (file)
@@ -3,6 +3,7 @@
 /*
   samr interface definition
 */
+import "misc.idl", "lsa.idl", "security.idl";
 
 /*
   Thanks to Todd Sabin for some information from his samr.idl in acltools
   version(1.0),
   endpoint("ncacn_np:[\\pipe\\samr]","ncacn_ip_tcp:", "ncalrpc:"),
   pointer_default(unique),
-  pointer_default_top(unique),
-  depends(misc,lsa,security)
+  pointer_default_top(unique)
 ] interface samr
 {
-       declare bitmap security_secinfo;
+       typedef bitmap security_secinfo security_secinfo;
 
        /* account control (acct_flags) bits */
        typedef [public,bitmap32bit] bitmap {
                ACB_NO_AUTH_DATA_REQD           = 0x00080000   /* 1 = No authorization data required */
        } samr_AcctFlags;
 
+       typedef [bitmap32bit] bitmap {
+               SAMR_ACCESS_CONNECT_TO_SERVER   = 0x00000001,
+               SAMR_ACCESS_SHUTDOWN_SERVER     = 0x00000002,
+               SAMR_ACCESS_INITIALIZE_SERVER   = 0x00000004,
+               SAMR_ACCESS_CREATE_DOMAIN       = 0x00000008,
+               SAMR_ACCESS_ENUM_DOMAINS        = 0x00000010,
+               SAMR_ACCESS_OPEN_DOMAIN         = 0x00000020
+       } samr_ConnectAccessMask;
+
+       typedef [bitmap32bit] bitmap {
+               SAMR_USER_ACCESS_GET_NAME_ETC             = 0x00000001,
+               SAMR_USER_ACCESS_GET_LOCALE               = 0x00000002,
+               SAMR_USER_ACCESS_SET_LOC_COM              = 0x00000004,
+               SAMR_USER_ACCESS_GET_LOGONINFO            = 0x00000008,
+               SAMR_USER_ACCESS_GET_ATTRIBUTES           = 0x00000010,
+               SAMR_USER_ACCESS_SET_ATTRIBUTES           = 0x00000020,
+               SAMR_USER_ACCESS_CHANGE_PASSWORD          = 0x00000040,
+               SAMR_USER_ACCESS_SET_PASSWORD             = 0x00000080,
+               SAMR_USER_ACCESS_GET_GROUPS               = 0x00000100,
+               SAMR_USER_ACCESS_GET_GROUP_MEMBERSHIP     = 0x00000200,
+               SAMR_USER_ACCESS_CHANGE_GROUP_MEMBERSHIP  = 0x00000400
+       } samr_UserAccessMask;
+
+       typedef [bitmap32bit] bitmap {
+               SAMR_DOMAIN_ACCESS_LOOKUP_INFO_1  = 0x00000001,
+               SAMR_DOMAIN_ACCESS_SET_INFO_1     = 0x00000002,
+               SAMR_DOMAIN_ACCESS_LOOKUP_INFO_2  = 0x00000004,
+               SAMR_DOMAIN_ACCESS_SET_INFO_2     = 0x00000008,
+               SAMR_DOMAIN_ACCESS_CREATE_USER    = 0x00000010,
+               SAMR_DOMAIN_ACCESS_CREATE_GROUP   = 0x00000020,
+               SAMR_DOMAIN_ACCESS_CREATE_ALIAS   = 0x00000040,
+               SAMR_DOMAIN_ACCESS_LOOKUP_ALIAS   = 0x00000080,
+               SAMR_DOMAIN_ACCESS_ENUM_ACCOUNTS  = 0x00000100,
+               SAMR_DOMAIN_ACCESS_OPEN_ACCOUNT   = 0x00000200,
+               SAMR_DOMAIN_ACCESS_SET_INFO_3     = 0x00000400
+       } samr_DomainAccessMask;
+
+       typedef [bitmap32bit] bitmap {
+               SAMR_GROUP_ACCESS_LOOKUP_INFO     = 0x00000001,
+               SAMR_GROUP_ACCESS_SET_INFO        = 0x00000002,
+               SAMR_GROUP_ACCESS_ADD_MEMBER      = 0x00000004,
+               SAMR_GROUP_ACCESS_REMOVE_MEMBER   = 0x00000008,
+               SAMR_GROUP_ACCESS_GET_MEMBERS     = 0x00000010
+       } samr_GroupAccessMask;
+
+       typedef [bitmap32bit] bitmap {
+               SAMR_ALIAS_ACCESS_ADD_MEMBER      = 0x00000001,
+               SAMR_ALIAS_ACCESS_REMOVE_MEMBER   = 0x00000002,
+               SAMR_ALIAS_ACCESS_GET_MEMBERS     = 0x00000004,
+               SAMR_ALIAS_ACCESS_LOOKUP_INFO     = 0x00000008,
+               SAMR_ALIAS_ACCESS_SET_INFO        = 0x00000010
+       } samr_AliasAccessMask;
+
        /******************/
        /* Function: 0x00 */
        NTSTATUS samr_Connect (
                /* notice the lack of [string] */
                [in]       uint16 *system_name,
-               [in]       uint32 access_mask,
+               [in]       samr_ConnectAccessMask access_mask,
                [out,ref]  policy_handle *connect_handle
                );
 
 
        /******************/
        /* Function: 0x01 */
-       NTSTATUS samr_Close (
+       [public] NTSTATUS samr_Close (
                [in,out,ref]  policy_handle *handle
                );
 
        NTSTATUS samr_QuerySecurity (
                [in,ref]          policy_handle *handle,
                [in]              security_secinfo sec_info,
-               [out]             sec_desc_buf *sdbuf
+               [out,ref]         sec_desc_buf *sdbuf
                );
 
        /******************/
        NTSTATUS samr_LookupDomain (
                [in,ref]  policy_handle *connect_handle,                
                [in,ref]  lsa_String *domain_name,
-               [out]     dom_sid2 *sid
+               [out,ref] dom_sid2 *sid
                );
 
 
                [in,ref]      policy_handle *connect_handle,
                [in,out,ref]  uint32 *resume_handle,
                [in]          uint32 buf_size,
-               [out]         samr_SamArray *sam,
-               [out]         uint32 num_entries
+               [out,ref]     samr_SamArray *sam,
+               [out,ref]     uint32 *num_entries
                );
 
 
        /************************/
        /* Function    0x07     */
-       NTSTATUS samr_OpenDomain(
+       [public] NTSTATUS samr_OpenDomain(
                [in,ref]      policy_handle *connect_handle,
-               [in]          uint32 access_mask,
+               [in]          samr_DomainAccessMask access_mask,
                [in,ref]      dom_sid2 *sid,
                [out,ref]     policy_handle *domain_handle
                );
        /* Function    0x08     */
        /* server roles */
        typedef [v1_enum] enum {
-               ROLE_STANDALONE    = 0,
-               ROLE_DOMAIN_MEMBER = 1,
-               ROLE_DOMAIN_BDC    = 2,
-               ROLE_DOMAIN_PDC    = 3
+               SAMR_ROLE_STANDALONE    = 0,
+               SAMR_ROLE_DOMAIN_MEMBER = 1,
+               SAMR_ROLE_DOMAIN_BDC    = 2,
+               SAMR_ROLE_DOMAIN_PDC    = 3
        } samr_Role;
 
        /* password properties flags */
        NTSTATUS samr_QueryDomainInfo(
                [in,ref]      policy_handle *domain_handle,
                [in]          uint16 level,
-               [out,switch_is(level)] samr_DomainInfo *info
+               [out,ref,switch_is(level)] samr_DomainInfo *info
                );
 
        /************************/
        NTSTATUS samr_CreateDomainGroup(
                [in,ref]      policy_handle *domain_handle,
                [in,ref]      lsa_String *name,
-               [in]          uint32 access_mask,
+               [in]          samr_GroupAccessMask access_mask,
                [out,ref]     policy_handle *group_handle,
                [out,ref]     uint32 *rid
                );
                [in,ref]      policy_handle *domain_handle,
                [in,out,ref]  uint32 *resume_handle,
                [in]          uint32 max_size,
-               [out]         samr_SamArray *sam,
-               [out]         uint32 num_entries
+               [out,ref]     samr_SamArray *sam,
+               [out,ref]     uint32 *num_entries
                );
 
        /************************/
        NTSTATUS samr_CreateUser(
                [in,ref]      policy_handle *domain_handle,
                [in,ref]      lsa_String *account_name,
-               [in]          uint32 access_mask,
+               [in]          samr_UserAccessMask access_mask,
                [out,ref]     policy_handle *user_handle,
                [out,ref]     uint32 *rid
                );
                [in]          samr_AcctFlags acct_flags,
                [in]          uint32 max_size,
                [out]         samr_SamArray *sam,
-               [out]         uint32 num_entries
+               [out,ref]     uint32 *num_entries
                );
 
        /************************/
        NTSTATUS samr_CreateDomAlias(
                [in,ref]      policy_handle *domain_handle,
                [in,ref]      lsa_String   *alias_name,
-               [in]          uint32         access_mask,
+               [in]          samr_AliasAccessMask access_mask,
                [out,ref]     policy_handle *alias_handle,
                [out,ref]     uint32        *rid
                );
                [in,ref]      policy_handle *domain_handle,
                [in,out,ref]  uint32 *resume_handle,
                [in]          samr_AcctFlags acct_flags,
-               [out]         samr_SamArray *sam,
-               [out]         uint32 num_entries
+               [out,ref]     samr_SamArray *sam,
+               [out,ref]     uint32 *num_entries
                );
 
        /************************/
        /************************/
        /* Function    0x11     */
 
-       NTSTATUS samr_LookupNames(
+       [public] NTSTATUS samr_LookupNames(
                [in,ref]      policy_handle *domain_handle,
                [in,range(0,1000)] uint32 num_names,
                [in,size_is(1000),length_is(num_names)] lsa_String names[],
-               [out]         samr_Ids rids,
-               [out]         samr_Ids types
+               [out,ref]     samr_Ids *rids,
+               [out,ref]     samr_Ids *types
                );
 
 
                [in,ref]      policy_handle *domain_handle,
                [in,range(0,1000)] uint32 num_rids,
                [in,size_is(1000),length_is(num_rids)] uint32 rids[],
-               [out]         lsa_Strings names,
-               [out]         samr_Ids types
+               [out,ref]     lsa_Strings *names,
+               [out,ref]     samr_Ids *types
                );
 
        /************************/
        /* Function    0x13     */
        NTSTATUS samr_OpenGroup(
                [in,ref]      policy_handle *domain_handle,
-               [in]          uint32 access_mask,
+               [in]          samr_GroupAccessMask access_mask,
                [in]          uint32 rid,
                [out,ref]     policy_handle *group_handle
                );
        NTSTATUS samr_QueryGroupInfo(
                [in,ref]                  policy_handle *group_handle,
                [in]                      samr_GroupInfoEnum level,
-               [out,switch_is(level)]    samr_GroupInfo *info
+               [out,ref,switch_is(level)] samr_GroupInfo *info
                );
 
        /************************/
 
        NTSTATUS samr_QueryGroupMember(
                [in,ref]  policy_handle *group_handle,
-               [out]     samr_RidTypeArray *rids
+               [out,ref] samr_RidTypeArray *rids
                );
 
 
        /* Function    0x1b     */
        NTSTATUS samr_OpenAlias (
                [in,ref]      policy_handle *domain_handle,
-               [in]          uint32 access_mask,
+               [in]          samr_AliasAccessMask access_mask,
                [in]          uint32 rid,
                [out,ref]     policy_handle *alias_handle
                );
        NTSTATUS samr_QueryAliasInfo(
                [in,ref]                  policy_handle  *alias_handle,
                [in]                      samr_AliasInfoEnum      level,
-               [out,switch_is(level)]    samr_AliasInfo *info
+               [out,ref,switch_is(level)] samr_AliasInfo *info
                );
 
        /************************/
 
        /************************/
        /* Function    0x22     */
-       NTSTATUS samr_OpenUser(
+       [public] NTSTATUS samr_OpenUser(
                [in,ref]      policy_handle *domain_handle,
-               [in]          uint32 access_mask,
+               [in]          samr_UserAccessMask access_mask,
                [in]          uint32 rid,
                [out,ref]     policy_handle *user_handle
                );
 
        /* this defines the bits used for fields_present in info21 */
        typedef [bitmap32bit] bitmap {
-               SAMR_FIELD_ACCOUNT_NAME = 0x00000001,
-               SAMR_FIELD_FULL_NAME    = 0x00000002,
-               SAMR_FIELD_DESCRIPTION  = 0x00000010,
-               SAMR_FIELD_COMMENT      = 0x00000020,
-               SAMR_FIELD_LOGON_SCRIPT = 0x00000100,
-               SAMR_FIELD_PROFILE_PATH = 0x00000200,
-               SAMR_FIELD_WORKSTATIONS = 0x00000400,
-               SAMR_FIELD_LOGON_HOURS  = 0x00002000,
-               SAMR_FIELD_ACCT_FLAGS   = 0x00100000,
-               SAMR_FIELD_PARAMETERS   = 0x00200000,
-               SAMR_FIELD_COUNTRY_CODE = 0x00400000,
-               SAMR_FIELD_CODE_PAGE    = 0x00800000,
-               SAMR_FIELD_PASSWORD     = 0x01000000, /* either of these */
-               SAMR_FIELD_PASSWORD2    = 0x02000000 /* two bits seems to work */
+               SAMR_FIELD_ACCOUNT_NAME     = 0x00000001,
+               SAMR_FIELD_FULL_NAME        = 0x00000002,
+               SAMR_FIELD_RID              = 0x00000004,
+               SAMR_FIELD_PRIMARY_GID      = 0x00000008,
+               SAMR_FIELD_DESCRIPTION      = 0x00000010,
+               SAMR_FIELD_COMMENT          = 0x00000020,
+               SAMR_FIELD_HOME_DIRECTORY   = 0x00000040,
+               SAMR_FIELD_HOME_DRIVE       = 0x00000080,
+               SAMR_FIELD_LOGON_SCRIPT     = 0x00000100,
+               SAMR_FIELD_PROFILE_PATH     = 0x00000200,
+               SAMR_FIELD_WORKSTATIONS     = 0x00000400,
+               SAMR_FIELD_LAST_LOGON       = 0x00000800,
+               SAMR_FIELD_LAST_LOGOFF      = 0x00001000,
+               SAMR_FIELD_LOGON_HOURS      = 0x00002000,
+               SAMR_FIELD_BAD_PWD_COUNT    = 0x00004000,
+               SAMR_FIELD_NUM_LOGONS       = 0x00008000,
+               SAMR_FIELD_ALLOW_PWD_CHANGE = 0x00010000,
+               SAMR_FIELD_FORCE_PWD_CHANGE = 0x00020000,
+               SAMR_FIELD_LAST_PWD_CHANGE  = 0x00040000,
+               SAMR_FIELD_ACCT_EXPIRY      = 0x00080000,
+               SAMR_FIELD_ACCT_FLAGS       = 0x00100000,
+               SAMR_FIELD_PARAMETERS       = 0x00200000,
+               SAMR_FIELD_COUNTRY_CODE     = 0x00400000,
+               SAMR_FIELD_CODE_PAGE        = 0x00800000,
+               SAMR_FIELD_PASSWORD         = 0x01000000, /* either of these */
+               SAMR_FIELD_PASSWORD2        = 0x02000000, /* two bits seems to work */
+               SAMR_FIELD_PRIVATE_DATA     = 0x04000000,
+               SAMR_FIELD_EXPIRED_FLAG     = 0x08000000,
+               SAMR_FIELD_SEC_DESC         = 0x10000000,
+               SAMR_FIELD_OWF_PWD          = 0x20000000
        } samr_FieldsPresent;
 
        typedef struct {
                [case(26)] samr_UserInfo26 info26;
        } samr_UserInfo;
 
-       NTSTATUS samr_QueryUserInfo(
+       [public] NTSTATUS samr_QueryUserInfo(
                [in,ref]                  policy_handle *user_handle,
                [in]                      uint16 level,
-               [out,switch_is(level)]    samr_UserInfo *info
+               [out,ref,switch_is(level)] samr_UserInfo *info
                );
 
 
        /************************/
        /* Function    0x25     */
-       NTSTATUS samr_SetUserInfo(
+       [public] NTSTATUS samr_SetUserInfo(
                [in,ref]                   policy_handle *user_handle,
                [in]                       uint16 level,
                [in,ref,switch_is(level)]  samr_UserInfo *info
 
        NTSTATUS samr_GetGroupsForUser(
                [in,ref]   policy_handle *user_handle,
-               [out]      samr_RidWithAttributeArray  *rids
+               [out,ref]  samr_RidWithAttributeArray  *rids
                );
 
        /************************/
                uint32    rid;
                samr_AcctFlags acct_flags;
                lsa_String account_name;
-               lsa_String full_name;
                lsa_String description;
+               lsa_String full_name;
        } samr_DispEntryGeneral;
 
        typedef struct {
                [size_is(count)] samr_DispEntryFull *entries;
        } samr_DispInfoFull;
 
+       typedef struct {
+               uint32    idx;
+               uint32    rid;
+               samr_GroupAttrs acct_flags;
+               lsa_String account_name;
+               lsa_String description;
+       } samr_DispEntryFullGroup;
+
+       typedef struct {
+               uint32 count;
+               [size_is(count)] samr_DispEntryFullGroup *entries;
+       } samr_DispInfoFullGroups;
+
        typedef struct {
                uint32    idx;
                lsa_AsciiString account_name;
        typedef [switch_type(uint16)] union {
                [case(1)] samr_DispInfoGeneral info1;/* users */
                [case(2)] samr_DispInfoFull info2; /* trust accounts? */
-               [case(3)] samr_DispInfoFull info3; /* groups */
+               [case(3)] samr_DispInfoFullGroups info3; /* groups */
                [case(4)] samr_DispInfoAscii info4; /* users */
                [case(5)] samr_DispInfoAscii info5; /* groups */
        } samr_DispInfo;
                [in]        uint32 start_idx,
                [in]        uint32 max_entries,
                [in]        uint32 buf_size,
-               [out]       uint32 total_size,
-               [out]       uint32 returned_size,
-               [out,switch_is(level)] samr_DispInfo info
+               [out,ref]   uint32 *total_size,
+               [out,ref]   uint32 *returned_size,
+               [out,ref,switch_is(level)] samr_DispInfo *info
                );
 
 
                [in,ref]    policy_handle *domain_handle,
                [in]        uint16 level,
                [in]        lsa_String name,
-               [out]       uint32 idx
+               [out,ref]   uint32 *idx
                );
 
 
                samr_PasswordProperties password_properties;
        } samr_PwInfo;
 
-       NTSTATUS samr_GetUserPwInfo(
+       [public] NTSTATUS samr_GetUserPwInfo(
                [in,ref]    policy_handle *user_handle,
-               [out]       samr_PwInfo info
+               [out,ref]   samr_PwInfo *info
                );
 
        /************************/
        NTSTATUS samr_QueryDomainInfo2(
                [in,ref]      policy_handle *domain_handle,
                [in]          uint16 level,
-               [out,switch_is(level)] samr_DomainInfo *info
+               [out,ref,switch_is(level)] samr_DomainInfo *info
                );
 
        /************************/
        NTSTATUS samr_QueryUserInfo2(
                [in,ref]                  policy_handle *user_handle,
                [in]                      uint16 level,
-               [out,switch_is(level)]    samr_UserInfo *info
+               [out,ref,switch_is(level)]    samr_UserInfo *info
                );
 
        /************************/
                [in]        uint32 start_idx,
                [in]        uint32 max_entries,
                [in]        uint32 buf_size,
-               [out]       uint32 total_size,
-               [out]       uint32 returned_size,
-               [out,switch_is(level)] samr_DispInfo info
+               [out,ref]   uint32 *total_size,
+               [out,ref]   uint32 *returned_size,
+               [out,ref,switch_is(level)] samr_DispInfo *info
                );
 
        /************************/
                [in,ref]    policy_handle *domain_handle,
                [in]        uint16 level,
                [in]        lsa_String name,
-               [out]       uint32 idx
+               [out,ref]   uint32 *idx
                );
 
 
                [in,ref]      policy_handle *domain_handle,
                [in,ref]      lsa_String *account_name,
                [in]          samr_AcctFlags acct_flags,
-               [in]          uint32 access_mask,
+               [in]          samr_UserAccessMask access_mask,
                [out,ref]     policy_handle *user_handle,
                [out,ref]     uint32 *access_granted,
                [out,ref]     uint32 *rid
                [in]        uint32 start_idx,
                [in]        uint32 max_entries,
                [in]        uint32 buf_size,
-               [out]       uint32 total_size,
-               [out]       uint32 returned_size,
-               [out,switch_is(level)] samr_DispInfo info
+               [out,ref]   uint32 *total_size,
+               [out,ref]   uint32 *returned_size,
+               [out,ref,switch_is(level)] samr_DispInfo *info
                );
 
        /************************/
        /* Function    0x38     */
        NTSTATUS samr_GetDomPwInfo(
                [in]        lsa_String *domain_name,
-               [out]       samr_PwInfo info
+               [out,ref]   samr_PwInfo *info
                );
 
        /************************/
        /* Function    0x39     */
        NTSTATUS samr_Connect2(
                [in,string,charset(UTF16)] uint16 *system_name,
-               [in] uint32 access_mask,
+               [in] samr_ConnectAccessMask access_mask,
                [out,ref]  policy_handle *connect_handle
                );
 
        /*
          seems to be an exact alias for samr_SetUserInfo() 
        */
-       NTSTATUS samr_SetUserInfo2(
+       [public] NTSTATUS samr_SetUserInfo2(
                [in,ref]                   policy_handle *user_handle,
                [in]                       uint16 level,
                [in,ref,switch_is(level)]  samr_UserInfo *info
        /* Function    0x3c     */
        NTSTATUS samr_GetBootKeyInformation(
                [in,ref]   policy_handle *domain_handle,
-               [out]      uint32 unknown
+               [out,ref]  uint32 *unknown
                );
 
        /************************/
                [in,string,charset(UTF16)] uint16 *system_name,
                /* this unknown value seems to be completely ignored by w2k3 */
                [in] uint32 unknown,
-               [in] uint32 access_mask,
+               [in] samr_ConnectAccessMask access_mask,
                [out,ref]  policy_handle *connect_handle
                );
 
        NTSTATUS samr_Connect4(
                [in,string,charset(UTF16)] uint16 *system_name,
                [in] uint32 unknown,
-               [in] uint32 access_mask,
+               [in] samr_ConnectAccessMask access_mask,
                [out,ref]  policy_handle *connect_handle
                );
 
        /************************/
        /* Function    0x3f     */
 
-       declare enum samr_RejectReason;
+       typedef enum samr_RejectReason samr_RejectReason;
 
        typedef struct {
                samr_RejectReason reason;
                [in]              samr_CryptPassword *lm_password,
                [in]              samr_Password *lm_verifier,
                [in]              samr_CryptPassword *password3,
-               [out]             samr_DomInfo1 *dominfo,
-               [out]             samr_ChangeReject *reject
+               [out,ref]         samr_DomInfo1 *dominfo,
+               [out,ref]         samr_ChangeReject *reject
                );
 
        /************************/
                [case(1)]  samr_ConnectInfo1 info1;
        } samr_ConnectInfo;
 
-       NTSTATUS samr_Connect5(
+       [public] NTSTATUS samr_Connect5(
                [in,string,charset(UTF16)] uint16 *system_name,
-               [in]       uint32             access_mask,
-               [in,out]   uint32             level,
-               [in,out,switch_is(level),ref] samr_ConnectInfo *info,
+               [in]       samr_ConnectAccessMask  access_mask,
+               [in]       uint32             level_in,
+               [in,ref,switch_is(level_in)] samr_ConnectInfo *info_in,
+               [out,ref]  uint32             *level_out,
+               [out,ref,switch_is(*level_out)] samr_ConnectInfo *info_out,
                [out,ref]  policy_handle      *connect_handle
                );
 
        NTSTATUS samr_RidToSid(
                [in,ref]    policy_handle *domain_handle,
                [in]        uint32        rid,
-               [out]       dom_sid2      *sid
+               [out,ref]   dom_sid2      *sid
                );
 
 
 
        /************************/
        /* Function    0x43     */
-       /*
-         I haven't been able to work out the format of this one yet.
-         Seems to start with a switch level for a union?
-       */
-       NTSTATUS samr_ValidatePassword();
+       /************************/
+       typedef [bitmap32bit] bitmap {
+               SAMR_VALIDATE_FIELD_PASSWORD_LAST_SET           = 0x00000001,
+               SAMR_VALIDATE_FIELD_BAD_PASSWORD_TIME           = 0x00000002,
+               SAMR_VALIDATE_FIELD_LOCKOUT_TIME                = 0x00000004,
+               SAMR_VALIDATE_FIELD_BAD_PASSWORD_COUNT          = 0x00000008,
+               SAMR_VALIDATE_FIELD_PASSWORD_HISTORY_LENGTH     = 0x00000010,
+               SAMR_VALIDATE_FIELD_PASSWORD_HISTORY            = 0x00000020
+       } samr_ValidateFieldsPresent;
+
+       typedef enum {
+               NetValidateAuthentication = 1,
+               NetValidatePasswordChange= 2,
+               NetValidatePasswordReset = 3
+       } samr_ValidatePasswordLevel;
+
+       /* NetApi maps samr_ValidationStatus errors to WERRORs. Haven't
+        * identified the mapping of
+        * - NERR_PasswordFilterError
+        * - NERR_PasswordExpired and
+        * - NERR_PasswordCantChange
+        * yet - Guenther
+        */
+
+       typedef enum {
+               SAMR_VALIDATION_STATUS_SUCCESS = 0,
+               SAMR_VALIDATION_STATUS_PASSWORD_MUST_CHANGE = 1,
+               SAMR_VALIDATION_STATUS_ACCOUNT_LOCKED_OUT = 2,
+               SAMR_VALIDATION_STATUS_BAD_PASSWORD = 4,
+               SAMR_VALIDATION_STATUS_PWD_HISTORY_CONFLICT = 5,
+               SAMR_VALIDATION_STATUS_PWD_TOO_SHORT = 6,
+               SAMR_VALIDATION_STATUS_PWD_TOO_LONG = 7,
+               SAMR_VALIDATION_STATUS_NOT_COMPLEX_ENOUGH = 8,
+               SAMR_VALIDATION_STATUS_PASSWORD_TOO_RECENT = 9
+       } samr_ValidationStatus;
+
+       typedef struct {
+               uint32 length;
+               [size_is(length)] uint8 *data;
+        } samr_ValidationBlob;
+
+       typedef struct {
+               samr_ValidateFieldsPresent fields_present;
+               NTTIME_hyper last_password_change;
+               NTTIME_hyper bad_password_time;
+               NTTIME_hyper lockout_time;
+               uint32 bad_pwd_count;
+               uint32 pwd_history_len;
+               [size_is(pwd_history_len)] samr_ValidationBlob *pwd_history;
+       } samr_ValidatePasswordInfo;
+
+       typedef struct {
+               samr_ValidatePasswordInfo info;
+               samr_ValidationStatus status;
+       } samr_ValidatePasswordRepCtr;
+
+       typedef [switch_type(uint16)] union {
+               [case(1)] samr_ValidatePasswordRepCtr ctr1;
+               [case(2)] samr_ValidatePasswordRepCtr ctr2;
+               [case(3)] samr_ValidatePasswordRepCtr ctr3;
+       } samr_ValidatePasswordRep;
+
+       typedef struct {
+               samr_ValidatePasswordInfo info;
+               lsa_StringLarge password;
+               lsa_StringLarge account;
+               samr_ValidationBlob hash;
+               boolean8 pwd_must_change_at_next_logon;
+               boolean8 clear_lockout;
+       } samr_ValidatePasswordReq3;
+
+       typedef struct {
+               samr_ValidatePasswordInfo info;
+               lsa_StringLarge password;
+               lsa_StringLarge account;
+               samr_ValidationBlob hash;
+               boolean8 password_matched;
+       } samr_ValidatePasswordReq2;
+
+       typedef struct {
+               samr_ValidatePasswordInfo info;
+               boolean8 password_matched;
+       } samr_ValidatePasswordReq1;
+
+       typedef [switch_type(uint16)] union {
+               [case(1)] samr_ValidatePasswordReq1 req1;
+               [case(2)] samr_ValidatePasswordReq2 req2;
+               [case(3)] samr_ValidatePasswordReq3 req3;
+       } samr_ValidatePasswordReq;
+
+       NTSTATUS samr_ValidatePassword(
+               [in] samr_ValidatePasswordLevel level,
+               [in,switch_is(level)] samr_ValidatePasswordReq req,
+               [out,ref,switch_is(level)] samr_ValidatePasswordRep *rep
+               );
 }
index 8a0d36a696f8d3980949235054937e9ae4ba6211..c4c30e9b5a5adc30c0b72864d5d6b85d2bfe4c11 100644 (file)
@@ -4,9 +4,26 @@
   security IDL structures
 */
 
+import "misc.idl";
+
+/* 
+   use the same structure for dom_sid2 as dom_sid. A dom_sid2 is really
+   just a dom sid, but with the sub_auths represented as a conformant
+   array. As with all in-structure conformant arrays, the array length
+   is placed before the start of the structure. That's what gives rise
+   to the extra num_auths elemenent. We don't want the Samba code to
+   have to bother with such esoteric NDR details, so its easier to just
+   define it as a dom_sid and use pidl magic to make it all work. It
+   just means you need to mark a sid as a "dom_sid2" in the IDL when you
+   know it is of the conformant array variety
+*/
+cpp_quote("#define dom_sid2 dom_sid")
+
+/* same struct as dom_sid but inside a 28 bytes fixed buffer in NDR */
+cpp_quote("#define dom_sid28 dom_sid")
+
 [
-       pointer_default(unique),
-       depends(misc,security)
+       pointer_default(unique)
 ]
 interface security
 {
@@ -121,6 +138,8 @@ interface security
        const string SID_NULL = "S-1-0-0";
 
        /* the world domain */
+       const string NAME_WORLD       = "WORLD";
+
        const string SID_WORLD_DOMAIN = "S-1-1";
        const string SID_WORLD        = "S-1-1-0";
 
@@ -130,6 +149,8 @@ interface security
        const string SID_CREATOR_GROUP        = "S-1-3-1";
 
        /* SECURITY_NT_AUTHORITY */
+       const string NAME_NT_AUTHORITY            = "NT AUTHORITY";
+
        const string SID_NT_AUTHORITY             = "S-1-5";
        const string SID_NT_DIALUP                = "S-1-5-1";
        const string SID_NT_NETWORK               = "S-1-5-2";
@@ -150,6 +171,8 @@ interface security
        const string SID_NT_NETWORK_SERVICE       = "S-1-5-20";
 
        /* SECURITY_BUILTIN_DOMAIN_RID */
+       const string NAME_BUILTIN                  = "BUILTIN";
+
        const string SID_BUILTIN                   = "S-1-5-32";
        const string SID_BUILTIN_ADMINISTRATORS    = "S-1-5-32-544";
        const string SID_BUILTIN_USERS             = "S-1-5-32-545";
@@ -169,6 +192,7 @@ interface security
        const int DOMAIN_RID_GUEST                 = 501;
        const int DOMAIN_RID_ADMINS                = 512;
        const int DOMAIN_RID_USERS                 = 513;
+       const int DOMAIN_RID_DOMAIN_MEMBERS        = 515;
        const int DOMAIN_RID_DCS                   = 516;
        const int DOMAIN_RID_CERT_ADMINS           = 517;
        const int DOMAIN_RID_SCHEMA_ADMINS         = 518;
@@ -206,16 +230,6 @@ interface security
                SEC_PRIV_REMOTE_INTERACTIVE_LOGON  = 24
        } sec_privilege;
 
-
-       /* a domain SID. Note that unlike Samba3 this contains a pointer,
-          so you can't copy them using assignment */
-       typedef [public,gensize,noprint,noejs,nosize] struct {
-               uint8  sid_rev_num;             /**< SID revision number */
-               [range(0,15)] int8  num_auths;  /**< Number of sub-authorities */
-               uint8  id_auth[6];              /**< Identifier Authority */
-               uint32 sub_auths[num_auths];
-       } dom_sid;
-
        typedef [bitmap8bit] bitmap {
                SEC_ACE_FLAG_OBJECT_INHERIT             = 0x01,
                SEC_ACE_FLAG_CONTAINER_INHERIT          = 0x02,
@@ -239,7 +253,7 @@ interface security
                SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT        = 8
        } security_ace_type;
 
-       typedef bitmap {
+       typedef [bitmap32bit] bitmap {
                SEC_ACE_OBJECT_TYPE_PRESENT             = 0x00000001,
                SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT   = 0x00000002
        } security_ace_object_flags;
index c054dfdb45f4ba664bdc9a9bd2fc373e5700feb3..c66486b29c3cba9fc3136bb0d23b014c00270610 100644 (file)
@@ -14,8 +14,8 @@ import "security.idl", "svcctl.idl";
   helpstring("Server Service")
 ] interface srvsvc
 {
-       declare bitmap svcctl_ServerType;
-       declare bitmap security_secinfo;
+       typedef bitmap svcctl_ServerType svcctl_ServerType;
+       typedef bitmap security_secinfo security_secinfo;
 
 /**************************/
 /* srvsvc_NetCharDev      */
index a0d43232680f20067db6ee171c5901b6115abdca..9f316ab39b58e0c54204a95e05cd491bcc3f3e00 100644 (file)
@@ -13,7 +13,7 @@ import "lsa.idl", "initshutdown.idl", "security.idl";
   helpstring("Remote Registry Service")
 ] interface winreg
 {
-       declare bitmap security_secinfo;
+       typedef bitmap security_secinfo security_secinfo;
 
        typedef [bitmap32bit] bitmap {
                KEY_QUERY_VALUE                 = 0x00001,
index dfb18e7ea8290aa7ec489ae15e6b4de16b45e5b3..9829379eef6b709ca52e1b5cb407b3a038747b11 100644 (file)
@@ -14,7 +14,7 @@ import "srvsvc.idl", "lsa.idl";
   endpoint("ncacn_np:[\\pipe\\wkssvc]","ncacn_ip_tcp:","ncalrpc:")
 ] interface wkssvc
 {
-       declare [v1_enum] enum srvsvc_PlatformId;
+       typedef [v1_enum] enum srvsvc_PlatformId srvsvc_PlatformId;
 
 #define BOOL uint32
 
diff --git a/source/librpc/idl/xattr.idl b/source/librpc/idl/xattr.idl
new file mode 100644 (file)
index 0000000..ec230a4
--- /dev/null
@@ -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;
+}
index 6341e20b650255fb28df949c898e8fb8af9102bc..a277a626c743c1cf2ea7feb09d6568549799d340 100644 (file)
@@ -22,8 +22,8 @@
 
 #define _PRINTF_ATTRIBUTE(a,b) 
 
-#include "librpc/ndr/misc.h"
-#include "librpc/ndr/security.h"
+#include "librpc/gen_ndr/misc.h"
+#include "librpc/gen_ndr/security.h"
 
 /*
   this provides definitions for the libcli/rpc/ MSRPC library
@@ -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 {
diff --git a/source/librpc/ndr/misc.h b/source/librpc/ndr/misc.h
deleted file mode 100644 (file)
index 71975d7..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/* header auto-generated by pidl */
-
-#ifndef _HEADER_misc
-#define _HEADER_misc
-
-struct GUID {
-       uint32_t time_low;
-       uint16_t time_mid;
-       uint16_t time_hi_and_version;
-       uint8_t clock_seq[2];
-       uint8_t node[6];
-}/* [noprint,gensize,public,noejs] */;
-
-struct ndr_syntax_id {
-       struct GUID uuid;
-       uint32_t if_version;
-}/* [public] */;
-
-struct policy_handle {
-       uint32_t handle_type;
-       struct GUID uuid;
-}/* [public] */;
-
-enum netr_SchannelType {
-       SEC_CHAN_WKSTA=2,
-       SEC_CHAN_DOMAIN=4,
-       SEC_CHAN_BDC=6
-};
-
-enum netr_SamDatabaseID {
-       SAM_DATABASE_DOMAIN=0,
-       SAM_DATABASE_BUILTIN=1,
-       SAM_DATABASE_PRIVS=2
-};
-
-enum samr_RejectReason {
-       SAMR_REJECT_OTHER=0,
-       SAMR_REJECT_TOO_SHORT=1,
-       SAMR_REJECT_COMPLEXITY=2
-};
-
-#endif /* _HEADER_misc */
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..79761b9251b44116f2208b6d7210ec72b161dd79 100644 (file)
 
 #include "includes.h"
 
-enum ndr_err_code ndr_push_GUID(struct ndr_push *ndr, int ndr_flags, const struct GUID *r)
-{
-       if (ndr_flags & NDR_SCALARS) {
-               NDR_CHECK(ndr_push_align(ndr, 4));
-               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->time_low));
-               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->time_mid));
-               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->time_hi_and_version));
-               NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->clock_seq, 2));
-               NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->node, 6));
-       }
-       if (ndr_flags & NDR_BUFFERS) {
-       }
-       return NDR_ERR_SUCCESS;
-}
-
-enum ndr_err_code ndr_pull_GUID(struct ndr_pull *ndr, int ndr_flags, struct GUID *r)
-{
-       if (ndr_flags & NDR_SCALARS) {
-               NDR_CHECK(ndr_pull_align(ndr, 4));
-               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->time_low));
-               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->time_mid));
-               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->time_hi_and_version));
-               NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->clock_seq, 2));
-               NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->node, 6));
-       }
-       if (ndr_flags & NDR_BUFFERS) {
-       }
-       return NDR_ERR_SUCCESS;
-}
-
-size_t ndr_size_GUID(const struct GUID *r, int flags)
-{
-       return ndr_size_struct(r, flags, (ndr_push_flags_fn_t)ndr_push_GUID);
-}
-
 /**
  * see if a range of memory is all zero. A NULL pointer is considered
  * to be all zero 
@@ -78,39 +43,6 @@ void ndr_print_GUID(struct ndr_print *ndr, const char *name, const struct GUID *
        ndr->print(ndr, "%-25s: %s", name, GUID_string(ndr, guid));
 }
 
-enum ndr_err_code ndr_push_policy_handle(struct ndr_push *ndr, int ndr_flags, const struct policy_handle *r)
-{
-       if (ndr_flags & NDR_SCALARS) {
-               NDR_CHECK(ndr_push_align(ndr, 4));
-               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->handle_type));
-               NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &r->uuid));
-       }
-       if (ndr_flags & NDR_BUFFERS) {
-       }
-       return NDR_ERR_SUCCESS;
-}
-
-enum ndr_err_code ndr_pull_policy_handle(struct ndr_pull *ndr, int ndr_flags, struct policy_handle *r)
-{
-       if (ndr_flags & NDR_SCALARS) {
-               NDR_CHECK(ndr_pull_align(ndr, 4));
-               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->handle_type));
-               NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, &r->uuid));
-       }
-       if (ndr_flags & NDR_BUFFERS) {
-       }
-       return NDR_ERR_SUCCESS;
-}
-
-void ndr_print_policy_handle(struct ndr_print *ndr, const char *name, const struct policy_handle *r)
-{
-       ndr_print_struct(ndr, name, "policy_handle");
-       ndr->depth++;
-       ndr_print_uint32(ndr, "handle_type", r->handle_type);
-       ndr_print_GUID(ndr, "uuid", &r->uuid);
-       ndr->depth--;
-}
-
 enum ndr_err_code ndr_push_server_id(struct ndr_push *ndr, int ndr_flags, const struct server_id *r)
 {
        if (ndr_flags & NDR_SCALARS) {
index d1938b95884e1939708bd28153fc88b3519ff095..f8bad6ca6164b376be09ba5a24963f3854d616fe 100644 (file)
@@ -89,818 +89,3 @@ void ndr_print_dom_sid28(struct ndr_print *ndr, const char *name, const struct d
 {
        ndr_print_dom_sid(ndr, name, sid);
 }
-
-static enum ndr_err_code ndr_push_security_ace_flags(struct ndr_push *ndr, int ndr_flags, uint8_t r)
-{
-       NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r));
-       return NDR_ERR_SUCCESS;
-}
-
-static enum ndr_err_code ndr_pull_security_ace_flags(struct ndr_pull *ndr, int ndr_flags, uint8_t *r)
-{
-       uint8_t v;
-       NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &v));
-       *r = v;
-       return NDR_ERR_SUCCESS;
-}
-
-void ndr_print_security_ace_flags(struct ndr_print *ndr, const char *name, uint8_t r)
-{
-       ndr_print_uint8(ndr, name, r);
-       ndr->depth++;
-       ndr_print_bitmap_flag(ndr, sizeof(uint8_t), "SEC_ACE_FLAG_OBJECT_INHERIT", SEC_ACE_FLAG_OBJECT_INHERIT, r);
-       ndr_print_bitmap_flag(ndr, sizeof(uint8_t), "SEC_ACE_FLAG_CONTAINER_INHERIT", SEC_ACE_FLAG_CONTAINER_INHERIT, r);
-       ndr_print_bitmap_flag(ndr, sizeof(uint8_t), "SEC_ACE_FLAG_NO_PROPAGATE_INHERIT", SEC_ACE_FLAG_NO_PROPAGATE_INHERIT, r);
-       ndr_print_bitmap_flag(ndr, sizeof(uint8_t), "SEC_ACE_FLAG_INHERIT_ONLY", SEC_ACE_FLAG_INHERIT_ONLY, r);
-       ndr_print_bitmap_flag(ndr, sizeof(uint8_t), "SEC_ACE_FLAG_INHERITED_ACE", SEC_ACE_FLAG_INHERITED_ACE, r);
-       ndr_print_bitmap_flag(ndr, sizeof(uint8_t), "SEC_ACE_FLAG_VALID_INHERIT", SEC_ACE_FLAG_VALID_INHERIT, r);
-       ndr_print_bitmap_flag(ndr, sizeof(uint8_t), "SEC_ACE_FLAG_SUCCESSFUL_ACCESS", SEC_ACE_FLAG_SUCCESSFUL_ACCESS, r);
-       ndr_print_bitmap_flag(ndr, sizeof(uint8_t), "SEC_ACE_FLAG_FAILED_ACCESS", SEC_ACE_FLAG_FAILED_ACCESS, r);
-       ndr->depth--;
-}
-
-static enum ndr_err_code ndr_push_security_ace_type(struct ndr_push *ndr, int ndr_flags, enum security_ace_type r)
-{
-       NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r));
-       return NDR_ERR_SUCCESS;
-}
-
-static enum ndr_err_code ndr_pull_security_ace_type(struct ndr_pull *ndr, int ndr_flags, enum security_ace_type *r)
-{
-       uint8_t v;
-       NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &v));
-       *r = (enum security_ace_type)v;
-       return NDR_ERR_SUCCESS;
-}
-
-void ndr_print_security_ace_type(struct ndr_print *ndr, const char *name, enum security_ace_type r)
-{
-       const char *val = NULL;
-
-       switch (r) {
-               case SEC_ACE_TYPE_ACCESS_ALLOWED: val = "SEC_ACE_TYPE_ACCESS_ALLOWED"; break;
-               case SEC_ACE_TYPE_ACCESS_DENIED: val = "SEC_ACE_TYPE_ACCESS_DENIED"; break;
-               case SEC_ACE_TYPE_SYSTEM_AUDIT: val = "SEC_ACE_TYPE_SYSTEM_AUDIT"; break;
-               case SEC_ACE_TYPE_SYSTEM_ALARM: val = "SEC_ACE_TYPE_SYSTEM_ALARM"; break;
-               case SEC_ACE_TYPE_ALLOWED_COMPOUND: val = "SEC_ACE_TYPE_ALLOWED_COMPOUND"; break;
-               case SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT: val = "SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT"; break;
-               case SEC_ACE_TYPE_ACCESS_DENIED_OBJECT: val = "SEC_ACE_TYPE_ACCESS_DENIED_OBJECT"; break;
-               case SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT: val = "SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT"; break;
-               case SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT: val = "SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT"; break;
-       }
-       ndr_print_enum(ndr, name, "ENUM", val, r);
-}
-
-static enum ndr_err_code ndr_push_security_ace_object_flags(struct ndr_push *ndr, int ndr_flags, uint32_t r)
-{
-       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
-       return NDR_ERR_SUCCESS;
-}
-
-static enum ndr_err_code ndr_pull_security_ace_object_flags(struct ndr_pull *ndr, int ndr_flags, uint32_t *r)
-{
-       uint32_t v;
-       NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
-       *r = v;
-       return NDR_ERR_SUCCESS;
-}
-
-void ndr_print_security_ace_object_flags(struct ndr_print *ndr, const char *name, uint32_t r)
-{
-       ndr_print_uint32(ndr, name, r);
-       ndr->depth++;
-       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SEC_ACE_OBJECT_TYPE_PRESENT", SEC_ACE_OBJECT_TYPE_PRESENT, r);
-       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT", SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT, r);
-       ndr->depth--;
-}
-
-static enum ndr_err_code ndr_push_security_ace_object_type(struct ndr_push *ndr, int ndr_flags, const union security_ace_object_type *r)
-{
-       int level;
-       level = ndr_push_get_switch_value(ndr, r);
-       if (ndr_flags & NDR_SCALARS) {
-               switch (level) {
-                       case SEC_ACE_OBJECT_TYPE_PRESENT:
-                               NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &r->type));
-                       break;
-
-                       default:
-                       break;
-
-               }
-       }
-       if (ndr_flags & NDR_BUFFERS) {
-               switch (level) {
-                       case SEC_ACE_OBJECT_TYPE_PRESENT:
-                       break;
-
-                       default:
-                       break;
-
-               }
-       }
-       return NDR_ERR_SUCCESS;
-}
-
-static enum ndr_err_code ndr_pull_security_ace_object_type(struct ndr_pull *ndr, int ndr_flags, union security_ace_object_type *r)
-{
-       int level;
-       level = ndr_pull_get_switch_value(ndr, r);
-       if (ndr_flags & NDR_SCALARS) {
-               switch (level) {
-                       case SEC_ACE_OBJECT_TYPE_PRESENT: {
-                               NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, &r->type));
-                       break; }
-
-                       default: {
-                       break; }
-
-               }
-       }
-       if (ndr_flags & NDR_BUFFERS) {
-               switch (level) {
-                       case SEC_ACE_OBJECT_TYPE_PRESENT:
-                       break;
-
-                       default:
-                       break;
-
-               }
-       }
-       return NDR_ERR_SUCCESS;
-}
-
-void ndr_print_security_ace_object_type(struct ndr_print *ndr, const char *name, const union security_ace_object_type *r)
-{
-       int level;
-       level = ndr_print_get_switch_value(ndr, r);
-       ndr_print_union(ndr, name, level, "security_ace_object_type");
-       switch (level) {
-               case SEC_ACE_OBJECT_TYPE_PRESENT:
-                       ndr_print_GUID(ndr, "type", &r->type);
-               break;
-
-               default:
-               break;
-
-       }
-}
-
-static enum ndr_err_code ndr_push_security_ace_object_inherited_type(struct ndr_push *ndr, int ndr_flags, const union security_ace_object_inherited_type *r)
-{
-       int level;
-       level = ndr_push_get_switch_value(ndr, r);
-       if (ndr_flags & NDR_SCALARS) {
-               switch (level) {
-                       case SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT:
-                               NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &r->inherited_type));
-                       break;
-
-                       default:
-                       break;
-
-               }
-       }
-       if (ndr_flags & NDR_BUFFERS) {
-               switch (level) {
-                       case SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT:
-                       break;
-
-                       default:
-                       break;
-
-               }
-       }
-       return NDR_ERR_SUCCESS;
-}
-
-static enum ndr_err_code ndr_pull_security_ace_object_inherited_type(struct ndr_pull *ndr, int ndr_flags, union security_ace_object_inherited_type *r)
-{
-       int level;
-       level = ndr_pull_get_switch_value(ndr, r);
-       if (ndr_flags & NDR_SCALARS) {
-               switch (level) {
-                       case SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT: {
-                               NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, &r->inherited_type));
-                       break; }
-
-                       default: {
-                       break; }
-
-               }
-       }
-       if (ndr_flags & NDR_BUFFERS) {
-               switch (level) {
-                       case SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT:
-                       break;
-
-                       default:
-                       break;
-
-               }
-       }
-       return NDR_ERR_SUCCESS;
-}
-
-void ndr_print_security_ace_object_inherited_type(struct ndr_print *ndr, const char *name, const union security_ace_object_inherited_type *r)
-{
-       int level;
-       level = ndr_print_get_switch_value(ndr, r);
-       ndr_print_union(ndr, name, level, "security_ace_object_inherited_type");
-       switch (level) {
-               case SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT:
-                       ndr_print_GUID(ndr, "inherited_type", &r->inherited_type);
-               break;
-
-               default:
-               break;
-
-       }
-}
-
-static enum ndr_err_code ndr_push_security_ace_object(struct ndr_push *ndr, int ndr_flags, const struct security_ace_object *r)
-{
-       if (ndr_flags & NDR_SCALARS) {
-               NDR_CHECK(ndr_push_align(ndr, 4));
-               NDR_CHECK(ndr_push_security_ace_object_flags(ndr, NDR_SCALARS, r->flags));
-               NDR_CHECK(ndr_push_set_switch_value(ndr, &r->type, r->flags&SEC_ACE_OBJECT_TYPE_PRESENT));
-               NDR_CHECK(ndr_push_security_ace_object_type(ndr, NDR_SCALARS, &r->type));
-               NDR_CHECK(ndr_push_set_switch_value(ndr, &r->inherited_type, r->flags&SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT));
-               NDR_CHECK(ndr_push_security_ace_object_inherited_type(ndr, NDR_SCALARS, &r->inherited_type));
-       }
-       if (ndr_flags & NDR_BUFFERS) {
-               NDR_CHECK(ndr_push_security_ace_object_type(ndr, NDR_BUFFERS, &r->type));
-               NDR_CHECK(ndr_push_security_ace_object_inherited_type(ndr, NDR_BUFFERS, &r->inherited_type));
-       }
-       return NDR_ERR_SUCCESS;
-}
-
-static enum ndr_err_code ndr_pull_security_ace_object(struct ndr_pull *ndr, int ndr_flags, struct security_ace_object *r)
-{
-       if (ndr_flags & NDR_SCALARS) {
-               NDR_CHECK(ndr_pull_align(ndr, 4));
-               NDR_CHECK(ndr_pull_security_ace_object_flags(ndr, NDR_SCALARS, &r->flags));
-               NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->type, r->flags&SEC_ACE_OBJECT_TYPE_PRESENT));
-               NDR_CHECK(ndr_pull_security_ace_object_type(ndr, NDR_SCALARS, &r->type));
-               NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->inherited_type, r->flags&SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT));
-               NDR_CHECK(ndr_pull_security_ace_object_inherited_type(ndr, NDR_SCALARS, &r->inherited_type));
-       }
-       if (ndr_flags & NDR_BUFFERS) {
-               NDR_CHECK(ndr_pull_security_ace_object_type(ndr, NDR_BUFFERS, &r->type));
-               NDR_CHECK(ndr_pull_security_ace_object_inherited_type(ndr, NDR_BUFFERS, &r->inherited_type));
-       }
-       return NDR_ERR_SUCCESS;
-}
-
-void ndr_print_security_ace_object(struct ndr_print *ndr, const char *name, const struct security_ace_object *r)
-{
-       ndr_print_struct(ndr, name, "security_ace_object");
-       ndr->depth++;
-       ndr_print_security_ace_object_flags(ndr, "flags", r->flags);
-       ndr_print_set_switch_value(ndr, &r->type, r->flags&SEC_ACE_OBJECT_TYPE_PRESENT);
-       ndr_print_security_ace_object_type(ndr, "type", &r->type);
-       ndr_print_set_switch_value(ndr, &r->inherited_type, r->flags&SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT);
-       ndr_print_security_ace_object_inherited_type(ndr, "inherited_type", &r->inherited_type);
-       ndr->depth--;
-}
-
-static enum ndr_err_code ndr_push_security_ace_object_ctr(struct ndr_push *ndr, int ndr_flags, const union security_ace_object_ctr *r)
-{
-       int level;
-       level = ndr_push_get_switch_value(ndr, r);
-       if (ndr_flags & NDR_SCALARS) {
-               switch (level) {
-                       case SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT:
-                               NDR_CHECK(ndr_push_security_ace_object(ndr, NDR_SCALARS, &r->object));
-                       break;
-
-                       case SEC_ACE_TYPE_ACCESS_DENIED_OBJECT:
-                               NDR_CHECK(ndr_push_security_ace_object(ndr, NDR_SCALARS, &r->object));
-                       break;
-
-                       case SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT:
-                               NDR_CHECK(ndr_push_security_ace_object(ndr, NDR_SCALARS, &r->object));
-                       break;
-
-                       case SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT:
-                               NDR_CHECK(ndr_push_security_ace_object(ndr, NDR_SCALARS, &r->object));
-                       break;
-
-                       default:
-                       break;
-
-               }
-       }
-       if (ndr_flags & NDR_BUFFERS) {
-               switch (level) {
-                       case SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT:
-                               NDR_CHECK(ndr_push_security_ace_object(ndr, NDR_BUFFERS, &r->object));
-                       break;
-
-                       case SEC_ACE_TYPE_ACCESS_DENIED_OBJECT:
-                               NDR_CHECK(ndr_push_security_ace_object(ndr, NDR_BUFFERS, &r->object));
-                       break;
-
-                       case SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT:
-                               NDR_CHECK(ndr_push_security_ace_object(ndr, NDR_BUFFERS, &r->object));
-                       break;
-
-                       case SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT:
-                               NDR_CHECK(ndr_push_security_ace_object(ndr, NDR_BUFFERS, &r->object));
-                       break;
-
-                       default:
-                       break;
-
-               }
-       }
-       return NDR_ERR_SUCCESS;
-}
-
-static enum ndr_err_code ndr_pull_security_ace_object_ctr(struct ndr_pull *ndr, int ndr_flags, union security_ace_object_ctr *r)
-{
-       int level;
-       level = ndr_pull_get_switch_value(ndr, r);
-       if (ndr_flags & NDR_SCALARS) {
-               switch (level) {
-                       case SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT: {
-                               NDR_CHECK(ndr_pull_security_ace_object(ndr, NDR_SCALARS, &r->object));
-                       break; }
-
-                       case SEC_ACE_TYPE_ACCESS_DENIED_OBJECT: {
-                               NDR_CHECK(ndr_pull_security_ace_object(ndr, NDR_SCALARS, &r->object));
-                       break; }
-
-                       case SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT: {
-                               NDR_CHECK(ndr_pull_security_ace_object(ndr, NDR_SCALARS, &r->object));
-                       break; }
-
-                       case SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT: {
-                               NDR_CHECK(ndr_pull_security_ace_object(ndr, NDR_SCALARS, &r->object));
-                       break; }
-
-                       default: {
-                       break; }
-
-               }
-       }
-       if (ndr_flags & NDR_BUFFERS) {
-               switch (level) {
-                       case SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT:
-                               NDR_CHECK(ndr_pull_security_ace_object(ndr, NDR_BUFFERS, &r->object));
-                       break;
-
-                       case SEC_ACE_TYPE_ACCESS_DENIED_OBJECT:
-                               NDR_CHECK(ndr_pull_security_ace_object(ndr, NDR_BUFFERS, &r->object));
-                       break;
-
-                       case SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT:
-                               NDR_CHECK(ndr_pull_security_ace_object(ndr, NDR_BUFFERS, &r->object));
-                       break;
-
-                       case SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT:
-                               NDR_CHECK(ndr_pull_security_ace_object(ndr, NDR_BUFFERS, &r->object));
-                       break;
-
-                       default:
-                       break;
-
-               }
-       }
-       return NDR_ERR_SUCCESS;
-}
-
-void ndr_print_security_ace_object_ctr(struct ndr_print *ndr, const char *name, const union security_ace_object_ctr *r)
-{
-       int level;
-       level = ndr_print_get_switch_value(ndr, r);
-       ndr_print_union(ndr, name, level, "security_ace_object_ctr");
-       switch (level) {
-               case SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT:
-                       ndr_print_security_ace_object(ndr, "object", &r->object);
-               break;
-
-               case SEC_ACE_TYPE_ACCESS_DENIED_OBJECT:
-                       ndr_print_security_ace_object(ndr, "object", &r->object);
-               break;
-
-               case SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT:
-                       ndr_print_security_ace_object(ndr, "object", &r->object);
-               break;
-
-               case SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT:
-                       ndr_print_security_ace_object(ndr, "object", &r->object);
-               break;
-
-               default:
-               break;
-
-       }
-}
-
-enum ndr_err_code ndr_push_security_ace(struct ndr_push *ndr, int ndr_flags, const struct security_ace *r)
-{
-       if (ndr_flags & NDR_SCALARS) {
-               NDR_CHECK(ndr_push_align(ndr, 4));
-               NDR_CHECK(ndr_push_security_ace_type(ndr, NDR_SCALARS, r->type));
-               NDR_CHECK(ndr_push_security_ace_flags(ndr, NDR_SCALARS, r->flags));
-               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, ndr_size_security_ace(r,ndr->flags)));
-               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->access_mask));
-               NDR_CHECK(ndr_push_set_switch_value(ndr, &r->object, r->type));
-               NDR_CHECK(ndr_push_security_ace_object_ctr(ndr, NDR_SCALARS, &r->object));
-               NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS, &r->trustee));
-       }
-       if (ndr_flags & NDR_BUFFERS) {
-               NDR_CHECK(ndr_push_security_ace_object_ctr(ndr, NDR_BUFFERS, &r->object));
-       }
-       return NDR_ERR_SUCCESS;
-}
-
-enum ndr_err_code ndr_pull_security_ace(struct ndr_pull *ndr, int ndr_flags, struct security_ace *r)
-{
-       if (ndr_flags & NDR_SCALARS) {
-               NDR_CHECK(ndr_pull_align(ndr, 4));
-               NDR_CHECK(ndr_pull_security_ace_type(ndr, NDR_SCALARS, &r->type));
-               NDR_CHECK(ndr_pull_security_ace_flags(ndr, NDR_SCALARS, &r->flags));
-               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->size));
-               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->access_mask));
-               NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->object, r->type));
-               NDR_CHECK(ndr_pull_security_ace_object_ctr(ndr, NDR_SCALARS, &r->object));
-               NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS, &r->trustee));
-       }
-       if (ndr_flags & NDR_BUFFERS) {
-               NDR_CHECK(ndr_pull_security_ace_object_ctr(ndr, NDR_BUFFERS, &r->object));
-       }
-       return NDR_ERR_SUCCESS;
-}
-
-void ndr_print_security_ace(struct ndr_print *ndr, const char *name, const struct security_ace *r)
-{
-       ndr_print_struct(ndr, name, "security_ace");
-       ndr->depth++;
-       ndr_print_security_ace_type(ndr, "type", r->type);
-       ndr_print_security_ace_flags(ndr, "flags", r->flags);
-       ndr_print_uint16(ndr, "size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?ndr_size_security_ace(r,ndr->flags):r->size);
-       ndr_print_uint32(ndr, "access_mask", r->access_mask);
-       ndr_print_set_switch_value(ndr, &r->object, r->type);
-       ndr_print_security_ace_object_ctr(ndr, "object", &r->object);
-       ndr_print_dom_sid(ndr, "trustee", &r->trustee);
-       ndr->depth--;
-}
-
-static enum ndr_err_code ndr_push_security_acl_revision(struct ndr_push *ndr, int ndr_flags, enum security_acl_revision r)
-{
-       NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r));
-       return NDR_ERR_SUCCESS;
-}
-
-static enum ndr_err_code ndr_pull_security_acl_revision(struct ndr_pull *ndr, int ndr_flags, enum security_acl_revision *r)
-{
-       uint16_t v;
-       NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v));
-       *r = (enum security_acl_revision)v;
-       return NDR_ERR_SUCCESS;
-}
-
-void ndr_print_security_acl_revision(struct ndr_print *ndr, const char *name, enum security_acl_revision r)
-{
-       const char *val = NULL;
-
-       switch (r) {
-               case SECURITY_ACL_REVISION_NT4: val = "SECURITY_ACL_REVISION_NT4"; break;
-               case SECURITY_ACL_REVISION_ADS: val = "SECURITY_ACL_REVISION_ADS"; break;
-       }
-       ndr_print_enum(ndr, name, "ENUM", val, r);
-}
-
-enum ndr_err_code ndr_push_security_acl(struct ndr_push *ndr, int ndr_flags, const struct security_acl *r)
-{
-       uint32_t cntr_aces_0;
-       if (ndr_flags & NDR_SCALARS) {
-               NDR_CHECK(ndr_push_align(ndr, 4));
-               NDR_CHECK(ndr_push_security_acl_revision(ndr, NDR_SCALARS, r->revision));
-               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, ndr_size_security_acl(r,ndr->flags)));
-               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num_aces));
-               for (cntr_aces_0 = 0; cntr_aces_0 < r->num_aces; cntr_aces_0++) {
-                       NDR_CHECK(ndr_push_security_ace(ndr, NDR_SCALARS, &r->aces[cntr_aces_0]));
-               }
-       }
-       if (ndr_flags & NDR_BUFFERS) {
-               for (cntr_aces_0 = 0; cntr_aces_0 < r->num_aces; cntr_aces_0++) {
-                       NDR_CHECK(ndr_push_security_ace(ndr, NDR_BUFFERS, &r->aces[cntr_aces_0]));
-               }
-       }
-       return NDR_ERR_SUCCESS;
-}
-
-enum ndr_err_code ndr_pull_security_acl(struct ndr_pull *ndr, int ndr_flags, struct security_acl *r)
-{
-       uint32_t cntr_aces_0;
-       TALLOC_CTX *_mem_save_aces_0;
-       if (ndr_flags & NDR_SCALARS) {
-               NDR_CHECK(ndr_pull_align(ndr, 4));
-               NDR_CHECK(ndr_pull_security_acl_revision(ndr, NDR_SCALARS, &r->revision));
-               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->size));
-               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->num_aces));
-               if (r->num_aces > 1000) { /* num_aces is unsigned */
-                       return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
-               }
-               NDR_PULL_ALLOC_N(ndr, r->aces, r->num_aces);
-               _mem_save_aces_0 = NDR_PULL_GET_MEM_CTX(ndr);
-               NDR_PULL_SET_MEM_CTX(ndr, r->aces, 0);
-               for (cntr_aces_0 = 0; cntr_aces_0 < r->num_aces; cntr_aces_0++) {
-                       NDR_CHECK(ndr_pull_security_ace(ndr, NDR_SCALARS, &r->aces[cntr_aces_0]));
-               }
-               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_aces_0, 0);
-       }
-       if (ndr_flags & NDR_BUFFERS) {
-               _mem_save_aces_0 = NDR_PULL_GET_MEM_CTX(ndr);
-               NDR_PULL_SET_MEM_CTX(ndr, r->aces, 0);
-               for (cntr_aces_0 = 0; cntr_aces_0 < r->num_aces; cntr_aces_0++) {
-                       NDR_CHECK(ndr_pull_security_ace(ndr, NDR_BUFFERS, &r->aces[cntr_aces_0]));
-               }
-               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_aces_0, 0);
-       }
-       return NDR_ERR_SUCCESS;
-}
-
-void ndr_print_security_acl(struct ndr_print *ndr, const char *name, const struct security_acl *r)
-{
-       uint32_t cntr_aces_0;
-       ndr_print_struct(ndr, name, "security_acl");
-       ndr->depth++;
-       ndr_print_security_acl_revision(ndr, "revision", r->revision);
-       ndr_print_uint16(ndr, "size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?ndr_size_security_acl(r,ndr->flags):r->size);
-       ndr_print_uint32(ndr, "num_aces", r->num_aces);
-       ndr->print(ndr, "%s: ARRAY(%d)", "aces", r->num_aces);
-       ndr->depth++;
-       for (cntr_aces_0=0;cntr_aces_0<r->num_aces;cntr_aces_0++) {
-               char *idx_0=NULL;
-               asprintf(&idx_0, "[%d]", cntr_aces_0);
-               if (idx_0) {
-                       ndr_print_security_ace(ndr, "aces", &r->aces[cntr_aces_0]);
-                       free(idx_0);
-               }
-       }
-       ndr->depth--;
-       ndr->depth--;
-}
-
-static enum ndr_err_code ndr_push_security_descriptor_revision(struct ndr_push *ndr, int ndr_flags, enum security_descriptor_revision r)
-{
-       NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r));
-       return NDR_ERR_SUCCESS;
-}
-
-static enum ndr_err_code ndr_pull_security_descriptor_revision(struct ndr_pull *ndr, int ndr_flags, enum security_descriptor_revision *r)
-{
-       uint8_t v;
-       NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &v));
-       *r = (enum security_descriptor_revision)v;
-       return NDR_ERR_SUCCESS;
-}
-
-void ndr_print_security_descriptor_revision(struct ndr_print *ndr, const char *name, enum security_descriptor_revision r)
-{
-       const char *val = NULL;
-
-       switch (r) {
-               case SECURITY_DESCRIPTOR_REVISION_1: val = "SECURITY_DESCRIPTOR_REVISION_1"; break;
-       }
-       ndr_print_enum(ndr, name, "ENUM", val, r);
-}
-
-static enum ndr_err_code ndr_push_security_descriptor_type(struct ndr_push *ndr, int ndr_flags, uint16_t r)
-{
-       NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r));
-       return NDR_ERR_SUCCESS;
-}
-
-static enum ndr_err_code ndr_pull_security_descriptor_type(struct ndr_pull *ndr, int ndr_flags, uint16_t *r)
-{
-       uint16_t v;
-       NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v));
-       *r = v;
-       return NDR_ERR_SUCCESS;
-}
-
-void ndr_print_security_descriptor_type(struct ndr_print *ndr, const char *name, uint16_t r)
-{
-       ndr_print_uint16(ndr, name, r);
-       ndr->depth++;
-       ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_OWNER_DEFAULTED", SEC_DESC_OWNER_DEFAULTED, r);
-       ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_GROUP_DEFAULTED", SEC_DESC_GROUP_DEFAULTED, r);
-       ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_DACL_PRESENT", SEC_DESC_DACL_PRESENT, r);
-       ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_DACL_DEFAULTED", SEC_DESC_DACL_DEFAULTED, r);
-       ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SACL_PRESENT", SEC_DESC_SACL_PRESENT, r);
-       ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SACL_DEFAULTED", SEC_DESC_SACL_DEFAULTED, r);
-       ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_DACL_TRUSTED", SEC_DESC_DACL_TRUSTED, r);
-       ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SERVER_SECURITY", SEC_DESC_SERVER_SECURITY, r);
-       ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_DACL_AUTO_INHERIT_REQ", SEC_DESC_DACL_AUTO_INHERIT_REQ, r);
-       ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SACL_AUTO_INHERIT_REQ", SEC_DESC_SACL_AUTO_INHERIT_REQ, r);
-       ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_DACL_AUTO_INHERITED", SEC_DESC_DACL_AUTO_INHERITED, r);
-       ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SACL_AUTO_INHERITED", SEC_DESC_SACL_AUTO_INHERITED, r);
-       ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_DACL_PROTECTED", SEC_DESC_DACL_PROTECTED, r);
-       ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SACL_PROTECTED", SEC_DESC_SACL_PROTECTED, r);
-       ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_RM_CONTROL_VALID", SEC_DESC_RM_CONTROL_VALID, r);
-       ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SELF_RELATIVE", SEC_DESC_SELF_RELATIVE, r);
-       ndr->depth--;
-}
-
-enum ndr_err_code ndr_push_security_descriptor(struct ndr_push *ndr, int ndr_flags, const struct security_descriptor *r)
-{
-       {
-               uint32_t _flags_save_STRUCT = ndr->flags;
-               ndr_set_flags(&ndr->flags, LIBNDR_FLAG_LITTLE_ENDIAN);
-               if (ndr_flags & NDR_SCALARS) {
-                       NDR_CHECK(ndr_push_align(ndr, 4));
-                       NDR_CHECK(ndr_push_security_descriptor_revision(ndr, NDR_SCALARS, r->revision));
-                       NDR_CHECK(ndr_push_security_descriptor_type(ndr, NDR_SCALARS, r->type));
-                       NDR_CHECK(ndr_push_relative_ptr1(ndr, r->owner_sid));
-                       NDR_CHECK(ndr_push_relative_ptr1(ndr, r->group_sid));
-                       NDR_CHECK(ndr_push_relative_ptr1(ndr, r->sacl));
-                       NDR_CHECK(ndr_push_relative_ptr1(ndr, r->dacl));
-               }
-               if (ndr_flags & NDR_BUFFERS) {
-                       if (r->owner_sid) {
-                               NDR_CHECK(ndr_push_relative_ptr2(ndr, r->owner_sid));
-                               NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS, r->owner_sid));
-                       }
-                       if (r->group_sid) {
-                               NDR_CHECK(ndr_push_relative_ptr2(ndr, r->group_sid));
-                               NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS, r->group_sid));
-                       }
-                       if (r->sacl) {
-                               NDR_CHECK(ndr_push_relative_ptr2(ndr, r->sacl));
-                               NDR_CHECK(ndr_push_security_acl(ndr, NDR_SCALARS|NDR_BUFFERS, r->sacl));
-                       }
-                       if (r->dacl) {
-                               NDR_CHECK(ndr_push_relative_ptr2(ndr, r->dacl));
-                               NDR_CHECK(ndr_push_security_acl(ndr, NDR_SCALARS|NDR_BUFFERS, r->dacl));
-                       }
-               }
-               ndr->flags = _flags_save_STRUCT;
-       }
-       return NDR_ERR_SUCCESS;
-}
-
-enum ndr_err_code ndr_pull_security_descriptor(struct ndr_pull *ndr, int ndr_flags, struct security_descriptor *r)
-{
-       uint32_t _ptr_owner_sid;
-       TALLOC_CTX *_mem_save_owner_sid_0;
-       uint32_t _ptr_group_sid;
-       TALLOC_CTX *_mem_save_group_sid_0;
-       uint32_t _ptr_sacl;
-       TALLOC_CTX *_mem_save_sacl_0;
-       uint32_t _ptr_dacl;
-       TALLOC_CTX *_mem_save_dacl_0;
-       {
-               uint32_t _flags_save_STRUCT = ndr->flags;
-               ndr_set_flags(&ndr->flags, LIBNDR_FLAG_LITTLE_ENDIAN);
-               if (ndr_flags & NDR_SCALARS) {
-                       NDR_CHECK(ndr_pull_align(ndr, 4));
-                       NDR_CHECK(ndr_pull_security_descriptor_revision(ndr, NDR_SCALARS, &r->revision));
-                       NDR_CHECK(ndr_pull_security_descriptor_type(ndr, NDR_SCALARS, &r->type));
-                       NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_owner_sid));
-                       if (_ptr_owner_sid) {
-                               NDR_PULL_ALLOC(ndr, r->owner_sid);
-                               NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->owner_sid, _ptr_owner_sid));
-                       } else {
-                               r->owner_sid = NULL;
-                       }
-                       NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_group_sid));
-                       if (_ptr_group_sid) {
-                               NDR_PULL_ALLOC(ndr, r->group_sid);
-                               NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->group_sid, _ptr_group_sid));
-                       } else {
-                               r->group_sid = NULL;
-                       }
-                       NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_sacl));
-                       if (_ptr_sacl) {
-                               NDR_PULL_ALLOC(ndr, r->sacl);
-                               NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->sacl, _ptr_sacl));
-                       } else {
-                               r->sacl = NULL;
-                       }
-                       NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_dacl));
-                       if (_ptr_dacl) {
-                               NDR_PULL_ALLOC(ndr, r->dacl);
-                               NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->dacl, _ptr_dacl));
-                       } else {
-                               r->dacl = NULL;
-                       }
-               }
-               if (ndr_flags & NDR_BUFFERS) {
-                       if (r->owner_sid) {
-                               struct ndr_pull_save _relative_save;
-                               ndr_pull_save(ndr, &_relative_save);
-                               NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->owner_sid));
-                               _mem_save_owner_sid_0 = NDR_PULL_GET_MEM_CTX(ndr);
-                               NDR_PULL_SET_MEM_CTX(ndr, r->owner_sid, 0);
-                               NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS, r->owner_sid));
-                               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_owner_sid_0, 0);
-                               ndr_pull_restore(ndr, &_relative_save);
-                       }
-                       if (r->group_sid) {
-                               struct ndr_pull_save _relative_save;
-                               ndr_pull_save(ndr, &_relative_save);
-                               NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->group_sid));
-                               _mem_save_group_sid_0 = NDR_PULL_GET_MEM_CTX(ndr);
-                               NDR_PULL_SET_MEM_CTX(ndr, r->group_sid, 0);
-                               NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS, r->group_sid));
-                               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_group_sid_0, 0);
-                               ndr_pull_restore(ndr, &_relative_save);
-                       }
-                       if (r->sacl) {
-                               struct ndr_pull_save _relative_save;
-                               ndr_pull_save(ndr, &_relative_save);
-                               NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->sacl));
-                               _mem_save_sacl_0 = NDR_PULL_GET_MEM_CTX(ndr);
-                               NDR_PULL_SET_MEM_CTX(ndr, r->sacl, 0);
-                               NDR_CHECK(ndr_pull_security_acl(ndr, NDR_SCALARS|NDR_BUFFERS, r->sacl));
-                               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sacl_0, 0);
-                               ndr_pull_restore(ndr, &_relative_save);
-                       }
-                       if (r->dacl) {
-                               struct ndr_pull_save _relative_save;
-                               ndr_pull_save(ndr, &_relative_save);
-                               NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->dacl));
-                               _mem_save_dacl_0 = NDR_PULL_GET_MEM_CTX(ndr);
-                               NDR_PULL_SET_MEM_CTX(ndr, r->dacl, 0);
-                               NDR_CHECK(ndr_pull_security_acl(ndr, NDR_SCALARS|NDR_BUFFERS, r->dacl));
-                               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_dacl_0, 0);
-                               ndr_pull_restore(ndr, &_relative_save);
-                       }
-               }
-               ndr->flags = _flags_save_STRUCT;
-       }
-       return NDR_ERR_SUCCESS;
-}
-
-void ndr_print_security_descriptor(struct ndr_print *ndr, const char *name, const struct security_descriptor *r)
-{
-       ndr_print_struct(ndr, name, "security_descriptor");
-       {
-               uint32_t _flags_save_STRUCT = ndr->flags;
-               ndr_set_flags(&ndr->flags, LIBNDR_FLAG_LITTLE_ENDIAN);
-               ndr->depth++;
-               ndr_print_security_descriptor_revision(ndr, "revision", r->revision);
-               ndr_print_security_descriptor_type(ndr, "type", r->type);
-               ndr_print_ptr(ndr, "owner_sid", r->owner_sid);
-               ndr->depth++;
-               if (r->owner_sid) {
-                       ndr_print_dom_sid(ndr, "owner_sid", r->owner_sid);
-               }
-               ndr->depth--;
-               ndr_print_ptr(ndr, "group_sid", r->group_sid);
-               ndr->depth++;
-               if (r->group_sid) {
-                       ndr_print_dom_sid(ndr, "group_sid", r->group_sid);
-               }
-               ndr->depth--;
-               ndr_print_ptr(ndr, "sacl", r->sacl);
-               ndr->depth++;
-               if (r->sacl) {
-                       ndr_print_security_acl(ndr, "sacl", r->sacl);
-               }
-               ndr->depth--;
-               ndr_print_ptr(ndr, "dacl", r->dacl);
-               ndr->depth++;
-               if (r->dacl) {
-                       ndr_print_security_acl(ndr, "dacl", r->dacl);
-               }
-               ndr->depth--;
-               ndr->depth--;
-               ndr->flags = _flags_save_STRUCT;
-       }
-}
-
-enum ndr_err_code ndr_push_security_secinfo(struct ndr_push *ndr, int ndr_flags, uint32_t r)
-{
-       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
-       return NDR_ERR_SUCCESS;
-}
-
-enum ndr_err_code ndr_pull_security_secinfo(struct ndr_pull *ndr, int ndr_flags, uint32_t *r)
-{
-       uint32_t v;
-       NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
-       *r = v;
-       return NDR_ERR_SUCCESS;
-}
-
-void ndr_print_security_secinfo(struct ndr_print *ndr, const char *name, uint32_t r)
-{
-       ndr_print_uint32(ndr, name, r);
-       ndr->depth++;
-       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_OWNER", SECINFO_OWNER, r);
-       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_GROUP", SECINFO_GROUP, r);
-       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_DACL", SECINFO_DACL, r);
-       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_SACL", SECINFO_SACL, r);
-       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_UNPROTECTED_SACL", SECINFO_UNPROTECTED_SACL, r);
-       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_UNPROTECTED_DACL", SECINFO_UNPROTECTED_DACL, r);
-       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_PROTECTED_SACL", SECINFO_PROTECTED_SACL, r);
-       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_PROTECTED_DACL", SECINFO_PROTECTED_DACL, r);
-       ndr->depth--;
-}
-
diff --git a/source/librpc/ndr/security.h b/source/librpc/ndr/security.h
deleted file mode 100644 (file)
index 99f7daf..0000000
+++ /dev/null
@@ -1,257 +0,0 @@
-/* header auto-generated by pidl */
-
-#ifndef _HEADER_security
-#define _HEADER_security
-
-#define SEC_MASK_GENERIC       ( 0xF0000000 )
-#define SEC_MASK_FLAGS ( 0x0F000000 )
-#define SEC_MASK_STANDARD      ( 0x00FF0000 )
-#define SEC_MASK_SPECIFIC      ( 0x0000FFFF )
-#define SEC_GENERIC_ALL        ( 0x10000000 )
-#define SEC_GENERIC_EXECUTE    ( 0x20000000 )
-#define SEC_GENERIC_WRITE      ( 0x40000000 )
-#define SEC_GENERIC_READ       ( 0x80000000 )
-#define SEC_FLAG_SYSTEM_SECURITY       ( 0x01000000 )
-#define SEC_FLAG_MAXIMUM_ALLOWED       ( 0x02000000 )
-#define SEC_STD_DELETE ( 0x00010000 )
-#define SEC_STD_READ_CONTROL   ( 0x00020000 )
-#define SEC_STD_WRITE_DAC      ( 0x00040000 )
-#define SEC_STD_WRITE_OWNER    ( 0x00080000 )
-#define SEC_STD_SYNCHRONIZE    ( 0x00100000 )
-#define SEC_STD_REQUIRED       ( 0x000F0000 )
-#define SEC_STD_ALL    ( 0x001F0000 )
-#define SEC_FILE_READ_DATA     ( 0x00000001 )
-#define SEC_FILE_WRITE_DATA    ( 0x00000002 )
-#define SEC_FILE_APPEND_DATA   ( 0x00000004 )
-#define SEC_FILE_READ_EA       ( 0x00000008 )
-#define SEC_FILE_WRITE_EA      ( 0x00000010 )
-#define SEC_FILE_EXECUTE       ( 0x00000020 )
-#define SEC_FILE_READ_ATTRIBUTE        ( 0x00000080 )
-#define SEC_FILE_WRITE_ATTRIBUTE       ( 0x00000100 )
-#define SEC_FILE_ALL   ( 0x000001ff )
-#define SEC_DIR_LIST   ( 0x00000001 )
-#define SEC_DIR_ADD_FILE       ( 0x00000002 )
-#define SEC_DIR_ADD_SUBDIR     ( 0x00000004 )
-#define SEC_DIR_READ_EA        ( 0x00000008 )
-#define SEC_DIR_WRITE_EA       ( 0x00000010 )
-#define SEC_DIR_TRAVERSE       ( 0x00000020 )
-#define SEC_DIR_DELETE_CHILD   ( 0x00000040 )
-#define SEC_DIR_READ_ATTRIBUTE ( 0x00000080 )
-#define SEC_DIR_WRITE_ATTRIBUTE        ( 0x00000100 )
-#define SEC_REG_QUERY_VALUE    ( 0x00000001 )
-#define SEC_REG_SET_VALUE      ( 0x00000002 )
-#define SEC_REG_CREATE_SUBKEY  ( 0x00000004 )
-#define SEC_REG_ENUM_SUBKEYS   ( 0x00000008 )
-#define SEC_REG_NOTIFY ( 0x00000010 )
-#define SEC_REG_CREATE_LINK    ( 0x00000020 )
-#define SEC_ADS_CREATE_CHILD   ( 0x00000001 )
-#define SEC_ADS_DELETE_CHILD   ( 0x00000002 )
-#define SEC_ADS_LIST   ( 0x00000004 )
-#define SEC_ADS_SELF_WRITE     ( 0x00000008 )
-#define SEC_ADS_READ_PROP      ( 0x00000010 )
-#define SEC_ADS_WRITE_PROP     ( 0x00000020 )
-#define SEC_ADS_DELETE_TREE    ( 0x00000040 )
-#define SEC_ADS_LIST_OBJECT    ( 0x00000080 )
-#define SEC_ADS_CONTROL_ACCESS ( 0x00000100 )
-#define SEC_RIGHTS_FILE_READ   ( SEC_STD_READ_CONTROL|SEC_STD_SYNCHRONIZE|SEC_FILE_READ_DATA|SEC_FILE_READ_ATTRIBUTE|SEC_FILE_READ_EA )
-#define SEC_RIGHTS_FILE_WRITE  ( SEC_STD_READ_CONTROL|SEC_STD_SYNCHRONIZE|SEC_FILE_WRITE_DATA|SEC_FILE_WRITE_ATTRIBUTE|SEC_FILE_WRITE_EA|SEC_FILE_APPEND_DATA )
-#define SEC_RIGHTS_FILE_EXECUTE        ( SEC_STD_SYNCHRONIZE|SEC_STD_READ_CONTROL|SEC_FILE_READ_ATTRIBUTE|SEC_FILE_EXECUTE )
-#define SEC_RIGHTS_FILE_ALL    ( SEC_STD_ALL|SEC_FILE_ALL )
-#define SEC_RIGHTS_DIR_READ    ( SEC_RIGHTS_FILE_READ )
-#define SEC_RIGHTS_DIR_WRITE   ( SEC_RIGHTS_FILE_WRITE )
-#define SEC_RIGHTS_DIR_EXECUTE ( SEC_RIGHTS_FILE_EXECUTE )
-#define SEC_RIGHTS_DIR_ALL     ( SEC_RIGHTS_FILE_ALL )
-#define SID_NULL       ( "S-1-0-0" )
-#define SID_WORLD_DOMAIN       ( "S-1-1" )
-#define SID_WORLD      ( "S-1-1-0" )
-#define SID_CREATOR_OWNER_DOMAIN       ( "S-1-3" )
-#define SID_CREATOR_OWNER      ( "S-1-3-0" )
-#define SID_CREATOR_GROUP      ( "S-1-3-1" )
-#define SID_NT_AUTHORITY       ( "S-1-5" )
-#define SID_NT_DIALUP  ( "S-1-5-1" )
-#define SID_NT_NETWORK ( "S-1-5-2" )
-#define SID_NT_BATCH   ( "S-1-5-3" )
-#define SID_NT_INTERACTIVE     ( "S-1-5-4" )
-#define SID_NT_SERVICE ( "S-1-5-6" )
-#define SID_NT_ANONYMOUS       ( "S-1-5-7" )
-#define SID_NT_PROXY   ( "S-1-5-8" )
-#define SID_NT_ENTERPRISE_DCS  ( "S-1-5-9" )
-#define SID_NT_SELF    ( "S-1-5-10" )
-#define SID_NT_AUTHENTICATED_USERS     ( "S-1-5-11" )
-#define SID_NT_RESTRICTED      ( "S-1-5-12" )
-#define SID_NT_TERMINAL_SERVER_USERS   ( "S-1-5-13" )
-#define SID_NT_REMOTE_INTERACTIVE      ( "S-1-5-14" )
-#define SID_NT_THIS_ORGANISATION       ( "S-1-5-15" )
-#define SID_NT_SYSTEM  ( "S-1-5-18" )
-#define SID_NT_LOCAL_SERVICE   ( "S-1-5-19" )
-#define SID_NT_NETWORK_SERVICE ( "S-1-5-20" )
-#define SID_BUILTIN    ( "S-1-5-32" )
-#define SID_BUILTIN_ADMINISTRATORS     ( "S-1-5-32-544" )
-#define SID_BUILTIN_USERS      ( "S-1-5-32-545" )
-#define SID_BUILTIN_GUESTS     ( "S-1-5-32-546" )
-#define SID_BUILTIN_POWER_USERS        ( "S-1-5-32-547" )
-#define SID_BUILTIN_ACCOUNT_OPERATORS  ( "S-1-5-32-548" )
-#define SID_BUILTIN_SERVER_OPERATORS   ( "S-1-5-32-549" )
-#define SID_BUILTIN_PRINT_OPERATORS    ( "S-1-5-32-550" )
-#define SID_BUILTIN_BACKUP_OPERATORS   ( "S-1-5-32-551" )
-#define SID_BUILTIN_REPLICATOR ( "S-1-5-32-552" )
-#define SID_BUILTIN_RAS_SERVERS        ( "S-1-5-32-553" )
-#define SID_BUILTIN_PREW2K     ( "S-1-5-32-554" )
-#define DOMAIN_RID_LOGON       ( 9 )
-#define DOMAIN_RID_ADMINISTRATOR       ( 500 )
-#define DOMAIN_RID_GUEST       ( 501 )
-#define DOMAIN_RID_ADMINS      ( 512 )
-#define DOMAIN_RID_USERS       ( 513 )
-#define DOMAIN_RID_DCS ( 516 )
-#define DOMAIN_RID_CERT_ADMINS ( 517 )
-#define DOMAIN_RID_SCHEMA_ADMINS       ( 518 )
-#define DOMAIN_RID_ENTERPRISE_ADMINS   ( 519 )
-#define NT4_ACL_REVISION       ( SECURITY_ACL_REVISION_NT4 )
-#define SD_REVISION    ( SECURITY_DESCRIPTOR_REVISION_1 )
-enum sec_privilege {
-       SEC_PRIV_SECURITY=1,
-       SEC_PRIV_BACKUP=2,
-       SEC_PRIV_RESTORE=3,
-       SEC_PRIV_SYSTEMTIME=4,
-       SEC_PRIV_SHUTDOWN=5,
-       SEC_PRIV_REMOTE_SHUTDOWN=6,
-       SEC_PRIV_TAKE_OWNERSHIP=7,
-       SEC_PRIV_DEBUG=8,
-       SEC_PRIV_SYSTEM_ENVIRONMENT=9,
-       SEC_PRIV_SYSTEM_PROFILE=10,
-       SEC_PRIV_PROFILE_SINGLE_PROCESS=11,
-       SEC_PRIV_INCREASE_BASE_PRIORITY=12,
-       SEC_PRIV_LOAD_DRIVER=13,
-       SEC_PRIV_CREATE_PAGEFILE=14,
-       SEC_PRIV_INCREASE_QUOTA=15,
-       SEC_PRIV_CHANGE_NOTIFY=16,
-       SEC_PRIV_UNDOCK=17,
-       SEC_PRIV_MANAGE_VOLUME=18,
-       SEC_PRIV_IMPERSONATE=19,
-       SEC_PRIV_CREATE_GLOBAL=20,
-       SEC_PRIV_ENABLE_DELEGATION=21,
-       SEC_PRIV_INTERACTIVE_LOGON=22,
-       SEC_PRIV_NETWORK_LOGON=23,
-       SEC_PRIV_REMOTE_INTERACTIVE_LOGON=24
-};
-
-/* bitmap security_ace_flags */
-#define SEC_ACE_FLAG_OBJECT_INHERIT ( 0x01 )
-#define SEC_ACE_FLAG_CONTAINER_INHERIT ( 0x02 )
-#define SEC_ACE_FLAG_NO_PROPAGATE_INHERIT ( 0x04 )
-#define SEC_ACE_FLAG_INHERIT_ONLY ( 0x08 )
-#define SEC_ACE_FLAG_INHERITED_ACE ( 0x10 )
-#define SEC_ACE_FLAG_VALID_INHERIT ( 0x0f )
-#define SEC_ACE_FLAG_SUCCESSFUL_ACCESS ( 0x40 )
-#define SEC_ACE_FLAG_FAILED_ACCESS ( 0x80 )
-
-enum security_ace_type {
-       SEC_ACE_TYPE_ACCESS_ALLOWED=0,
-       SEC_ACE_TYPE_ACCESS_DENIED=1,
-       SEC_ACE_TYPE_SYSTEM_AUDIT=2,
-       SEC_ACE_TYPE_SYSTEM_ALARM=3,
-       SEC_ACE_TYPE_ALLOWED_COMPOUND=4,
-       SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT=5,
-       SEC_ACE_TYPE_ACCESS_DENIED_OBJECT=6,
-       SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT=7,
-       SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT=8
-};
-
-/* bitmap security_ace_object_flags */
-#define SEC_ACE_OBJECT_TYPE_PRESENT ( 0x00000001 )
-#define SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT ( 0x00000002 )
-
-union security_ace_object_type {
-       struct GUID type;/* [case(SEC_ACE_OBJECT_TYPE_PRESENT)] */
-}/* [nodiscriminant] */;
-
-union security_ace_object_inherited_type {
-       struct GUID inherited_type;/* [case(SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT)] */
-}/* [nodiscriminant] */;
-
-struct security_ace_object {
-       uint32_t flags;
-       union security_ace_object_type type;/* [switch_is(flags&SEC_ACE_OBJECT_TYPE_PRESENT)] */
-       union security_ace_object_inherited_type inherited_type;/* [switch_is(flags&SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT)] */
-};
-
-union security_ace_object_ctr {
-       struct security_ace_object object;/* [case(SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT)] */
-}/* [nodiscriminant] */;
-
-struct security_ace {
-       enum security_ace_type type;
-       uint8_t flags;
-       uint16_t size;/* [value(ndr_size_security_ace(r,ndr->flags))] */
-       uint32_t access_mask;
-       union security_ace_object_ctr object;/* [switch_is(type)] */
-       struct dom_sid trustee;
-}/* [gensize,public,nosize] */;
-
-enum security_acl_revision {
-       SECURITY_ACL_REVISION_NT4=2,
-       SECURITY_ACL_REVISION_ADS=4
-};
-
-struct security_acl {
-       enum security_acl_revision revision;
-       uint16_t size;/* [value(ndr_size_security_acl(r,ndr->flags))] */
-       uint32_t num_aces;/* [range(0 1000)] */
-       struct security_ace *aces;
-}/* [gensize,public,nosize] */;
-
-enum security_descriptor_revision {
-       SECURITY_DESCRIPTOR_REVISION_1=1
-};
-
-/* bitmap security_descriptor_type */
-#define SEC_DESC_OWNER_DEFAULTED ( 0x0001 )
-#define SEC_DESC_GROUP_DEFAULTED ( 0x0002 )
-#define SEC_DESC_DACL_PRESENT ( 0x0004 )
-#define SEC_DESC_DACL_DEFAULTED ( 0x0008 )
-#define SEC_DESC_SACL_PRESENT ( 0x0010 )
-#define SEC_DESC_SACL_DEFAULTED ( 0x0020 )
-#define SEC_DESC_DACL_TRUSTED ( 0x0040 )
-#define SEC_DESC_SERVER_SECURITY ( 0x0080 )
-#define SEC_DESC_DACL_AUTO_INHERIT_REQ ( 0x0100 )
-#define SEC_DESC_SACL_AUTO_INHERIT_REQ ( 0x0200 )
-#define SEC_DESC_DACL_AUTO_INHERITED ( 0x0400 )
-#define SEC_DESC_SACL_AUTO_INHERITED ( 0x0800 )
-#define SEC_DESC_DACL_PROTECTED ( 0x1000 )
-#define SEC_DESC_SACL_PROTECTED ( 0x2000 )
-#define SEC_DESC_RM_CONTROL_VALID ( 0x4000 )
-#define SEC_DESC_SELF_RELATIVE ( 0x8000 )
-
-struct security_descriptor {
-       enum security_descriptor_revision revision;
-       uint16_t type;
-       struct dom_sid *owner_sid;/* [relative] */
-       struct dom_sid *group_sid;/* [relative] */
-       struct security_acl *sacl;/* [relative] */
-       struct security_acl *dacl;/* [relative] */
-}/* [gensize,public,flag(LIBNDR_FLAG_LITTLE_ENDIAN),nosize] */;
-
-struct sec_desc_buf {
-       uint32_t sd_size;/* [value(ndr_size_security_descriptor(sd,ndr->flags)),range(0 0x40000)] */
-       struct security_descriptor *sd;/* [unique,subcontext(4)] */
-}/* [public] */;
-
-struct security_token {
-       struct dom_sid *user_sid;/* [unique] */
-       struct dom_sid *group_sid;/* [unique] */
-       uint32_t num_sids;
-       struct dom_sid **sids;/* [unique,size_is(num_sids)] */
-       uint64_t privilege_mask;
-}/* [public] */;
-
-/* bitmap security_secinfo */
-#define SECINFO_OWNER ( 0x00000001 )
-#define SECINFO_GROUP ( 0x00000002 )
-#define SECINFO_DACL ( 0x00000004 )
-#define SECINFO_SACL ( 0x00000008 )
-#define SECINFO_UNPROTECTED_SACL ( 0x10000000 )
-#define SECINFO_UNPROTECTED_DACL ( 0x20000000 )
-#define SECINFO_PROTECTED_SACL ( 0x40000000 )
-#define SECINFO_PROTECTED_DACL ( 0x80000000 )
-
-#endif /* _HEADER_security */
index 89ab2b8ea50557c3304692cc85a523cd2a8f4bba..b6ec045806d8876b266ea28845b2319d32d13181 100644 (file)
@@ -187,70 +187,3 @@ enum ndr_err_code ndr_push_dom_sid28(struct ndr_push *ndr, int ndr_flags, const
 
        return NDR_ERR_SUCCESS;
 }
-
-enum ndr_err_code ndr_push_sec_desc_buf(struct ndr_push *ndr, int ndr_flags, const struct sec_desc_buf *r)
-{
-       if (ndr_flags & NDR_SCALARS) {
-               NDR_CHECK(ndr_push_align(ndr, 4));
-               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_size_security_descriptor(r->sd,ndr->flags)));
-               NDR_CHECK(ndr_push_unique_ptr(ndr, r->sd));
-       }
-       if (ndr_flags & NDR_BUFFERS) {
-               if (r->sd) {
-                       {
-                               struct ndr_push *_ndr_sd;
-                               NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_sd, 4, -1));
-                               NDR_CHECK(ndr_push_security_descriptor(_ndr_sd, NDR_SCALARS|NDR_BUFFERS, r->sd));
-                               NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_sd, 4, -1));
-                       }
-               }
-       }
-       return NDR_ERR_SUCCESS;
-}
-
-enum ndr_err_code ndr_pull_sec_desc_buf(struct ndr_pull *ndr, int ndr_flags, struct sec_desc_buf *r)
-{
-       uint32_t _ptr_sd;
-       TALLOC_CTX *_mem_save_sd_0;
-       if (ndr_flags & NDR_SCALARS) {
-               NDR_CHECK(ndr_pull_align(ndr, 4));
-               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->sd_size));
-               if (r->sd_size > 0x40000) { /* sd_size is unsigned */
-                       return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
-               }
-               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_sd));
-               if (_ptr_sd) {
-                       NDR_PULL_ALLOC(ndr, r->sd);
-               } else {
-                       r->sd = NULL;
-               }
-       }
-       if (ndr_flags & NDR_BUFFERS) {
-               if (r->sd) {
-                       _mem_save_sd_0 = NDR_PULL_GET_MEM_CTX(ndr);
-                       NDR_PULL_SET_MEM_CTX(ndr, r->sd, 0);
-                       {
-                               struct ndr_pull *_ndr_sd;
-                               NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_sd, 4, -1));
-                               NDR_CHECK(ndr_pull_security_descriptor(_ndr_sd, NDR_SCALARS|NDR_BUFFERS, r->sd));
-                               NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_sd, 4, -1));
-                       }
-                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sd_0, 0);
-               }
-       }
-       return NDR_ERR_SUCCESS;
-}
-
-void ndr_print_sec_desc_buf(struct ndr_print *ndr, const char *name, const struct sec_desc_buf *r)
-{
-       ndr_print_struct(ndr, name, "sec_desc_buf");
-       ndr->depth++;
-       ndr_print_uint32(ndr, "sd_size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?ndr_size_security_descriptor(r->sd,ndr->flags):r->sd_size);
-       ndr_print_ptr(ndr, "sd", r->sd);
-       ndr->depth++;
-       if (r->sd) {
-               ndr_print_security_descriptor(ndr, "sd", r->sd);
-       }
-       ndr->depth--;
-       ndr->depth--;
-}
index 52ff69953eb12cdf550fcad2dd07c65acaffbb69..f3926b777b92e9381e416200fe7fbb80427eb3f1 100644 (file)
@@ -98,7 +98,7 @@ static NTSTATUS cli_session_setup_lanman2(struct cli_state *cli,
 
        /* send a session setup command */
        memset(cli->outbuf,'\0',smb_size);
-       set_message(cli->outbuf,10, 0, True);
+       cli_set_message(cli->outbuf,10, 0, True);
        SCVAL(cli->outbuf,smb_com,SMBsesssetupX);
        cli_setup_packet(cli);
        
@@ -168,7 +168,7 @@ static NTSTATUS cli_session_setup_guest(struct cli_state *cli)
        uint32 capabilities = cli_session_setup_capabilities(cli);
 
        memset(cli->outbuf, '\0', smb_size);
-       set_message(cli->outbuf,13,0,True);
+       cli_set_message(cli->outbuf,13,0,True);
        SCVAL(cli->outbuf,smb_com,SMBsesssetupX);
        cli_setup_packet(cli);
                        
@@ -228,7 +228,7 @@ static NTSTATUS cli_session_setup_plaintext(struct cli_state *cli,
        fstr_sprintf( lanman, "Samba %s", SAMBA_VERSION_STRING);
 
        memset(cli->outbuf, '\0', smb_size);
-       set_message(cli->outbuf,13,0,True);
+       cli_set_message(cli->outbuf,13,0,True);
        SCVAL(cli->outbuf,smb_com,SMBsesssetupX);
        cli_setup_packet(cli);
                        
@@ -377,7 +377,7 @@ static NTSTATUS cli_session_setup_nt1(struct cli_state *cli, const char *user,
        /* send a session setup command */
        memset(cli->outbuf,'\0',smb_size);
 
-       set_message(cli->outbuf,13,0,True);
+       cli_set_message(cli->outbuf,13,0,True);
        SCVAL(cli->outbuf,smb_com,SMBsesssetupX);
        cli_setup_packet(cli);
                        
@@ -457,7 +457,7 @@ static bool cli_session_setup_blob_send(struct cli_state *cli, DATA_BLOB blob)
        /* send a session setup command */
        memset(cli->outbuf,'\0',smb_size);
 
-       set_message(cli->outbuf,12,0,True);
+       cli_set_message(cli->outbuf,12,0,True);
        SCVAL(cli->outbuf,smb_com,SMBsesssetupX);
 
        cli_setup_packet(cli);
@@ -863,8 +863,7 @@ ADS_STATUS cli_session_setup_spnego(struct cli_state *cli, const char *user,
                /* If we get a bad principal, try to guess it if
                   we have a valid host NetBIOS name.
                 */
-               if (strequal(principal,
-                               "not_defined_in_RFC4178@please_ignore")) {
+               if (strequal(principal, ADS_IGNORE_PRINCIPAL)) {
                        SAFE_FREE(principal);
                }
 
@@ -873,13 +872,27 @@ ADS_STATUS cli_session_setup_spnego(struct cli_state *cli, const char *user,
                        !strequal(star_smbserver_name,
                                cli->desthost)) {
                        char *realm = NULL;
+                       char *machine = NULL;
+                       char *host = NULL;
                        DEBUG(3,("cli_session_setup_spnego: got a "
                                "bad server principal, trying to guess ...\n"));
 
+                       host = strchr_m(cli->desthost, '.');
+                       if (host) {
+                               machine = SMB_STRNDUP(cli->desthost,
+                                       host - cli->desthost);
+                       } else {
+                               machine = SMB_STRDUP(cli->desthost);
+                       }
+                       if (machine == NULL) {
+                               return ADS_ERROR_NT(NT_STATUS_NO_MEMORY);
+                       }
+
                        realm = kerberos_get_default_realm_from_ccache();
                        if (realm && *realm) {
                                if (asprintf(&principal, "%s$@%s",
-                                               cli->desthost, realm) < 0) {
+                                               machine, realm) < 0) {
+                                       SAFE_FREE(machine);
                                        SAFE_FREE(realm);
                                        return ADS_ERROR_NT(NT_STATUS_NO_MEMORY);
                                }
@@ -887,6 +900,7 @@ ADS_STATUS cli_session_setup_spnego(struct cli_state *cli, const char *user,
                                        "server principal=%s\n",
                                        principal ? principal : "<null>"));
                        }
+                       SAFE_FREE(machine);
                        SAFE_FREE(realm);
                }
 
@@ -959,8 +973,8 @@ NTSTATUS cli_session_setup(struct cli_state *cli,
 
                if ((cli->sec_mode & NEGOTIATE_SECURITY_CHALLENGE_RESPONSE) == 0 &&
                    !lp_client_plaintext_auth() && (*pass)) {
-                       DEBUG(1, ("Server requested plaintext password but 'client use plaintext auth'"
-                                 " is disabled\n"));
+                       DEBUG(1, ("Server requested plaintext password but "
+                                 "'client plaintext auth' is disabled\n"));
                        return NT_STATUS_ACCESS_DENIED;
                }
 
@@ -986,8 +1000,8 @@ NTSTATUS cli_session_setup(struct cli_state *cli,
 
        if ((cli->sec_mode & NEGOTIATE_SECURITY_CHALLENGE_RESPONSE) == 0) {
                if (!lp_client_plaintext_auth() && (*pass)) {
-                       DEBUG(1, ("Server requested plaintext password but 'client use plaintext auth'"
-                                 " is disabled\n"));
+                       DEBUG(1, ("Server requested plaintext password but "
+                                 "'client plaintext auth' is disabled\n"));
                        return NT_STATUS_ACCESS_DENIED;
                }
                return cli_session_setup_plaintext(cli, user, pass, workgroup);
@@ -1029,7 +1043,7 @@ NTSTATUS cli_session_setup(struct cli_state *cli,
 bool cli_ulogoff(struct cli_state *cli)
 {
        memset(cli->outbuf,'\0',smb_size);
-       set_message(cli->outbuf,2,0,True);
+       cli_set_message(cli->outbuf,2,0,True);
        SCVAL(cli->outbuf,smb_com,SMBulogoffX);
        cli_setup_packet(cli);
        SSVAL(cli->outbuf,smb_vwv0,0xFF);
@@ -1086,8 +1100,9 @@ bool cli_send_tconX(struct cli_state *cli,
        } else {
                if((cli->sec_mode & (NEGOTIATE_SECURITY_USER_LEVEL|NEGOTIATE_SECURITY_CHALLENGE_RESPONSE)) == 0) {
                        if (!lp_client_plaintext_auth() && (*pass)) {
-                               DEBUG(1, ("Server requested plaintext password but 'client use plaintext auth'"
-                                         " is disabled\n"));
+                               DEBUG(1, ("Server requested plaintext "
+                                         "password but 'client plaintext "
+                                         "auth' is disabled\n"));
                                return False;
                        }
 
@@ -1106,7 +1121,7 @@ bool cli_send_tconX(struct cli_state *cli,
        slprintf(fullshare, sizeof(fullshare)-1,
                 "\\\\%s\\%s", cli->desthost, share);
 
-       set_message(cli->outbuf,4, 0, True);
+       cli_set_message(cli->outbuf,4, 0, True);
        SCVAL(cli->outbuf,smb_com,SMBtconX);
        cli_setup_packet(cli);
 
@@ -1157,7 +1172,7 @@ bool cli_send_tconX(struct cli_state *cli,
 bool cli_tdis(struct cli_state *cli)
 {
        memset(cli->outbuf,'\0',smb_size);
-       set_message(cli->outbuf,0,0,True);
+       cli_set_message(cli->outbuf,0,0,True);
        SCVAL(cli->outbuf,smb_com,SMBtdis);
        SSVAL(cli->outbuf,smb_tid,cli->cnum);
        cli_setup_packet(cli);
@@ -1189,7 +1204,7 @@ void cli_negprot_send(struct cli_state *cli)
        memset(cli->outbuf,'\0',smb_size);
 
        /* setup the protocol strings */
-       set_message(cli->outbuf,0,0,True);
+       cli_set_message(cli->outbuf,0,0,True);
 
        p = smb_buf(cli->outbuf);
        for (numprots=0;
@@ -1229,7 +1244,7 @@ bool cli_negprot(struct cli_state *cli)
             numprots++)
                plength += strlen(prots[numprots].name)+2;
     
-       set_message(cli->outbuf,0,plength,True);
+       cli_set_message(cli->outbuf,0,plength,True);
 
        p = smb_buf(cli->outbuf);
        for (numprots=0;
@@ -1798,15 +1813,15 @@ NTSTATUS cli_raw_tcon(struct cli_state *cli,
        char *p;
 
        if (!lp_client_plaintext_auth() && (*pass)) {
-               DEBUG(1, ("Server requested plaintext password but 'client use plaintext auth'"
-                         " is disabled\n"));
+               DEBUG(1, ("Server requested plaintext password but 'client "
+                         "plaintext auth' is disabled\n"));
                return NT_STATUS_ACCESS_DENIED;
        }
 
        memset(cli->outbuf,'\0',smb_size);
        memset(cli->inbuf,'\0',smb_size);
 
-       set_message(cli->outbuf, 0, 0, True);
+       cli_set_message(cli->outbuf, 0, 0, True);
        SCVAL(cli->outbuf,smb_com,SMBtcon);
        cli_setup_packet(cli);
 
index e0c40b52ed269bf95dd24a89923ab4ba5dc95641..16582f80490693db73d3151031828a8839b1a509 100644 (file)
@@ -58,6 +58,52 @@ static struct sockaddr_storage dest_ss;
 
 static struct client_connection *connections;
 
+static bool cli_check_msdfs_proxy(TALLOC_CTX *ctx,
+                               struct cli_state *cli,
+                               const char *sharename,
+                               char **pp_newserver,
+                               char **pp_newshare,
+                               bool force_encrypt,
+                               const char *username,
+                               const char *password,
+                               const char *domain);
+
+/********************************************************************
+ Ensure a connection is encrypted.
+********************************************************************/
+
+NTSTATUS cli_cm_force_encryption(struct cli_state *c,
+                       const char *username,
+                       const char *password,
+                       const char *domain,
+                       const char *sharename)
+{
+       NTSTATUS status = cli_force_encryption(c,
+                                       username,
+                                       password,
+                                       domain);
+
+       if (NT_STATUS_EQUAL(status,NT_STATUS_NOT_SUPPORTED)) {
+               d_printf("Encryption required and "
+                       "server that doesn't support "
+                       "UNIX extensions - failing connect\n");
+       } else if (NT_STATUS_EQUAL(status,NT_STATUS_UNKNOWN_REVISION)) {
+               d_printf("Encryption required and "
+                       "can't get UNIX CIFS extensions "
+                       "version from server.\n");
+       } else if (NT_STATUS_EQUAL(status,NT_STATUS_UNSUPPORTED_COMPRESSION)) {
+               d_printf("Encryption required and "
+                       "share %s doesn't support "
+                       "encryption.\n", sharename);
+       } else if (!NT_STATUS_IS_OK(status)) {
+               d_printf("Encryption required and "
+                       "setup failed with error %s.\n",
+                       nt_errstr(status));
+       }
+
+       return status;
+}
+       
 /********************************************************************
  Return a connection to a server.
 ********************************************************************/
@@ -65,7 +111,8 @@ static struct client_connection *connections;
 static struct cli_state *do_connect(TALLOC_CTX *ctx,
                                        const char *server,
                                        const char *share,
-                                       bool show_sessetup)
+                                       bool show_sessetup,
+                                       bool force_encrypt)
 {
        struct cli_state *c = NULL;
        struct nmb_name called, calling;
@@ -109,6 +156,9 @@ static struct cli_state *do_connect(TALLOC_CTX *ctx,
        /* have to open a new connection */
        if (!(c=cli_initialise()) || (cli_set_port(c, port) != port)) {
                d_printf("Connection to %s failed\n", server_n);
+               if (c) {
+                       cli_shutdown(c);
+               }
                return NULL;
        }
        status = cli_connect(c, server_n, &ss);
@@ -116,6 +166,7 @@ static struct cli_state *do_connect(TALLOC_CTX *ctx,
                d_printf("Connection to %s failed (Error %s)\n",
                                server_n,
                                nt_errstr(status));
+               cli_shutdown(c);
                return NULL;
        }
 
@@ -197,9 +248,14 @@ static struct cli_state *do_connect(TALLOC_CTX *ctx,
 
        if ((c->capabilities & CAP_DFS) &&
                        cli_check_msdfs_proxy(ctx, c, sharename,
-                               &newserver, &newshare)) {
+                               &newserver, &newshare,
+                               force_encrypt,
+                               username,
+                               password,
+                               lp_workgroup())) {
                cli_shutdown(c);
-               return do_connect(ctx, newserver, newshare, false);
+               return do_connect(ctx, newserver,
+                               newshare, false, force_encrypt);
        }
 
        /* must be a normal share */
@@ -211,6 +267,18 @@ static struct cli_state *do_connect(TALLOC_CTX *ctx,
                return NULL;
        }
 
+       if (force_encrypt) {
+               status = cli_cm_force_encryption(c,
+                                       username,
+                                       password,
+                                       lp_workgroup(),
+                                       sharename);
+               if (!NT_STATUS_IS_OK(status)) {
+                       cli_shutdown(c);
+                       return NULL;
+               }
+       }
+
        DEBUG(4,(" tconx ok\n"));
        return c;
 }
@@ -269,7 +337,8 @@ static struct cli_state *cli_cm_connect(TALLOC_CTX *ctx,
                                        struct cli_state *referring_cli,
                                        const char *server,
                                        const char *share,
-                                       bool show_hdr)
+                                       bool show_hdr,
+                                       bool force_encrypt)
 {
        struct client_connection *node;
 
@@ -279,7 +348,7 @@ static struct cli_state *cli_cm_connect(TALLOC_CTX *ctx,
                return NULL;
        }
 
-       node->cli = do_connect(ctx, server, share, show_hdr);
+       node->cli = do_connect(ctx, server, share, show_hdr, force_encrypt);
 
        if ( !node->cli ) {
                TALLOC_FREE( node );
@@ -331,7 +400,8 @@ struct cli_state *cli_cm_open(TALLOC_CTX *ctx,
                                struct cli_state *referring_cli,
                                const char *server,
                                const char *share,
-                               bool show_hdr)
+                               bool show_hdr,
+                               bool force_encrypt)
 {
        struct cli_state *c;
 
@@ -339,7 +409,8 @@ struct cli_state *cli_cm_open(TALLOC_CTX *ctx,
 
        c = cli_cm_find(server, share);
        if (!c) {
-               c = cli_cm_connect(ctx, referring_cli, server, share, show_hdr);
+               c = cli_cm_connect(ctx, referring_cli,
+                               server, share, show_hdr, force_encrypt);
        }
 
        return c;
@@ -776,7 +847,9 @@ bool cli_resolve_path(TALLOC_CTX *ctx,
        /* Check for the referral. */
 
        if (!(cli_ipc = cli_cm_open(ctx, rootcli,
-                                       rootcli->desthost, "IPC$", false))) {
+                                       rootcli->desthost,
+                                       "IPC$", false,
+                                       (rootcli->trans_enc_state != NULL)))) {
                return false;
        }
 
@@ -818,7 +891,10 @@ bool cli_resolve_path(TALLOC_CTX *ctx,
 
        /* Open the connection to the target server & share */
        if ((*targetcli = cli_cm_open(ctx, rootcli,
-                                       server, share, false)) == NULL) {
+                                       server,
+                                       share,
+                                       false,
+                                       (rootcli->trans_enc_state != NULL))) == NULL) {
                d_printf("Unable to follow dfs referral [\\%s\\%s]\n",
                        server, share );
                return false;
@@ -905,11 +981,15 @@ bool cli_resolve_path(TALLOC_CTX *ctx,
 /********************************************************************
 ********************************************************************/
 
-bool cli_check_msdfs_proxy(TALLOC_CTX *ctx,
+static bool cli_check_msdfs_proxy(TALLOC_CTX *ctx,
                                struct cli_state *cli,
                                const char *sharename,
                                char **pp_newserver,
-                               char **pp_newshare )
+                               char **pp_newshare,
+                               bool force_encrypt,
+                               const char *username,
+                               const char *password,
+                               const char *domain)
 {
        CLIENT_DFS_REFERRAL *refs = NULL;
        size_t num_refs = 0;
@@ -944,6 +1024,17 @@ bool cli_check_msdfs_proxy(TALLOC_CTX *ctx,
                return false;
        }
 
+       if (force_encrypt) {
+               NTSTATUS status = cli_cm_force_encryption(cli,
+                                       username,
+                                       password,
+                                       lp_workgroup(),
+                                       "IPC$");
+               if (!NT_STATUS_IS_OK(status)) {
+                       return false;
+               }
+       }
+
        res = cli_dfs_get_referral(ctx, cli, fullpath, &refs, &num_refs, &consumed);
 
        if (!cli_tdis(cli)) {
index 76630bd50426d2b4843b3377466512ce9ce7078e..66c6ee10228f6f6afa25378ca1baf3fd50d700ec 100644 (file)
@@ -81,7 +81,7 @@ bool cli_send_mailslot(struct messaging_context *msg_ctx,
                return False;
        }
 
-       set_message(ptr,17,strlen(mailslot) + 1 + len,True);
+       cli_set_message(ptr,17,strlen(mailslot) + 1 + len,True);
        memcpy(ptr,tmp,4);
 
        SCVAL(ptr,smb_com,SMBtrans);
index 1a6fb8f93fb9149dfe4ce1377a861f05ca74582d..042b3bdfb041cbe7b53b65e13e7d9ac87921db73 100644 (file)
 
 #include "includes.h"
 
+/*******************************************************************
+ Setup the word count and byte count for a client smb message.
+********************************************************************/
+
+int cli_set_message(char *buf,int num_words,int num_bytes,bool zero)
+{
+       if (zero && (num_words || num_bytes)) {
+               memset(buf + smb_size,'\0',num_words*2 + num_bytes);
+       }
+       SCVAL(buf,smb_wct,num_words);
+       SSVAL(buf,smb_vwv + num_words*SIZEOFWORD,num_bytes);
+       smb_setlen(buf,smb_size + num_words*2 + num_bytes - 4);
+       return (smb_size + num_words*2 + num_bytes);
+}
+
 /****************************************************************************
  Change the timeout (in milliseconds).
 ****************************************************************************/
@@ -71,6 +86,17 @@ static ssize_t client_receive_smb(struct cli_state *cli, size_t maxlen)
                        break;
                }
        }
+
+       if (cli_encryption_on(cli)) {
+               NTSTATUS status = cli_decrypt_message(cli);
+               if (!NT_STATUS_IS_OK(status)) {
+                       DEBUG(0, ("SMB decryption failed on incoming packet! Error %s\n",
+                               nt_errstr(status)));
+                       cli->smb_rw_error = SMB_READ_BAD_DECRYPT;
+                       return -1;
+               }
+       }
+
        show_msg(cli->inbuf);
        return len;
 }
@@ -85,7 +111,7 @@ bool cli_receive_smb(struct cli_state *cli)
 
        /* fd == -1 causes segfaults -- Tom (tom@ninja.nl) */
        if (cli->fd == -1)
-               return False; 
+               return false; 
 
  again:
        len = client_receive_smb(cli, 0);
@@ -100,7 +126,7 @@ bool cli_receive_smb(struct cli_state *cli)
                                int fnum = SVAL(cli->inbuf,smb_vwv2);
                                unsigned char level = CVAL(cli->inbuf,smb_vwv3+1);
                                if (!cli->oplock_handler(cli, fnum, level)) {
-                                       return False;
+                                       return false;
                                }
                        }
                        /* try to prevent loops */
@@ -114,7 +140,7 @@ bool cli_receive_smb(struct cli_state *cli)
                 DEBUG(0, ("Receiving SMB: Server stopped responding\n"));
                close(cli->fd);
                cli->fd = -1;
-               return False;
+               return false;
        }
 
        if (!cli_check_sign_mac(cli)) {
@@ -135,16 +161,16 @@ bool cli_receive_smb(struct cli_state *cli)
                         * Set bad sig but don't close fd.
                         */
                        cli->smb_rw_error = SMB_READ_BAD_SIG;
-                       return True;
+                       return true;
                }
 
                DEBUG(0, ("SMB Signature verification failed on incoming packet!\n"));
                cli->smb_rw_error = SMB_READ_BAD_SIG;
                close(cli->fd);
                cli->fd = -1;
-               return False;
+               return false;
        };
-       return True;
+       return true;
 }
 
 /****************************************************************************
@@ -154,16 +180,13 @@ bool cli_receive_smb(struct cli_state *cli)
 
 ssize_t cli_receive_smb_data(struct cli_state *cli, char *buffer, size_t len)
 {
-       if (cli->timeout > 0) {
-               return read_socket_with_timeout(cli->fd, buffer, len,
-                                               len, cli->timeout, &cli->smb_rw_error);
-       } else {
-               return read_data(cli->fd, buffer, len, &cli->smb_rw_error);
-       }
+       return read_socket_with_timeout(cli->fd, buffer, len, len,
+                                       cli->timeout, &cli->smb_rw_error);
 }
 
 /****************************************************************************
  Read a smb readX header.
+ We can only use this if encryption and signing are off.
 ****************************************************************************/
 
 bool cli_receive_smb_readX_header(struct cli_state *cli)
@@ -171,7 +194,7 @@ bool cli_receive_smb_readX_header(struct cli_state *cli)
        ssize_t len, offset;
 
        if (cli->fd == -1)
-               return False; 
+               return false; 
 
  again:
 
@@ -199,7 +222,7 @@ bool cli_receive_smb_readX_header(struct cli_state *cli)
                        if (cli->oplock_handler) {
                                int fnum = SVAL(cli->inbuf,smb_vwv2);
                                unsigned char level = CVAL(cli->inbuf,smb_vwv3+1);
-                               if (!cli->oplock_handler(cli, fnum, level)) return False;
+                               if (!cli->oplock_handler(cli, fnum, level)) return false;
                        }
                        /* try to prevent loops */
                        SCVAL(cli->inbuf,smb_com,0xFF);
@@ -238,14 +261,14 @@ bool cli_receive_smb_readX_header(struct cli_state *cli)
                }
        }
 
-       return True;
+       return true;
 
   read_err:
 
        cli->smb_rw_error = SMB_READ_ERROR;
        close(cli->fd);
        cli->fd = -1;
-       return False;
+       return false;
 }
 
 static ssize_t write_socket(int fd, const char *buf, size_t len)
@@ -272,32 +295,54 @@ bool cli_send_smb(struct cli_state *cli)
        size_t len;
        size_t nwritten=0;
        ssize_t ret;
+       char *buf_out = cli->outbuf;
+       bool enc_on = cli_encryption_on(cli);
 
        /* fd == -1 causes segfaults -- Tom (tom@ninja.nl) */
        if (cli->fd == -1)
-               return False;
+               return false;
 
        cli_calculate_sign_mac(cli);
 
-       len = smb_len(cli->outbuf) + 4;
+       if (enc_on) {
+               NTSTATUS status = cli_encrypt_message(cli, &buf_out);
+               if (!NT_STATUS_IS_OK(status)) {
+                       close(cli->fd);
+                       cli->fd = -1;
+                       cli->smb_rw_error = SMB_WRITE_ERROR;
+                       DEBUG(0,("Error in encrypting client message. Error %s\n",
+                               nt_errstr(status) ));
+                       return false;
+               }
+       }
+
+       len = smb_len(buf_out) + 4;
 
        while (nwritten < len) {
-               ret = write_socket(cli->fd,cli->outbuf+nwritten,len - nwritten);
+               ret = write_socket(cli->fd,buf_out+nwritten,len - nwritten);
                if (ret <= 0) {
+                       if (enc_on) {
+                               cli_free_enc_buffer(cli, buf_out);
+                       }
                        close(cli->fd);
                        cli->fd = -1;
                        cli->smb_rw_error = SMB_WRITE_ERROR;
                        DEBUG(0,("Error writing %d bytes to client. %d (%s)\n",
                                (int)len,(int)ret, strerror(errno) ));
-                       return False;
+                       return false;
                }
                nwritten += ret;
        }
+
+       if (enc_on) {
+               cli_free_enc_buffer(cli, buf_out);
+       }
+
        /* Increment the mid so we can tell between responses. */
        cli->mid++;
        if (!cli->mid)
                cli->mid++;
-       return True;
+       return true;
 }
 
 /****************************************************************************
@@ -347,7 +392,7 @@ bool cli_send_smb_direct_writeX(struct cli_state *cli,
                        DEBUG(0,("Error writing %d extradata "
                                "bytes to client. %d (%s)\n",
                                (int)extradata,(int)ret, strerror(errno) ));
-                       return False;
+                       return false;
                }
                nwritten += ret;
        }
@@ -409,7 +454,7 @@ void cli_init_creds(struct cli_state *cli, const char *username, const char *dom
        fstrcpy(cli->user_name, username);
        pwd_set_cleartext(&cli->pwd, password);
        if (!*username) {
-               cli->pwd.null_pwd = True;
+               cli->pwd.null_pwd = true;
        }
 
         DEBUG(10,("cli_init_creds: user %s domain %s\n", cli->user_name, cli->domain));
@@ -424,16 +469,16 @@ void cli_setup_signing_state(struct cli_state *cli, int signing_state)
        if (signing_state == Undefined)
                return;
 
-       if (signing_state == False) {
-               cli->sign_info.allow_smb_signing = False;
-               cli->sign_info.mandatory_signing = False;
+       if (signing_state == false) {
+               cli->sign_info.allow_smb_signing = false;
+               cli->sign_info.mandatory_signing = false;
                return;
        }
 
-       cli->sign_info.allow_smb_signing = True;
+       cli->sign_info.allow_smb_signing = true;
 
        if (signing_state == Required) 
-               cli->sign_info.mandatory_signing = True;
+               cli->sign_info.mandatory_signing = true;
 }
 
 /****************************************************************************
@@ -470,8 +515,8 @@ struct cli_state *cli_initialise(void)
        cli->outbuf = (char *)SMB_MALLOC(cli->bufsize+SAFETY_MARGIN);
        cli->inbuf = (char *)SMB_MALLOC(cli->bufsize+SAFETY_MARGIN);
        cli->oplock_handler = cli_oplock_ack;
-       cli->case_sensitive = False;
-       cli->smb_rw_error = 0;
+       cli->case_sensitive = false;
+       cli->smb_rw_error = SMB_READ_OK;
 
        cli->use_spnego = lp_client_use_spnego();
 
@@ -481,13 +526,13 @@ struct cli_state *cli_initialise(void)
           client routines using DOS errors instead of STATUS32
           ones.  This intended only as a temporary hack. */    
        if (getenv("CLI_FORCE_DOSERR"))
-               cli->force_dos_errors = True;
+               cli->force_dos_errors = true;
 
        if (lp_client_signing()) 
-               cli->sign_info.allow_smb_signing = True;
+               cli->sign_info.allow_smb_signing = true;
 
        if (lp_client_signing() == Required) 
-               cli->sign_info.mandatory_signing = True;
+               cli->sign_info.mandatory_signing = true;
                                    
        if (!cli->outbuf || !cli->inbuf)
                 goto error;
@@ -522,7 +567,7 @@ struct cli_state *cli_initialise(void)
 /****************************************************************************
  External interface.
  Close an open named pipe over SMB. Free any authentication data.
- Returns False if the cli_close call failed.
+ Returns false if the cli_close call failed.
  ****************************************************************************/
 
 bool cli_rpc_pipe_close(struct rpc_pipe_client *cli)
@@ -530,7 +575,7 @@ bool cli_rpc_pipe_close(struct rpc_pipe_client *cli)
        bool ret;
 
        if (!cli) {
-               return False;
+               return false;
        }
 
        ret = cli_close(cli->cli, cli->fnum);
@@ -606,7 +651,7 @@ void cli_shutdown(struct cli_state *cli)
                close(cli->fd);
        }
        cli->fd = -1;
-       cli->smb_rw_error = 0;
+       cli->smb_rw_error = SMB_READ_OK;
 
        SAFE_FREE(cli);
 }
@@ -650,15 +695,15 @@ bool cli_send_keepalive(struct cli_state *cli)
 {
         if (cli->fd == -1) {
                 DEBUG(3, ("cli_send_keepalive: fd == -1\n"));
-                return False;
+                return false;
         }
         if (!send_keepalive(cli->fd)) {
                 close(cli->fd);
                 cli->fd = -1;
                 DEBUG(0,("Error sending keepalive packet to client.\n"));
-                return False;
+                return false;
         }
-        return True;
+        return true;
 }
 
 /****************************************************************************
@@ -674,7 +719,7 @@ bool cli_echo(struct cli_state *cli, uint16 num_echos,
        SMB_ASSERT(length < 1024);
 
        memset(cli->outbuf,'\0',smb_size);
-       set_message(cli->outbuf,1,length,True);
+       cli_set_message(cli->outbuf,1,length,true);
        SCVAL(cli->outbuf,smb_com,SMBecho);
        SSVAL(cli->outbuf,smb_tid,65535);
        SSVAL(cli->outbuf,smb_vwv0,num_echos);
@@ -689,13 +734,13 @@ bool cli_echo(struct cli_state *cli, uint16 num_echos,
 
        for (i=0; i<num_echos; i++) {
                if (!cli_receive_smb(cli)) {
-                       return False;
+                       return false;
                }
 
                if (cli_is_error(cli)) {
-                       return False;
+                       return false;
                }
        }
 
-       return True;
+       return true;
 }
index 001a42d4b9a244c32c119840f0555eaa55eddaa8..9b4c380d40705e74afddca0279ffbc4b00e08e05 100644 (file)
@@ -429,7 +429,7 @@ bool cli_rename(struct cli_state *cli, const char *fname_src, const char *fname_
        memset(cli->outbuf,'\0',smb_size);
        memset(cli->inbuf,'\0',smb_size);
 
-       set_message(cli->outbuf,1, 0, true);
+       cli_set_message(cli->outbuf,1, 0, true);
 
        SCVAL(cli->outbuf,smb_com,SMBmv);
        SSVAL(cli->outbuf,smb_tid,cli->cnum);
@@ -470,7 +470,7 @@ bool cli_ntrename(struct cli_state *cli, const char *fname_src, const char *fnam
        memset(cli->outbuf,'\0',smb_size);
        memset(cli->inbuf,'\0',smb_size);
 
-       set_message(cli->outbuf, 4, 0, true);
+       cli_set_message(cli->outbuf, 4, 0, true);
 
        SCVAL(cli->outbuf,smb_com,SMBntrename);
        SSVAL(cli->outbuf,smb_tid,cli->cnum);
@@ -512,7 +512,7 @@ bool cli_nt_hardlink(struct cli_state *cli, const char *fname_src, const char *f
        memset(cli->outbuf,'\0',smb_size);
        memset(cli->inbuf,'\0',smb_size);
 
-       set_message(cli->outbuf, 4, 0, true);
+       cli_set_message(cli->outbuf, 4, 0, true);
 
        SCVAL(cli->outbuf,smb_com,SMBntrename);
        SSVAL(cli->outbuf,smb_tid,cli->cnum);
@@ -554,7 +554,7 @@ bool cli_unlink_full(struct cli_state *cli, const char *fname, uint16 attrs)
        memset(cli->outbuf,'\0',smb_size);
        memset(cli->inbuf,'\0',smb_size);
 
-       set_message(cli->outbuf,1, 0, true);
+       cli_set_message(cli->outbuf,1, 0, true);
 
        SCVAL(cli->outbuf,smb_com,SMBunlink);
        SSVAL(cli->outbuf,smb_tid,cli->cnum);
@@ -600,7 +600,7 @@ bool cli_mkdir(struct cli_state *cli, const char *dname)
        memset(cli->outbuf,'\0',smb_size);
        memset(cli->inbuf,'\0',smb_size);
 
-       set_message(cli->outbuf,0, 0, true);
+       cli_set_message(cli->outbuf,0, 0, true);
 
        SCVAL(cli->outbuf,smb_com,SMBmkdir);
        SSVAL(cli->outbuf,smb_tid,cli->cnum);
@@ -636,7 +636,7 @@ bool cli_rmdir(struct cli_state *cli, const char *dname)
        memset(cli->outbuf,'\0',smb_size);
        memset(cli->inbuf,'\0',smb_size);
 
-       set_message(cli->outbuf,0, 0, true);
+       cli_set_message(cli->outbuf,0, 0, true);
 
        SCVAL(cli->outbuf,smb_com,SMBrmdir);
        SSVAL(cli->outbuf,smb_tid,cli->cnum);
@@ -719,7 +719,7 @@ int cli_nt_create_full(struct cli_state *cli, const char *fname,
        memset(cli->outbuf,'\0',smb_size);
        memset(cli->inbuf,'\0',smb_size);
 
-       set_message(cli->outbuf,24,0, true);
+       cli_set_message(cli->outbuf,24,0, true);
 
        SCVAL(cli->outbuf,smb_com,SMBntcreateX);
        SSVAL(cli->outbuf,smb_tid,cli->cnum);
@@ -815,7 +815,7 @@ int cli_open(struct cli_state *cli, const char *fname, int flags, int share_mode
        memset(cli->outbuf,'\0',smb_size);
        memset(cli->inbuf,'\0',smb_size);
 
-       set_message(cli->outbuf,15,0, true);
+       cli_set_message(cli->outbuf,15,0, true);
 
        SCVAL(cli->outbuf,smb_com,SMBopenX);
        SSVAL(cli->outbuf,smb_tid,cli->cnum);
@@ -863,7 +863,7 @@ bool cli_close(struct cli_state *cli, int fnum)
        memset(cli->outbuf,'\0',smb_size);
        memset(cli->inbuf,'\0',smb_size);
 
-       set_message(cli->outbuf,3,0,True);
+       cli_set_message(cli->outbuf,3,0,True);
 
        SCVAL(cli->outbuf,smb_com,SMBclose);
        SSVAL(cli->outbuf,smb_tid,cli->cnum);
@@ -896,7 +896,7 @@ NTSTATUS cli_locktype(struct cli_state *cli, int fnum,
        memset(cli->outbuf,'\0',smb_size);
        memset(cli->inbuf,'\0', smb_size);
 
-       set_message(cli->outbuf,8,0,True);
+       cli_set_message(cli->outbuf,8,0,True);
 
        SCVAL(cli->outbuf,smb_com,SMBlockingX);
        SSVAL(cli->outbuf,smb_tid,cli->cnum);
@@ -948,7 +948,7 @@ bool cli_lock(struct cli_state *cli, int fnum,
        memset(cli->outbuf,'\0',smb_size);
        memset(cli->inbuf,'\0', smb_size);
 
-       set_message(cli->outbuf,8,0,True);
+       cli_set_message(cli->outbuf,8,0,True);
 
        SCVAL(cli->outbuf,smb_com,SMBlockingX);
        SSVAL(cli->outbuf,smb_tid,cli->cnum);
@@ -1001,7 +1001,7 @@ bool cli_unlock(struct cli_state *cli, int fnum, uint32 offset, uint32 len)
        memset(cli->outbuf,'\0',smb_size);
        memset(cli->inbuf,'\0',smb_size);
 
-       set_message(cli->outbuf,8,0,True);
+       cli_set_message(cli->outbuf,8,0,True);
 
        SCVAL(cli->outbuf,smb_com,SMBlockingX);
        SSVAL(cli->outbuf,smb_tid,cli->cnum);
@@ -1053,7 +1053,7 @@ bool cli_lock64(struct cli_state *cli, int fnum,
        memset(cli->outbuf,'\0',smb_size);
        memset(cli->inbuf,'\0', smb_size);
 
-       set_message(cli->outbuf,8,0,True);
+       cli_set_message(cli->outbuf,8,0,True);
 
        SCVAL(cli->outbuf,smb_com,SMBlockingX);
        SSVAL(cli->outbuf,smb_tid,cli->cnum);
@@ -1108,7 +1108,7 @@ bool cli_unlock64(struct cli_state *cli, int fnum, SMB_BIG_UINT offset, SMB_BIG_
        memset(cli->outbuf,'\0',smb_size);
        memset(cli->inbuf,'\0',smb_size);
 
-       set_message(cli->outbuf,8,0,True);
+       cli_set_message(cli->outbuf,8,0,True);
 
        SCVAL(cli->outbuf,smb_com,SMBlockingX);
        SSVAL(cli->outbuf,smb_tid,cli->cnum);
@@ -1255,7 +1255,7 @@ bool cli_getattrE(struct cli_state *cli, int fd,
        memset(cli->outbuf,'\0',smb_size);
        memset(cli->inbuf,'\0',smb_size);
 
-       set_message(cli->outbuf,1,0,True);
+       cli_set_message(cli->outbuf,1,0,True);
 
        SCVAL(cli->outbuf,smb_com,SMBgetattrE);
        SSVAL(cli->outbuf,smb_tid,cli->cnum);
@@ -1307,7 +1307,7 @@ bool cli_getatr(struct cli_state *cli, const char *fname,
        memset(cli->outbuf,'\0',smb_size);
        memset(cli->inbuf,'\0',smb_size);
 
-       set_message(cli->outbuf,0,0,True);
+       cli_set_message(cli->outbuf,0,0,True);
 
        SCVAL(cli->outbuf,smb_com,SMBgetatr);
        SSVAL(cli->outbuf,smb_tid,cli->cnum);
@@ -1359,7 +1359,7 @@ bool cli_setattrE(struct cli_state *cli, int fd,
        memset(cli->outbuf,'\0',smb_size);
        memset(cli->inbuf,'\0',smb_size);
 
-       set_message(cli->outbuf,7,0,True);
+       cli_set_message(cli->outbuf,7,0,True);
 
        SCVAL(cli->outbuf,smb_com,SMBsetattrE);
        SSVAL(cli->outbuf,smb_tid,cli->cnum);
@@ -1398,7 +1398,7 @@ bool cli_setatr(struct cli_state *cli, const char *fname, uint16 attr, time_t t)
        memset(cli->outbuf,'\0',smb_size);
        memset(cli->inbuf,'\0',smb_size);
 
-       set_message(cli->outbuf,8,0,True);
+       cli_set_message(cli->outbuf,8,0,True);
 
        SCVAL(cli->outbuf,smb_com,SMBsetatr);
        SSVAL(cli->outbuf,smb_tid,cli->cnum);
@@ -1452,7 +1452,7 @@ bool cli_chkpath(struct cli_state *cli, const char *path)
        }
 
        memset(cli->outbuf,'\0',smb_size);
-       set_message(cli->outbuf,0,0,True);
+       cli_set_message(cli->outbuf,0,0,True);
        SCVAL(cli->outbuf,smb_com,SMBcheckpath);
        SSVAL(cli->outbuf,smb_tid,cli->cnum);
        cli_setup_packet(cli);
@@ -1483,7 +1483,7 @@ bool cli_chkpath(struct cli_state *cli, const char *path)
 bool cli_dskattr(struct cli_state *cli, int *bsize, int *total, int *avail)
 {
        memset(cli->outbuf,'\0',smb_size);
-       set_message(cli->outbuf,0,0,True);
+       cli_set_message(cli->outbuf,0,0,True);
        SCVAL(cli->outbuf,smb_com,SMBdskattr);
        SSVAL(cli->outbuf,smb_tid,cli->cnum);
        cli_setup_packet(cli);
@@ -1512,7 +1512,7 @@ int cli_ctemp(struct cli_state *cli, const char *path, char **tmp_path)
        memset(cli->outbuf,'\0',smb_size);
        memset(cli->inbuf,'\0',smb_size);
 
-       set_message(cli->outbuf,3,0,True);
+       cli_set_message(cli->outbuf,3,0,True);
 
        SCVAL(cli->outbuf,smb_com,SMBctemp);
        SSVAL(cli->outbuf,smb_tid,cli->cnum);
@@ -1565,7 +1565,7 @@ NTSTATUS cli_raw_ioctl(struct cli_state *cli, int fnum, uint32 code, DATA_BLOB *
        memset(cli->outbuf,'\0',smb_size);
        memset(cli->inbuf,'\0',smb_size);
 
-       set_message(cli->outbuf, 3, 0, True);
+       cli_set_message(cli->outbuf, 3, 0, True);
        SCVAL(cli->outbuf,smb_com,SMBioctl);
        cli_setup_packet(cli);
 
index 1a75d144b2aa3420aafc0da48600bfe4b2b0bc12..fb923378ab46e18e3fa237e0412cf38beba6b668 100644 (file)
@@ -2,6 +2,7 @@
    Unix SMB/CIFS implementation.
    FS info functions
    Copyright (C) Stefan (metze) Metzmacher     2003
+   Copyright (C) Jeremy Allison 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
@@ -301,3 +302,368 @@ cleanup:
 
        return ret;
 }
+
+/******************************************************************************
+ Send/receive the request encryption blob.
+******************************************************************************/
+
+static NTSTATUS enc_blob_send_receive(struct cli_state *cli, DATA_BLOB *in, DATA_BLOB *out, DATA_BLOB *param_out)
+{
+       uint16 setup;
+       char param[4];
+       char *rparam=NULL, *rdata=NULL;
+       unsigned int rparam_count=0, rdata_count=0;
+       NTSTATUS status = NT_STATUS_OK;
+
+       setup = TRANSACT2_SETFSINFO;
+
+       SSVAL(param,0,0);
+       SSVAL(param,2,SMB_REQUEST_TRANSPORT_ENCRYPTION);
+
+       if (!cli_send_trans(cli, SMBtrans2,
+                               NULL,
+                               0, 0,
+                               &setup, 1, 0,
+                               param, 4, 0,
+                               (char *)in->data, in->length, CLI_BUFFER_SIZE)) {
+               status = cli_nt_error(cli);
+               goto out;
+       }
+
+       if (!cli_receive_trans(cli, SMBtrans2,
+                               &rparam, &rparam_count,
+                               &rdata, &rdata_count)) {
+               status = cli_nt_error(cli);
+               goto out;
+       }
+
+       if (cli_is_error(cli)) {
+               status = cli_nt_error(cli);
+               if (!NT_STATUS_EQUAL(status, NT_STATUS_MORE_PROCESSING_REQUIRED)) {
+                       goto out;
+               }
+       }
+
+       *out = data_blob(rdata, rdata_count);
+       *param_out = data_blob(rparam, rparam_count);
+
+  out:
+
+       SAFE_FREE(rparam);
+       SAFE_FREE(rdata);
+       return status;
+}
+
+/******************************************************************************
+ Make a client state struct.
+******************************************************************************/
+
+static struct smb_trans_enc_state *make_cli_enc_state(enum smb_trans_enc_type smb_enc_type)
+{
+       struct smb_trans_enc_state *es = NULL;
+       es = SMB_MALLOC_P(struct smb_trans_enc_state);
+       if (!es) {
+               return NULL;
+       }
+       ZERO_STRUCTP(es);
+       es->smb_enc_type = smb_enc_type;
+
+       if (smb_enc_type == SMB_TRANS_ENC_GSS) {
+#if defined(HAVE_GSSAPI) && defined(HAVE_KRB5)
+               es->s.gss_state = SMB_MALLOC_P(struct smb_tran_enc_state_gss);
+               if (!es->s.gss_state) {
+                       SAFE_FREE(es);
+                       return NULL;
+               }
+               ZERO_STRUCTP(es->s.gss_state);
+#else
+               DEBUG(0,("make_cli_enc_state: no krb5 compiled.\n"));
+               SAFE_FREE(es);
+               return NULL;
+#endif
+       }
+       return es;
+}
+
+/******************************************************************************
+ Start a raw ntlmssp encryption.
+******************************************************************************/
+
+NTSTATUS cli_raw_ntlm_smb_encryption_start(struct cli_state *cli, 
+                               const char *user,
+                               const char *pass,
+                               const char *domain)
+{
+       DATA_BLOB blob_in = data_blob_null;
+       DATA_BLOB blob_out = data_blob_null;
+       DATA_BLOB param_out = data_blob_null;
+       NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
+       struct smb_trans_enc_state *es = make_cli_enc_state(SMB_TRANS_ENC_NTLM);
+
+       if (!es) {
+               return NT_STATUS_NO_MEMORY;
+       }
+       status = ntlmssp_client_start(&es->s.ntlmssp_state);
+       if (!NT_STATUS_IS_OK(status)) {
+               goto fail;
+       }
+
+       ntlmssp_want_feature(es->s.ntlmssp_state, NTLMSSP_FEATURE_SESSION_KEY);
+       es->s.ntlmssp_state->neg_flags |= (NTLMSSP_NEGOTIATE_SIGN|NTLMSSP_NEGOTIATE_SEAL);
+
+       if (!NT_STATUS_IS_OK(status = ntlmssp_set_username(es->s.ntlmssp_state, user))) {
+               goto fail;
+       }
+       if (!NT_STATUS_IS_OK(status = ntlmssp_set_domain(es->s.ntlmssp_state, domain))) {
+               goto fail;
+       }
+       if (!NT_STATUS_IS_OK(status = ntlmssp_set_password(es->s.ntlmssp_state, pass))) {
+               goto fail;
+       }
+
+       do {
+               status = ntlmssp_update(es->s.ntlmssp_state, blob_in, &blob_out);
+               data_blob_free(&blob_in);
+               data_blob_free(&param_out);
+               if (NT_STATUS_EQUAL(status, NT_STATUS_MORE_PROCESSING_REQUIRED) || NT_STATUS_IS_OK(status)) {
+                       NTSTATUS trans_status = enc_blob_send_receive(cli,
+                                                                       &blob_out,
+                                                                       &blob_in,
+                                                                       &param_out);
+                       if (!NT_STATUS_EQUAL(trans_status,
+                                       NT_STATUS_MORE_PROCESSING_REQUIRED) &&
+                                       !NT_STATUS_IS_OK(trans_status)) {
+                               status = trans_status;
+                       } else {
+                               if (param_out.length == 2) {
+                                       es->enc_ctx_num = SVAL(param_out.data, 0);
+                               }
+                       }
+               }
+               data_blob_free(&blob_out);
+       } while (NT_STATUS_EQUAL(status, NT_STATUS_MORE_PROCESSING_REQUIRED));
+
+       data_blob_free(&blob_in);
+
+       if (NT_STATUS_IS_OK(status)) {
+               /* Replace the old state, if any. */
+               if (cli->trans_enc_state) {
+                       common_free_encryption_state(&cli->trans_enc_state);
+               }
+               cli->trans_enc_state = es;
+               cli->trans_enc_state->enc_on = True;
+               es = NULL;
+       }
+
+  fail:
+
+       common_free_encryption_state(&es);
+       return status;
+}
+
+#if defined(HAVE_GSSAPI) && defined(HAVE_KRB5)
+
+#ifndef SMB_GSS_REQUIRED_FLAGS
+#define SMB_GSS_REQUIRED_FLAGS (GSS_C_CONF_FLAG|GSS_C_INTEG_FLAG|GSS_C_MUTUAL_FLAG|GSS_C_REPLAY_FLAG|GSS_C_SEQUENCE_FLAG)
+#endif
+
+/******************************************************************************
+ Get client gss blob to send to a server.
+******************************************************************************/
+
+static NTSTATUS make_cli_gss_blob(struct smb_trans_enc_state *es,
+                               const char *service,
+                               const char *host,
+                               NTSTATUS status_in,
+                               DATA_BLOB spnego_blob_in,
+                               DATA_BLOB *p_blob_out)
+{
+       const char *krb_mechs[] = {OID_KERBEROS5, NULL};
+       OM_uint32 ret;
+       OM_uint32 min;
+       gss_name_t srv_name;
+       gss_buffer_desc input_name;
+       gss_buffer_desc *p_tok_in;
+       gss_buffer_desc tok_out, tok_in;
+       DATA_BLOB blob_out = data_blob_null;
+       DATA_BLOB blob_in = data_blob_null;
+       char *host_princ_s = NULL;
+       OM_uint32 ret_flags = 0;
+       NTSTATUS status = NT_STATUS_OK;
+
+       gss_OID_desc nt_hostbased_service =
+       {10, CONST_DISCARD(char *,"\x2a\x86\x48\x86\xf7\x12\x01\x02\x01\x04")};
+
+       memset(&tok_out, '\0', sizeof(tok_out));
+
+       /* Get a ticket for the service@host */
+       asprintf(&host_princ_s, "%s@%s", service, host);
+       if (host_princ_s == NULL) {
+               return NT_STATUS_NO_MEMORY;
+       }
+
+       input_name.value = host_princ_s;
+       input_name.length = strlen(host_princ_s) + 1;
+
+       ret = gss_import_name(&min,
+                               &input_name,
+                               &nt_hostbased_service,
+                               &srv_name);
+
+       if (ret != GSS_S_COMPLETE) {
+               SAFE_FREE(host_princ_s);
+               return map_nt_error_from_gss(ret, min);
+       }
+
+       if (spnego_blob_in.length == 0) {
+               p_tok_in = GSS_C_NO_BUFFER;
+       } else {
+               /* Remove the SPNEGO wrapper */
+               if (!spnego_parse_auth_response(spnego_blob_in, status_in, OID_KERBEROS5, &blob_in)) {
+                       status = NT_STATUS_UNSUCCESSFUL;
+                       goto fail;
+               }
+               tok_in.value = blob_in.data;
+               tok_in.length = blob_in.length;
+               p_tok_in = &tok_in;
+       }
+
+       ret = gss_init_sec_context(&min,
+                               GSS_C_NO_CREDENTIAL, /* Use our default cred. */
+                               &es->s.gss_state->gss_ctx,
+                               srv_name,
+                               GSS_C_NO_OID, /* default OID. */
+                               GSS_C_MUTUAL_FLAG | GSS_C_REPLAY_FLAG | GSS_C_SEQUENCE_FLAG,
+                               GSS_C_INDEFINITE,       /* requested ticket lifetime. */
+                               NULL,   /* no channel bindings */
+                               p_tok_in,
+                               NULL,   /* ignore mech type */
+                               &tok_out,
+                               &ret_flags,
+                               NULL);  /* ignore time_rec */
+
+       status = map_nt_error_from_gss(ret, min);
+       if (!NT_STATUS_IS_OK(status) && !NT_STATUS_EQUAL(status,NT_STATUS_MORE_PROCESSING_REQUIRED)) {
+               ADS_STATUS adss = ADS_ERROR_GSS(ret, min);
+               DEBUG(10,("make_cli_gss_blob: gss_init_sec_context failed with %s\n",
+                       ads_errstr(adss)));
+               goto fail;
+       }
+
+       if ((ret_flags & SMB_GSS_REQUIRED_FLAGS) != SMB_GSS_REQUIRED_FLAGS) {
+               status = NT_STATUS_ACCESS_DENIED;
+       }
+
+       blob_out = data_blob(tok_out.value, tok_out.length);
+
+       /* Wrap in an SPNEGO wrapper */
+       *p_blob_out = gen_negTokenTarg(krb_mechs, blob_out);
+
+  fail:
+
+       data_blob_free(&blob_out);
+       data_blob_free(&blob_in);
+       SAFE_FREE(host_princ_s);
+       gss_release_name(&min, &srv_name);
+       if (tok_out.value) {
+               gss_release_buffer(&min, &tok_out);
+       }
+       return status;
+}
+
+/******************************************************************************
+ Start a SPNEGO gssapi encryption context.
+******************************************************************************/
+
+NTSTATUS cli_gss_smb_encryption_start(struct cli_state *cli)
+{
+       DATA_BLOB blob_recv = data_blob_null;
+       DATA_BLOB blob_send = data_blob_null;
+       DATA_BLOB param_out = data_blob_null;
+       NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
+       fstring fqdn;
+       const char *servicename;
+       struct smb_trans_enc_state *es = make_cli_enc_state(SMB_TRANS_ENC_GSS);
+
+       if (!es) {
+               return NT_STATUS_NO_MEMORY;
+       }
+
+       name_to_fqdn(fqdn, cli->desthost);
+       strlower_m(fqdn);
+
+       servicename = "cifs";
+       status = make_cli_gss_blob(es, servicename, fqdn, NT_STATUS_OK, blob_recv, &blob_send);
+       if (!NT_STATUS_EQUAL(status,NT_STATUS_MORE_PROCESSING_REQUIRED)) {
+               servicename = "host";
+               status = make_cli_gss_blob(es, servicename, fqdn, NT_STATUS_OK, blob_recv, &blob_send);
+               if (!NT_STATUS_EQUAL(status,NT_STATUS_MORE_PROCESSING_REQUIRED)) {
+                       goto fail;
+               }
+       }
+
+       do {
+               data_blob_free(&blob_recv);
+               status = enc_blob_send_receive(cli, &blob_send, &blob_recv, &param_out);
+               if (param_out.length == 2) {
+                       es->enc_ctx_num = SVAL(param_out.data, 0);
+               }
+               data_blob_free(&blob_send);
+               status = make_cli_gss_blob(es, servicename, fqdn, status, blob_recv, &blob_send);
+       } while (NT_STATUS_EQUAL(status, NT_STATUS_MORE_PROCESSING_REQUIRED));
+       data_blob_free(&blob_recv);
+
+       if (NT_STATUS_IS_OK(status)) {
+               /* Replace the old state, if any. */
+               if (cli->trans_enc_state) {
+                       common_free_encryption_state(&cli->trans_enc_state);
+               }
+               cli->trans_enc_state = es;
+               cli->trans_enc_state->enc_on = True;
+               es = NULL;
+       }
+
+  fail:
+
+       common_free_encryption_state(&es);
+       return status;
+}
+#else
+NTSTATUS cli_gss_smb_encryption_start(struct cli_state *cli)
+{
+       return NT_STATUS_NOT_SUPPORTED;
+}
+#endif
+
+/********************************************************************
+ Ensure a connection is encrypted.
+********************************************************************/
+
+NTSTATUS cli_force_encryption(struct cli_state *c,
+                       const char *username,
+                       const char *password,
+                       const char *domain)
+{
+       uint16 major, minor;
+       uint32 caplow, caphigh;
+
+       if (!SERVER_HAS_UNIX_CIFS(c)) {
+               return NT_STATUS_NOT_SUPPORTED;
+       }
+
+       if (!cli_unix_extensions_version(c, &major, &minor, &caplow, &caphigh)) {
+               return NT_STATUS_UNKNOWN_REVISION;
+       }
+
+       if (!(caplow & CIFS_UNIX_TRANSPORT_ENCRYPTION_CAP)) {
+               return NT_STATUS_UNSUPPORTED_COMPRESSION;
+       }
+
+       if (c->use_kerberos) {
+               return cli_gss_smb_encryption_start(c);
+       }
+       return cli_raw_ntlm_smb_encryption_start(c,
+                                       username,
+                                       password,
+                                       domain);
+}
index 2e4c360507f610c3af851d7261f7d2b95b7f0bdd..d5c7db09e998c4dfd55962a82d3bd4c6bd03628c 100644 (file)
@@ -521,7 +521,7 @@ int cli_list_old(struct cli_state *cli,const char *Mask,uint16 attribute,
                memset(cli->outbuf,'\0',smb_size);
                memset(cli->inbuf,'\0',smb_size);
 
-               set_message(cli->outbuf,2,0,True);
+               cli_set_message(cli->outbuf,2,0,True);
 
                SCVAL(cli->outbuf,smb_com,SMBsearch);
 
@@ -581,7 +581,7 @@ int cli_list_old(struct cli_state *cli,const char *Mask,uint16 attribute,
                memset(cli->outbuf,'\0',smb_size);
                memset(cli->inbuf,'\0',smb_size);
 
-               set_message(cli->outbuf,2,0,True);
+               cli_set_message(cli->outbuf,2,0,True);
                SCVAL(cli->outbuf,smb_com,SMBfclose);
                SSVAL(cli->outbuf,smb_tid,cli->cnum);
                cli_setup_packet(cli);
index 13ef1d43d427e04c8340caa0ea1f1102ec61c5b7..00c25aa7254d3c365df91e77434ee936fd003661 100644 (file)
@@ -29,7 +29,7 @@ int cli_message_start_build(struct cli_state *cli, const char *host, const char
 
        /* construct a SMBsendstrt command */
        memset(cli->outbuf,'\0',smb_size);
-       set_message(cli->outbuf,0,0,True);
+       cli_set_message(cli->outbuf,0,0,True);
        SCVAL(cli->outbuf,smb_com,SMBsendstrt);
        SSVAL(cli->outbuf,smb_tid,cli->cnum);
        cli_setup_packet(cli);
@@ -75,7 +75,7 @@ int cli_message_text_build(struct cli_state *cli, const char *msg, int len, int
        char *p;
 
        memset(cli->outbuf,'\0',smb_size);
-       set_message(cli->outbuf,1,0,True);
+       cli_set_message(cli->outbuf,1,0,True);
        SCVAL(cli->outbuf,smb_com,SMBsendtxt);
        SSVAL(cli->outbuf,smb_tid,cli->cnum);
        cli_setup_packet(cli);
@@ -132,7 +132,7 @@ int cli_message_end_build(struct cli_state *cli, int grp)
        char *p;
 
        memset(cli->outbuf,'\0',smb_size);
-       set_message(cli->outbuf,1,0,True);
+       cli_set_message(cli->outbuf,1,0,True);
        SCVAL(cli->outbuf,smb_com,SMBsendend);
        SSVAL(cli->outbuf,smb_tid,cli->cnum);
 
index 2e54f5a781b1fc5ba4c5e897bd40e1c7e3de8ea6..ef8b3964613ef9921403a5174866797f2b70e31c 100644 (file)
@@ -32,7 +32,7 @@ bool cli_oplock_ack(struct cli_state *cli, int fnum, unsigned char level)
        cli->outbuf = buf;
 
         memset(buf,'\0',smb_size);
-        set_message(buf,8,0,True);
+        cli_set_message(buf,8,0,True);
 
         SCVAL(buf,smb_com,SMBlockingX);
        SSVAL(buf,smb_tid, cli->cnum);
index 7fbdb97c016daaf7130b10d2ec0cef19f38e35c5..223ddb41866e3ee294fede75f9e6cc858e660acf 100644 (file)
@@ -195,7 +195,7 @@ int cli_spl_open(struct cli_state *cli, const char *fname, int flags, int share_
        memset(cli->outbuf,'\0',smb_size);
        memset(cli->inbuf,'\0',smb_size);
 
-       set_message(cli->outbuf,15,0,True);
+       cli_set_message(cli->outbuf,15,0,True);
 
        SCVAL(cli->outbuf,smb_com,SMBsplopen);
        SSVAL(cli->outbuf,smb_tid,cli->cnum);
@@ -242,7 +242,7 @@ bool cli_spl_close(struct cli_state *cli, int fnum)
        memset(cli->outbuf,'\0',smb_size);
        memset(cli->inbuf,'\0',smb_size);
 
-       set_message(cli->outbuf,3,0,True);
+       cli_set_message(cli->outbuf,3,0,True);
 
        SCVAL(cli->outbuf,smb_com,SMBsplclose);
        SSVAL(cli->outbuf,smb_tid,cli->cnum);
index 206576f040b593c01c18060ba5e0422ec1efebd3..f369d28dff4a645a5925a78aaa3d817c2f33281f 100644 (file)
@@ -150,7 +150,7 @@ bool cli_get_user_quota(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_STRUC
        SIVAL(params, 8,0x00000000);
        SIVAL(params,12,0x00000024);
        
-       sid_len = sid_size(&pqt->sid);
+       sid_len = ndr_size_dom_sid(&pqt->sid, 0);
        data_len = sid_len+8;
        SIVAL(data, 0, 0x00000000);
        SIVAL(data, 4, sid_len);
@@ -213,7 +213,7 @@ bool cli_set_user_quota(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_STRUC
 
        SSVAL(params,0,quota_fnum);
 
-       sid_len = sid_size(&pqt->sid);
+       sid_len = ndr_size_dom_sid(&pqt->sid, 0);
        SIVAL(data,0,0);
        SIVAL(data,4,sid_len);
        SBIG_UINT(data, 8,(SMB_BIG_UINT)0);
index 54504f608da05ad446b49293ef1895cf5661006d..4c5e338606f9f2b8c9a7d120ec2bc82c2b46239c 100644 (file)
@@ -297,6 +297,7 @@ bool cli_NetServerEnum(struct cli_state *cli, char *workgroup, uint32 stype,
                                STR_TERMINATE|STR_UPPER);
 
                if (len == (size_t)-1) {
+                       SAFE_FREE(last_entry);
                        return false;
                }
                p += len;
@@ -804,6 +805,137 @@ bool cli_qpathinfo2(struct cli_state *cli, const char *fname,
        return True;
 }
 
+/****************************************************************************
+ Get the stream info
+****************************************************************************/
+
+bool cli_qpathinfo_streams(struct cli_state *cli, const char *fname,
+                          TALLOC_CTX *mem_ctx,
+                          unsigned int *pnum_streams,
+                          struct stream_struct **pstreams)
+{
+       unsigned int data_len = 0;
+       unsigned int param_len = 0;
+       uint16 setup = TRANSACT2_QPATHINFO;
+       char *param;
+       char *rparam=NULL, *rdata=NULL;
+       char *p;
+       unsigned int num_streams;
+       struct stream_struct *streams;
+       unsigned int ofs;
+       size_t namelen = 2*(strlen(fname)+1);
+
+       param = SMB_MALLOC_ARRAY(char, 6+namelen+2);
+       if (param == NULL) {
+               return false;
+       }
+       p = param;
+       memset(p, 0, 6);
+       SSVAL(p, 0, SMB_FILE_STREAM_INFORMATION);
+       p += 6;
+       p += clistr_push(cli, p, fname, namelen, STR_TERMINATE);
+
+       param_len = PTR_DIFF(p, param);
+
+       if (!cli_send_trans(cli, SMBtrans2,
+                            NULL,                     /* name */
+                            -1, 0,                    /* fid, flags */
+                            &setup, 1, 0,             /* setup, len, max */
+                            param, param_len, 10,     /* param, len, max */
+                            NULL, data_len, cli->max_xmit /* data, len, max */
+                           )) {
+               return false;
+       }
+
+       if (!cli_receive_trans(cli, SMBtrans2,
+                               &rparam, &param_len,
+                               &rdata, &data_len)) {
+               return false;
+       }
+
+       if (!rdata) {
+               SAFE_FREE(rparam);
+               return false;
+       }
+
+       num_streams = 0;
+       streams = NULL;
+       ofs = 0;
+
+       while ((data_len > ofs) && (data_len - ofs >= 24)) {
+               uint32_t nlen, len;
+               ssize_t size;
+               void *vstr;
+               struct stream_struct *tmp;
+               uint8_t *tmp_buf;
+
+               tmp = TALLOC_REALLOC_ARRAY(mem_ctx, streams,
+                                          struct stream_struct,
+                                          num_streams+1);
+
+               if (tmp == NULL) {
+                       goto fail;
+               }
+               streams = tmp;
+
+               nlen                      = IVAL(rdata, ofs + 0x04);
+
+               streams[num_streams].size = IVAL_TO_SMB_OFF_T(
+                       rdata, ofs + 0x08);
+               streams[num_streams].alloc_size = IVAL_TO_SMB_OFF_T(
+                       rdata, ofs + 0x10);
+
+               if (nlen > data_len - (ofs + 24)) {
+                       goto fail;
+               }
+
+               /*
+                * We need to null-terminate src, how do I do this with
+                * convert_string_talloc??
+                */
+
+               tmp_buf = TALLOC_ARRAY(streams, uint8_t, nlen+2);
+               if (tmp_buf == NULL) {
+                       goto fail;
+               }
+
+               memcpy(tmp_buf, rdata+ofs+24, nlen);
+               tmp_buf[nlen] = 0;
+               tmp_buf[nlen+1] = 0;
+
+               size = convert_string_talloc(streams, CH_UTF16, CH_UNIX,
+                                            tmp_buf, nlen+2, &vstr,
+                                            false);
+               TALLOC_FREE(tmp_buf);
+
+               if (size == -1) {
+                       goto fail;
+               }
+               streams[num_streams].name = (char *)vstr;
+               num_streams++;
+
+               len = IVAL(rdata, ofs);
+               if (len > data_len - ofs) {
+                       goto fail;
+               }
+               if (len == 0) break;
+               ofs += len;
+       }
+
+       SAFE_FREE(rdata);
+       SAFE_FREE(rparam);
+
+       *pnum_streams = num_streams;
+       *pstreams = streams;
+       return true;
+
+ fail:
+       TALLOC_FREE(streams);
+       SAFE_FREE(rdata);
+       SAFE_FREE(rparam);
+       return false;
+}
+
 /****************************************************************************
  Send a qfileinfo QUERY_FILE_NAME_INFO call.
 ****************************************************************************/
index d77875bae52f3b0e5144b82e8c583a03aa138bdb..af13ed8f7337775377fe646aa01c797c188524d5 100644 (file)
@@ -34,7 +34,7 @@ static bool cli_issue_read(struct cli_state *cli, int fnum, off_t offset,
        if ((SMB_BIG_UINT)offset >> 32)
                bigoffset = True;
 
-       set_message(cli->outbuf,bigoffset ? 12 : 10,0,True);
+       cli_set_message(cli->outbuf,bigoffset ? 12 : 10,0,True);
 
        SCVAL(cli->outbuf,smb_com,SMBreadX);
        SSVAL(cli->outbuf,smb_tid,cli->cnum);
@@ -65,8 +65,8 @@ ssize_t cli_read(struct cli_state *cli, int fnum, char *buf, off_t offset, size_
        size_t size2;
        size_t readsize;
        ssize_t total = 0;
-       /* We can only do direct reads if not signing. */
-       bool direct_reads = !client_is_signing_on(cli);
+       /* We can only do direct reads if not signing or encrypting. */
+       bool direct_reads = !client_is_signing_on(cli) && !cli_encryption_on(cli);
 
        if (size == 0)
                return 0;
@@ -76,7 +76,9 @@ ssize_t cli_read(struct cli_state *cli, int fnum, char *buf, off_t offset, size_
         * rounded down to a multiple of 1024.
         */
 
-       if (client_is_signing_on(cli) == False && (cli->posix_capabilities & CIFS_UNIX_LARGE_READ_CAP)) {
+       if (client_is_signing_on(cli) == false &&
+                       cli_encryption_on(cli) == false &&
+                       (cli->posix_capabilities & CIFS_UNIX_LARGE_READ_CAP)) {
                readsize = CLI_SAMBA_MAX_POSIX_LARGE_READX_SIZE;
        } else if (cli->capabilities & CAP_LARGE_READX) {
                if (cli->is_samba) {
@@ -132,6 +134,8 @@ ssize_t cli_read(struct cli_state *cli, int fnum, char *buf, off_t offset, size_
                                 return -1;
                }
 
+               /* size2 is the number of bytes the server returned.
+                * Might be zero. */
                size2 = SVAL(cli->inbuf, smb_vwv5);
                size2 |= (((unsigned int)(SVAL(cli->inbuf, smb_vwv7))) << 16);
 
@@ -143,27 +147,32 @@ ssize_t cli_read(struct cli_state *cli, int fnum, char *buf, off_t offset, size_
                        return -1;
                }
 
-               if (!direct_reads) {
-                       /* Copy data into buffer */
-                       p = smb_base(cli->inbuf) + SVAL(cli->inbuf,smb_vwv6);
-                       memcpy(buf + total, p, size2);
-               } else {
-                       /* Ensure the remaining data matches the return size. */
-                       ssize_t toread = smb_len_large(cli->inbuf) - SVAL(cli->inbuf,smb_vwv6);
-
-                       /* Ensure the size is correct. */
-                       if (toread != size2) {
-                               DEBUG(5,("direct read logic fail toread (%d) != size2 (%u)\n",
-                                       (int)toread, (unsigned int)size2 ));
-                               return -1;
-                       }
-
-                       /* Read data directly into buffer */
-                       toread = cli_receive_smb_data(cli,buf+total,size2);
-                       if (toread != size2) {
-                               DEBUG(5,("direct read read failure toread (%d) != size2 (%u)\n",
-                                       (int)toread, (unsigned int)size2 ));
-                               return -1;
+               if (size2) {
+                       /* smb_vwv6 is the offset in the packet of the returned
+                        * data bytes. Only valid if size2 != 0. */
+
+                       if (!direct_reads) {
+                               /* Copy data into buffer */
+                               p = smb_base(cli->inbuf) + SVAL(cli->inbuf,smb_vwv6);
+                               memcpy(buf + total, p, size2);
+                       } else {
+                               /* Ensure the remaining data matches the return size. */
+                               ssize_t toread = smb_len_large(cli->inbuf) - SVAL(cli->inbuf,smb_vwv6);
+
+                               /* Ensure the size is correct. */
+                               if (toread != size2) {
+                                       DEBUG(5,("direct read logic fail toread (%d) != size2 (%u)\n",
+                                               (int)toread, (unsigned int)size2 ));
+                                       return -1;
+                               }
+
+                               /* Read data directly into buffer */
+                               toread = cli_receive_smb_data(cli,buf+total,size2);
+                               if (toread != size2) {
+                                       DEBUG(5,("direct read read failure toread (%d) != size2 (%u)\n",
+                                               (int)toread, (unsigned int)size2 ));
+                                       return -1;
+                               }
                        }
                }
 
@@ -203,7 +212,7 @@ static bool cli_issue_readraw(struct cli_state *cli, int fnum, off_t offset,
        memset(cli->outbuf,'\0',smb_size);
        memset(cli->inbuf,'\0',smb_size);
 
-       set_message(cli->outbuf,10,0,True);
+       cli_set_message(cli->outbuf,10,0,True);
                
        SCVAL(cli->outbuf,smb_com,SMBreadbraw);
        SSVAL(cli->outbuf,smb_tid,cli->cnum);
@@ -295,8 +304,8 @@ static bool cli_issue_write(struct cli_state *cli,
 {
        char *p;
        bool large_writex = false;
-       /* We can only do direct writes if not signing. */
-       bool direct_writes = !client_is_signing_on(cli);
+       /* We can only do direct writes if not signing and not encrypting. */
+       bool direct_writes = !client_is_signing_on(cli) && !cli_encryption_on(cli);
 
        if (!direct_writes && size + 1 > cli->bufsize) {
                cli->outbuf = (char *)SMB_REALLOC(cli->outbuf, size + 1024);
@@ -319,9 +328,9 @@ static bool cli_issue_write(struct cli_state *cli,
        }
 
        if (large_writex) {
-               set_message(cli->outbuf,14,0,True);
+               cli_set_message(cli->outbuf,14,0,True);
        } else {
-               set_message(cli->outbuf,12,0,True);
+               cli_set_message(cli->outbuf,12,0,True);
        }
 
        SCVAL(cli->outbuf,smb_com,SMBwriteX);
@@ -402,21 +411,25 @@ 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) &&
                        (cli->posix_capabilities & CIFS_UNIX_LARGE_WRITE_CAP) &&
                        (cli->capabilities & CAP_LARGE_FILES)) {
                /* Only do massive writes if we can do them direct
-                * with no signing - not on a pipe. */
+                * with no signing or encrypting - not on a pipe. */
                writesize = CLI_SAMBA_MAX_POSIX_LARGE_WRITEX_SIZE;
-       } else if (cli->capabilities & CAP_LARGE_READX) {
+       } else if (cli->capabilities & CAP_LARGE_WRITEX) {
                if (cli->is_samba) {
-                       writesize = CLI_SAMBA_MAX_LARGE_READX_SIZE;
-               } else {
-                       writesize = CLI_WINDOWS_MAX_LARGE_READX_SIZE;
+                       writesize = CLI_SAMBA_MAX_LARGE_WRITEX_SIZE;
+               } 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;
@@ -471,7 +484,7 @@ ssize_t cli_smbwrite(struct cli_state *cli,
                memset(cli->outbuf,'\0',smb_size);
                memset(cli->inbuf,'\0',smb_size);
 
-               set_message(cli->outbuf,5, 0,True);
+               cli_set_message(cli->outbuf,5, 0,True);
 
                SCVAL(cli->outbuf,smb_com,SMBwrite);
                SSVAL(cli->outbuf,smb_tid,cli->cnum);
index 46a660941514642f916a6922787630d943bcb622..adc6fba9afa767d3ab706f75016e6ae498fa9a14 100644 (file)
@@ -28,9 +28,8 @@ SEC_DESC *cli_query_secdesc(struct cli_state *cli, int fnum,
        char param[8];
        char *rparam=NULL, *rdata=NULL;
        unsigned int rparam_count=0, rdata_count=0;
-       prs_struct pd;
-       bool pd_initialized = False;
        SEC_DESC *psd = NULL;
+       NTSTATUS status;
 
        SIVAL(param, 0, fnum);
        SIVAL(param, 4, 0x7);
@@ -56,15 +55,12 @@ SEC_DESC *cli_query_secdesc(struct cli_state *cli, int fnum,
        if (cli_is_error(cli))
                goto cleanup;
 
-       if (!prs_init(&pd, rdata_count, mem_ctx, UNMARSHALL)) {
-               goto cleanup;
-       }
-       pd_initialized = True;
-       prs_copy_data_in(&pd, rdata, rdata_count);
-       prs_set_offset(&pd,0);
+       status = unmarshall_sec_desc(mem_ctx, (uint8 *)rdata, rdata_count,
+                                    &psd);
 
-       if (!sec_io_desc("sd data", &psd, &pd, 1)) {
-               DEBUG(1,("Failed to parse secdesc\n"));
+       if (!NT_STATUS_IS_OK(status)) {
+               DEBUG(10, ("unmarshall_sec_desc failed: %s\n",
+                          nt_errstr(status)));
                goto cleanup;
        }
 
@@ -73,8 +69,6 @@ SEC_DESC *cli_query_secdesc(struct cli_state *cli, int fnum,
        SAFE_FREE(rparam);
        SAFE_FREE(rdata);
 
-       if (pd_initialized)
-               prs_mem_free(&pd);
        return psd;
 }
 
@@ -87,20 +81,16 @@ bool cli_set_secdesc(struct cli_state *cli, int fnum, SEC_DESC *sd)
        char *rparam=NULL, *rdata=NULL;
        unsigned int rparam_count=0, rdata_count=0;
        uint32 sec_info = 0;
-       TALLOC_CTX *mem_ctx;
-       prs_struct pd;
+       TALLOC_CTX *frame = talloc_stackframe();
        bool ret = False;
-
-       if ((mem_ctx = talloc_init("cli_set_secdesc")) == NULL) {
-               DEBUG(0,("talloc_init failed.\n"));
-               goto cleanup;
-       }
-
-       prs_init(&pd, 0, mem_ctx, MARSHALL);
-       prs_give_memory(&pd, NULL, 0, True);
-
-       if (!sec_io_desc("sd data", &sd, &pd, 1)) {
-               DEBUG(1,("Failed to marshall secdesc\n"));
+       uint8 *data;
+       size_t len;
+       NTSTATUS status;
+
+       status = marshall_sec_desc(talloc_tos(), sd, &data, &len);
+       if (!NT_STATUS_IS_OK(status)) {
+               DEBUG(10, ("marshall_sec_desc failed: %s\n",
+                          nt_errstr(status)));
                goto cleanup;
        }
 
@@ -119,7 +109,7 @@ bool cli_set_secdesc(struct cli_state *cli, int fnum, SEC_DESC *sd)
                               0, 
                               NULL, 0, 0,
                               param, 8, 0,
-                              prs_data_p(&pd), prs_offset(&pd), 0)) {
+                              (char *)data, len, 0)) {
                DEBUG(1,("Failed to send NT_TRANSACT_SET_SECURITY_DESC\n"));
                goto cleanup;
        }
@@ -139,8 +129,7 @@ bool cli_set_secdesc(struct cli_state *cli, int fnum, SEC_DESC *sd)
        SAFE_FREE(rparam);
        SAFE_FREE(rdata);
 
-       talloc_destroy(mem_ctx);
+       TALLOC_FREE(frame);
 
-       prs_mem_free(&pd);
        return ret;
 }
index a6f7f7fec1972117bf6d665725853eed8012f959..bfb31fdb74845a1a2908942dfaee5eaee14b9075 100644 (file)
@@ -43,7 +43,7 @@ bool cli_send_trans(struct cli_state *cli, int trans,
        this_ldata = MIN(ldata,cli->max_xmit - (500+lsetup*2+this_lparam));
 
        memset(cli->outbuf,'\0',smb_size);
-       set_message(cli->outbuf,14+lsetup,0,True);
+       cli_set_message(cli->outbuf,14+lsetup,0,True);
        SCVAL(cli->outbuf,smb_com,trans);
        SSVAL(cli->outbuf,smb_tid, cli->cnum);
        cli_setup_packet(cli);
@@ -107,7 +107,7 @@ bool cli_send_trans(struct cli_state *cli, int trans,
                        this_lparam = MIN(lparam-tot_param,cli->max_xmit - 500); /* hack */
                        this_ldata = MIN(ldata-tot_data,cli->max_xmit - (500+this_lparam));
 
-                       set_message(cli->outbuf,trans==SMBtrans?8:9,0,True);
+                       cli_set_message(cli->outbuf,trans==SMBtrans?8:9,0,True);
                        SCVAL(cli->outbuf,smb_com,(trans==SMBtrans ? SMBtranss : SMBtranss2));
 
                        outparam = smb_buf(cli->outbuf);
@@ -368,7 +368,7 @@ bool cli_send_nt_trans(struct cli_state *cli,
        this_ldata = MIN(ldata,cli->max_xmit - (500+lsetup*2+this_lparam));
 
        memset(cli->outbuf,'\0',smb_size);
-       set_message(cli->outbuf,19+lsetup,0,True);
+       cli_set_message(cli->outbuf,19+lsetup,0,True);
        SCVAL(cli->outbuf,smb_com,SMBnttrans);
        SSVAL(cli->outbuf,smb_tid, cli->cnum);
        cli_setup_packet(cli);
@@ -424,7 +424,7 @@ bool cli_send_nt_trans(struct cli_state *cli,
                        this_lparam = MIN(lparam-tot_param,cli->max_xmit - 500); /* hack */
                        this_ldata = MIN(ldata-tot_data,cli->max_xmit - (500+this_lparam));
 
-                       set_message(cli->outbuf,18,0,True);
+                       cli_set_message(cli->outbuf,18,0,True);
                        SCVAL(cli->outbuf,smb_com,SMBnttranss);
 
                        /* XXX - these should probably be aligned */
index 84cc8981879ccc0e3a849acb50082b42926381d6..a3043a2152019a1c7323bb92bcbb67d61b14983b 100644 (file)
@@ -1,18 +1,18 @@
-/* 
+/*
  *  Unix SMB/CIFS implementation.
  *  DOS error routines
  *  Copyright (C) Tim Potter 2002.
- *  
+ *
  *  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"
 
-typedef const struct
-{
+typedef const struct {
        const char *dos_errstr;
        WERROR werror;
 } werror_code_struct;
 
+typedef const struct {
+       WERROR werror;
+       const char *friendly_errstr;
+} werror_str_struct;
+
 werror_code_struct dos_errs[] =
 {
        { "WERR_OK", WERR_OK },
@@ -59,7 +63,9 @@ werror_code_struct dos_errs[] =
        { "WERR_JOB_NOT_FOUND", WERR_JOB_NOT_FOUND },
        { "WERR_DEST_NOT_FOUND", WERR_DEST_NOT_FOUND },
        { "WERR_NOT_LOCAL_DOMAIN", WERR_NOT_LOCAL_DOMAIN },
+       { "WERR_USER_EXISTS", WERR_USER_EXISTS },
        { "WERR_NO_LOGON_SERVERS", WERR_NO_LOGON_SERVERS },
+       { "WERR_NO_SUCH_LOGON_SESSION", WERR_NO_SUCH_LOGON_SESSION },
        { "WERR_PRINTER_DRIVER_IN_USE", WERR_PRINTER_DRIVER_IN_USE },
        { "WERR_STATUS_MORE_ENTRIES  ", WERR_STATUS_MORE_ENTRIES },
        { "WERR_DFS_NO_SUCH_VOL", WERR_DFS_NO_SUCH_VOL },
@@ -67,11 +73,13 @@ werror_code_struct dos_errs[] =
        { "WERR_DFS_NO_SUCH_SERVER", WERR_DFS_NO_SUCH_SERVER },
        { "WERR_DFS_INTERNAL_ERROR", WERR_DFS_INTERNAL_ERROR },
        { "WERR_DFS_CANT_CREATE_JUNCT", WERR_DFS_CANT_CREATE_JUNCT },
+       { "WERR_INVALID_COMPUTER_NAME", WERR_INVALID_COMPUTER_NAME },
        { "WERR_MACHINE_LOCKED", WERR_MACHINE_LOCKED },
-       { "WERR_DOMAIN_CONTROLLER_NOT_FOUND", WERR_DOMAIN_CONTROLLER_NOT_FOUND },
+       { "WERR_DC_NOT_FOUND", WERR_DC_NOT_FOUND },
        { "WERR_SETUP_NOT_JOINED", WERR_SETUP_NOT_JOINED },
        { "WERR_SETUP_ALREADY_JOINED", WERR_SETUP_ALREADY_JOINED },
        { "WERR_SETUP_DOMAIN_CONTROLLER", WERR_SETUP_DOMAIN_CONTROLLER },
+       { "WERR_DEFAULT_JOIN_REQUIRED", WERR_DEFAULT_JOIN_REQUIRED },
        { "WERR_DEVICE_NOT_AVAILABLE", WERR_DEVICE_NOT_AVAILABLE },
        { "WERR_LOGON_FAILURE", WERR_LOGON_FAILURE },
        { "WERR_NO_SUCH_DOMAIN", WERR_NO_SUCH_DOMAIN },
@@ -85,12 +93,36 @@ werror_code_struct dos_errs[] =
        { "WERR_REG_CORRUPT", WERR_REG_CORRUPT },
        { "WERR_REG_IO_FAILURE", WERR_REG_IO_FAILURE },
        { "WERR_REG_FILE_INVALID", WERR_REG_FILE_INVALID },
+       { "WERR_NO_SUCH_SERVICE", WERR_NO_SUCH_SERVICE },
        { "WERR_SERVICE_DISABLED", WERR_SERVICE_DISABLED },
        { "WERR_CAN_NOT_COMPLETE", WERR_CAN_NOT_COMPLETE},
        { "WERR_INVALID_FLAGS", WERR_INVALID_FLAGS},
+       { "WERR_PASSWORD_MUST_CHANGE", WERR_PASSWORD_MUST_CHANGE },
+       { "WERR_DOMAIN_CONTROLLER_NOT_FOUND", WERR_DOMAIN_CONTROLLER_NOT_FOUND },
+       { "WERR_ACCOUNT_LOCKED_OUT", WERR_ACCOUNT_LOCKED_OUT },
        { NULL, W_ERROR(0) }
 };
 
+werror_str_struct dos_err_strs[] = {
+       { WERR_OK, "Success" },
+       { WERR_ACCESS_DENIED, "Access is denied" },
+       { WERR_INVALID_PARAM, "Invalid parameter" },
+       { WERR_NOT_SUPPORTED, "Not supported" },
+       { WERR_BAD_PASSWORD, "A bad password was supplied" },
+       { WERR_NOMEM, "Out of memory" },
+       { WERR_NO_LOGON_SERVERS, "No logon servers found" },
+       { WERR_NO_SUCH_LOGON_SESSION, "No such logon session" },
+       { WERR_DOMAIN_CONTROLLER_NOT_FOUND, "A domain controller could not be found" },
+       { WERR_DC_NOT_FOUND, "A domain controller could not be found" },
+       { WERR_SETUP_NOT_JOINED, "Join failed" },
+       { WERR_SETUP_ALREADY_JOINED, "Machine is already joined" },
+       { WERR_SETUP_DOMAIN_CONTROLLER, "Machine is a Domain Controller" },
+       { WERR_LOGON_FAILURE, "Invalid logon credentials" },
+       { WERR_USER_EXISTS, "User account already exists" },
+       { WERR_PASSWORD_MUST_CHANGE, "The password must be changed" },
+       { WERR_ACCOUNT_LOCKED_OUT, "Account locked out" },
+};
+
 /*****************************************************************************
  Returns a DOS error message.  not amazingly helpful, but better than a number.
  *****************************************************************************/
@@ -101,7 +133,7 @@ const char *dos_errstr(WERROR werror)
         int idx = 0;
 
        while (dos_errs[idx].dos_errstr != NULL) {
-               if (W_ERROR_V(dos_errs[idx].werror) == 
+               if (W_ERROR_V(dos_errs[idx].werror) ==
                     W_ERROR_V(werror))
                         return dos_errs[idx].dos_errstr;
                idx++;
@@ -113,6 +145,24 @@ const char *dos_errstr(WERROR werror)
         return result;
 }
 
+/*****************************************************************************
+ Get friendly error string for WERRORs
+ *****************************************************************************/
+
+const char *get_friendly_werror_msg(WERROR werror)
+{
+       int i = 0;
+
+       for (i = 0; i < ARRAY_SIZE(dos_err_strs); i++) {
+               if (W_ERROR_V(dos_err_strs[i].werror) ==
+                    W_ERROR_V(werror)) {
+                       return dos_err_strs[i].friendly_errstr;
+               }
+       }
+
+       return dos_errstr(werror);
+}
+
 /* compat function for samba4 */
 const char *win_errstr(WERROR werror)
 {
index f8089cbd6a579691d5c7207efd154972ec8a32b0..e0be76cc85205927f1276ce26879424995e0234e 100644 (file)
@@ -1,10 +1,10 @@
 /*
    Unix SMB/CIFS implementation.
 
-   DsGetDcname
+   dsgetdcname
 
    Copyright (C) Gerald Carter 2006
-   Copyright (C) Guenther Deschner 2007
+   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
@@ -259,7 +259,7 @@ static NTSTATUS unpack_dsdcinfo(TALLOC_CTX *mem_ctx,
 /****************************************************************
 ****************************************************************/
 
-static char *DsGetDcName_cache_key(TALLOC_CTX *mem_ctx, const char *domain)
+static char *dsgetdcname_cache_key(TALLOC_CTX *mem_ctx, const char *domain)
 {
        if (!mem_ctx || !domain) {
                return NULL;
@@ -271,7 +271,7 @@ static char *DsGetDcName_cache_key(TALLOC_CTX *mem_ctx, const char *domain)
 /****************************************************************
 ****************************************************************/
 
-static NTSTATUS DsGetDcName_cache_delete(TALLOC_CTX *mem_ctx,
+static NTSTATUS dsgetdcname_cache_delete(TALLOC_CTX *mem_ctx,
                                        const char *domain_name)
 {
        char *key;
@@ -280,7 +280,7 @@ static NTSTATUS DsGetDcName_cache_delete(TALLOC_CTX *mem_ctx,
                return NT_STATUS_INTERNAL_DB_ERROR;
        }
 
-       key = DsGetDcName_cache_key(mem_ctx, domain_name);
+       key = dsgetdcname_cache_key(mem_ctx, domain_name);
        if (!key) {
                return NT_STATUS_NO_MEMORY;
        }
@@ -295,13 +295,13 @@ static NTSTATUS DsGetDcName_cache_delete(TALLOC_CTX *mem_ctx,
 /****************************************************************
 ****************************************************************/
 
-static NTSTATUS DsGetDcName_cache_store(TALLOC_CTX *mem_ctx,
+static NTSTATUS dsgetdcname_cache_store(TALLOC_CTX *mem_ctx,
                                        const char *domain_name,
                                        struct DS_DOMAIN_CONTROLLER_INFO *info)
 {
        time_t expire_time;
        char *key;
-       bool ret = False;
+       bool ret = false;
        DATA_BLOB blob;
        unsigned char *buf = NULL;
        int len = 0;
@@ -310,7 +310,7 @@ static NTSTATUS DsGetDcName_cache_store(TALLOC_CTX *mem_ctx,
                return NT_STATUS_INTERNAL_DB_ERROR;
        }
 
-       key = DsGetDcName_cache_key(mem_ctx, domain_name);
+       key = dsgetdcname_cache_key(mem_ctx, domain_name);
        if (!key) {
                return NT_STATUS_NO_MEMORY;
        }
@@ -341,7 +341,7 @@ static NTSTATUS DsGetDcName_cache_store(TALLOC_CTX *mem_ctx,
 /****************************************************************
 ****************************************************************/
 
-static NTSTATUS DsGetDcName_cache_refresh(TALLOC_CTX *mem_ctx,
+static NTSTATUS dsgetdcname_cache_refresh(TALLOC_CTX *mem_ctx,
                                          const char *domain_name,
                                          struct GUID *domain_guid,
                                          uint32_t flags,
@@ -358,9 +358,9 @@ static NTSTATUS DsGetDcName_cache_refresh(TALLOC_CTX *mem_ctx,
        if (ads_cldap_netlogon(info->domain_controller_name,
                               info->domain_name, &r)) {
 
-               DsGetDcName_cache_delete(mem_ctx, domain_name);
+               dsgetdcname_cache_delete(mem_ctx, domain_name);
 
-               return DsGetDcName_cache_store(mem_ctx,
+               return dsgetdcname_cache_store(mem_ctx,
                                               info->domain_name,
                                               info);
        }
@@ -371,7 +371,7 @@ static NTSTATUS DsGetDcName_cache_refresh(TALLOC_CTX *mem_ctx,
 /****************************************************************
 ****************************************************************/
 
-#define RETURN_ON_FALSE(x) if (!x) return False;
+#define RETURN_ON_FALSE(x) if (!x) return false;
 
 static bool check_cldap_reply_required_flags(uint32_t ret_flags,
                                             uint32_t req_flags)
@@ -398,13 +398,13 @@ static bool check_cldap_reply_required_flags(uint32_t ret_flags,
        if (req_flags & DS_WRITABLE_REQUIRED)
                RETURN_ON_FALSE(ret_flags & ADS_WRITABLE);
 
-       return True;
+       return true;
 }
 
 /****************************************************************
 ****************************************************************/
 
-static NTSTATUS DsGetDcName_cache_fetch(TALLOC_CTX *mem_ctx,
+static NTSTATUS dsgetdcname_cache_fetch(TALLOC_CTX *mem_ctx,
                                        const char *domain_name,
                                        struct GUID *domain_guid,
                                        uint32_t flags,
@@ -420,7 +420,7 @@ static NTSTATUS DsGetDcName_cache_fetch(TALLOC_CTX *mem_ctx,
                return NT_STATUS_INTERNAL_DB_ERROR;
        }
 
-       key = DsGetDcName_cache_key(mem_ctx, domain_name);
+       key = dsgetdcname_cache_key(mem_ctx, domain_name);
        if (!key) {
                return NT_STATUS_NO_MEMORY;
        }
@@ -454,7 +454,7 @@ static NTSTATUS DsGetDcName_cache_fetch(TALLOC_CTX *mem_ctx,
 /****************************************************************
 ****************************************************************/
 
-static NTSTATUS DsGetDcName_cached(TALLOC_CTX *mem_ctx,
+static NTSTATUS dsgetdcname_cached(TALLOC_CTX *mem_ctx,
                                   const char *domain_name,
                                   struct GUID *domain_guid,
                                   uint32_t flags,
@@ -462,12 +462,12 @@ static NTSTATUS DsGetDcName_cached(TALLOC_CTX *mem_ctx,
                                   struct DS_DOMAIN_CONTROLLER_INFO **info)
 {
        NTSTATUS status;
-       bool expired = False;
+       bool expired = false;
 
-       status = DsGetDcName_cache_fetch(mem_ctx, domain_name, domain_guid,
+       status = dsgetdcname_cache_fetch(mem_ctx, domain_name, domain_guid,
                                         flags, site_name, info, &expired);
        if (!NT_STATUS_IS_OK(status)) {
-               DEBUG(10,("DsGetDcName_cached: cache fetch failed with: %s\n",
+               DEBUG(10,("dsgetdcname_cached: cache fetch failed with: %s\n",
                        nt_errstr(status)));
                return NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND;
        }
@@ -477,7 +477,7 @@ static NTSTATUS DsGetDcName_cached(TALLOC_CTX *mem_ctx,
        }
 
        if (expired) {
-               status = DsGetDcName_cache_refresh(mem_ctx, domain_name,
+               status = dsgetdcname_cache_refresh(mem_ctx, domain_name,
                                                   domain_guid, flags,
                                                   site_name, *info);
                if (!NT_STATUS_IS_OK(status)) {
@@ -503,24 +503,24 @@ static bool check_allowed_required_flags(uint32_t flags)
        debug_dsdcinfo_flags(10, flags);
 
        if (return_type == (DS_RETURN_FLAT_NAME|DS_RETURN_DNS_NAME)) {
-               return False;
+               return false;
        }
 
        if (offered_type == (DS_IS_DNS_NAME|DS_IS_FLAT_NAME)) {
-               return False;
+               return false;
        }
 
        if (query_type == (DS_BACKGROUND_ONLY|DS_FORCE_REDISCOVERY)) {
-               return False;
+               return false;
        }
 
 #if 0
        if ((flags & DS_RETURN_DNS_NAME) && (!(flags & DS_IP_REQUIRED))) {
                printf("gd: here5 \n");
-               return False;
+               return false;
        }
 #endif
-       return True;
+       return true;
 }
 
 /****************************************************************
@@ -739,7 +739,7 @@ static NTSTATUS process_dc_dns(TALLOC_CTX *mem_ctx,
                               struct DS_DOMAIN_CONTROLLER_INFO **info)
 {
        int i = 0;
-       bool valid_dc = False;
+       bool valid_dc = false;
        struct cldap_netlogon_reply r;
        const char *dc_hostname, *dc_domain_name;
        const char *dc_address;
@@ -754,7 +754,7 @@ static NTSTATUS process_dc_dns(TALLOC_CTX *mem_ctx,
                if ((ads_cldap_netlogon(dclist[i]->hostname,
                                        domain_name, &r)) &&
                    (check_cldap_reply_required_flags(r.flags, flags))) {
-                       valid_dc = True;
+                       valid_dc = true;
                        break;
                }
 
@@ -837,7 +837,7 @@ static NTSTATUS process_dc_netbios(TALLOC_CTX *mem_ctx,
 /****************************************************************
 ****************************************************************/
 
-static NTSTATUS DsGetDcName_rediscover(TALLOC_CTX *mem_ctx,
+static NTSTATUS dsgetdcname_rediscover(TALLOC_CTX *mem_ctx,
                                       const char *domain_name,
                                       struct GUID *domain_guid,
                                       uint32_t flags,
@@ -848,7 +848,7 @@ static NTSTATUS DsGetDcName_rediscover(TALLOC_CTX *mem_ctx,
        struct ip_service_name *dclist;
        int num_dcs;
 
-       DEBUG(10,("DsGetDcName_rediscover\n"));
+       DEBUG(10,("dsgetdcname_rediscover\n"));
 
        if (flags & DS_IS_FLAT_NAME) {
 
@@ -891,13 +891,12 @@ static NTSTATUS DsGetDcName_rediscover(TALLOC_CTX *mem_ctx,
 }
 
 /********************************************************************
DsGetDcName.
dsgetdcname.
 
  This will be the only public function here.
 ********************************************************************/
 
-NTSTATUS DsGetDcName(TALLOC_CTX *mem_ctx,
-                    const char *computer_name,
+NTSTATUS dsgetdcname(TALLOC_CTX *mem_ctx,
                     const char *domain_name,
                     struct GUID *domain_guid,
                     const char *site_name,
@@ -907,9 +906,9 @@ NTSTATUS DsGetDcName(TALLOC_CTX *mem_ctx,
        NTSTATUS status = NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND;
        struct DS_DOMAIN_CONTROLLER_INFO *myinfo = NULL;
 
-       DEBUG(10,("DsGetDcName: computer_name: %s, domain_name: %s, "
+       DEBUG(10,("dsgetdcname: domain_name: %s, "
                  "domain_guid: %s, site_name: %s, flags: 0x%08x\n",
-                 computer_name, domain_name,
+                 domain_name,
                  domain_guid ? GUID_string(mem_ctx, domain_guid) : "(null)",
                  site_name, flags));
 
@@ -924,7 +923,7 @@ NTSTATUS DsGetDcName(TALLOC_CTX *mem_ctx,
                goto rediscover;
        }
 
-       status = DsGetDcName_cached(mem_ctx, domain_name, domain_guid,
+       status = dsgetdcname_cached(mem_ctx, domain_name, domain_guid,
                                    flags, site_name, &myinfo);
        if (NT_STATUS_IS_OK(status)) {
                *info = myinfo;
@@ -936,12 +935,12 @@ NTSTATUS DsGetDcName(TALLOC_CTX *mem_ctx,
        }
 
  rediscover:
-       status = DsGetDcName_rediscover(mem_ctx, domain_name,
+       status = dsgetdcname_rediscover(mem_ctx, domain_name,
                                        domain_guid, flags, site_name,
                                        &myinfo);
 
        if (NT_STATUS_IS_OK(status)) {
-               DsGetDcName_cache_store(mem_ctx, domain_name, myinfo);
+               dsgetdcname_cache_store(mem_ctx, domain_name, myinfo);
                *info = myinfo;
        }
 
index ce826ae999ec34bd84969ccd78ae50b97ac3e4ca..4ec30f7e17f0d23d89a89390c882c3aa3be5b363 100644 (file)
@@ -1502,3 +1502,108 @@ WERROR ntstatus_to_werror(NTSTATUS error)
        /* a lame guess */
        return W_ERROR(NT_STATUS_V(error) & 0xffff);
 }
+
+#if defined(HAVE_GSSAPI)
+/*******************************************************************************
+ Map between gssapi errors and NT status. I made these up :-(. JRA.
+*******************************************************************************/
+
+static const struct {
+               unsigned long gss_err;
+               NTSTATUS ntstatus;
+} gss_to_ntstatus_errormap[] = {
+#if defined(GSS_S_CALL_INACCESSIBLE_READ)
+               {GSS_S_CALL_INACCESSIBLE_READ, NT_STATUS_INVALID_PARAMETER},
+#endif
+#if defined(GSS_S_CALL_INACCESSIBLE_WRITE)
+               {GSS_S_CALL_INACCESSIBLE_WRITE, NT_STATUS_INVALID_PARAMETER},
+#endif
+#if defined(GSS_S_CALL_BAD_STRUCTURE)
+               {GSS_S_CALL_BAD_STRUCTURE, NT_STATUS_INVALID_PARAMETER},
+#endif
+#if defined(GSS_S_BAD_MECH)
+               {GSS_S_BAD_MECH, NT_STATUS_INVALID_PARAMETER},
+#endif
+#if defined(GSS_S_BAD_NAME)
+               {GSS_S_BAD_NAME, NT_STATUS_INVALID_ACCOUNT_NAME},
+#endif
+#if defined(GSS_S_BAD_NAMETYPE)
+               {GSS_S_BAD_NAMETYPE, NT_STATUS_INVALID_PARAMETER},
+#endif
+#if defined(GSS_S_BAD_BINDINGS)
+               {GSS_S_BAD_BINDINGS, NT_STATUS_INVALID_PARAMETER},
+#endif
+#if defined(GSS_S_BAD_STATUS)
+               {GSS_S_BAD_STATUS, NT_STATUS_UNSUCCESSFUL},
+#endif
+#if defined(GSS_S_BAD_SIG)
+               {GSS_S_BAD_SIG, NT_STATUS_ACCESS_DENIED},
+#endif
+#if defined(GSS_S_NO_CRED)
+               {GSS_S_NO_CRED, NT_STATUS_ACCESS_DENIED},
+#endif
+#if defined(GSS_S_NO_CONTEXT)
+               {GSS_S_NO_CONTEXT, NT_STATUS_ACCESS_DENIED},
+#endif
+#if defined(GSS_S_DEFECTIVE_TOKEN)
+               {GSS_S_DEFECTIVE_TOKEN, NT_STATUS_ACCESS_DENIED},
+#endif
+#if defined(GSS_S_DEFECTIVE_CREDENTIAL)
+               {GSS_S_DEFECTIVE_CREDENTIAL, NT_STATUS_ACCESS_DENIED},
+#endif
+#if defined(GSS_S_CREDENTIALS_EXPIRED)
+               {GSS_S_CREDENTIALS_EXPIRED, NT_STATUS_PASSWORD_EXPIRED},
+#endif
+#if defined(GSS_S_CONTEXT_EXPIRED)
+               {GSS_S_CONTEXT_EXPIRED, NT_STATUS_PASSWORD_EXPIRED},
+#endif
+#if defined(GSS_S_BAD_QOP)
+               {GSS_S_BAD_QOP, NT_STATUS_ACCESS_DENIED},
+#endif
+#if defined(GSS_S_UNAUTHORIZED)
+               {GSS_S_UNAUTHORIZED, NT_STATUS_ACCESS_DENIED},
+#endif
+#if defined(GSS_S_UNAVAILABLE)
+               {GSS_S_UNAVAILABLE, NT_STATUS_UNSUCCESSFUL},
+#endif
+#if defined(GSS_S_DUPLICATE_ELEMENT)
+               {GSS_S_DUPLICATE_ELEMENT, NT_STATUS_INVALID_PARAMETER},
+#endif
+#if defined(GSS_S_NAME_NOT_MN)
+               {GSS_S_NAME_NOT_MN, NT_STATUS_INVALID_PARAMETER},
+#endif
+               { 0, NT_STATUS_OK }
+};
+
+/*********************************************************************
+ Map an NT error code from a gssapi error code.
+*********************************************************************/
+
+NTSTATUS map_nt_error_from_gss(uint32 gss_maj, uint32 minor)
+{
+       int i = 0;
+
+       if (gss_maj == GSS_S_COMPLETE) {
+               return NT_STATUS_OK;
+       }
+
+       if (gss_maj == GSS_S_CONTINUE_NEEDED) {
+               return NT_STATUS_MORE_PROCESSING_REQUIRED;
+       }
+
+       if (gss_maj == GSS_S_FAILURE) {
+               return map_nt_error_from_unix((int)minor);
+       }
+       
+       /* Look through list */
+       while(gss_to_ntstatus_errormap[i].gss_err != 0) {
+               if (gss_to_ntstatus_errormap[i].gss_err == gss_maj) {
+                       return gss_to_ntstatus_errormap[i].ntstatus;
+               }
+               i++;
+       }
+
+       /* Default return */
+       return NT_STATUS_ACCESS_DENIED;
+}
+#endif
index 2ff28302561b5d14c96689a5aaf3a87c06fcf1bf..2eb580a52d416aa071e5a85e586cb2ec3538360e 100644 (file)
@@ -6,6 +6,7 @@
    Copyright (C) John Terpstra 2000
    Copyright (C) Tom Jansen (Ninja ISD) 2002 
    Copyright (C) Derrell Lipman 2003, 2004
+   Copyright (C) Jeremy Allison 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
@@ -591,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;
@@ -605,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;
                }
 
                /*
@@ -651,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;
@@ -677,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;
@@ -705,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
@@ -724,23 +764,27 @@ 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
+                        * here as the encryption context is not per
+                        * 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);
@@ -774,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);
 
@@ -870,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;
@@ -895,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;
@@ -903,6 +952,30 @@ smbc_server(SMBCCTX *context,
 
        DEBUG(4,(" tconx ok\n"));
 
+       if (context->internal->_smb_encryption_level) {
+               /* Attempt UNIX smb encryption. */
+               if (!NT_STATUS_IS_OK(cli_force_encryption(c,
+                                               username_used,
+                                               *pp_password,
+                                               *pp_workgroup))) {
+
+                       /*
+                        * context->internal->_smb_encryption_level == 1
+                        * means don't fail if encryption can't be negotiated,
+                        * == 2 means fail if encryption can't be negotiated.
+                        */
+
+                       DEBUG(4,(" SMB encrypt failed\n"));
+
+                       if (context->internal->_smb_encryption_level == 2) {
+                               cli_shutdown(c);
+                               errno = EPERM;
+                               return NULL;
+                       }
+               }
+               DEBUG(4,(" SMB encrypt ok\n"));
+       }
+
        /*
         * Ok, we have got a nice connection
         * Let's allocate a server structure.
@@ -925,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;
@@ -957,13 +1031,13 @@ 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)
 {
         int flags;
         struct sockaddr_storage ss;
@@ -977,27 +1051,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;
@@ -1007,11 +1073,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)));
@@ -1019,6 +1087,30 @@ smbc_attr_server(SMBCCTX *context,
                         return NULL;
                 }
 
+               if (context->internal->_smb_encryption_level) {
+                       /* Attempt UNIX smb encryption. */
+                       if (!NT_STATUS_IS_OK(cli_force_encryption(ipc_cli,
+                                               *pp_username,
+                                               *pp_password,
+                                               *pp_workgroup))) {
+
+                               /*
+                                * context->internal->_smb_encryption_level == 1
+                                * means don't fail if encryption can't be negotiated,
+                                * == 2 means fail if encryption can't be negotiated.
+                                */
+
+                               DEBUG(4,(" SMB encrypt failed on IPC$\n"));
+
+                               if (context->internal->_smb_encryption_level == 2) {
+                                       cli_shutdown(ipc_cli);
+                                       errno = EPERM;
+                                       return NULL;
+                               }
+                       }
+                       DEBUG(4,(" SMB encrypt ok on IPC$\n"));
+               }
+
                 ipc_srv = SMB_MALLOC_P(SMBCSRV);
                 if (!ipc_srv) {
                         errno = ENOMEM;
@@ -1029,46 +1121,44 @@ smbc_attr_server(SMBCCTX *context,
                 ZERO_STRUCTP(ipc_srv);
                 ipc_srv->cli = ipc_cli;
 
-                if (pol) {
-                        pipe_hnd = cli_rpc_pipe_open_noauth(ipc_srv->cli,
-                                                            PI_LSARPC,
-                                                            &nt_status);
-                        if (!pipe_hnd) {
-                                DEBUG(1, ("cli_nt_session_open fail!\n"));
-                                errno = ENOTSUP;
-                                cli_shutdown(ipc_srv->cli);
-                                free(ipc_srv);
-                                return NULL;
-                        }
+                pipe_hnd = cli_rpc_pipe_open_noauth(ipc_srv->cli,
+                                                    PI_LSARPC,
+                                                    &nt_status);
+                if (!pipe_hnd) {
+                    DEBUG(1, ("cli_nt_session_open fail!\n"));
+                    errno = ENOTSUP;
+                    cli_shutdown(ipc_srv->cli);
+                    free(ipc_srv);
+                    return NULL;
+                }
 
-                        /*
-                         * Some systems don't support
-                         * 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, 
-                                GENERIC_EXECUTE_ACCESS,
-                                pol);
-        
-                        if (!NT_STATUS_IS_OK(nt_status)) {
-                                errno = smbc_errno(context, ipc_srv->cli);
-                                cli_shutdown(ipc_srv->cli);
-                                return NULL;
-                        }
+                /*
+                 * Some systems don't support
+                 * 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,
+                    GENERIC_EXECUTE_ACCESS,
+                    &ipc_srv->pol);
+
+                if (!NT_STATUS_IS_OK(nt_status)) {
+                    errno = smbc_errno(context, ipc_srv->cli);
+                    cli_shutdown(ipc_srv->cli);
+                    return NULL;
                 }
 
                 /* now add it to the cache (internal or external) */
 
                 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;
@@ -1094,10 +1184,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;
@@ -1144,8 +1234,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;
@@ -1288,10 +1378,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();
 
         /*
@@ -1389,10 +1479,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 */
@@ -1471,10 +1561,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 ||
@@ -1563,9 +1653,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();
 
@@ -1634,11 +1724,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;
                 }
@@ -1749,10 +1839,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();
 
@@ -1795,8 +1885,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);
@@ -1871,21 +1961,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();
 
@@ -1962,8 +2052,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;
@@ -2025,10 +2115,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 ||
@@ -2170,6 +2260,9 @@ smbc_setup_stat(SMBCCTX *context,
 #endif
 #ifdef HAVE_STAT_ST_BLOCKS
        st->st_blocks = (size+511)/512;
+#endif
+#ifdef HAVE_STRUCT_STAT_ST_RDEV
+       st->st_rdev = 0;
 #endif
        st->st_uid = getuid();
        st->st_gid = getgid();
@@ -2198,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;
@@ -2253,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);
@@ -2274,7 +2367,7 @@ smbc_stat_ctx(SMBCCTX *context,
 
        st->st_ino = ino;
 
-       smbc_setup_stat(context, st, path, size, mode);
+       smbc_setup_stat(context, st, (char *) fname, size, mode);
 
        set_atimespec(st, access_time_ts);
        set_ctimespec(st, change_time_ts);
@@ -2300,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();
 
@@ -2688,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();
 
@@ -2884,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;
                         }
@@ -2938,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
@@ -2977,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) {
@@ -3010,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) {
@@ -3072,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) {
@@ -3440,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 ||
@@ -3490,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) {
 
@@ -3548,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 ||
@@ -3598,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) {
 
@@ -3833,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();
 
@@ -3882,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);
@@ -3912,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();
@@ -3988,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);
@@ -4596,7 +4689,15 @@ dos_attr_parse(SMBCCTX *context,
        frame = talloc_stackframe();
        while (next_token_talloc(frame, &p, &tok, "\t,\r\n")) {
                if (StrnCaseCmp(tok, "MODE:", 5) == 0) {
-                       dad->mode = strtol(tok+5, NULL, 16);
+                        long request = strtol(tok+5, NULL, 16);
+                        if (request == 0) {
+                                dad->mode = (request |
+                                             (IS_DOS_DIR(dad->mode)
+                                              ? FILE_ATTRIBUTE_DIRECTORY
+                                              : FILE_ATTRIBUTE_NORMAL));
+                        } else {
+                                dad->mode = request;
+                        }
                        continue;
                }
 
@@ -5624,16 +5725,15 @@ 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;
-        POLICY_HND pol;
-        DOS_ATTR_DESC *dad;
+        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;
+        DOS_ATTR_DESC *dad = NULL;
         struct {
                 const char * create_time_attr;
                 const char * access_time_attr;
@@ -5682,17 +5782,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,
-                                           &pol);
+                ipc_srv = smbc_attr_server(frame, context, server, share,
+                                           &workgroup, &user, &password);
                 if (! ipc_srv) {
                         srv->no_nt_session = True;
                 }
@@ -5718,7 +5817,7 @@ smbc_setxattr_ctx(SMBCCTX *context,
 
                 if (ipc_srv) {
                         ret = cacl_set(talloc_tos(), srv->cli,
-                                       ipc_srv->cli, &pol, path,
+                                       ipc_srv->cli, &ipc_srv->pol, path,
                                        namevalue,
                                        (*namevalue == '*'
                                         ? SMBC_XATTR_MODE_SET
@@ -5782,7 +5881,7 @@ smbc_setxattr_ctx(SMBCCTX *context,
                         ret = -1;
                 } else {
                         ret = cacl_set(talloc_tos(), srv->cli,
-                                       ipc_srv->cli, &pol, path,
+                                       ipc_srv->cli, &ipc_srv->pol, path,
                                        namevalue,
                                        (*namevalue == '*'
                                         ? SMBC_XATTR_MODE_SET
@@ -5812,7 +5911,7 @@ smbc_setxattr_ctx(SMBCCTX *context,
                         ret = -1;
                 } else {
                         ret = cacl_set(talloc_tos(), srv->cli,
-                                       ipc_srv->cli, &pol, path,
+                                       ipc_srv->cli, &ipc_srv->pol, path,
                                        namevalue, SMBC_XATTR_MODE_CHOWN, 0);
                 }
                TALLOC_FREE(frame);
@@ -5839,8 +5938,8 @@ smbc_setxattr_ctx(SMBCCTX *context,
                         ret = -1;
                 } else {
                         ret = cacl_set(talloc_tos(), srv->cli,
-                                       ipc_srv->cli, &pol, path,
-                                       namevalue, SMBC_XATTR_MODE_CHOWN, 0);
+                                       ipc_srv->cli, &ipc_srv->pol, path,
+                                       namevalue, SMBC_XATTR_MODE_CHGRP, 0);
                 }
                TALLOC_FREE(frame);
                 return ret;
@@ -5922,15 +6021,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;
-        POLICY_HND pol;
+        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;
         struct {
                 const char * create_time_attr;
                 const char * access_time_attr;
@@ -5978,17 +6076,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,
-                                           &pol);
+                ipc_srv = smbc_attr_server(frame, context, server, share,
+                                           &workgroup, &user, &password);
                 if (! ipc_srv) {
                         srv->no_nt_session = True;
                 }
@@ -6041,7 +6138,7 @@ smbc_getxattr_ctx(SMBCCTX *context,
                 /* Yup. */
                 ret = cacl_get(context, talloc_tos(), srv,
                                ipc_srv == NULL ? NULL : ipc_srv->cli, 
-                               &pol, path,
+                               &ipc_srv->pol, path,
                                CONST_DISCARD(char *, name),
                                CONST_DISCARD(char *, value), size);
                 if (ret < 0 && errno == 0) {
@@ -6064,15 +6161,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;
-        POLICY_HND pol;
+        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;
        TALLOC_CTX *frame = talloc_stackframe();
 
         if (!context || !context->internal ||
@@ -6114,17 +6210,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,
-                                           &pol);
+                ipc_srv = smbc_attr_server(frame, context, server, share,
+                                           &workgroup, &user, &password);
                 if (! ipc_srv) {
                         srv->no_nt_session = True;
                 }
@@ -6143,7 +6238,7 @@ smbc_removexattr_ctx(SMBCCTX *context,
 
                 /* Yup. */
                 ret = cacl_set(talloc_tos(), srv->cli,
-                               ipc_srv->cli, &pol, path,
+                               ipc_srv->cli, &ipc_srv->pol, path,
                                NULL, SMBC_XATTR_MODE_REMOVE_ALL, 0);
                TALLOC_FREE(frame);
                 return ret;
@@ -6163,7 +6258,7 @@ smbc_removexattr_ctx(SMBCCTX *context,
 
                 /* Yup. */
                 ret = cacl_set(talloc_tos(), srv->cli,
-                               ipc_srv->cli, &pol, path,
+                               ipc_srv->cli, &ipc_srv->pol, path,
                                name + 19, SMBC_XATTR_MODE_REMOVE, 0);
                TALLOC_FREE(frame);
                 return ret;
@@ -6186,6 +6281,7 @@ smbc_listxattr_ctx(SMBCCTX *context,
          * the complete set of attribute names, always, rather than only those
          * attribute names which actually exist for a file.  Hmmm...
          */
+        size_t retsize;
         const char supported_old[] =
                 "system.*\0"
                 "system.*+\0"
@@ -6229,22 +6325,24 @@ smbc_listxattr_ctx(SMBCCTX *context,
 
         if (context->internal->_full_time_names) {
                 supported = supported_new;
+                retsize = sizeof(supported_new);
         } else {
                 supported = supported_old;
+                retsize = sizeof(supported_old);
         }
 
         if (size == 0) {
-                return sizeof(supported);
+                return retsize;
         }
 
-        if (sizeof(supported) > size) {
+        if (retsize > size) {
                 errno = ERANGE;
                 return -1;
         }
 
         /* this can't be strcpy() because there are embedded null characters */
-        memcpy(list, supported, sizeof(supported));
-        return sizeof(supported);
+        memcpy(list, supported, retsize);
+        return retsize;
 }
 
 
@@ -6256,11 +6354,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 ||
@@ -6399,13 +6497,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 ||
@@ -6447,8 +6545,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);
@@ -6476,13 +6574,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();
 
@@ -6525,8 +6623,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) {
 
@@ -6724,6 +6822,7 @@ smbc_option_set(SMBCCTX *context,
                 bool b;
                 smbc_get_auth_data_with_context_fn auth_fn;
                 void *v;
+               const char *s;
         } option_value;
 
         va_start(ap, option_name);
@@ -6772,6 +6871,19 @@ smbc_option_set(SMBCCTX *context,
                  */
                 option_value.v = va_arg(ap, void *);
                 context->internal->_user_data = option_value.v;
+        } else if (strcmp(option_name, "smb_encrypt_level") == 0) {
+                /*
+                 * Save an encoded value for encryption level.
+                 * 0 = off, 1 = attempt, 2 = required.
+                 */
+                option_value.s = va_arg(ap, const char *);
+               if (strcmp(option_value.s, "none") == 0) {
+                       context->internal->_smb_encryption_level = 0;
+               } else if (strcmp(option_value.s, "request") == 0) {
+                       context->internal->_smb_encryption_level = 1;
+               } else if (strcmp(option_value.s, "require") == 0) {
+                       context->internal->_smb_encryption_level = 2;
+               }
         }
 
         va_end(ap);
@@ -6821,6 +6933,35 @@ smbc_option_get(SMBCCTX *context,
                  * with smbc_option_get()
                  */
                 return context->internal->_user_data;
+        } else if (strcmp(option_name, "smb_encrypt_level") == 0) {
+               /*
+                * Return the current smb encrypt negotiate option as a string.
+                */
+               switch (context->internal->_smb_encryption_level) {
+               case 0:
+                       return (void *) "none";
+               case 1:
+                       return (void *) "request";
+               case 2:
+                       return (void *) "require";
+               }
+        } else if (strcmp(option_name, "smb_encrypt_on") == 0) {
+               /*
+                * Return the current smb encrypt status option as a bool.
+                * false = off, true = on. We don't know what server is
+                * being requested, so we only return true if all servers
+                * are using an encrypted connection.
+                */
+               SMBCSRV *s;
+               unsigned int num_servers = 0;
+
+               for (s = context->internal->_servers; s; s = s->next) {
+                       num_servers++;
+                       if (s->cli->trans_enc_state == NULL) {
+                               return (void *)false;
+                       }
+               }
+               return (void *) (bool) (num_servers > 0);
         }
 
         return NULL;
index 853fe979b7704677fbb97287cc020a6d3c8ff5c4..ad16452e3e650d90edf1411bf11fb12a7be14712 100644 (file)
@@ -1299,11 +1299,11 @@ static NTSTATUS resolve_hosts(const char *name, int name_type,
  Resolve via "ADS" method.
 *********************************************************/
 
-NTSTATUS resolve_ads(const char *name,
-                       int name_type,
-                       const char *sitename,
-                       struct ip_service **return_iplist,
-                       int *return_count)
+static NTSTATUS resolve_ads(const char *name,
+                           int name_type,
+                           const char *sitename,
+                           struct ip_service **return_iplist,
+                           int *return_count)
 {
        int                     i, j;
        NTSTATUS                status;
@@ -1422,14 +1422,13 @@ NTSTATUS resolve_ads(const char *name,
  resolve_hosts() when looking up DC's via SRV RR entries in DNS
 **********************************************************************/
 
-NTSTATUS internal_resolve_name(const char *name,
+static NTSTATUS internal_resolve_name(const char *name,
                                int name_type,
                                const char *sitename,
                                struct ip_service **return_iplist,
                                int *return_count,
                                const char *resolve_order)
 {
-       const char *name_resolve_list;
        char *tok;
        const char *ptr;
        NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
@@ -1483,16 +1482,10 @@ NTSTATUS internal_resolve_name(const char *name,
                return NT_STATUS_INVALID_PARAMETER;
        }
 
-       if (!resolve_order) {
-               name_resolve_list = lp_name_resolve_order();
-       } else {
-               name_resolve_list = resolve_order;
-       }
-
-       if (!name_resolve_list[0]) {
+       if (!resolve_order[0]) {
                ptr = "host";
        } else {
-               ptr = name_resolve_list;
+               ptr = resolve_order;
        }
 
        /* iterate through the name resolution backends */
index 2ff925ef361ab7dc464ef7f5c0a0836e297dde92..15a9a93ff29c37306e1ba9c0becfe929115ea085 100644 (file)
@@ -740,6 +740,8 @@ struct packet_struct *parse_packet(char *buf,int length,
        if (!p)
                return(NULL);
 
+       ZERO_STRUCTP(p);        /* initialize for possible padding */
+
        p->next = NULL;
        p->prev = NULL;
        p->ip = ip;
index f8ed044f8a562bb04ee61d86f1e2929011305f47..ae10d7373dad776bd3e82e3cbe0682f73e3f0c0e 100644 (file)
@@ -182,7 +182,10 @@ NTSTATUS ntlm_password_check(TALLOC_CTX *mem_ctx,
                             DATA_BLOB *user_sess_key, 
                             DATA_BLOB *lm_sess_key)
 {
-       static const unsigned char zeros[8] = { 0, };
+       unsigned char zeros[8];
+
+       ZERO_STRUCT(zeros);
+
        if (nt_pw == NULL) {
                DEBUG(3,("ntlm_password_check: NO NT password stored for user %s.\n", 
                         username));
index ed08e8102b377c742c62761b2708388f180302f3..35c20ed6475fe5306c00a0b025f79c9ad1993402 100644 (file)
@@ -823,7 +823,8 @@ static NTSTATUS ntlmssp_server_auth(struct ntlmssp_state *ntlmssp_state,
                                                          session_key.data);
                                DEBUG(10,("ntlmssp_server_auth: Created NTLM session key.\n"));
                        } else {
-                               static const uint8 zeros[24] = { 0, };
+                               uint8 zeros[24];
+                               ZERO_STRUCT(zeros);
                                session_key = data_blob_talloc(
                                        ntlmssp_state->mem_ctx, NULL, 16);
                                if (session_key.data == NULL) {
@@ -1066,9 +1067,11 @@ static NTSTATUS ntlmssp_client_challenge(struct ntlmssp_state *ntlmssp_state,
        }
 
        if (!ntlmssp_state->nt_hash || !ntlmssp_state->lm_hash) {
-               static const uchar zeros[16] = { 0, };
+               uchar zeros[16];
                /* do nothing - blobs are zero length */
 
+               ZERO_STRUCT(zeros);
+
                /* session key is all zeros */
                session_key = data_blob_talloc(ntlmssp_state->mem_ctx, zeros, 16);
                
index ac8846ad1e079f875c2ea72deb03b2b0d660820b..70377cba7d50019998b24d7cf23a33ec5fa25781 100644 (file)
@@ -170,6 +170,7 @@ bool msrpc_gen(DATA_BLOB *blob,
 /* a helpful macro to avoid running over the end of our blob */
 #define NEED_DATA(amount) \
 if ((head_ofs + amount) > blob->length) { \
+        va_end(ap); \
         return False; \
 }
 
@@ -216,16 +217,20 @@ bool msrpc_parse(const DATA_BLOB *blob,
                                if ((len1 != len2) || (ptr + len1 < ptr) ||
                                                (ptr + len1 < len1) ||
                                                (ptr + len1 > blob->length)) {
+                                       va_end(ap);
                                        return false;
                                }
                                if (len1 & 1) {
                                        /* if odd length and unicode */
+                                       va_end(ap);
                                        return false;
                                }
                                if (blob->data + ptr <
                                                (uint8 *)(unsigned long)ptr ||
-                                               blob->data + ptr < blob->data)
+                                   blob->data + ptr < blob->data) {
+                                       va_end(ap);
                                        return false;
+                               }
 
                                if (0 < len1) {
                                        char *p = NULL;
@@ -261,13 +266,16 @@ bool msrpc_parse(const DATA_BLOB *blob,
                                if ((len1 != len2) || (ptr + len1 < ptr) ||
                                                (ptr + len1 < len1) ||
                                                (ptr + len1 > blob->length)) {
+                                       va_end(ap);
                                        return false;
                                }
 
                                if (blob->data + ptr <
                                                (uint8 *)(unsigned long)ptr ||
-                                               blob->data + ptr < blob->data)
+                                   blob->data + ptr < blob->data) {
+                                       va_end(ap);
                                        return false;
+                               }
 
                                if (0 < len1) {
                                        char *p = NULL;
@@ -304,13 +312,16 @@ bool msrpc_parse(const DATA_BLOB *blob,
                                if ((len1 != len2) || (ptr + len1 < ptr) ||
                                                (ptr + len1 < len1) ||
                                                (ptr + len1 > blob->length)) {
+                                       va_end(ap);
                                        return false;
                                }
 
                                if (blob->data + ptr <
                                                (uint8 *)(unsigned long)ptr ||
-                                               blob->data + ptr < blob->data)
+                                   blob->data + ptr < blob->data) {
+                                       va_end(ap);
                                        return false;
+                               }
 
                                *b = data_blob(blob->data + ptr, len1);
                        }
@@ -322,6 +333,7 @@ bool msrpc_parse(const DATA_BLOB *blob,
                        NEED_DATA(len1);
                        if (blob->data + head_ofs < (uint8 *)head_ofs ||
                                        blob->data + head_ofs < blob->data) {
+                               va_end(ap);
                                return false;
                        }
 
@@ -337,7 +349,8 @@ bool msrpc_parse(const DATA_BLOB *blob,
                        s = va_arg(ap, char *);
 
                        if (blob->data + head_ofs < (uint8 *)head_ofs ||
-                                       blob->data + head_ofs < blob->data) {
+                           blob->data + head_ofs < blob->data) {
+                               va_end(ap);
                                return false;
                        }
 
@@ -351,11 +364,13 @@ bool msrpc_parse(const DATA_BLOB *blob,
                                                blob->length - head_ofs,
                                                STR_ASCII|STR_TERMINATE);
                                if (ret == (size_t)-1 || p == NULL) {
+                                       va_end(ap);
                                        return false;
                                }
                                head_ofs += ret;
                                if (strcmp(s, p) != 0) {
                                        TALLOC_FREE(p);
+                                       va_end(ap);
                                        return false;
                                }
                                TALLOC_FREE(p);
diff --git a/source/libsmb/smb_seal.c b/source/libsmb/smb_seal.c
new file mode 100644 (file)
index 0000000..b5befbf
--- /dev/null
@@ -0,0 +1,497 @@
+/* 
+   Unix SMB/CIFS implementation.
+   SMB Transport encryption (sealing) code.
+   Copyright (C) Jeremy Allison 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"
+
+/******************************************************************************
+ Pull out the encryption context for this packet. 0 means global context.
+******************************************************************************/
+
+NTSTATUS get_enc_ctx_num(const uint8_t *buf, uint16 *p_enc_ctx_num)
+{
+       if (smb_len(buf) < 8) {
+               return NT_STATUS_INVALID_BUFFER_SIZE;
+       }
+
+       if (buf[4] == 0xFF) {
+               if (buf[5] == 'S' && buf [6] == 'M' && buf[7] == 'B') {
+                       /* Not an encrypted buffer. */
+                       return NT_STATUS_NOT_FOUND;
+               }
+               if (buf[5] == 'E') {
+                       *p_enc_ctx_num = SVAL(buf,6);
+                       return NT_STATUS_OK;
+               }
+       }
+       return NT_STATUS_INVALID_NETWORK_RESPONSE;
+}
+
+/******************************************************************************
+ Generic code for client and server.
+ Is encryption turned on ?
+******************************************************************************/
+
+bool common_encryption_on(struct smb_trans_enc_state *es)
+{
+       return ((es != NULL) && es->enc_on);
+}
+
+/******************************************************************************
+ Generic code for client and server.
+ NTLM decrypt an incoming buffer.
+ Abartlett tells me that SSPI puts the signature first before the encrypted
+ output, so cope with the same for compatibility.
+******************************************************************************/
+
+NTSTATUS common_ntlm_decrypt_buffer(NTLMSSP_STATE *ntlmssp_state, char *buf)
+{
+       NTSTATUS status;
+       size_t buf_len = smb_len(buf) + 4; /* Don't forget the 4 length bytes. */
+       size_t data_len;
+       char *inbuf;
+       DATA_BLOB sig;
+
+       if (buf_len < 8 + NTLMSSP_SIG_SIZE) {
+               return NT_STATUS_BUFFER_TOO_SMALL;
+       }
+
+       inbuf = (char *)smb_xmemdup(buf, buf_len);
+
+       /* Adjust for the signature. */
+       data_len = buf_len - 8 - NTLMSSP_SIG_SIZE;
+
+       /* Point at the signature. */
+       sig = data_blob_const(inbuf+8, NTLMSSP_SIG_SIZE);
+
+       status = ntlmssp_unseal_packet(ntlmssp_state,
+               (unsigned char *)inbuf + 8 + NTLMSSP_SIG_SIZE, /* 4 byte len + 0xFF 'E' <enc> <ctx> */
+               data_len,
+               (unsigned char *)inbuf + 8 + NTLMSSP_SIG_SIZE,
+               data_len,
+               &sig);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               SAFE_FREE(inbuf);
+               return status;
+       }
+
+       memcpy(buf + 8, inbuf + 8 + NTLMSSP_SIG_SIZE, data_len);
+
+       /* Reset the length and overwrite the header. */
+       smb_setlen(buf,data_len + 4);
+
+       SAFE_FREE(inbuf);
+       return NT_STATUS_OK;
+}
+
+/******************************************************************************
+ Generic code for client and server.
+ NTLM encrypt an outgoing buffer. Return the encrypted pointer in ppbuf_out.
+ Abartlett tells me that SSPI puts the signature first before the encrypted
+ output, so do the same for compatibility.
+******************************************************************************/
+
+NTSTATUS common_ntlm_encrypt_buffer(NTLMSSP_STATE *ntlmssp_state,
+                               uint16 enc_ctx_num,
+                               char *buf,
+                               char **ppbuf_out)
+{
+       NTSTATUS status;
+       char *buf_out;
+       size_t data_len = smb_len(buf) - 4; /* Ignore the 0xFF SMB bytes. */
+       DATA_BLOB sig;
+
+       *ppbuf_out = NULL;
+
+       if (data_len == 0) {
+               return NT_STATUS_BUFFER_TOO_SMALL;
+       }
+
+       /* 
+        * We know smb_len can't return a value > 128k, so no int overflow
+        * check needed.
+        */
+
+       buf_out = SMB_XMALLOC_ARRAY(char, 8 + NTLMSSP_SIG_SIZE + data_len);
+
+       /* Copy the data from the original buffer. */
+
+       memcpy(buf_out + 8 + NTLMSSP_SIG_SIZE, buf + 8, data_len);
+
+       smb_set_enclen(buf_out, smb_len(buf) + NTLMSSP_SIG_SIZE, enc_ctx_num);
+
+       sig = data_blob(NULL, NTLMSSP_SIG_SIZE);
+
+       status = ntlmssp_seal_packet(ntlmssp_state,
+               (unsigned char *)buf_out + 8 + NTLMSSP_SIG_SIZE, /* 4 byte len + 0xFF 'S' <enc> <ctx> */
+               data_len,
+               (unsigned char *)buf_out + 8 + NTLMSSP_SIG_SIZE,
+               data_len,
+               &sig);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               data_blob_free(&sig);
+               SAFE_FREE(buf_out);
+               return status;
+       }
+
+       /* First 16 data bytes are signature for SSPI compatibility. */
+       memcpy(buf_out + 8, sig.data, NTLMSSP_SIG_SIZE);
+       *ppbuf_out = buf_out;
+       return NT_STATUS_OK;
+}
+
+/******************************************************************************
+ Generic code for client and server.
+ gss-api decrypt an incoming buffer. We insist that the size of the
+ unwrapped buffer must be smaller or identical to the incoming buffer.
+******************************************************************************/
+
+#if defined(HAVE_GSSAPI) && defined(HAVE_KRB5)
+static NTSTATUS common_gss_decrypt_buffer(struct smb_tran_enc_state_gss *gss_state, char *buf)
+{
+       gss_ctx_id_t gss_ctx = gss_state->gss_ctx;
+       OM_uint32 ret = 0;
+       OM_uint32 minor = 0;
+       int flags_got = 0;
+       gss_buffer_desc in_buf, out_buf;
+       size_t buf_len = smb_len(buf) + 4; /* Don't forget the 4 length bytes. */
+
+       if (buf_len < 8) {
+               return NT_STATUS_BUFFER_TOO_SMALL;
+       }
+
+       in_buf.value = buf + 8;
+       in_buf.length = buf_len - 8;
+
+       ret = gss_unwrap(&minor,
+                       gss_ctx,
+                       &in_buf,
+                       &out_buf,
+                       &flags_got,             /* did we get sign+seal ? */
+                       (gss_qop_t *) NULL);    
+
+       if (ret != GSS_S_COMPLETE) {
+               ADS_STATUS adss = ADS_ERROR_GSS(ret, minor);
+               DEBUG(0,("common_gss_encrypt_buffer: gss_unwrap failed. Error %s\n",
+                       ads_errstr(adss) ));
+               return map_nt_error_from_gss(ret, minor);
+       }
+
+       if (out_buf.length > in_buf.length) {
+               DEBUG(0,("common_gss_encrypt_buffer: gss_unwrap size (%u) too large (%u) !\n",
+                       (unsigned int)out_buf.length,
+                       (unsigned int)in_buf.length ));
+               gss_release_buffer(&minor, &out_buf);
+               return NT_STATUS_INVALID_PARAMETER;
+       }
+
+       memcpy(buf + 8, out_buf.value, out_buf.length);
+       /* Reset the length and overwrite the header. */
+       smb_setlen(buf, out_buf.length + 4);
+
+       gss_release_buffer(&minor, &out_buf);
+       return NT_STATUS_OK;
+}
+
+/******************************************************************************
+ Generic code for client and server.
+ gss-api encrypt an outgoing buffer. Return the alloced encrypted pointer in buf_out.
+******************************************************************************/
+
+static NTSTATUS common_gss_encrypt_buffer(struct smb_tran_enc_state_gss *gss_state,
+                                       uint16 enc_ctx_num,
+                                       char *buf,
+                                       char **ppbuf_out)
+{
+       gss_ctx_id_t gss_ctx = gss_state->gss_ctx;
+       OM_uint32 ret = 0;
+       OM_uint32 minor = 0;
+       int flags_got = 0;
+       gss_buffer_desc in_buf, out_buf;
+       size_t buf_len = smb_len(buf) + 4; /* Don't forget the 4 length bytes. */
+
+       *ppbuf_out = NULL;
+
+       if (buf_len < 8) {
+               return NT_STATUS_BUFFER_TOO_SMALL;
+       }
+
+       in_buf.value = buf + 8;
+       in_buf.length = buf_len - 8;
+
+       ret = gss_wrap(&minor,
+                       gss_ctx,
+                       true,                   /* we want sign+seal. */
+                       GSS_C_QOP_DEFAULT,
+                       &in_buf,
+                       &flags_got,             /* did we get sign+seal ? */
+                       &out_buf);
+
+       if (ret != GSS_S_COMPLETE) {
+               ADS_STATUS adss = ADS_ERROR_GSS(ret, minor);
+               DEBUG(0,("common_gss_encrypt_buffer: gss_wrap failed. Error %s\n",
+                       ads_errstr(adss) ));
+               return map_nt_error_from_gss(ret, minor);
+       }
+
+       if (!flags_got) {
+               /* Sign+seal not supported. */
+               gss_release_buffer(&minor, &out_buf);
+               return NT_STATUS_NOT_SUPPORTED;
+       }
+
+       /* Ya see - this is why I *hate* gss-api. I don't 
+        * want to have to malloc another buffer of the
+        * same size + 8 bytes just to get a continuous
+        * header + buffer, but gss won't let me pass in
+        * a pre-allocated buffer. Bastards (and you know
+        * who you are....). I might fix this by
+        * going to "encrypt_and_send" passing in a file
+        * descriptor and doing scatter-gather write with
+        * TCP cork on Linux. But I shouldn't have to
+        * bother :-*(. JRA.
+        */
+
+       *ppbuf_out = (char *)SMB_MALLOC(out_buf.length + 8); /* We know this can't wrap. */
+       if (!*ppbuf_out) {
+               gss_release_buffer(&minor, &out_buf);
+               return NT_STATUS_NO_MEMORY;
+       }
+
+       memcpy(*ppbuf_out+8, out_buf.value, out_buf.length);
+       smb_set_enclen(*ppbuf_out, out_buf.length + 4, enc_ctx_num);
+
+       gss_release_buffer(&minor, &out_buf);
+       return NT_STATUS_OK;
+}
+#endif
+
+/******************************************************************************
+ Generic code for client and server.
+ Encrypt an outgoing buffer. Return the alloced encrypted pointer in buf_out.
+******************************************************************************/
+
+NTSTATUS common_encrypt_buffer(struct smb_trans_enc_state *es, char *buffer, char **buf_out)
+{
+       if (!common_encryption_on(es)) {
+               /* Not encrypting. */
+               *buf_out = buffer;
+               return NT_STATUS_OK;
+       }
+
+       switch (es->smb_enc_type) {
+               case SMB_TRANS_ENC_NTLM:
+                       return common_ntlm_encrypt_buffer(es->s.ntlmssp_state, es->enc_ctx_num, buffer, buf_out);
+#if defined(HAVE_GSSAPI) && defined(HAVE_KRB5)
+               case SMB_TRANS_ENC_GSS:
+                       return common_gss_encrypt_buffer(es->s.gss_state, es->enc_ctx_num, buffer, buf_out);
+#endif
+               default:
+                       return NT_STATUS_NOT_SUPPORTED;
+       }
+}
+
+/******************************************************************************
+ Generic code for client and server.
+ Decrypt an incoming SMB buffer. Replaces the data within it.
+ New data must be less than or equal to the current length.
+******************************************************************************/
+
+NTSTATUS common_decrypt_buffer(struct smb_trans_enc_state *es, char *buf)
+{
+       if (!common_encryption_on(es)) {
+               /* Not decrypting. */
+               return NT_STATUS_OK;
+       }
+
+       switch (es->smb_enc_type) {
+               case SMB_TRANS_ENC_NTLM:
+                       return common_ntlm_decrypt_buffer(es->s.ntlmssp_state, buf);
+#if defined(HAVE_GSSAPI) && defined(HAVE_KRB5)
+               case SMB_TRANS_ENC_GSS:
+                       return common_gss_decrypt_buffer(es->s.gss_state, buf);
+#endif
+               default:
+                       return NT_STATUS_NOT_SUPPORTED;
+       }
+}
+
+#if defined(HAVE_GSSAPI) && defined(HAVE_KRB5)
+/******************************************************************************
+ Shutdown a gss encryption state.
+******************************************************************************/
+
+static void common_free_gss_state(struct smb_tran_enc_state_gss **pp_gss_state)
+{
+       OM_uint32 minor = 0;
+       struct smb_tran_enc_state_gss *gss_state = *pp_gss_state;
+
+       if (gss_state->creds != GSS_C_NO_CREDENTIAL) {
+               gss_release_cred(&minor, &gss_state->creds);
+       }
+       if (gss_state->gss_ctx != GSS_C_NO_CONTEXT) {
+               gss_delete_sec_context(&minor, &gss_state->gss_ctx, NULL);
+       }
+       SAFE_FREE(*pp_gss_state);
+}
+#endif
+
+/******************************************************************************
+ Shutdown an encryption state.
+******************************************************************************/
+
+void common_free_encryption_state(struct smb_trans_enc_state **pp_es)
+{
+       struct smb_trans_enc_state *es = *pp_es;
+
+       if (es == NULL) {
+               return;
+       }
+
+       if (es->smb_enc_type == SMB_TRANS_ENC_NTLM) {
+               if (es->s.ntlmssp_state) {
+                       ntlmssp_end(&es->s.ntlmssp_state);
+               }
+       }
+#if defined(HAVE_GSSAPI) && defined(HAVE_KRB5)
+       if (es->smb_enc_type == SMB_TRANS_ENC_GSS) {
+               /* Free the gss context handle. */
+               if (es->s.gss_state) {
+                       common_free_gss_state(&es->s.gss_state);
+               }
+       }
+#endif
+       SAFE_FREE(es);
+       *pp_es = NULL;
+}
+
+/******************************************************************************
+ Free an encryption-allocated buffer.
+******************************************************************************/
+
+void common_free_enc_buffer(struct smb_trans_enc_state *es, char *buf)
+{
+       if (!common_encryption_on(es)) {
+               return;
+       }
+
+       if (es->smb_enc_type == SMB_TRANS_ENC_NTLM) {
+               SAFE_FREE(buf);
+               return;
+       }
+
+#if defined(HAVE_GSSAPI) && defined(HAVE_KRB5)
+       if (es->smb_enc_type == SMB_TRANS_ENC_GSS) {
+               OM_uint32 min;
+               gss_buffer_desc rel_buf;
+               rel_buf.value = buf;
+               rel_buf.length = smb_len(buf) + 4;
+               gss_release_buffer(&min, &rel_buf);
+       }
+#endif
+}
+
+/******************************************************************************
+ Client side encryption.
+******************************************************************************/
+
+/******************************************************************************
+ Is client encryption on ?
+******************************************************************************/
+
+bool cli_encryption_on(struct cli_state *cli)
+{
+       /* If we supported multiple encrytion contexts
+        * here we'd look up based on tid.
+        */
+       return common_encryption_on(cli->trans_enc_state);
+}
+
+/******************************************************************************
+ Shutdown a client encryption state.
+******************************************************************************/
+
+void cli_free_encryption_context(struct cli_state *cli)
+{
+       common_free_encryption_state(&cli->trans_enc_state);
+}
+
+/******************************************************************************
+ Free an encryption-allocated buffer.
+******************************************************************************/
+
+void cli_free_enc_buffer(struct cli_state *cli, char *buf)
+{
+       /* We know this is an smb buffer, and we
+        * didn't malloc, only copy, for a keepalive,
+        * so ignore non-session messages. */
+
+       if(CVAL(buf,0)) {
+               return;
+       }
+
+       /* If we supported multiple encrytion contexts
+        * here we'd look up based on tid.
+        */
+       common_free_enc_buffer(cli->trans_enc_state, buf);
+}
+
+/******************************************************************************
+ Decrypt an incoming buffer.
+******************************************************************************/
+
+NTSTATUS cli_decrypt_message(struct cli_state *cli)
+{
+       NTSTATUS status;
+       uint16 enc_ctx_num;
+
+       /* Ignore non-session messages. */
+       if(CVAL(cli->inbuf,0)) {
+               return NT_STATUS_OK;
+       }
+
+       status = get_enc_ctx_num((const uint8_t *)cli->inbuf, &enc_ctx_num);
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (enc_ctx_num != cli->trans_enc_state->enc_ctx_num) {
+               return NT_STATUS_INVALID_HANDLE;
+       }
+
+       return common_decrypt_buffer(cli->trans_enc_state, cli->inbuf);
+}
+
+/******************************************************************************
+ Encrypt an outgoing buffer. Return the encrypted pointer in buf_out.
+******************************************************************************/
+
+NTSTATUS cli_encrypt_message(struct cli_state *cli, char **buf_out)
+{
+       /* Ignore non-session messages. */
+       if(CVAL(cli->outbuf,0)) {
+               return NT_STATUS_OK;
+       }
+
+       /* If we supported multiple encrytion contexts
+        * here we'd look up based on tid.
+        */
+       return common_encrypt_buffer(cli->trans_enc_state, cli->outbuf, buf_out);
+}
index d5cbe3b12535aec2eb323184b30c83a7546fb10b..f03c21bd0e0c59e6a569c8afaebb0b257ed29354 100644 (file)
@@ -745,8 +745,8 @@ bool srv_oplock_set_signing(bool onoff)
 
 bool srv_check_sign_mac(const char *inbuf, bool must_be_ok)
 {
-       /* Check if it's a session keepalive. */
-       if(CVAL(inbuf,0) == SMBkeepalive) {
+       /* Check if it's a non-session message. */
+       if(CVAL(inbuf,0)) {
                return True;
        }
 
@@ -759,8 +759,8 @@ bool srv_check_sign_mac(const char *inbuf, bool must_be_ok)
 
 void srv_calculate_sign_mac(char *outbuf)
 {
-       /* Check if it's a session keepalive. */
-       if(CVAL(outbuf,0) == SMBkeepalive) {
+       /* Check if it's a non-session message. */
+       if(CVAL(outbuf,0)) {
                return;
        }
 
index 9e37d1d6cfa4b98b822559471b4ac1ceacb01796..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;
        }
        
@@ -704,16 +704,22 @@ char *decrypt_trustdom_secret(const char *pass, DATA_BLOB *data_in)
 void encode_wkssvc_join_password_buffer(TALLOC_CTX *mem_ctx,
                                        const char *pwd,
                                        DATA_BLOB *session_key,
-                                       struct wkssvc_PasswordBuffer *pwd_buf)
+                                       struct wkssvc_PasswordBuffer **pwd_buf)
 {
        uint8_t buffer[516];
        struct MD5Context ctx;
-
-       DATA_BLOB confounded_session_key = data_blob_talloc(mem_ctx, NULL, 16);
-
+       struct wkssvc_PasswordBuffer *my_pwd_buf = NULL;
+       DATA_BLOB confounded_session_key;
        int confounder_len = 8;
        uint8_t confounder[8];
 
+       my_pwd_buf = talloc_zero(mem_ctx, struct wkssvc_PasswordBuffer);
+       if (!my_pwd_buf) {
+               return;
+       }
+
+       confounded_session_key = data_blob_talloc(mem_ctx, NULL, 16);
+
        encode_pw_buffer(buffer, pwd, STR_UNICODE);
 
        generate_random_buffer((uint8_t *)confounder, confounder_len);
@@ -725,10 +731,12 @@ void encode_wkssvc_join_password_buffer(TALLOC_CTX *mem_ctx,
 
        SamOEMhashBlob(buffer, 516, &confounded_session_key);
 
-       memcpy(&pwd_buf->data[0], confounder, confounder_len);
-       memcpy(&pwd_buf->data[8], buffer, 516);
+       memcpy(&my_pwd_buf->data[0], confounder, confounder_len);
+       memcpy(&my_pwd_buf->data[8], buffer, 516);
 
        data_blob_free(&confounded_session_key);
+
+       *pwd_buf = my_pwd_buf;
 }
 
 WERROR decode_wkssvc_join_password_buffer(TALLOC_CTX *mem_ctx,
index 732dc78c75ea6687f30a35419f7514ecd65b8c9f..1ca7d56a83621b1083dae20a2a8f68a0aa7919af 100644 (file)
@@ -40,7 +40,7 @@ static NTSTATUS just_change_the_password(struct rpc_pipe_client *cli, TALLOC_CTX
           already have valid creds. If not we must set them up. */
 
        if (cli->auth.auth_type != PIPE_AUTH_TYPE_SCHANNEL) {
-               uint32 neg_flags = NETLOGON_NEG_AUTH2_FLAGS;
+               uint32 neg_flags = NETLOGON_NEG_SELECT_AUTH2_FLAGS;
 
                result = rpccli_netlogon_setup_creds(cli, 
                                        cli->cli->desthost, /* server name */
index 92a609c42b5b7008d01e73a2dc5fb33fc05ed466..5fbc33cdf572b81dec8cc6faf84640fbe296f05d 100644 (file)
@@ -63,6 +63,8 @@ void unexpected_packet(struct packet_struct *p)
 
        len = build_packet(&buf[6], sizeof(buf)-6, p) + 6;
 
+       ZERO_STRUCT(key);       /* needed for potential alignment */
+
        key.packet_type = p->packet_type;
        key.timestamp = p->timestamp;
        key.count = count++;
@@ -86,6 +88,10 @@ static int traverse_fn(TDB_CONTEXT *ttdb, TDB_DATA kbuf, TDB_DATA dbuf, void *st
 {
        struct unexpected_key key;
 
+       if (kbuf.dsize != sizeof(key)) {
+               tdb_delete(ttdb, kbuf);
+       }
+
        memcpy(&key, kbuf.dptr, sizeof(key));
 
        if (lastt - key.timestamp > NMBD_UNEXPECTED_TIMEOUT) {
@@ -134,6 +140,10 @@ static int traverse_match(TDB_CONTEXT *ttdb, TDB_DATA kbuf, TDB_DATA dbuf,
        int port;
        struct packet_struct *p;
 
+       if (kbuf.dsize != sizeof(key)) {
+               return 0;
+       }
+
        memcpy(&key, kbuf.dptr, sizeof(key));
 
        if (key.packet_type != state->match_type) return 0;
index eb42d081fed5d42791aa503b35f6f435120d1681..341d00f3fe0aac5d0b77cedce5b83f88c43077d8 100644 (file)
@@ -41,11 +41,11 @@ static struct db_context *brlock_db;
 
 static void print_lock_struct(unsigned int i, struct lock_struct *pls)
 {
-       DEBUG(10,("[%u]: smbpid = %u, tid = %u, pid = %s, ",
+       DEBUG(10,("[%u]: smbpid = %u, tid = %u, pid = %u, ",
                        i,
                        (unsigned int)pls->context.smbpid,
                        (unsigned int)pls->context.tid,
-                       procid_str_static(&pls->context.pid) ));
+                       (unsigned int)procid_to_pid(&pls->context.pid) ));
        
        DEBUG(10,("start = %.0f, size = %.0f, fnum = %d, %s %s\n",
                (double)pls->start,
@@ -263,10 +263,9 @@ void brl_init(bool read_only)
        if (brlock_db) {
                return;
        }
-       brlock_db = db_open(NULL, lock_path("brlock.tdb"), 0,
-                           TDB_DEFAULT
-                           |TDB_VOLATILE
-                           |(read_only?0x0:TDB_CLEAR_IF_FIRST),
+       brlock_db = db_open(NULL, lock_path("brlock.tdb"),
+                           lp_open_files_db_hash_size(),
+                           TDB_DEFAULT | TDB_CLEAR_IF_FIRST,
                            read_only?O_RDONLY:(O_RDWR|O_CREAT), 0644 );
        if (!brlock_db) {
                DEBUG(0,("Failed to open byte range locking database %s\n",
@@ -1495,14 +1494,16 @@ static int traverse_fn(struct db_record *rec, void *state)
                }
        }
 
-       for ( i=0; i<num_locks; i++) {
-               cb->fn(*key,
-                      locks[i].context.pid,
-                      locks[i].lock_type,
-                      locks[i].lock_flav,
-                      locks[i].start,
-                      locks[i].size,
-                      cb->private_data);
+       if (cb->fn) {
+               for ( i=0; i<num_locks; i++) {
+                       cb->fn(*key,
+                               locks[i].context.pid,
+                               locks[i].lock_type,
+                               locks[i].lock_flav,
+                               locks[i].start,
+                               locks[i].size,
+                               cb->private_data);
+               }
        }
 
        SAFE_FREE(locks);
@@ -1538,11 +1539,6 @@ int brl_forall(void (*fn)(struct file_id id, struct server_id pid,
 
 static int byte_range_lock_destructor(struct byte_range_lock *br_lck)
 {
-       TDB_DATA key;
-
-       key.dptr = (uint8 *)&br_lck->key;
-       key.dsize = sizeof(struct file_id);
-
        if (br_lck->read_only) {
                SMB_ASSERT(!br_lck->modified);
        }
index dab21e53b3b5366fb73799bd71dff28635ccd8f6..513bb31d9da7b4e34aa24a43a24c4525d7f0e5f8 100644 (file)
@@ -102,7 +102,7 @@ bool is_locked(files_struct *fsp,
                        DEBUG(10,("is_locked: optimisation - level II oplock on file %s\n", fsp->fsp_name ));
                        ret = False;
                } else {
-                       struct byte_range_lock *br_lck = brl_get_locks_readonly(NULL, fsp);
+                       struct byte_range_lock *br_lck = brl_get_locks_readonly(talloc_tos(), fsp);
                        if (!br_lck) {
                                return False;
                        }
@@ -116,7 +116,7 @@ bool is_locked(files_struct *fsp,
                        TALLOC_FREE(br_lck);
                }
        } else {
-               struct byte_range_lock *br_lck = brl_get_locks_readonly(NULL, fsp);
+               struct byte_range_lock *br_lck = brl_get_locks_readonly(talloc_tos(), fsp);
                if (!br_lck) {
                        return False;
                }
@@ -160,7 +160,7 @@ NTSTATUS query_lock(files_struct *fsp,
                return NT_STATUS_OK;
        }
 
-       br_lck = brl_get_locks_readonly(NULL, fsp);
+       br_lck = brl_get_locks_readonly(talloc_tos(), fsp);
        if (!br_lck) {
                return NT_STATUS_NO_MEMORY;
        }
@@ -210,7 +210,7 @@ struct byte_range_lock *do_lock(struct messaging_context *msg_ctx,
                lock_flav_name(lock_flav), lock_type_name(lock_type),
                (double)offset, (double)count, fsp->fnum, fsp->fsp_name ));
 
-       br_lck = brl_get_locks(NULL, fsp);
+       br_lck = brl_get_locks(talloc_tos(), fsp);
        if (!br_lck) {
                *perr = NT_STATUS_NO_MEMORY;
                return NULL;
@@ -269,7 +269,7 @@ NTSTATUS do_unlock(struct messaging_context *msg_ctx,
        DEBUG(10,("do_unlock: unlock start=%.0f len=%.0f requested for fnum %d file %s\n",
                  (double)offset, (double)count, fsp->fnum, fsp->fsp_name ));
 
-       br_lck = brl_get_locks(NULL, fsp);
+       br_lck = brl_get_locks(talloc_tos(), fsp);
        if (!br_lck) {
                return NT_STATUS_NO_MEMORY;
        }
@@ -323,7 +323,7 @@ NTSTATUS do_lock_cancel(files_struct *fsp,
        DEBUG(10,("do_lock_cancel: cancel start=%.0f len=%.0f requested for fnum %d file %s\n",
                  (double)offset, (double)count, fsp->fnum, fsp->fsp_name ));
 
-       br_lck = brl_get_locks(NULL, fsp);
+       br_lck = brl_get_locks(talloc_tos(), fsp);
        if (!br_lck) {
                return NT_STATUS_NO_MEMORY;
        }
@@ -372,7 +372,7 @@ void locking_close_file(struct messaging_context *msg_ctx,
                return;
        }
 
-       br_lck = brl_get_locks(NULL,fsp);
+       br_lck = brl_get_locks(talloc_tos(),fsp);
 
        if (br_lck) {
                cancel_pending_lock_requests_by_fid(fsp, br_lck);
@@ -585,22 +585,14 @@ static bool parse_share_modes(TDB_DATA dbuf, struct share_mode_lock *lck)
        }
 
        /* Save off the associated service path and filename. */
-       lck->servicepath = talloc_strdup(lck, (const char *)dbuf.dptr + sizeof(*data) +
-                                       (lck->num_share_modes *
-                                       sizeof(struct share_mode_entry)) +
-                                       data->u.s.delete_token_size );
-       if (lck->servicepath == NULL) {
-               smb_panic("parse_share_modes: talloc_strdup failed");
-       }
+       lck->servicepath = (const char *)dbuf.dptr + sizeof(*data) +
+               (lck->num_share_modes * sizeof(struct share_mode_entry)) +
+               data->u.s.delete_token_size;
 
-       lck->filename = talloc_strdup(lck, (const char *)dbuf.dptr + sizeof(*data) +
-                                       (lck->num_share_modes *
-                                       sizeof(struct share_mode_entry)) +
-                                       data->u.s.delete_token_size +
-                                       strlen(lck->servicepath) + 1 );
-       if (lck->filename == NULL) {
-               smb_panic("parse_share_modes: talloc_strdup failed");
-       }
+       lck->filename = (const char *)dbuf.dptr + sizeof(*data) +
+               (lck->num_share_modes * sizeof(struct share_mode_entry)) +
+               data->u.s.delete_token_size +
+               strlen(lck->servicepath) + 1;
 
        /*
         * Ensure that each entry has a real process attached.
@@ -608,7 +600,10 @@ static bool parse_share_modes(TDB_DATA dbuf, struct share_mode_lock *lck)
 
        for (i = 0; i < lck->num_share_modes; i++) {
                struct share_mode_entry *entry_p = &lck->share_modes[i];
-               char *str = share_mode_str(NULL, i, entry_p);
+               char *str = NULL;
+               if (DEBUGLEVEL >= 10) {
+                       str = share_mode_str(NULL, i, entry_p);
+               }
                DEBUG(10,("parse_share_modes: %s\n",
                        str ? str : ""));
                if (!process_exists(entry_p->pid)) {
@@ -841,8 +836,6 @@ struct share_mode_lock *fetch_share_mode_unlocked(TALLOC_CTX *mem_ctx,
                return NULL;
        }
 
-       TALLOC_FREE(data.dptr);
-
        return lck;
 }
 
@@ -930,7 +923,7 @@ bool get_delete_on_close_flag(struct file_id id)
        bool result;
        struct share_mode_lock *lck;
   
-       if (!(lck = fetch_share_mode_unlocked(NULL, id, NULL, NULL))) {
+       if (!(lck = fetch_share_mode_unlocked(talloc_tos(), id, NULL, NULL))) {
                return False;
        }
        result = lck->delete_on_close;
@@ -1286,11 +1279,7 @@ static UNIX_USER_TOKEN *copy_unix_token(TALLOC_CTX *ctx, UNIX_USER_TOKEN *tok)
 
 void set_delete_on_close_token(struct share_mode_lock *lck, UNIX_USER_TOKEN *tok)
 {
-       /* Ensure there's no token. */
-       if (lck->delete_token) {
-               TALLOC_FREE(lck->delete_token); /* Also deletes groups... */
-               lck->delete_token = NULL;
-       }
+       TALLOC_FREE(lck->delete_token); /* Also deletes groups... */
 
        /* Copy the new token (can be NULL). */
        lck->delete_token = copy_unix_token(lck, tok);
@@ -1333,7 +1322,7 @@ bool set_delete_on_close(files_struct *fsp, bool delete_on_close, UNIX_USER_TOKE
                return True;
        }
 
-       lck = get_share_mode_lock(NULL, fsp->file_id, NULL, NULL);
+       lck = get_share_mode_lock(talloc_tos(), fsp->file_id, NULL, NULL);
        if (lck == NULL) {
                return False;
        }
index aef5c1784ff3ba3b793bafcc1299abf5124320a6..1b88c472b0ea9492d7342f30ef0154077f8fcfc7 100644 (file)
@@ -188,7 +188,7 @@ static bool posix_fcntl_lock(files_struct *fsp, int op, SMB_OFF_T offset, SMB_OF
 
        DEBUG(8,("posix_fcntl_lock %d %d %.0f %.0f %d\n",fsp->fh->fd,op,(double)offset,(double)count,type));
 
-       ret = SMB_VFS_LOCK(fsp,fsp->fh->fd,op,offset,count,type);
+       ret = SMB_VFS_LOCK(fsp, op, offset, count, type);
 
        if (!ret && ((errno == EFBIG) || (errno == ENOLCK) || (errno ==  EINVAL))) {
 
@@ -212,7 +212,7 @@ static bool posix_fcntl_lock(files_struct *fsp, int op, SMB_OFF_T offset, SMB_OF
                        DEBUG(0,("Count greater than 31 bits - retrying with 31 bit truncated length.\n"));
                        errno = 0;
                        count &= 0x7fffffff;
-                       ret = SMB_VFS_LOCK(fsp,fsp->fh->fd,op,offset,count,type);
+                       ret = SMB_VFS_LOCK(fsp, op, offset, count, type);
                }
        }
 
@@ -233,7 +233,7 @@ static bool posix_fcntl_getlock(files_struct *fsp, SMB_OFF_T *poffset, SMB_OFF_T
        DEBUG(8,("posix_fcntl_getlock %d %.0f %.0f %d\n",
                fsp->fh->fd,(double)*poffset,(double)*pcount,*ptype));
 
-       ret = SMB_VFS_GETLOCK(fsp,fsp->fh->fd,poffset,pcount,ptype,&pid);
+       ret = SMB_VFS_GETLOCK(fsp, poffset, pcount, ptype, &pid);
 
        if (!ret && ((errno == EFBIG) || (errno == ENOLCK) || (errno ==  EINVAL))) {
 
@@ -257,7 +257,7 @@ static bool posix_fcntl_getlock(files_struct *fsp, SMB_OFF_T *poffset, SMB_OFF_T
                        DEBUG(0,("Count greater than 31 bits - retrying with 31 bit truncated length.\n"));
                        errno = 0;
                        *pcount &= 0x7fffffff;
-                       ret = SMB_VFS_GETLOCK(fsp,fsp->fh->fd,poffset,pcount,ptype,&pid);
+                       ret = SMB_VFS_GETLOCK(fsp,poffset,pcount,ptype,&pid);
                }
        }
 
@@ -607,14 +607,14 @@ static size_t get_posix_pending_close_entries(TALLOC_CTX *mem_ctx,
  to delete all locks on this fsp before this function is called.
 ****************************************************************************/
 
-NTSTATUS fd_close_posix(struct connection_struct *conn, files_struct *fsp)
+NTSTATUS fd_close_posix(struct files_struct *fsp)
 {
        int saved_errno = 0;
        int ret;
        int *fd_array = NULL;
        size_t count, i;
 
-       if (!lp_locking(fsp->conn->params) || !lp_posix_locking(conn->params)) {
+       if (!lp_locking(fsp->conn->params) || !lp_posix_locking(fsp->conn->params)) {
                /*
                 * No locking or POSIX to worry about or we want POSIX semantics
                 * which will lose all locks on all fd's open on this dev/inode,
index 300e90fa697c7daa0ccea27a12135c307cd48d3b..590dbac26fe41c42108e4ef6717d7cd45519b116 100644 (file)
 #ifdef HAVE_GPFS
 
 #include "gpfs_gpl.h"
+#include "vfs_gpfs.h"
 
 static void *libgpfs_handle = NULL;
 static bool gpfs_share_modes;
+static bool gpfs_leases;
 
 static int (*gpfs_set_share_fn)(int fd, unsigned int allow, unsigned int deny);
 static int (*gpfs_set_lease_fn)(int fd, unsigned int leaseType);
@@ -42,7 +44,7 @@ bool set_gpfs_sharemode(files_struct *fsp, uint32 access_mask,
        if (!gpfs_share_modes) {
                return True;
        }
-
+       
        if (gpfs_set_share_fn == NULL) {
                return False;
        }
@@ -88,7 +90,7 @@ int set_gpfs_lease(int fd, int leasetype)
 {
        int gpfs_type = GPFS_LEASE_NONE;
 
-       if (!gpfs_share_modes) {
+       if (!gpfs_leases) {
                return True;
        }
 
@@ -103,6 +105,13 @@ int set_gpfs_lease(int fd, int leasetype)
        if (leasetype == F_WRLCK) {
                gpfs_type = GPFS_LEASE_WRITE;
        }
+       
+       /* we unconditionally set CAP_LEASE, rather than looking for
+          -1/EACCES as there is a bug in some versions of
+          libgpfs_gpl.so which results in a leaked fd on /dev/ss0
+          each time we try this with the wrong capabilities set
+       */
+       linux_set_lease_capability();
        return gpfs_set_lease_fn(fd, gpfs_type);
 }
 
@@ -172,11 +181,8 @@ void init_gpfs(void)
                goto failed;
        }
 
-       if (lp_parm_bool(-1, "gpfs", "sharemodes", True)) {
-               gpfs_share_modes = True;
-       } else {
-               gpfs_share_modes = False;
-       }
+       gpfs_share_modes = lp_parm_bool(-1, "gpfs", "sharemodes", True);
+       gpfs_leases      = lp_parm_bool(-1, "gpfs", "leases", True);
 
        return;
 
index edcc52261ca52d4e273dba505530f28512ddcc3d..0c3d010dcde64553487648b50ef23dc6e46d619f 100644 (file)
@@ -20,6 +20,9 @@
 #include "includes.h"
 #include "nfs4_acls.h"
 
+#undef DBGC_CLASS
+#define DBGC_CLASS DBGC_ACLS
+
 #define SMBACL4_PARAM_TYPE_NAME "nfs4"
 
 #define SMB_ACE4_INT_MAGIC 0x76F8A967
@@ -161,24 +164,35 @@ uint32 smb_get_naces(SMB4ACL_T *acl)
        return aclint->naces;
 }
 
-static int smbacl4_GetFileOwner(files_struct *fsp, SMB_STRUCT_STAT *psbuf)
+static int smbacl4_GetFileOwner(struct connection_struct *conn,
+                               const char *filename,
+                               SMB_STRUCT_STAT *psbuf)
 {
        memset(psbuf, 0, sizeof(SMB_STRUCT_STAT));
+
+       /* Get the stat struct for the owner info. */
+       if (SMB_VFS_STAT(conn, filename, psbuf) != 0)
+       {
+               DEBUG(8, ("SMB_VFS_STAT failed with error %s\n",
+                       strerror(errno)));
+               return -1;
+       }
+
+       return 0;
+}
+
+static int smbacl4_fGetFileOwner(files_struct *fsp, SMB_STRUCT_STAT *psbuf)
+{
+       memset(psbuf, 0, sizeof(SMB_STRUCT_STAT));
+
        if (fsp->is_directory || fsp->fh->fd == -1) {
-               /* Get the stat struct for the owner info. */
-               if (SMB_VFS_STAT(fsp->conn,fsp->fsp_name, psbuf) != 0)
-               {
-                       DEBUG(8, ("SMB_VFS_STAT failed with error %s\n",
-                               strerror(errno)));
-                       return -1;
-               }
-       } else {
-               if (SMB_VFS_FSTAT(fsp,fsp->fh->fd, psbuf) != 0)
-               {
-                       DEBUG(8, ("SMB_VFS_FSTAT failed with error %s\n",
-                               strerror(errno)));
-                       return -1;
-               }
+               return smbacl4_GetFileOwner(fsp->conn, fsp->fsp_name, psbuf);
+       }
+       if (SMB_VFS_FSTAT(fsp, psbuf) != 0)
+       {
+               DEBUG(8, ("SMB_VFS_FSTAT failed with error %s\n",
+                       strerror(errno)));
+               return -1;
        }
 
        return 0;
@@ -257,30 +271,24 @@ static bool smbacl4_nfs42win(TALLOC_CTX *mem_ctx, SMB4ACL_T *acl, /* in */
        return True;
 }
 
-NTSTATUS smb_get_nt_acl_nfs4(files_struct *fsp,
+static NTSTATUS smb_get_nt_acl_nfs4_common(const SMB_STRUCT_STAT *sbuf,
        uint32 security_info,
        SEC_DESC **ppdesc, SMB4ACL_T *acl)
 {
        int     good_aces = 0;
-       SMB_STRUCT_STAT sbuf;
        DOM_SID sid_owner, sid_group;
        size_t sd_size = 0;
        SEC_ACE *nt_ace_list = NULL;
        SEC_ACL *psa = NULL;
        TALLOC_CTX *mem_ctx = talloc_tos();
 
-       DEBUG(10, ("smb_get_nt_acl_nfs4 invoked for %s\n", fsp->fsp_name));
-
        if (acl==NULL || smb_get_naces(acl)==0)
                return NT_STATUS_ACCESS_DENIED; /* special because we
                                                 * shouldn't alloc 0 for
                                                 * win */
 
-       if (smbacl4_GetFileOwner(fsp, &sbuf))
-               return map_nt_error_from_unix(errno);
-
-       uid_to_sid(&sid_owner, sbuf.st_uid);
-       gid_to_sid(&sid_group, sbuf.st_gid);
+       uid_to_sid(&sid_owner, sbuf->st_uid);
+       gid_to_sid(&sid_group, sbuf->st_gid);
 
        if (smbacl4_nfs42win(mem_ctx, acl, &sid_owner, &sid_group, &nt_ace_list, &good_aces)==False) {
                DEBUG(8,("smbacl4_nfs42win failed\n"));
@@ -303,12 +311,43 @@ NTSTATUS smb_get_nt_acl_nfs4(files_struct *fsp,
                return NT_STATUS_NO_MEMORY;
        }
 
-       DEBUG(10, ("smb_get_nt_acl_nfs4 successfully exited with sd_size %d\n",
-                  sec_desc_size(*ppdesc)));
+       DEBUG(10, ("smb_get_nt_acl_nfs4_common successfully exited with sd_size %d\n",
+                  ndr_size_security_descriptor(*ppdesc, 0)));
 
        return NT_STATUS_OK;
 }
 
+NTSTATUS smb_fget_nt_acl_nfs4(files_struct *fsp,
+                              uint32 security_info,
+                              SEC_DESC **ppdesc, SMB4ACL_T *acl)
+{
+       SMB_STRUCT_STAT sbuf;
+
+       DEBUG(10, ("smb_fget_nt_acl_nfs4 invoked for %s\n", fsp->fsp_name));
+
+       if (smbacl4_fGetFileOwner(fsp, &sbuf)) {
+               return map_nt_error_from_unix(errno);
+       }
+
+       return smb_get_nt_acl_nfs4_common(&sbuf, security_info, ppdesc, acl);
+}
+
+NTSTATUS smb_get_nt_acl_nfs4(struct connection_struct *conn,
+                             const char *name,
+                             uint32 security_info,
+                             SEC_DESC **ppdesc, SMB4ACL_T *acl)
+{
+       SMB_STRUCT_STAT sbuf;
+
+       DEBUG(10, ("smb_get_nt_acl_nfs4 invoked for %s\n", name));
+
+       if (smbacl4_GetFileOwner(conn, name, &sbuf)) {
+               return map_nt_error_from_unix(errno);
+       }
+
+       return smb_get_nt_acl_nfs4_common(&sbuf, security_info, ppdesc, acl);
+}
+
 enum smbacl4_mode_enum {e_simple=0, e_special=1};
 enum smbacl4_acedup_enum {e_dontcare=0, e_reject=1, e_ignore=2, e_merge=3};
 
@@ -316,6 +355,7 @@ typedef struct _smbacl4_vfs_params {
        enum smbacl4_mode_enum mode;
        bool do_chown;
        enum smbacl4_acedup_enum acedup;
+       struct db_context *sid_mapping_table;
 } smbacl4_vfs_params;
 
 /*
@@ -415,8 +455,65 @@ static SMB_ACE4PROP_T *smbacl4_find_equal_special(
        return NULL;
 }
 
-static int smbacl4_fill_ace4(
+static bool nfs4_map_sid(smbacl4_vfs_params *params, const DOM_SID *src,
+                        DOM_SID *dst)
+{
+       static struct db_context *mapping_db = NULL;
+       TDB_DATA data;
+       
+       if (mapping_db == NULL) {
+               const char *dbname = lp_parm_const_string(
+                       -1, SMBACL4_PARAM_TYPE_NAME, "sidmap", NULL);
+               
+               if (dbname == NULL) {
+                       DEBUG(10, ("%s:sidmap not defined\n",
+                                  SMBACL4_PARAM_TYPE_NAME));
+                       return False;
+               }
+               
+               become_root();
+               mapping_db = db_open(NULL, dbname, 0, TDB_DEFAULT,
+                                    O_RDONLY, 0600);
+               unbecome_root();
+               
+               if (mapping_db == NULL) {
+                       DEBUG(1, ("could not open sidmap: %s\n",
+                                 strerror(errno)));
+                       return False;
+               }
+       }
+       
+       if (mapping_db->fetch(mapping_db, NULL,
+                             string_term_tdb_data(sid_string_tos(src)),
+                             &data) == -1) {
+               DEBUG(10, ("could not find mapping for SID %s\n",
+                          sid_string_dbg(src)));
+               return False;
+       }
+       
+       if ((data.dptr == NULL) || (data.dsize <= 0)
+           || (data.dptr[data.dsize-1] != '\0')) {
+               DEBUG(5, ("invalid mapping for SID %s\n",
+                         sid_string_dbg(src)));
+               TALLOC_FREE(data.dptr);
+               return False;
+       }
+       
+       if (!string_to_sid(dst, (char *)data.dptr)) {
+               DEBUG(1, ("invalid mapping %s for SID %s\n",
+                         (char *)data.dptr, sid_string_dbg(src)));
+               TALLOC_FREE(data.dptr);
+               return False;
+       }
+
+       TALLOC_FREE(data.dptr);
+       
+       return True;
+}
+
+static bool smbacl4_fill_ace4(
        TALLOC_CTX *mem_ctx,
+       const char *filename,
        smbacl4_vfs_params *params,
        uid_t ownerUID,
        gid_t ownerGID,
@@ -424,11 +521,6 @@ static int smbacl4_fill_ace4(
        SMB_ACE4PROP_T *ace_v4 /* output */
 )
 {
-       const char *dom, *name;
-       enum lsa_SidType type;
-       uid_t uid;
-       gid_t gid;
-
        DEBUG(10, ("got ace for %s\n", sid_string_dbg(&ace_nt->trustee)));
 
        memset(ace_v4, 0, sizeof(SMB_ACE4PROP_T));
@@ -449,18 +541,46 @@ static int smbacl4_fill_ace4(
                ace_v4->who.special_id = SMB_ACE4_WHO_EVERYONE;
                ace_v4->flags |= SMB_ACE4_ID_SPECIAL;
        } else {
-               if (!lookup_sid(mem_ctx, &ace_nt->trustee, &dom, &name, &type)) {
-                       DEBUG(8, ("Could not find %s' type\n",
-                                 sid_string_dbg(&ace_nt->trustee)));
-                       errno = EINVAL;
-                       return -1;
+               const char *dom, *name;
+               enum lsa_SidType type;
+               uid_t uid;
+               gid_t gid;
+               DOM_SID sid;
+               
+               sid_copy(&sid, &ace_nt->trustee);
+               
+               if (!lookup_sid(mem_ctx, &sid, &dom, &name, &type)) {
+                       
+                       DOM_SID mapped;
+                       
+                       if (!nfs4_map_sid(params, &sid, &mapped)) {
+                               DEBUG(1, ("nfs4_acls.c: file [%s]: SID %s "
+                                         "unknown\n", filename, sid_string_dbg(&sid)));
+                               errno = EINVAL;
+                               return False;
+                       }
+                       
+                       DEBUG(2, ("nfs4_acls.c: file [%s]: mapped SID %s "
+                                 "to %s\n", filename, sid_string_dbg(&sid), sid_string_dbg(&mapped)));
+                       
+                       if (!lookup_sid(mem_ctx, &mapped, &dom,
+                                       &name, &type)) {
+                               DEBUG(1, ("nfs4_acls.c: file [%s]: SID %s "
+                                         "mapped from %s is unknown\n",
+                                         filename, sid_string_dbg(&mapped), sid_string_dbg(&sid)));
+                               errno = EINVAL;
+                               return False;
+                       }
+                       
+                       sid_copy(&sid, &mapped);
                }
-
+               
                if (type == SID_NAME_USER) {
-                       if (!sid_to_uid(&ace_nt->trustee, &uid)) {
-                               DEBUG(2, ("Could not convert %s to uid\n",
-                                         sid_string_dbg(&ace_nt->trustee)));
-                               return -1;
+                       if (!sid_to_uid(&sid, &uid)) {
+                               DEBUG(1, ("nfs4_acls.c: file [%s]: could not "
+                                         "convert %s to uid\n", filename,
+                                         sid_string_dbg(&sid)));
+                               return False;
                        }
 
                        if (params->mode==e_special && uid==ownerUID) {
@@ -470,11 +590,13 @@ static int smbacl4_fill_ace4(
                                ace_v4->who.uid = uid;
                        }
                } else { /* else group? - TODO check it... */
-                       if (!sid_to_gid(&ace_nt->trustee, &gid)) {
-                               DEBUG(2, ("Could not convert %s to gid\n",
-                                         sid_string_dbg(&ace_nt->trustee)));
-                               return -1;
+                       if (!sid_to_gid(&sid, &gid)) {
+                               DEBUG(1, ("nfs4_acls.c: file [%s]: could not "
+                                         "convert %s to gid\n", filename,
+                                         sid_string_dbg(&sid)));
+                               return False;
                        }
+                               
                        ace_v4->aceFlags |= SMB_ACE4_IDENTIFIER_GROUP;
 
                        if (params->mode==e_special && gid==ownerGID) {
@@ -486,7 +608,7 @@ static int smbacl4_fill_ace4(
                }
        }
 
-       return 0; /* OK */
+       return True; /* OK */
 }
 
 static int smbacl4_MergeIgnoreReject(
@@ -524,6 +646,7 @@ static int smbacl4_MergeIgnoreReject(
 }
 
 static SMB4ACL_T *smbacl4_win2nfs4(
+       const char *filename,
        SEC_ACL *dacl,
        smbacl4_vfs_params *pparams,
        uid_t ownerUID,
@@ -544,9 +667,14 @@ static SMB4ACL_T *smbacl4_win2nfs4(
                SMB_ACE4PROP_T  ace_v4;
                bool    addNewACE = True;
 
-               if (smbacl4_fill_ace4(mem_ctx, pparams, ownerUID, ownerGID,
-                       dacl->aces + i, &ace_v4))
-                       return NULL;
+               if (!smbacl4_fill_ace4(mem_ctx, filename, pparams,
+                                      ownerUID, ownerGID,
+                                      dacl->aces + i, &ace_v4)) {
+                       DEBUG(3, ("Could not fill ace for file %s, SID %s\n",
+                                 filename,
+                                 sid_string_dbg(&((dacl->aces+i)->trustee))));
+                       continue;
+               }
 
                if (pparams->acedup!=e_dontcare) {
                        if (smbacl4_MergeIgnoreReject(pparams->acedup, acl,
@@ -571,6 +699,7 @@ NTSTATUS smb_set_nt_acl_nfs4(files_struct *fsp,
        bool    result;
 
        SMB_STRUCT_STAT sbuf;
+       bool need_chown = False;
        uid_t newUID = (uid_t)-1;
        gid_t newGID = (gid_t)-1;
 
@@ -588,7 +717,7 @@ NTSTATUS smb_set_nt_acl_nfs4(files_struct *fsp,
        if (smbacl4_get_vfs_params(SMBACL4_PARAM_TYPE_NAME, fsp, &params))
                return NT_STATUS_NO_MEMORY;
 
-       if (smbacl4_GetFileOwner(fsp, &sbuf))
+       if (smbacl4_fGetFileOwner(fsp, &sbuf))
                return map_nt_error_from_unix(errno);
 
        if (params.do_chown) {
@@ -599,25 +728,33 @@ NTSTATUS smb_set_nt_acl_nfs4(files_struct *fsp,
                        return status;
                }
                if (((newUID != (uid_t)-1) && (sbuf.st_uid != newUID)) ||
-                               ((newGID != (gid_t)-1) && (sbuf.st_gid != newGID))) {
-                       if(try_chown(fsp->conn, fsp->fsp_name, newUID, newGID)) {
-                               DEBUG(3,("chown %s, %u, %u failed. Error = %s.\n",
-                                       fsp->fsp_name, (unsigned int)newUID, (unsigned int)newGID, strerror(errno) ));
-                               if (errno == EPERM) {
-                                       return NT_STATUS_INVALID_OWNER;
+                   ((newGID != (gid_t)-1) && (sbuf.st_gid != newGID))) {
+                       need_chown = True;
+               }
+               if (need_chown) {
+                       if ((newUID == (uid_t)-1 || newUID == current_user.ut.uid)) {
+                               if(try_chown(fsp->conn, fsp->fsp_name, newUID, newGID)) {
+                                       DEBUG(3,("chown %s, %u, %u failed. Error = %s.\n",
+                                                fsp->fsp_name, (unsigned int)newUID, (unsigned int)newGID, 
+                                                strerror(errno)));
+                                       return map_nt_error_from_unix(errno);
                                }
-                               return map_nt_error_from_unix(errno);
+
+                               DEBUG(10,("chown %s, %u, %u succeeded.\n",
+                                         fsp->fsp_name, (unsigned int)newUID, (unsigned int)newGID));
+                               if (smbacl4_GetFileOwner(fsp->conn, fsp->fsp_name, &sbuf))
+                                       return map_nt_error_from_unix(errno);
+                               need_chown = False;
+                       } else { /* chown is needed, but _after_ changing acl */
+                               sbuf.st_uid = newUID; /* OWNER@ in case of e_special */
+                               sbuf.st_gid = newGID; /* GROUP@ in case of e_special */
                        }
-                       DEBUG(10,("chown %s, %u, %u succeeded.\n",
-                               fsp->fsp_name, (unsigned int)newUID, (unsigned int)newGID));
-                       if (smbacl4_GetFileOwner(fsp, &sbuf))
-                               return map_nt_error_from_unix(errno);
                }
        }
 
        if ((security_info_sent & DACL_SECURITY_INFORMATION)!=0 && psd->dacl!=NULL)
        {
-               acl = smbacl4_win2nfs4(psd->dacl, &params, sbuf.st_uid, sbuf.st_gid);
+               acl = smbacl4_win2nfs4(fsp->fsp_name, psd->dacl, &params, sbuf.st_uid, sbuf.st_gid);
                if (!acl)
                        return map_nt_error_from_unix(errno);
 
@@ -632,6 +769,20 @@ NTSTATUS smb_set_nt_acl_nfs4(files_struct *fsp,
        } else
                DEBUG(10, ("no dacl found; security_info_sent = 0x%x\n", security_info_sent));
 
+       /* Any chown pending? */
+       if (need_chown) {
+               DEBUG(3,("chown#2 %s. uid = %u, gid = %u.\n",
+                        fsp->fsp_name, (unsigned int)newUID, (unsigned int)newGID));
+               if (try_chown(fsp->conn, fsp->fsp_name, newUID, newGID)) {
+                       DEBUG(2,("chown#2 %s, %u, %u failed. Error = %s.\n",
+                                fsp->fsp_name, (unsigned int)newUID, (unsigned int)newGID,
+                                strerror(errno)));
+                       return map_nt_error_from_unix(errno);
+               }
+               DEBUG(10,("chown#2 %s, %u, %u succeeded.\n",
+                         fsp->fsp_name, (unsigned int)newUID, (unsigned int)newGID));
+       }
+
        DEBUG(10, ("smb_set_nt_acl_nfs4 succeeded\n"));
        return NT_STATUS_OK;
 }
index ceb66ec09460a51baf7fb8ae694054e25fb699b6..0f783aa977c7cb43451bdae678ab5c933a57f0e9 100644 (file)
@@ -129,7 +129,12 @@ SMB4ACE_T *smb_next_ace4(SMB4ACE_T *ace);
 
 uint32 smb_get_naces(SMB4ACL_T *acl);
 
-NTSTATUS smb_get_nt_acl_nfs4(files_struct *fsp,
+NTSTATUS smb_fget_nt_acl_nfs4(files_struct *fsp,
+       uint32 security_info,
+       SEC_DESC **ppdesc, SMB4ACL_T *acl);
+
+NTSTATUS smb_get_nt_acl_nfs4(connection_struct *conn,
+       const char *name,
        uint32 security_info,
        SEC_DESC **ppdesc, SMB4ACL_T *acl);
 
index a923ce188ffb75ccdbf9f2677f5d2ab793ad45ff..e35bfabb8c7a8df88b33c4d152c814989b42eabc 100644 (file)
@@ -585,15 +585,14 @@ static uint32 nt_to_afs_file_rights(const char *filename, const SEC_ACE *ace)
        return result;
 }
 
-static size_t afs_to_nt_acl(struct afs_acl *afs_acl, 
-                           struct files_struct *fsp,
-                           uint32 security_info,
-                           struct security_descriptor **ppdesc)
+static size_t afs_to_nt_acl_common(struct afs_acl *afs_acl,
+                                  SMB_STRUCT_STAT *psbuf,
+                                  uint32 security_info,
+                                  struct security_descriptor **ppdesc)
 {
        SEC_ACE *nt_ace_list;
        DOM_SID owner_sid, group_sid;
        SEC_ACCESS mask;
-       SMB_STRUCT_STAT sbuf;
        SEC_ACL *psa = NULL;
        int good_aces;
        size_t sd_size;
@@ -601,19 +600,8 @@ static size_t afs_to_nt_acl(struct afs_acl *afs_acl,
 
        struct afs_ace *afs_ace;
 
-       if (fsp->is_directory || fsp->fh->fd == -1) {
-               /* Get the stat struct for the owner info. */
-               if(SMB_VFS_STAT(fsp->conn,fsp->fsp_name, &sbuf) != 0) {
-                       return 0;
-               }
-       } else {
-               if(SMB_VFS_FSTAT(fsp,fsp->fh->fd,&sbuf) != 0) {
-                       return 0;
-               }
-       }
-
-       uid_to_sid(&owner_sid, sbuf.st_uid);
-       gid_to_sid(&group_sid, sbuf.st_gid);
+       uid_to_sid(&owner_sid, psbuf->st_uid);
+       gid_to_sid(&group_sid, psbuf->st_gid);
 
        if (afs_acl->num_aces) {
                nt_ace_list = TALLOC_ARRAY(mem_ctx, SEC_ACE, afs_acl->num_aces);
@@ -639,7 +627,7 @@ static size_t afs_to_nt_acl(struct afs_acl *afs_acl,
                        continue;
                }
 
-               if (fsp->is_directory)
+               if (S_ISDIR(psbuf->st_mode))
                        afs_to_nt_dir_rights(afs_ace->rights, &nt_rights,
                                             &flag);
                else
@@ -656,7 +644,6 @@ static size_t afs_to_nt_acl(struct afs_acl *afs_acl,
        if (psa == NULL)
                return 0;
 
-       
        *ppdesc = make_sec_desc(mem_ctx, SEC_DESC_REVISION,
                                SEC_DESC_SELF_RELATIVE,
                                (security_info & OWNER_SECURITY_INFORMATION)
@@ -668,6 +655,42 @@ static size_t afs_to_nt_acl(struct afs_acl *afs_acl,
        return sd_size;
 }
 
+static size_t afs_to_nt_acl(struct afs_acl *afs_acl,
+                           struct connection_struct *conn,
+                           const char *name,
+                           uint32 security_info,
+                           struct security_descriptor **ppdesc)
+{
+       SMB_STRUCT_STAT sbuf;
+
+       /* Get the stat struct for the owner info. */
+       if(SMB_VFS_STAT(conn, name, &sbuf) != 0) {
+               return 0;
+       }
+
+       return afs_to_nt_acl_common(afs_acl, &sbuf, security_info, ppdesc);
+}
+
+static size_t afs_fto_nt_acl(struct afs_acl *afs_acl,
+                            struct files_struct *fsp,
+                            uint32 security_info,
+                            struct security_descriptor **ppdesc)
+{
+       SMB_STRUCT_STAT sbuf;
+
+       if (fsp->is_directory || fsp->fh->fd == -1) {
+               /* Get the stat struct for the owner info. */
+               return afs_to_nt_acl(afs_acl, fsp->conn, fsp->fsp_name,
+                                    security_info, ppdesc);
+       }
+
+       if(SMB_VFS_FSTAT(fsp, &sbuf) != 0) {
+               return 0;
+       }
+
+       return afs_to_nt_acl_common(afs_acl, &sbuf, security_info, ppdesc);
+}
+
 static bool mappable_sid(const DOM_SID *sid)
 {
        DOM_SID domain_sid;
@@ -830,27 +853,6 @@ static bool afs_get_afs_acl(char *filename, struct afs_acl *acl)
        return True;
 }
 
-static NTSTATUS afs_get_nt_acl(struct files_struct *fsp, uint32 security_info,
-                              struct security_descriptor **ppdesc)
-{
-       struct afs_acl acl;
-       size_t sd_size;
-
-       DEBUG(5, ("afs_get_nt_acl: %s\n", fsp->fsp_name));
-
-       sidpts = lp_parm_bool(SNUM(fsp->conn), "afsacl", "sidpts", False);
-
-       if (!afs_get_afs_acl(fsp->fsp_name, &acl)) {
-               return NT_STATUS_ACCESS_DENIED;
-       }
-
-       sd_size = afs_to_nt_acl(&acl, fsp, security_info, ppdesc);
-
-       free_afs_acl(&acl);
-
-       return (sd_size != 0) ? NT_STATUS_OK : NT_STATUS_ACCESS_DENIED;
-}
-
 /* For setting an AFS ACL we have to take care of the ACEs we could
  * not properly map to SIDs. Merge all of them into the new ACL. */
 
@@ -991,22 +993,53 @@ static NTSTATUS afs_set_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
 
 static NTSTATUS afsacl_fget_nt_acl(struct vfs_handle_struct *handle,
                                   struct files_struct *fsp,
-                                  int fd,  uint32 security_info,
+                                  uint32 security_info,
                                   struct security_descriptor **ppdesc)
 {
-       return afs_get_nt_acl(fsp, security_info, ppdesc);
+       struct afs_acl acl;
+       size_t sd_size;
+
+       DEBUG(5, ("afsacl_fget_nt_acl: %s\n", fsp->fsp_name));
+
+       sidpts = lp_parm_bool(SNUM(fsp->conn), "afsacl", "sidpts", False);
+
+       if (!afs_get_afs_acl(fsp->fsp_name, &acl)) {
+               return NT_STATUS_ACCESS_DENIED;
+       }
+
+       sd_size = afs_fto_nt_acl(&acl, fsp, security_info, ppdesc);
+
+       free_afs_acl(&acl);
+
+       return (sd_size != 0) ? NT_STATUS_OK : NT_STATUS_ACCESS_DENIED;
 }
+
 static NTSTATUS afsacl_get_nt_acl(struct vfs_handle_struct *handle,
-                                 struct files_struct *fsp,
                                  const char *name,  uint32 security_info,
                                  struct security_descriptor **ppdesc)
 {
-       return afs_get_nt_acl(fsp, security_info, ppdesc);
+       struct afs_acl acl;
+       size_t sd_size;
+
+       DEBUG(5, ("afsacl_get_nt_acl: %s\n", name));
+
+       sidpts = lp_parm_bool(SNUM(handle->conn), "afsacl", "sidpts", False);
+
+       if (!afs_get_afs_acl(name, &acl)) {
+               return NT_STATUS_ACCESS_DENIED;
+       }
+
+       sd_size = afs_to_nt_acl(&acl, handle->conn, name, security_info,
+                               ppdesc);
+
+       free_afs_acl(&acl);
+
+       return (sd_size != 0) ? NT_STATUS_OK : NT_STATUS_ACCESS_DENIED;
 }
 
 NTSTATUS afsacl_fset_nt_acl(vfs_handle_struct *handle,
                         files_struct *fsp,
-                        int fd, uint32 security_info_sent,
+                        uint32 security_info_sent,
                         SEC_DESC *psd)
 {
        return afs_set_nt_acl(handle, fsp, security_info_sent, psd);
index a60470ffc9528537f98c91c0b7e51ff1cc95e747..726a7f485e84e7218d93f153d431c182b68f2fb8 100644 (file)
@@ -80,8 +80,7 @@ SMB_ACL_T aixacl_sys_acl_get_file(vfs_handle_struct *handle,
 }
 
 SMB_ACL_T aixacl_sys_acl_get_fd(vfs_handle_struct *handle,
-                                 files_struct *fsp,
-                                 int fd)
+                               files_struct *fsp)
 {
 
        struct acl *file_acl = (struct acl *)NULL;
@@ -93,7 +92,7 @@ SMB_ACL_T aixacl_sys_acl_get_fd(vfs_handle_struct *handle,
        /* Get the acl using fstatacl */
    
        DEBUG(10,("Entering AIX sys_acl_get_fd\n"));
-       DEBUG(10,("fd is %d\n",fd));
+       DEBUG(10,("fd is %d\n",fsp->fh->fd));
        file_acl = (struct acl *)SMB_MALLOC(BUFSIZ);
 
        if(file_acl == NULL) {
@@ -104,7 +103,7 @@ SMB_ACL_T aixacl_sys_acl_get_fd(vfs_handle_struct *handle,
 
        memset(file_acl,0,BUFSIZ);
 
-       rc = fstatacl(fd,0,file_acl,BUFSIZ);
+       rc = fstatacl(fsp->fh->fd,0,file_acl,BUFSIZ);
        if( (rc == -1) && (errno == ENOSPC)) {
                struct acl *new_acl = SMB_MALLOC(file_acl->acl_len + sizeof(struct acl));
                if( new_acl == NULL) {
@@ -113,7 +112,7 @@ SMB_ACL_T aixacl_sys_acl_get_fd(vfs_handle_struct *handle,
                        return NULL;
                }
                file_acl = new_acl;
-               rc = fstatacl(fd,0,file_acl,file_acl->acl_len + sizeof(struct acl));
+               rc = fstatacl(fsp->fh->fd,0,file_acl,file_acl->acl_len + sizeof(struct acl));
                if( rc == -1) {
                        DEBUG(0,("fstatacl returned %d with errno %d\n",rc,errno));
                        SAFE_FREE(file_acl);
@@ -154,7 +153,7 @@ int aixacl_sys_acl_set_file(vfs_handle_struct *handle,
 
 int aixacl_sys_acl_set_fd(vfs_handle_struct *handle,
                            files_struct *fsp,
-                           int fd, SMB_ACL_T theacl)
+                           SMB_ACL_T theacl)
 {
        struct acl *file_acl = NULL;
        unsigned int rc;
@@ -163,7 +162,7 @@ int aixacl_sys_acl_set_fd(vfs_handle_struct *handle,
        if (!file_acl)
                return -1;
 
-       rc = fchacl(fd,file_acl,file_acl->acl_len);
+       rc = fchacl(fsp->fh->fd,file_acl,file_acl->acl_len);
        DEBUG(10,("errno is %d\n",errno));
        DEBUG(10,("return code is %d\n",rc));
        SAFE_FREE(file_acl);
index 756977df4f3d8bcfbbc474edf3808b20108d4043..996adbbdfe3b2c185776b7ad1da5a5987fc9ce6e 100644 (file)
@@ -98,7 +98,7 @@ static AIXJFS2_ACL_T *aixjfs2_getacl_alloc(const char *fname, acl_type_t *type)
        return acl;
 }
 
-static bool aixjfs2_get_nfs4_acl(files_struct *fsp,
+static bool aixjfs2_get_nfs4_acl(const char *name,
        SMB4ACL_T **ppacl, bool *pretryPosix)
 {
        int32_t i;
@@ -108,15 +108,15 @@ static bool aixjfs2_get_nfs4_acl(files_struct *fsp,
        nfs4_ace_int_t *jfs2_ace = NULL;
        acl_type_t type;
 
-       DEBUG(10,("jfs2 get_nt_acl invoked for %s\n", fsp->fsp_name));
+       DEBUG(10,("jfs2 get_nt_acl invoked for %s\n", name));
 
        memset(&type, 0, sizeof(acl_type_t));
        type.u64 = ACL_NFS4;
 
-       pacl = aixjfs2_getacl_alloc(fsp->fsp_name, &type);
+       pacl = aixjfs2_getacl_alloc(name, &type);
         if (pacl == NULL) {
                DEBUG(9, ("aixjfs2_getacl_alloc failed for %s with %s\n",
-                               fsp->fsp_name, strerror(errno)));
+                               name, strerror(errno)));
                if (errno==ENOSYS)
                        *pretryPosix = True;
                return False;
@@ -158,38 +158,48 @@ static bool aixjfs2_get_nfs4_acl(files_struct *fsp,
        return True;
 }
 
-static NTSTATUS aixjfs2_get_nt_acl_common(files_struct *fsp,
-       uint32 security_info, SEC_DESC **ppdesc)
+static NTSTATUS aixjfs2_fget_nt_acl(vfs_handle_struct *handle,
+       files_struct *fsp, uint32 security_info,
+       SEC_DESC **ppdesc)
 {
        SMB4ACL_T *pacl = NULL;
        bool    result;
        bool    retryPosix = False;
 
        *ppdesc = NULL;
-       result = aixjfs2_get_nfs4_acl(fsp, &pacl, &retryPosix);
+       result = aixjfs2_get_nfs4_acl(fsp->fsp_name, &pacl, &retryPosix);
        if (retryPosix)
        {
                DEBUG(10, ("retrying with posix acl...\n"));
-               return get_nt_acl(fsp, security_info, ppdesc);
+               return posix_fget_nt_acl(fsp, security_info, ppdesc);
        }
        if (result==False)
                return NT_STATUS_ACCESS_DENIED;
 
-       return smb_get_nt_acl_nfs4(fsp, security_info, ppdesc, pacl);
+       return smb_fget_nt_acl_nfs4(fsp, security_info, ppdesc, pacl);
 }
 
-NTSTATUS aixjfs2_fget_nt_acl(vfs_handle_struct *handle,
-       files_struct *fsp, int fd, uint32 security_info,
-       SEC_DESC **ppdesc)
-{
-       return aixjfs2_get_nt_acl_common(fsp, security_info, ppdesc);
-}
-
-NTSTATUS aixjfs2_get_nt_acl(vfs_handle_struct *handle,
+static NTSTATUS aixjfs2_get_nt_acl(vfs_handle_struct *handle,
        files_struct *fsp, const char *name,
        uint32 security_info, SEC_DESC **ppdesc)
 {
-       return aixjfs2_get_nt_acl_common(fsp, security_info, ppdesc);
+       SMB4ACL_T *pacl = NULL;
+       bool    result;
+       bool    retryPosix = False;
+
+       *ppdesc = NULL;
+       result = aixjfs2_get_nfs4_acl(name, &pacl, &retryPosix);
+       if (retryPosix)
+       {
+               DEBUG(10, ("retrying with posix acl...\n"));
+               return posix_get_nt_acl(handle->conn, name security_info,
+                                       ppdesc);
+       }
+       if (result==False)
+               return NT_STATUS_ACCESS_DENIED;
+
+       return smb_get_nt_acl_nfs4(handle->conn, name, security_info, ppdesc,
+                                  pacl);
 }
 
 static SMB_ACL_T aixjfs2_get_posix_acl(const char *path, acl_type_t type)
@@ -248,8 +258,7 @@ SMB_ACL_T aixjfs2_sys_acl_get_file(vfs_handle_struct *handle,
 }
 
 SMB_ACL_T aixjfs2_sys_acl_get_fd(vfs_handle_struct *handle,
-                                  files_struct *fsp,
-                                  int fd)
+                                  files_struct *fsp)
 {
         acl_type_t aixjfs2_type;
         aixjfs2_type.u64 = ACL_AIXC;
@@ -389,7 +398,7 @@ static NTSTATUS aixjfs2_set_nt_acl_common(files_struct *fsp, uint32 security_inf
        return result;
 }
 
-NTSTATUS aixjfs2_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, int fd, uint32 security_info_sent, SEC_DESC *psd)
+NTSTATUS aixjfs2_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, uint32 security_info_sent, SEC_DESC *psd)
 {
        return aixjfs2_set_nt_acl_common(fsp, security_info_sent, psd);
 }
@@ -439,7 +448,7 @@ int aixjfs2_sys_acl_set_file(vfs_handle_struct *handle,
 
 int aixjfs2_sys_acl_set_fd(vfs_handle_struct *handle,
                            files_struct *fsp,
-                           int fd, SMB_ACL_T theacl)
+                           SMB_ACL_T theacl)
 {
        struct acl      *acl_aixc;
        acl_type_t      acl_type_info;
@@ -458,7 +467,7 @@ int aixjfs2_sys_acl_set_fd(vfs_handle_struct *handle,
                return -1;
 
        rc = aclx_fput(
-               fd,
+               fsp->fh->fd,
                SET_ACL, /* set only the ACL, not mode bits */
                acl_type_info,
                acl_aixc,
index 91993a47d72119b1382f318c153469e63b0bd6e1..a63bf4f67261e50ed551c439ec4748d98ada45d2 100644 (file)
@@ -39,8 +39,8 @@ static int audit_rename(vfs_handle_struct *handle, const char *oldname, const ch
 static int audit_unlink(vfs_handle_struct *handle, const char *path);
 static int audit_chmod(vfs_handle_struct *handle, const char *path, mode_t mode);
 static int audit_chmod_acl(vfs_handle_struct *handle, const char *name, mode_t mode);
-static int audit_fchmod(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode);
-static int audit_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode);
+static int audit_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t mode);
+static int audit_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, mode_t mode);
 
 /* VFS operations */
 
@@ -268,11 +268,11 @@ static int audit_chmod_acl(vfs_handle_struct *handle, const char *path, mode_t m
        return result;
 }
 
-static int audit_fchmod(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode)
+static int audit_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t mode)
 {
        int result;
 
-       result = SMB_VFS_NEXT_FCHMOD(handle, fsp, fd, mode);
+       result = SMB_VFS_NEXT_FCHMOD(handle, fsp, mode);
 
        syslog(audit_syslog_priority(handle), "fchmod %s mode 0x%x %s%s\n",
               fsp->fsp_name, mode,
@@ -282,11 +282,11 @@ static int audit_fchmod(vfs_handle_struct *handle, files_struct *fsp, int fd, mo
        return result;
 }
 
-static int audit_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode)
+static int audit_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, mode_t mode)
 {
        int result;
 
-       result = SMB_VFS_NEXT_FCHMOD_ACL(handle, fsp, fd, mode);
+       result = SMB_VFS_NEXT_FCHMOD_ACL(handle, fsp, mode);
 
        syslog(audit_syslog_priority(handle), "fchmod_acl %s mode 0x%x %s%s\n",
               fsp->fsp_name, mode,
index 9574087d9d3a5307fb413d0d176d339198c3effd..be934f6bd602c0db70e28ddc2bad24c2fad88abd 100644 (file)
@@ -48,7 +48,6 @@ static void * g_readbuf = NULL;
 static bool prime_cache(
             struct vfs_handle_struct *  handle,
                        files_struct *                  fsp,
-                       int                                     fd,
                        SMB_OFF_T                           offset,
                        size_t                              count)
 {
@@ -75,7 +74,7 @@ static bool prime_cache(
             MODULE, (long long)g_readsz, (long long)*last,
             fsp->fsp_name));
 
-        nread = sys_pread(fd, g_readbuf, g_readsz, *last);
+        nread = sys_pread(fsp->fh->fd, g_readbuf, g_readsz, *last);
         if (nread < 0) {
             *last = -1;
             return False;
@@ -125,51 +124,48 @@ static int cprime_connect(
 static ssize_t cprime_sendfile(
                 struct vfs_handle_struct *  handle,
                 int                         tofd,
-                files_struct *              fsp,
-                int                         fromfd,
+                files_struct *              fromfsp,
                 const DATA_BLOB *           header,
                 SMB_OFF_T                   offset,
                 size_t                      count)
 {
         if (g_readbuf && offset == 0) {
-                prime_cache(handle, fsp, fromfd, offset, count);
+                prime_cache(handle, fromfsp, offset, count);
         }
 
-        return SMB_VFS_NEXT_SENDFILE(handle, tofd, fsp, fromfd,
+        return SMB_VFS_NEXT_SENDFILE(handle, tofd, fromfsp,
                                      header, offset, count);
 }
 
 static ssize_t cprime_read(
                 vfs_handle_struct * handle,
                 files_struct *      fsp,
-                int                 fd,
                 void *              data,
                 size_t              count)
 {
         SMB_OFF_T offset;
 
-        offset = SMB_VFS_LSEEK(fsp, fd, 0, SEEK_CUR);
+        offset = SMB_VFS_LSEEK(fsp, 0, SEEK_CUR);
         if (offset >= 0 && g_readbuf)  {
-                prime_cache(handle, fsp, fd, offset, count);
-                SMB_VFS_LSEEK(fsp, fd, offset, SEEK_SET);
+                prime_cache(handle, fsp, offset, count);
+                SMB_VFS_LSEEK(fsp, offset, SEEK_SET);
         }
 
-        return SMB_VFS_NEXT_READ(handle, fsp, fd, data, count);
+        return SMB_VFS_NEXT_READ(handle, fsp, data, count);
 }
 
 static ssize_t cprime_pread(
                 vfs_handle_struct * handle,
                 files_struct *      fsp,
-                int                 fd,
                 void *              data,
                        size_t              count,
                 SMB_OFF_T           offset)
 {
         if (g_readbuf) {
-                prime_cache(handle, fsp, fd, offset, count);
+                prime_cache(handle, fsp, offset, count);
         }
 
-        return SMB_VFS_NEXT_PREAD(handle, fsp, fd, data, count, offset);
+        return SMB_VFS_NEXT_PREAD(handle, fsp, data, count, offset);
 }
 
 static vfs_op_tuple cprime_ops [] =
index f99891cb329ee62687d71003622f2ebc1f6494ee..2f2d6a718264aca27aacccf7f173125663a17e53 100644 (file)
@@ -363,7 +363,7 @@ size)
         return SMB_VFS_NEXT_LGETXATTR(handle, cappath, capname, value, size);
 }
 
-static ssize_t cap_fgetxattr(vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *path, void *value, size_t size)
+static ssize_t cap_fgetxattr(vfs_handle_struct *handle, struct files_struct *fsp, const char *path, void *value, size_t size)
 {
        char *cappath = capencode(talloc_tos(), path);
 
@@ -371,7 +371,7 @@ static ssize_t cap_fgetxattr(vfs_handle_struct *handle, struct files_struct *fsp
                errno = ENOMEM;
                return -1;
        }
-        return SMB_VFS_NEXT_FGETXATTR(handle, fsp, fd, cappath, value, size);
+        return SMB_VFS_NEXT_FGETXATTR(handle, fsp, cappath, value, size);
 }
 
 static ssize_t cap_listxattr(vfs_handle_struct *handle, const char *path, char *list, size_t size)
@@ -420,7 +420,7 @@ static int cap_lremovexattr(vfs_handle_struct *handle, const char *path, const c
         return SMB_VFS_NEXT_LREMOVEXATTR(handle, cappath, capname);
 }
 
-static int cap_fremovexattr(vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *path)
+static int cap_fremovexattr(vfs_handle_struct *handle, struct files_struct *fsp, const char *path)
 {
        char *cappath = capencode(talloc_tos(), path);
 
@@ -428,7 +428,7 @@ static int cap_fremovexattr(vfs_handle_struct *handle, struct files_struct *fsp,
                errno = ENOMEM;
                return -1;
        }
-        return SMB_VFS_NEXT_FREMOVEXATTR(handle, fsp, fd, cappath);
+        return SMB_VFS_NEXT_FREMOVEXATTR(handle, fsp, cappath);
 }
 
 static int cap_setxattr(vfs_handle_struct *handle, const char *path, const char *name, const void *value, size_t size, int flags)
@@ -455,7 +455,7 @@ static int cap_lsetxattr(vfs_handle_struct *handle, const char *path, const char
         return SMB_VFS_NEXT_LSETXATTR(handle, cappath, capname, value, size, flags);
 }
 
-static int cap_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *path, const void *value, size_t size, int flags)
+static int cap_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp, const char *path, const void *value, size_t size, int flags)
 {
        char *cappath = capencode(talloc_tos(), path);
 
@@ -463,7 +463,7 @@ static int cap_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp,int
                errno = ENOMEM;
                return -1;
        }
-        return SMB_VFS_NEXT_FSETXATTR(handle, fsp, fd, cappath, value, size, flags);
+        return SMB_VFS_NEXT_FSETXATTR(handle, fsp, cappath, value, size, flags);
 }
 
 /* VFS operations structure */
index 71f478a8a9a6aaa7c1e32e6ab88588db4e8d4872..ab48c963ec4fdc9122ac9a5669993875f73a8eb6 100644 (file)
@@ -290,8 +290,7 @@ static NTSTATUS catia_get_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
                               const char *name, uint32 security_info,
                               struct  security_descriptor **ppdesc)
 {
-        return SMB_VFS_NEXT_GET_NT_ACL(handle, fsp, name, security_info,
-                                      ppdesc);
+        return SMB_VFS_NEXT_GET_NT_ACL(handle, name, security_info, ppdesc);
 }
 
 static NTSTATUS catia_set_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
index d7d81924f1864e0b2003333dd84fa48ac3af3caf..ac391cf00780f8461dc1bf7541063f3ef48166f1 100644 (file)
@@ -217,7 +217,7 @@ static int commit_open(
         /* EOF commit modes require us to know the initial file size. */
         if (c && (c->on_eof != EOF_NONE)) {
                 SMB_STRUCT_STAT st;
-                if (SMB_VFS_FSTAT(fsp, fd, &st) == -1) {
+                if (SMB_VFS_FSTAT(fsp, &st) == -1) {
                         return -1;
                 }
                c->eof = st.st_size;
@@ -229,12 +229,11 @@ static int commit_open(
 static ssize_t commit_write(
         vfs_handle_struct * handle,
         files_struct *      fsp,
-        int                 fd,
         void *              data,
         size_t              count)
 {
         ssize_t ret;
-        ret = SMB_VFS_NEXT_WRITE(handle, fsp, fd, data, count);
+        ret = SMB_VFS_NEXT_WRITE(handle, fsp, data, count);
 
         if (ret > 0) {
                 if (commit(handle, fsp, fsp->fh->pos, ret) == -1) {
@@ -248,14 +247,13 @@ static ssize_t commit_write(
 static ssize_t commit_pwrite(
         vfs_handle_struct * handle,
         files_struct *      fsp,
-        int                 fd,
         void *              data,
         size_t              count,
        SMB_OFF_T           offset)
 {
         ssize_t ret;
 
-        ret = SMB_VFS_NEXT_PWRITE(handle, fsp, fd, data, count, offset);
+        ret = SMB_VFS_NEXT_PWRITE(handle, fsp, data, count, offset);
         if (ret > 0) {
                 if (commit(handle, fsp, offset, ret) == -1) {
                         return -1;
@@ -278,12 +276,11 @@ static int commit_close(
 static int commit_ftruncate(
         vfs_handle_struct * handle,
         files_struct *      fsp,
-        int                 fd,
         SMB_OFF_T           len)
 {
         int result;
 
-        result = SMB_VFS_NEXT_FTRUNCATE(handle, fsp, fd, len);
+        result = SMB_VFS_NEXT_FTRUNCATE(handle, fsp, len);
         if (result == 0) {
                struct commit_info *c;
                if ((c = VFS_FETCH_FSP_EXTENSION(handle, fsp))) {
index cce5430493ebae97c729fa0c33057d168508c03e..cf135dfd0302c68ff26d2306e06a65163b3dada4 100644 (file)
@@ -90,6 +90,17 @@ static int vfswrap_statvfs(struct vfs_handle_struct *handle,  const char *path,
        return sys_statvfs(path, statbuf);
 }
 
+static uint32_t vfswrap_fs_capabilities(struct vfs_handle_struct *handle)
+{
+#if defined(DARWINOS)
+       struct vfs_statvfs_struct statbuf;
+       ZERO_STRUCT(statbuf);
+       sys_statvfs(handle->conn->connectpath, &statbuf);
+       return statbuf.FsCapabilities;
+#endif
+       return FILE_CASE_SENSITIVE_SEARCH | FILE_CASE_PRESERVED_NAMES;
+}
+
 /* Directory operations */
 
 static SMB_STRUCT_DIR *vfswrap_opendir(vfs_handle_struct *handle,  const char *fname, const char *mask, uint32 attr)
@@ -208,29 +219,29 @@ static int vfswrap_close(vfs_handle_struct *handle, files_struct *fsp, int fd)
        return result;
 }
 
-static ssize_t vfswrap_read(vfs_handle_struct *handle, files_struct *fsp, int fd, void *data, size_t n)
+static ssize_t vfswrap_read(vfs_handle_struct *handle, files_struct *fsp, void *data, size_t n)
 {
        ssize_t result;
 
        START_PROFILE_BYTES(syscall_read, n);
-       result = sys_read(fd, data, n);
+       result = sys_read(fsp->fh->fd, data, n);
        END_PROFILE(syscall_read);
        return result;
 }
 
-static ssize_t vfswrap_pread(vfs_handle_struct *handle, files_struct *fsp, int fd, void *data,
+static ssize_t vfswrap_pread(vfs_handle_struct *handle, files_struct *fsp, void *data,
                        size_t n, SMB_OFF_T offset)
 {
        ssize_t result;
 
 #if defined(HAVE_PREAD) || defined(HAVE_PREAD64)
        START_PROFILE_BYTES(syscall_pread, n);
-       result = sys_pread(fd, data, n, offset);
+       result = sys_pread(fsp->fh->fd, data, n, offset);
        END_PROFILE(syscall_pread);
 
        if (result == -1 && errno == ESPIPE) {
                /* Maintain the fiction that pipes can be seeked (sought?) on. */
-               result = SMB_VFS_READ(fsp, fd, data, n);
+               result = SMB_VFS_READ(fsp, data, n);
                fsp->fh->pos = 0;
        }
 
@@ -238,23 +249,23 @@ static ssize_t vfswrap_pread(vfs_handle_struct *handle, files_struct *fsp, int f
        SMB_OFF_T   curr;
        int lerrno;
 
-       curr = SMB_VFS_LSEEK(fsp, fd, 0, SEEK_CUR);
+       curr = SMB_VFS_LSEEK(fsp, 0, SEEK_CUR);
        if (curr == -1 && errno == ESPIPE) {
                /* Maintain the fiction that pipes can be seeked (sought?) on. */
-               result = SMB_VFS_READ(fsp, fd, data, n);
+               result = SMB_VFS_READ(fsp, data, n);
                fsp->fh->pos = 0;
                return result;
        }
 
-       if (SMB_VFS_LSEEK(fsp, fd, offset, SEEK_SET) == -1) {
+       if (SMB_VFS_LSEEK(fsp, offset, SEEK_SET) == -1) {
                return -1;
        }
 
        errno = 0;
-       result = SMB_VFS_READ(fsp, fd, data, n);
+       result = SMB_VFS_READ(fsp, data, n);
        lerrno = errno;
 
-       SMB_VFS_LSEEK(fsp, fd, curr, SEEK_SET);
+       SMB_VFS_LSEEK(fsp, curr, SEEK_SET);
        errno = lerrno;
 
 #endif /* HAVE_PREAD */
@@ -262,48 +273,48 @@ static ssize_t vfswrap_pread(vfs_handle_struct *handle, files_struct *fsp, int f
        return result;
 }
 
-static ssize_t vfswrap_write(vfs_handle_struct *handle, files_struct *fsp, int fd, const void *data, size_t n)
+static ssize_t vfswrap_write(vfs_handle_struct *handle, files_struct *fsp, const void *data, size_t n)
 {
        ssize_t result;
 
        START_PROFILE_BYTES(syscall_write, n);
-       result = sys_write(fd, data, n);
+       result = sys_write(fsp->fh->fd, data, n);
        END_PROFILE(syscall_write);
        return result;
 }
 
-static ssize_t vfswrap_pwrite(vfs_handle_struct *handle, files_struct *fsp, int fd, const void *data,
+static ssize_t vfswrap_pwrite(vfs_handle_struct *handle, files_struct *fsp, const void *data,
                        size_t n, SMB_OFF_T offset)
 {
        ssize_t result;
 
 #if defined(HAVE_PWRITE) || defined(HAVE_PRWITE64)
        START_PROFILE_BYTES(syscall_pwrite, n);
-       result = sys_pwrite(fd, data, n, offset);
+       result = sys_pwrite(fsp->fh->fd, data, n, offset);
        END_PROFILE(syscall_pwrite);
 
        if (result == -1 && errno == ESPIPE) {
                /* Maintain the fiction that pipes can be sought on. */
-               result = SMB_VFS_WRITE(fsp, fd, data, n);
+               result = SMB_VFS_WRITE(fsp, data, n);
        }
 
 #else /* HAVE_PWRITE */
        SMB_OFF_T   curr;
        int         lerrno;
 
-       curr = SMB_VFS_LSEEK(fsp, fd, 0, SEEK_CUR);
+       curr = SMB_VFS_LSEEK(fsp, 0, SEEK_CUR);
        if (curr == -1) {
                return -1;
        }
 
-       if (SMB_VFS_LSEEK(fsp, fd, offset, SEEK_SET) == -1) {
+       if (SMB_VFS_LSEEK(fsp, offset, SEEK_SET) == -1) {
                return -1;
        }
 
-       result = SMB_VFS_WRITE(fsp, fd, data, n);
+       result = SMB_VFS_WRITE(fsp, data, n);
        lerrno = errno;
 
-       SMB_VFS_LSEEK(fsp, fd, curr, SEEK_SET);
+       SMB_VFS_LSEEK(fsp, curr, SEEK_SET);
        errno = lerrno;
 
 #endif /* HAVE_PWRITE */
@@ -311,15 +322,15 @@ static ssize_t vfswrap_pwrite(vfs_handle_struct *handle, files_struct *fsp, int
        return result;
 }
 
-static SMB_OFF_T vfswrap_lseek(vfs_handle_struct *handle, files_struct *fsp, int filedes, SMB_OFF_T offset, int whence)
+static SMB_OFF_T vfswrap_lseek(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_T offset, int whence)
 {
        SMB_OFF_T result = 0;
 
        START_PROFILE(syscall_lseek);
 
        /* Cope with 'stat' file opens. */
-       if (filedes != -1)
-               result = sys_lseek(filedes, offset, whence);
+       if (fsp->fh->fd != -1)
+               result = sys_lseek(fsp->fh->fd, offset, whence);
 
        /*
         * We want to maintain the fiction that we can seek
@@ -337,28 +348,27 @@ static SMB_OFF_T vfswrap_lseek(vfs_handle_struct *handle, files_struct *fsp, int
        return result;
 }
 
-static ssize_t vfswrap_sendfile(vfs_handle_struct *handle, int tofd, files_struct *fsp, int fromfd, const DATA_BLOB *hdr,
+static ssize_t vfswrap_sendfile(vfs_handle_struct *handle, int tofd, files_struct *fromfsp, const DATA_BLOB *hdr,
                        SMB_OFF_T offset, size_t n)
 {
        ssize_t result;
 
        START_PROFILE_BYTES(syscall_sendfile, n);
-       result = sys_sendfile(tofd, fromfd, hdr, offset, n);
+       result = sys_sendfile(tofd, fromfsp->fh->fd, hdr, offset, n);
        END_PROFILE(syscall_sendfile);
        return result;
 }
 
 static ssize_t vfswrap_recvfile(vfs_handle_struct *handle,
                        int fromfd,
-                       files_struct *fsp,
-                       int tofd,
+                       files_struct *tofsp,
                        SMB_OFF_T offset,
                        size_t n)
 {
        ssize_t result;
 
        START_PROFILE_BYTES(syscall_recvfile, n);
-       result = sys_recvfile(fromfd, tofd, offset, n);
+       result = sys_recvfile(fromfd, tofsp->fh->fd, offset, n);
        END_PROFILE(syscall_recvfile);
        return result;
 }
@@ -467,13 +477,13 @@ static int vfswrap_rename(vfs_handle_struct *handle,  const char *oldname, const
        return result;
 }
 
-static int vfswrap_fsync(vfs_handle_struct *handle, files_struct *fsp, int fd)
+static int vfswrap_fsync(vfs_handle_struct *handle, files_struct *fsp)
 {
 #ifdef HAVE_FSYNC
        int result;
 
        START_PROFILE(syscall_fsync);
-       result = fsync(fd);
+       result = fsync(fsp->fh->fd);
        END_PROFILE(syscall_fsync);
        return result;
 #else
@@ -491,12 +501,12 @@ static int vfswrap_stat(vfs_handle_struct *handle,  const char *fname, SMB_STRUC
        return result;
 }
 
-static int vfswrap_fstat(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_STRUCT_STAT *sbuf)
+static int vfswrap_fstat(vfs_handle_struct *handle, files_struct *fsp, SMB_STRUCT_STAT *sbuf)
 {
        int result;
 
        START_PROFILE(syscall_fstat);
-       result = sys_fstat(fd, sbuf);
+       result = sys_fstat(fsp->fh->fd, sbuf);
        END_PROFILE(syscall_fstat);
        return result;
 }
@@ -549,7 +559,7 @@ static int vfswrap_chmod(vfs_handle_struct *handle,  const char *path, mode_t mo
        return result;
 }
 
-static int vfswrap_fchmod(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode)
+static int vfswrap_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t mode)
 {
        int result;
 
@@ -563,7 +573,7 @@ static int vfswrap_fchmod(vfs_handle_struct *handle, files_struct *fsp, int fd,
 
        {
                int saved_errno = errno; /* We might get ENOSYS */
-               if ((result = SMB_VFS_FCHMOD_ACL(fsp, fd, mode)) == 0) {
+               if ((result = SMB_VFS_FCHMOD_ACL(fsp, mode)) == 0) {
                        END_PROFILE(syscall_fchmod);
                        return result;
                }
@@ -572,7 +582,7 @@ static int vfswrap_fchmod(vfs_handle_struct *handle, files_struct *fsp, int fd,
        }
 
 #if defined(HAVE_FCHMOD)
-       result = fchmod(fd, mode);
+       result = fchmod(fsp->fh->fd, mode);
 #else
        result = -1;
        errno = ENOSYS;
@@ -592,13 +602,13 @@ static int vfswrap_chown(vfs_handle_struct *handle, const char *path, uid_t uid,
        return result;
 }
 
-static int vfswrap_fchown(vfs_handle_struct *handle, files_struct *fsp, int fd, uid_t uid, gid_t gid)
+static int vfswrap_fchown(vfs_handle_struct *handle, files_struct *fsp, uid_t uid, gid_t gid)
 {
 #ifdef HAVE_FCHOWN
        int result;
 
        START_PROFILE(syscall_fchown);
-       result = fchown(fd, uid, gid);
+       result = fchown(fsp->fh->fd, uid, gid);
        END_PROFILE(syscall_fchown);
        return result;
 #else
@@ -674,17 +684,17 @@ static int vfswrap_ntimes(vfs_handle_struct *handle, const char *path, const str
  allocate is set.
 **********************************************************************/
 
-static int strict_allocate_ftruncate(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_OFF_T len)
+static int strict_allocate_ftruncate(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_T len)
 {
        SMB_STRUCT_STAT st;
-       SMB_OFF_T currpos = SMB_VFS_LSEEK(fsp, fd, 0, SEEK_CUR);
+       SMB_OFF_T currpos = SMB_VFS_LSEEK(fsp, 0, SEEK_CUR);
        unsigned char zero_space[4096];
        SMB_OFF_T space_to_write;
 
        if (currpos == -1)
                return -1;
 
-       if (SMB_VFS_FSTAT(fsp, fd, &st) == -1)
+       if (SMB_VFS_FSTAT(fsp, &st) == -1)
                return -1;
 
        space_to_write = len - st.st_size;
@@ -699,10 +709,10 @@ static int strict_allocate_ftruncate(vfs_handle_struct *handle, files_struct *fs
 
        /* Shrink - just ftruncate. */
        if (st.st_size > len)
-               return sys_ftruncate(fd, len);
+               return sys_ftruncate(fsp->fh->fd, len);
 
        /* Write out the real space on disk. */
-       if (SMB_VFS_LSEEK(fsp, fd, st.st_size, SEEK_SET) != st.st_size)
+       if (SMB_VFS_LSEEK(fsp, st.st_size, SEEK_SET) != st.st_size)
                return -1;
 
        space_to_write = len - st.st_size;
@@ -712,7 +722,7 @@ static int strict_allocate_ftruncate(vfs_handle_struct *handle, files_struct *fs
                SMB_OFF_T retlen;
                SMB_OFF_T current_len_to_write = MIN(sizeof(zero_space),space_to_write);
 
-               retlen = SMB_VFS_WRITE(fsp,fsp->fh->fd,(char *)zero_space,current_len_to_write);
+               retlen = SMB_VFS_WRITE(fsp,(char *)zero_space,current_len_to_write);
                if (retlen <= 0)
                        return -1;
 
@@ -720,13 +730,13 @@ static int strict_allocate_ftruncate(vfs_handle_struct *handle, files_struct *fs
        }
 
        /* Seek to where we were */
-       if (SMB_VFS_LSEEK(fsp, fd, currpos, SEEK_SET) != currpos)
+       if (SMB_VFS_LSEEK(fsp, currpos, SEEK_SET) != currpos)
                return -1;
 
        return 0;
 }
 
-static int vfswrap_ftruncate(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_OFF_T len)
+static int vfswrap_ftruncate(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_T len)
 {
        int result = -1;
        SMB_STRUCT_STAT st;
@@ -736,7 +746,7 @@ static int vfswrap_ftruncate(vfs_handle_struct *handle, files_struct *fsp, int f
        START_PROFILE(syscall_ftruncate);
 
        if (lp_strict_allocate(SNUM(fsp->conn))) {
-               result = strict_allocate_ftruncate(handle, fsp, fd, len);
+               result = strict_allocate_ftruncate(handle, fsp, len);
                END_PROFILE(syscall_ftruncate);
                return result;
        }
@@ -747,14 +757,14 @@ static int vfswrap_ftruncate(vfs_handle_struct *handle, files_struct *fsp, int f
           expansion and some that don't! On Linux fat can't do
           ftruncate extend but ext2 can. */
 
-       result = sys_ftruncate(fd, len);
+       result = sys_ftruncate(fsp->fh->fd, len);
        if (result == 0)
                goto done;
 
        /* According to W. R. Stevens advanced UNIX prog. Pure 4.3 BSD cannot
           extend a file with ftruncate. Provide alternate implementation
           for this */
-       currpos = SMB_VFS_LSEEK(fsp, fd, 0, SEEK_CUR);
+       currpos = SMB_VFS_LSEEK(fsp, 0, SEEK_CUR);
        if (currpos == -1) {
                goto done;
        }
@@ -763,7 +773,7 @@ static int vfswrap_ftruncate(vfs_handle_struct *handle, files_struct *fsp, int f
           size in which case the ftruncate above should have
           succeeded or shorter, in which case seek to len - 1 and
           write 1 byte of zero */
-       if (SMB_VFS_FSTAT(fsp, fd, &st) == -1) {
+       if (SMB_VFS_FSTAT(fsp, &st) == -1) {
                goto done;
        }
 
@@ -784,14 +794,14 @@ static int vfswrap_ftruncate(vfs_handle_struct *handle, files_struct *fsp, int f
                goto done;
        }
 
-       if (SMB_VFS_LSEEK(fsp, fd, len-1, SEEK_SET) != len -1)
+       if (SMB_VFS_LSEEK(fsp, len-1, SEEK_SET) != len -1)
                goto done;
 
-       if (SMB_VFS_WRITE(fsp, fd, &c, 1)!=1)
+       if (SMB_VFS_WRITE(fsp, &c, 1)!=1)
                goto done;
 
        /* Seek to where we were */
-       if (SMB_VFS_LSEEK(fsp, fd, currpos, SEEK_SET) != currpos)
+       if (SMB_VFS_LSEEK(fsp, currpos, SEEK_SET) != currpos)
                goto done;
        result = 0;
 
@@ -801,36 +811,36 @@ static int vfswrap_ftruncate(vfs_handle_struct *handle, files_struct *fsp, int f
        return result;
 }
 
-static bool vfswrap_lock(vfs_handle_struct *handle, files_struct *fsp, int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type)
+static bool vfswrap_lock(vfs_handle_struct *handle, files_struct *fsp, int op, SMB_OFF_T offset, SMB_OFF_T count, int type)
 {
        bool result;
 
        START_PROFILE(syscall_fcntl_lock);
-       result =  fcntl_lock(fd, op, offset, count, type);
+       result =  fcntl_lock(fsp->fh->fd, op, offset, count, type);
        END_PROFILE(syscall_fcntl_lock);
        return result;
 }
 
-static int vfswrap_kernel_flock(vfs_handle_struct *handle, files_struct *fsp, int fd,
+static int vfswrap_kernel_flock(vfs_handle_struct *handle, files_struct *fsp,
                                uint32 share_mode)
 {
        START_PROFILE(syscall_kernel_flock);
-       kernel_flock(fd, share_mode);
+       kernel_flock(fsp->fh->fd, share_mode);
        END_PROFILE(syscall_kernel_flock);
        return 0;
 }
 
-static bool vfswrap_getlock(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid)
+static bool vfswrap_getlock(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid)
 {
        bool result;
 
        START_PROFILE(syscall_fcntl_getlock);
-       result =  fcntl_getlock(fd, poffset, pcount, ptype, ppid);
+       result =  fcntl_getlock(fsp->fh->fd, poffset, pcount, ptype, ppid);
        END_PROFILE(syscall_fcntl_getlock);
        return result;
 }
 
-static int vfswrap_linux_setlease(vfs_handle_struct *handle, files_struct *fsp, int fd,
+static int vfswrap_linux_setlease(vfs_handle_struct *handle, files_struct *fsp,
                                int leasetype)
 {
        int result = -1;
@@ -839,11 +849,11 @@ static int vfswrap_linux_setlease(vfs_handle_struct *handle, files_struct *fsp,
 
 #ifdef HAVE_KERNEL_OPLOCKS_LINUX
        /* first set the signal handler */
-       if(linux_set_lease_sighandler(fd) == -1) {
+       if(linux_set_lease_sighandler(fsp->fh->fd) == -1) {
                return -1;
        }
 
-       result = linux_setlease(fd, leasetype);
+       result = linux_setlease(fsp->fh->fd, leasetype);
 #else
        errno = ENOSYS;
 #endif
@@ -943,31 +953,87 @@ static struct file_id vfswrap_file_id_create(struct vfs_handle_struct *handle, S
        return file_id_create_dev(dev, inode);
 }
 
+static NTSTATUS vfswrap_streaminfo(vfs_handle_struct *handle,
+                                  struct files_struct *fsp,
+                                  const char *fname,
+                                  TALLOC_CTX *mem_ctx,
+                                  unsigned int *pnum_streams,
+                                  struct stream_struct **pstreams)
+{
+       SMB_STRUCT_STAT sbuf;
+       unsigned int num_streams = 0;
+       struct stream_struct *streams = NULL;
+       int ret;
+
+       if ((fsp != NULL) && (fsp->is_directory)) {
+               /*
+                * No default streams on directories
+                */
+               goto done;
+       }
+
+       if ((fsp != NULL) && (fsp->fh->fd != -1)) {
+               ret = SMB_VFS_FSTAT(fsp, &sbuf);
+       }
+       else {
+               ret = SMB_VFS_STAT(handle->conn, fname, &sbuf);
+       }
+
+       if (ret == -1) {
+               return map_nt_error_from_unix(errno);
+       }
+
+       if (S_ISDIR(sbuf.st_mode)) {
+               goto done;
+       }
+
+       streams = talloc(mem_ctx, struct stream_struct);
+
+       if (streams == NULL) {
+               return NT_STATUS_NO_MEMORY;
+       }
+
+       streams->size = sbuf.st_size;
+       streams->alloc_size = get_allocation_size(handle->conn, fsp, &sbuf);
+
+       streams->name = talloc_strdup(streams, "::$DATA");
+       if (streams->name == NULL) {
+               TALLOC_FREE(streams);
+               return NT_STATUS_NO_MEMORY;
+       }
+
+       num_streams = 1;
+ done:
+       *pnum_streams = num_streams;
+       *pstreams = streams;
+       return NT_STATUS_OK;
+}
+
 static NTSTATUS vfswrap_fget_nt_acl(vfs_handle_struct *handle,
-                                   files_struct *fsp, int fd,
+                                   files_struct *fsp,
                                    uint32 security_info, SEC_DESC **ppdesc)
 {
        NTSTATUS result;
 
        START_PROFILE(fget_nt_acl);
-       result = get_nt_acl(fsp, security_info, ppdesc);
+       result = posix_fget_nt_acl(fsp, security_info, ppdesc);
        END_PROFILE(fget_nt_acl);
        return result;
 }
 
 static NTSTATUS vfswrap_get_nt_acl(vfs_handle_struct *handle,
-                                  files_struct *fsp, const char *name,
+                                  const char *name,
                                   uint32 security_info, SEC_DESC **ppdesc)
 {
        NTSTATUS result;
 
        START_PROFILE(get_nt_acl);
-       result = get_nt_acl(fsp, security_info, ppdesc);
+       result = posix_get_nt_acl(handle->conn, name, security_info, ppdesc);
        END_PROFILE(get_nt_acl);
        return result;
 }
 
-static NTSTATUS vfswrap_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, int fd, uint32 security_info_sent, SEC_DESC *psd)
+static NTSTATUS vfswrap_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, uint32 security_info_sent, SEC_DESC *psd)
 {
        NTSTATUS result;
 
@@ -1002,7 +1068,7 @@ static int vfswrap_chmod_acl(vfs_handle_struct *handle,  const char *name, mode_
 #endif
 }
 
-static int vfswrap_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode)
+static int vfswrap_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, mode_t mode)
 {
 #ifdef HAVE_NO_ACL
        errno = ENOSYS;
@@ -1011,7 +1077,7 @@ static int vfswrap_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, int
        int result;
 
        START_PROFILE(fchmod_acl);
-       result = fchmod_acl(fsp, fd, mode);
+       result = fchmod_acl(fsp, mode);
        END_PROFILE(fchmod_acl);
        return result;
 #endif
@@ -1042,9 +1108,9 @@ static SMB_ACL_T vfswrap_sys_acl_get_file(vfs_handle_struct *handle,  const char
        return sys_acl_get_file(handle, path_p, type);
 }
 
-static SMB_ACL_T vfswrap_sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp, int fd)
+static SMB_ACL_T vfswrap_sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp)
 {
-       return sys_acl_get_fd(handle, fsp, fd);
+       return sys_acl_get_fd(handle, fsp);
 }
 
 static int vfswrap_sys_acl_clear_perms(vfs_handle_struct *handle,  SMB_ACL_PERMSET_T permset)
@@ -1097,9 +1163,9 @@ static int vfswrap_sys_acl_set_file(vfs_handle_struct *handle,  const char *name
        return sys_acl_set_file(handle, name, acltype, theacl);
 }
 
-static int vfswrap_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_ACL_T theacl)
+static int vfswrap_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp, SMB_ACL_T theacl)
 {
-       return sys_acl_set_fd(handle, fsp, fd, theacl);
+       return sys_acl_set_fd(handle, fsp, theacl);
 }
 
 static int vfswrap_sys_acl_delete_def_file(vfs_handle_struct *handle,  const char *path)
@@ -1141,9 +1207,9 @@ static ssize_t vfswrap_lgetxattr(struct vfs_handle_struct *handle,const char *pa
        return sys_lgetxattr(path, name, value, size);
 }
 
-static ssize_t vfswrap_fgetxattr(struct vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *name, void *value, size_t size)
+static ssize_t vfswrap_fgetxattr(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name, void *value, size_t size)
 {
-       return sys_fgetxattr(fd, name, value, size);
+       return sys_fgetxattr(fsp->fh->fd, name, value, size);
 }
 
 static ssize_t vfswrap_listxattr(struct vfs_handle_struct *handle, const char *path, char *list, size_t size)
@@ -1156,9 +1222,9 @@ ssize_t vfswrap_llistxattr(struct vfs_handle_struct *handle, const char *path, c
        return sys_llistxattr(path, list, size);
 }
 
-ssize_t vfswrap_flistxattr(struct vfs_handle_struct *handle, struct files_struct *fsp,int fd, char *list, size_t size)
+ssize_t vfswrap_flistxattr(struct vfs_handle_struct *handle, struct files_struct *fsp, char *list, size_t size)
 {
-       return sys_flistxattr(fd, list, size);
+       return sys_flistxattr(fsp->fh->fd, list, size);
 }
 
 static int vfswrap_removexattr(struct vfs_handle_struct *handle, const char *path, const char *name)
@@ -1171,9 +1237,9 @@ static int vfswrap_lremovexattr(struct vfs_handle_struct *handle, const char *pa
        return sys_lremovexattr(path, name);
 }
 
-static int vfswrap_fremovexattr(struct vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *name)
+static int vfswrap_fremovexattr(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name)
 {
-       return sys_fremovexattr(fd, name);
+       return sys_fremovexattr(fsp->fh->fd, name);
 }
 
 static int vfswrap_setxattr(struct vfs_handle_struct *handle, const char *path, const char *name, const void *value, size_t size, int flags)
@@ -1186,9 +1252,9 @@ static int vfswrap_lsetxattr(struct vfs_handle_struct *handle, const char *path,
        return sys_lsetxattr(path, name, value, size, flags);
 }
 
-static int vfswrap_fsetxattr(struct vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *name, const void *value, size_t size, int flags)
+static int vfswrap_fsetxattr(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name, const void *value, size_t size, int flags)
 {
-       return sys_fsetxattr(fd, name, value, size, flags);
+       return sys_fsetxattr(fsp->fh->fd, name, value, size, flags);
 }
 
 static int vfswrap_aio_read(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb)
@@ -1206,9 +1272,9 @@ static ssize_t vfswrap_aio_return(struct vfs_handle_struct *handle, struct files
        return sys_aio_return(aiocb);
 }
 
-static int vfswrap_aio_cancel(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, SMB_STRUCT_AIOCB *aiocb)
+static int vfswrap_aio_cancel(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb)
 {
-       return sys_aio_cancel(fd, aiocb);
+       return sys_aio_cancel(fsp->fh->fd, aiocb);
 }
 
 static int vfswrap_aio_error(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb)
@@ -1226,6 +1292,36 @@ static int vfswrap_aio_suspend(struct vfs_handle_struct *handle, struct files_st
        return sys_aio_suspend(aiocb, n, timeout);
 }
 
+static bool vfswrap_aio_force(struct vfs_handle_struct *handle, struct files_struct *fsp)
+{
+       return false;
+}
+
+static bool vfswrap_is_offline(struct vfs_handle_struct *handle, const char *path, SMB_STRUCT_STAT *sbuf)
+{
+       if (ISDOT(path) || ISDOTDOT(path)) {
+               return false;
+       }
+
+       if (!lp_dmapi_support(SNUM(handle->conn)) || !dmapi_have_session()) {
+#if defined(ENOTSUP)
+               errno = ENOTSUP;
+#endif
+               return false;
+       }
+
+       return (dmapi_file_flags(path) & FILE_ATTRIBUTE_OFFLINE) != 0;
+}
+
+static int vfswrap_set_offline(struct vfs_handle_struct *handle, const char *path)
+{
+       /* We don't know how to set offline bit by default, needs to be overriden in the vfs modules */
+#if defined(ENOTSUP)
+       errno = ENOTSUP;
+#endif
+       return -1;
+}
+
 static vfs_op_tuple vfs_default_ops[] = {
 
        /* Disk operations */
@@ -1244,6 +1340,8 @@ static vfs_op_tuple vfs_default_ops[] = {
         SMB_VFS_LAYER_OPAQUE},
        {SMB_VFS_OP(vfswrap_statvfs),   SMB_VFS_OP_STATVFS,
         SMB_VFS_LAYER_OPAQUE},
+       {SMB_VFS_OP(vfswrap_fs_capabilities), SMB_VFS_OP_FS_CAPABILITIES,
+        SMB_VFS_LAYER_OPAQUE},
 
        /* Directory operations */
 
@@ -1338,6 +1436,8 @@ static vfs_op_tuple vfs_default_ops[] = {
         SMB_VFS_LAYER_OPAQUE},
        {SMB_VFS_OP(vfswrap_file_id_create),    SMB_VFS_OP_FILE_ID_CREATE,
         SMB_VFS_LAYER_OPAQUE},
+       {SMB_VFS_OP(vfswrap_streaminfo),        SMB_VFS_OP_STREAMINFO,
+        SMB_VFS_LAYER_OPAQUE},
 
        /* NT ACL operations. */
 
@@ -1443,6 +1543,14 @@ static vfs_op_tuple vfs_default_ops[] = {
        {SMB_VFS_OP(vfswrap_aio_suspend),SMB_VFS_OP_AIO_SUSPEND,
         SMB_VFS_LAYER_OPAQUE},
 
+       {SMB_VFS_OP(vfswrap_aio_force), SMB_VFS_OP_AIO_FORCE,
+        SMB_VFS_LAYER_OPAQUE},
+
+       {SMB_VFS_OP(vfswrap_is_offline),SMB_VFS_OP_IS_OFFLINE,
+        SMB_VFS_LAYER_OPAQUE},
+       {SMB_VFS_OP(vfswrap_set_offline),SMB_VFS_OP_SET_OFFLINE,
+        SMB_VFS_LAYER_OPAQUE},
+
        /* Finish VFS operations definition */
 
        {SMB_VFS_OP(NULL),              SMB_VFS_OP_NOOP,
index 552c64016ea6445de62181f6ac5bdf119855b73a..a21e281e2ca6b09cd10f228837c81bc016a0a9a4 100644 (file)
@@ -42,8 +42,8 @@ static int audit_rename(vfs_handle_struct *handle, const char *oldname, const ch
 static int audit_unlink(vfs_handle_struct *handle, const char *path);
 static int audit_chmod(vfs_handle_struct *handle, const char *path, mode_t mode);
 static int audit_chmod_acl(vfs_handle_struct *handle, const char *name, mode_t mode);
-static int audit_fchmod(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode);
-static int audit_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode);
+static int audit_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t mode);
+static int audit_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, mode_t mode);
 
 /* VFS operations */
 
@@ -310,11 +310,11 @@ static int audit_chmod_acl(vfs_handle_struct *handle, const char *path, mode_t m
        return result;
 }
 
-static int audit_fchmod(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode)
+static int audit_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t mode)
 {
        int result;
        
-       result = SMB_VFS_NEXT_FCHMOD(handle, fsp, fd, mode);
+       result = SMB_VFS_NEXT_FCHMOD(handle, fsp, mode);
 
        syslog(audit_syslog_priority(handle), "fchmod %s mode 0x%x %s%s\n",
               fsp->fsp_name, mode,
@@ -328,11 +328,11 @@ static int audit_fchmod(vfs_handle_struct *handle, files_struct *fsp, int fd, mo
        return result;
 }
 
-static int audit_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode)
+static int audit_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, mode_t mode)
 {
        int result;
        
-       result = SMB_VFS_NEXT_FCHMOD_ACL(handle, fsp, fd, mode);
+       result = SMB_VFS_NEXT_FCHMOD_ACL(handle, fsp, mode);
 
        syslog(audit_syslog_priority(handle), "fchmod_acl %s mode 0x%x %s%s\n",
               fsp->fsp_name, mode,
index 8157f05d52eb4ce107aff238ce71e05ebcfc454e..ddad0008a7ef55d1a8a3763b5e9b19f3690dbac4 100644 (file)
@@ -46,11 +46,11 @@ static int fake_perms_stat(vfs_handle_struct *handle, const char *fname, SMB_STR
        return ret;
 }
 
-static int fake_perms_fstat(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_STRUCT_STAT *sbuf)
+static int fake_perms_fstat(vfs_handle_struct *handle, files_struct *fsp, SMB_STRUCT_STAT *sbuf)
 {
        int ret = -1;
 
-       ret = SMB_VFS_NEXT_FSTAT(handle, fsp, fd, sbuf);
+       ret = SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf);
        if (ret == 0) {
                if (S_ISDIR(sbuf->st_mode)) {
                        sbuf->st_mode = S_IFDIR | S_IRWXU;
index f4aeefbbf054352bf898a69e8386ca0ad6c858d6..5aa9bab5b5ce9695b1f9410498b474848500bbcd 100644 (file)
@@ -113,30 +113,30 @@ static int smb_full_audit_open(vfs_handle_struct *handle,
                      const char *fname, files_struct *fsp, int flags, mode_t mode);
 static int smb_full_audit_close(vfs_handle_struct *handle, files_struct *fsp, int fd);
 static ssize_t smb_full_audit_read(vfs_handle_struct *handle, files_struct *fsp,
-                         int fd, void *data, size_t n);
+                         void *data, size_t n);
 static ssize_t smb_full_audit_pread(vfs_handle_struct *handle, files_struct *fsp,
-                          int fd, void *data, size_t n, SMB_OFF_T offset);
+                          void *data, size_t n, SMB_OFF_T offset);
 static ssize_t smb_full_audit_write(vfs_handle_struct *handle, files_struct *fsp,
-                          int fd, const void *data, size_t n);
+                          const void *data, size_t n);
 static ssize_t smb_full_audit_pwrite(vfs_handle_struct *handle, files_struct *fsp,
-                           int fd, const void *data, size_t n,
+                           const void *data, size_t n,
                            SMB_OFF_T offset);
 static SMB_OFF_T smb_full_audit_lseek(vfs_handle_struct *handle, files_struct *fsp,
-                            int filedes, SMB_OFF_T offset, int whence);
+                            SMB_OFF_T offset, int whence);
 static ssize_t smb_full_audit_sendfile(vfs_handle_struct *handle, int tofd,
-                             files_struct *fsp, int fromfd,
+                             files_struct *fromfsp,
                              const DATA_BLOB *hdr, SMB_OFF_T offset,
                              size_t n);
 static ssize_t smb_full_audit_recvfile(vfs_handle_struct *handle, int fromfd,
-                             files_struct *fsp, int tofd,
+                             files_struct *tofsp,
                              SMB_OFF_T offset,
                              size_t n);
 static int smb_full_audit_rename(vfs_handle_struct *handle,
                        const char *oldname, const char *newname);
-static int smb_full_audit_fsync(vfs_handle_struct *handle, files_struct *fsp, int fd);
+static int smb_full_audit_fsync(vfs_handle_struct *handle, files_struct *fsp);
 static int smb_full_audit_stat(vfs_handle_struct *handle,
                      const char *fname, SMB_STRUCT_STAT *sbuf);
-static int smb_full_audit_fstat(vfs_handle_struct *handle, files_struct *fsp, int fd,
+static int smb_full_audit_fstat(vfs_handle_struct *handle, files_struct *fsp,
                       SMB_STRUCT_STAT *sbuf);
 static int smb_full_audit_lstat(vfs_handle_struct *handle,
                       const char *path, SMB_STRUCT_STAT *sbuf);
@@ -144,11 +144,11 @@ static int smb_full_audit_unlink(vfs_handle_struct *handle,
                        const char *path);
 static int smb_full_audit_chmod(vfs_handle_struct *handle,
                       const char *path, mode_t mode);
-static int smb_full_audit_fchmod(vfs_handle_struct *handle, files_struct *fsp, int fd,
+static int smb_full_audit_fchmod(vfs_handle_struct *handle, files_struct *fsp,
                        mode_t mode);
 static int smb_full_audit_chown(vfs_handle_struct *handle,
                       const char *path, uid_t uid, gid_t gid);
-static int smb_full_audit_fchown(vfs_handle_struct *handle, files_struct *fsp, int fd,
+static int smb_full_audit_fchown(vfs_handle_struct *handle, files_struct *fsp,
                        uid_t uid, gid_t gid);
 static int smb_full_audit_lchown(vfs_handle_struct *handle,
                       const char *path, uid_t uid, gid_t gid);
@@ -159,15 +159,15 @@ static char *smb_full_audit_getwd(vfs_handle_struct *handle,
 static int smb_full_audit_ntimes(vfs_handle_struct *handle,
                       const char *path, const struct timespec ts[2]);
 static int smb_full_audit_ftruncate(vfs_handle_struct *handle, files_struct *fsp,
-                          int fd, SMB_OFF_T len);
-static bool smb_full_audit_lock(vfs_handle_struct *handle, files_struct *fsp, int fd,
+                          SMB_OFF_T len);
+static bool smb_full_audit_lock(vfs_handle_struct *handle, files_struct *fsp,
                       int op, SMB_OFF_T offset, SMB_OFF_T count, int type);
 static int smb_full_audit_kernel_flock(struct vfs_handle_struct *handle,
-                                      struct files_struct *fsp, int fd,
+                                      struct files_struct *fsp,
                                       uint32 share_mode);
 static int smb_full_audit_linux_setlease(vfs_handle_struct *handle, files_struct *fsp,
-                                       int fd, int leasetype);
-static bool smb_full_audit_getlock(vfs_handle_struct *handle, files_struct *fsp, int fd,
+                                       int leasetype);
+static bool smb_full_audit_getlock(vfs_handle_struct *handle, files_struct *fsp,
                       SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid);
 static int smb_full_audit_symlink(vfs_handle_struct *handle,
                         const char *oldpath, const char *newpath);
@@ -191,13 +191,13 @@ static int smb_full_audit_chflags(vfs_handle_struct *handle,
 static struct file_id smb_full_audit_file_id_create(struct vfs_handle_struct *handle,
                                                    SMB_DEV_T dev, SMB_INO_T inode);
 static NTSTATUS smb_full_audit_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
-                               int fd, uint32 security_info,
+                               uint32 security_info,
                                SEC_DESC **ppdesc);
 static NTSTATUS smb_full_audit_get_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
                               const char *name, uint32 security_info,
                               SEC_DESC **ppdesc);
 static NTSTATUS smb_full_audit_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
-                             int fd, uint32 security_info_sent,
+                             uint32 security_info_sent,
                              SEC_DESC *psd);
 static NTSTATUS smb_full_audit_set_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
                             const char *name, uint32 security_info_sent,
@@ -205,7 +205,7 @@ static NTSTATUS smb_full_audit_set_nt_acl(vfs_handle_struct *handle, files_struc
 static int smb_full_audit_chmod_acl(vfs_handle_struct *handle,
                           const char *path, mode_t mode);
 static int smb_full_audit_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp,
-                           int fd, mode_t mode);
+                                    mode_t mode);
 static int smb_full_audit_sys_acl_get_entry(vfs_handle_struct *handle,
                                   SMB_ACL_T theacl, int entry_id,
                                   SMB_ACL_ENTRY_T *entry_p);
@@ -221,8 +221,7 @@ static SMB_ACL_T smb_full_audit_sys_acl_get_file(vfs_handle_struct *handle,
                                        const char *path_p,
                                        SMB_ACL_TYPE_T type);
 static SMB_ACL_T smb_full_audit_sys_acl_get_fd(vfs_handle_struct *handle,
-                                     files_struct *fsp,
-                                     int fd);
+                                     files_struct *fsp);
 static int smb_full_audit_sys_acl_clear_perms(vfs_handle_struct *handle,
                                     SMB_ACL_PERMSET_T permset);
 static int smb_full_audit_sys_acl_add_perm(vfs_handle_struct *handle,
@@ -251,7 +250,7 @@ static int smb_full_audit_sys_acl_set_file(vfs_handle_struct *handle,
                                  const char *name, SMB_ACL_TYPE_T acltype,
                                  SMB_ACL_T theacl);
 static int smb_full_audit_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
-                               int fd, SMB_ACL_T theacl);
+                               SMB_ACL_T theacl);
 static int smb_full_audit_sys_acl_delete_def_file(vfs_handle_struct *handle,
                                         const char *path);
 static int smb_full_audit_sys_acl_get_perm(vfs_handle_struct *handle,
@@ -271,14 +270,14 @@ static ssize_t smb_full_audit_lgetxattr(struct vfs_handle_struct *handle,
                               const char *path, const char *name,
                               void *value, size_t size);
 static ssize_t smb_full_audit_fgetxattr(struct vfs_handle_struct *handle,
-                              struct files_struct *fsp, int fd,
+                              struct files_struct *fsp,
                               const char *name, void *value, size_t size);
 static ssize_t smb_full_audit_listxattr(struct vfs_handle_struct *handle,
                               const char *path, char *list, size_t size);
 static ssize_t smb_full_audit_llistxattr(struct vfs_handle_struct *handle,
                                const char *path, char *list, size_t size);
 static ssize_t smb_full_audit_flistxattr(struct vfs_handle_struct *handle,
-                               struct files_struct *fsp, int fd, char *list,
+                               struct files_struct *fsp, char *list,
                                size_t size);
 static int smb_full_audit_removexattr(struct vfs_handle_struct *handle,
                             const char *path,
@@ -287,7 +286,7 @@ static int smb_full_audit_lremovexattr(struct vfs_handle_struct *handle,
                              const char *path,
                              const char *name);
 static int smb_full_audit_fremovexattr(struct vfs_handle_struct *handle,
-                             struct files_struct *fsp, int fd,
+                             struct files_struct *fsp,
                              const char *name);
 static int smb_full_audit_setxattr(struct vfs_handle_struct *handle,
                          const char *path,
@@ -298,13 +297,13 @@ static int smb_full_audit_lsetxattr(struct vfs_handle_struct *handle,
                           const char *name, const void *value, size_t size,
                           int flags);
 static int smb_full_audit_fsetxattr(struct vfs_handle_struct *handle,
-                          struct files_struct *fsp, int fd, const char *name,
+                          struct files_struct *fsp, const char *name,
                           const void *value, size_t size, int flags);
 
 static int smb_full_audit_aio_read(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb);
 static int smb_full_audit_aio_write(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb);
 static ssize_t smb_full_audit_aio_return(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb);
-static int smb_full_audit_aio_cancel(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, SMB_STRUCT_AIOCB *aiocb);
+static int smb_full_audit_aio_cancel(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb);
 static int smb_full_audit_aio_error(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb);
 static int smb_full_audit_aio_fsync(struct vfs_handle_struct *handle, struct files_struct *fsp, int op, SMB_STRUCT_AIOCB *aiocb);
 static int smb_full_audit_aio_suspend(struct vfs_handle_struct *handle, struct files_struct *fsp, const SMB_STRUCT_AIOCB * const aiocb[], int n, const struct timespec *ts);
@@ -451,7 +450,7 @@ static vfs_op_tuple audit_op_tuples[] = {
         SMB_VFS_LAYER_LOGGER},
        {SMB_VFS_OP(smb_full_audit_sys_acl_get_file),   SMB_VFS_OP_SYS_ACL_GET_FILE,
         SMB_VFS_LAYER_LOGGER},
-       {SMB_VFS_OP(smb_full_audit_sys_acl_get_fd),     SMB_VFS_OP_SYS_ACL_GET_FD,
+{SMB_VFS_OP(smb_full_audit_sys_acl_get_fd),    SMB_VFS_OP_SYS_ACL_GET_FD,
         SMB_VFS_LAYER_LOGGER},
        {SMB_VFS_OP(smb_full_audit_sys_acl_clear_perms),        SMB_VFS_OP_SYS_ACL_CLEAR_PERMS,
         SMB_VFS_LAYER_LOGGER},
@@ -1088,11 +1087,11 @@ static int smb_full_audit_close(vfs_handle_struct *handle, files_struct *fsp, in
 }
 
 static ssize_t smb_full_audit_read(vfs_handle_struct *handle, files_struct *fsp,
-                         int fd, void *data, size_t n)
+                         void *data, size_t n)
 {
        ssize_t result;
 
-       result = SMB_VFS_NEXT_READ(handle, fsp, fd, data, n);
+       result = SMB_VFS_NEXT_READ(handle, fsp, data, n);
 
        do_log(SMB_VFS_OP_READ, (result >= 0), handle, "%s", fsp->fsp_name);
 
@@ -1100,11 +1099,11 @@ static ssize_t smb_full_audit_read(vfs_handle_struct *handle, files_struct *fsp,
 }
 
 static ssize_t smb_full_audit_pread(vfs_handle_struct *handle, files_struct *fsp,
-                          int fd, void *data, size_t n, SMB_OFF_T offset)
+                          void *data, size_t n, SMB_OFF_T offset)
 {
        ssize_t result;
 
-       result = SMB_VFS_NEXT_PREAD(handle, fsp, fd, data, n, offset);
+       result = SMB_VFS_NEXT_PREAD(handle, fsp, data, n, offset);
 
        do_log(SMB_VFS_OP_PREAD, (result >= 0), handle, "%s", fsp->fsp_name);
 
@@ -1112,11 +1111,11 @@ static ssize_t smb_full_audit_pread(vfs_handle_struct *handle, files_struct *fsp
 }
 
 static ssize_t smb_full_audit_write(vfs_handle_struct *handle, files_struct *fsp,
-                          int fd, const void *data, size_t n)
+                          const void *data, size_t n)
 {
        ssize_t result;
 
-       result = SMB_VFS_NEXT_WRITE(handle, fsp, fd, data, n);
+       result = SMB_VFS_NEXT_WRITE(handle, fsp, data, n);
 
        do_log(SMB_VFS_OP_WRITE, (result >= 0), handle, "%s", fsp->fsp_name);
 
@@ -1124,12 +1123,12 @@ static ssize_t smb_full_audit_write(vfs_handle_struct *handle, files_struct *fsp
 }
 
 static ssize_t smb_full_audit_pwrite(vfs_handle_struct *handle, files_struct *fsp,
-                           int fd, const void *data, size_t n,
+                           const void *data, size_t n,
                            SMB_OFF_T offset)
 {
        ssize_t result;
 
-       result = SMB_VFS_NEXT_PWRITE(handle, fsp, fd, data, n, offset);
+       result = SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, offset);
 
        do_log(SMB_VFS_OP_PWRITE, (result >= 0), handle, "%s", fsp->fsp_name);
 
@@ -1137,11 +1136,11 @@ static ssize_t smb_full_audit_pwrite(vfs_handle_struct *handle, files_struct *fs
 }
 
 static SMB_OFF_T smb_full_audit_lseek(vfs_handle_struct *handle, files_struct *fsp,
-                            int filedes, SMB_OFF_T offset, int whence)
+                            SMB_OFF_T offset, int whence)
 {
        ssize_t result;
 
-       result = SMB_VFS_NEXT_LSEEK(handle, fsp, filedes, offset, whence);
+       result = SMB_VFS_NEXT_LSEEK(handle, fsp, offset, whence);
 
        do_log(SMB_VFS_OP_LSEEK, (result != (ssize_t)-1), handle,
               "%s", fsp->fsp_name);
@@ -1150,33 +1149,31 @@ static SMB_OFF_T smb_full_audit_lseek(vfs_handle_struct *handle, files_struct *f
 }
 
 static ssize_t smb_full_audit_sendfile(vfs_handle_struct *handle, int tofd,
-                             files_struct *fsp, int fromfd,
+                             files_struct *fromfsp,
                              const DATA_BLOB *hdr, SMB_OFF_T offset,
                              size_t n)
 {
        ssize_t result;
 
-       result = SMB_VFS_NEXT_SENDFILE(handle, tofd, fsp, fromfd, hdr,
-                                      offset, n);
+       result = SMB_VFS_NEXT_SENDFILE(handle, tofd, fromfsp, hdr, offset, n);
 
        do_log(SMB_VFS_OP_SENDFILE, (result >= 0), handle,
-              "%s", fsp->fsp_name);
+              "%s", fromfsp->fsp_name);
 
        return result;
 }
 
 static ssize_t smb_full_audit_recvfile(vfs_handle_struct *handle, int fromfd,
-                             files_struct *fsp, int tofd,
+                     files_struct *tofsp,
                              SMB_OFF_T offset,
                              size_t n)
 {
        ssize_t result;
 
-       result = SMB_VFS_NEXT_RECVFILE(handle, fromfd, fsp, tofd,
-                                      offset, n);
+       result = SMB_VFS_NEXT_RECVFILE(handle, fromfd, tofsp, offset, n);
 
        do_log(SMB_VFS_OP_RECVFILE, (result >= 0), handle,
-              "%s", fsp->fsp_name);
+              "%s", tofsp->fsp_name);
 
        return result;
 }
@@ -1193,11 +1190,11 @@ static int smb_full_audit_rename(vfs_handle_struct *handle,
        return result;    
 }
 
-static int smb_full_audit_fsync(vfs_handle_struct *handle, files_struct *fsp, int fd)
+static int smb_full_audit_fsync(vfs_handle_struct *handle, files_struct *fsp)
 {
        int result;
        
-       result = SMB_VFS_NEXT_FSYNC(handle, fsp, fd);
+       result = SMB_VFS_NEXT_FSYNC(handle, fsp);
 
        do_log(SMB_VFS_OP_FSYNC, (result >= 0), handle, "%s", fsp->fsp_name);
 
@@ -1216,12 +1213,12 @@ static int smb_full_audit_stat(vfs_handle_struct *handle,
        return result;    
 }
 
-static int smb_full_audit_fstat(vfs_handle_struct *handle, files_struct *fsp, int fd,
+static int smb_full_audit_fstat(vfs_handle_struct *handle, files_struct *fsp,
                       SMB_STRUCT_STAT *sbuf)
 {
        int result;
        
-       result = SMB_VFS_NEXT_FSTAT(handle, fsp, fd, sbuf);
+       result = SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf);
 
        do_log(SMB_VFS_OP_FSTAT, (result >= 0), handle, "%s", fsp->fsp_name);
 
@@ -1264,12 +1261,12 @@ static int smb_full_audit_chmod(vfs_handle_struct *handle,
        return result;
 }
 
-static int smb_full_audit_fchmod(vfs_handle_struct *handle, files_struct *fsp, int fd,
+static int smb_full_audit_fchmod(vfs_handle_struct *handle, files_struct *fsp,
                        mode_t mode)
 {
        int result;
        
-       result = SMB_VFS_NEXT_FCHMOD(handle, fsp, fd, mode);
+       result = SMB_VFS_NEXT_FCHMOD(handle, fsp, mode);
 
        do_log(SMB_VFS_OP_FCHMOD, (result >= 0), handle,
               "%s|%o", fsp->fsp_name, mode);
@@ -1290,12 +1287,12 @@ static int smb_full_audit_chown(vfs_handle_struct *handle,
        return result;
 }
 
-static int smb_full_audit_fchown(vfs_handle_struct *handle, files_struct *fsp, int fd,
+static int smb_full_audit_fchown(vfs_handle_struct *handle, files_struct *fsp,
                        uid_t uid, gid_t gid)
 {
        int result;
 
-       result = SMB_VFS_NEXT_FCHOWN(handle, fsp, fd, uid, gid);
+       result = SMB_VFS_NEXT_FCHOWN(handle, fsp, uid, gid);
 
        do_log(SMB_VFS_OP_FCHOWN, (result >= 0), handle, "%s|%ld|%ld",
               fsp->fsp_name, (long int)uid, (long int)gid);
@@ -1353,11 +1350,11 @@ static int smb_full_audit_ntimes(vfs_handle_struct *handle,
 }
 
 static int smb_full_audit_ftruncate(vfs_handle_struct *handle, files_struct *fsp,
-                          int fd, SMB_OFF_T len)
+                          SMB_OFF_T len)
 {
        int result;
 
-       result = SMB_VFS_NEXT_FTRUNCATE(handle, fsp, fd, len);
+       result = SMB_VFS_NEXT_FTRUNCATE(handle, fsp, len);
 
        do_log(SMB_VFS_OP_FTRUNCATE, (result >= 0), handle,
               "%s", fsp->fsp_name);
@@ -1365,12 +1362,12 @@ static int smb_full_audit_ftruncate(vfs_handle_struct *handle, files_struct *fsp
        return result;
 }
 
-static bool smb_full_audit_lock(vfs_handle_struct *handle, files_struct *fsp, int fd,
+static bool smb_full_audit_lock(vfs_handle_struct *handle, files_struct *fsp,
                       int op, SMB_OFF_T offset, SMB_OFF_T count, int type)
 {
        bool result;
 
-       result = SMB_VFS_NEXT_LOCK(handle, fsp, fd, op, offset, count, type);
+       result = SMB_VFS_NEXT_LOCK(handle, fsp, op, offset, count, type);
 
        do_log(SMB_VFS_OP_LOCK, result, handle, "%s", fsp->fsp_name);
 
@@ -1378,12 +1375,12 @@ static bool smb_full_audit_lock(vfs_handle_struct *handle, files_struct *fsp, in
 }
 
 static int smb_full_audit_kernel_flock(struct vfs_handle_struct *handle,
-                                      struct files_struct *fsp, int fd,
+                                      struct files_struct *fsp,
                                       uint32 share_mode)
 {
        int result;
 
-       result = SMB_VFS_NEXT_KERNEL_FLOCK(handle, fsp, fd, share_mode);
+       result = SMB_VFS_NEXT_KERNEL_FLOCK(handle, fsp, share_mode);
 
        do_log(SMB_VFS_OP_KERNEL_FLOCK, (result >= 0), handle, "%s",
               fsp->fsp_name);
@@ -1392,11 +1389,11 @@ static int smb_full_audit_kernel_flock(struct vfs_handle_struct *handle,
 }
 
 static int smb_full_audit_linux_setlease(vfs_handle_struct *handle, files_struct *fsp,
-                                 int fd, int leasetype)
+                                 int leasetype)
 {
         int result;
 
-        result = SMB_VFS_NEXT_LINUX_SETLEASE(handle, fsp, fd, leasetype);
+        result = SMB_VFS_NEXT_LINUX_SETLEASE(handle, fsp, leasetype);
 
         do_log(SMB_VFS_OP_LINUX_SETLEASE, (result >= 0), handle, "%s",
                fsp->fsp_name);
@@ -1404,12 +1401,12 @@ static int smb_full_audit_linux_setlease(vfs_handle_struct *handle, files_struct
         return result;
 }
 
-static bool smb_full_audit_getlock(vfs_handle_struct *handle, files_struct *fsp, int fd,
+static bool smb_full_audit_getlock(vfs_handle_struct *handle, files_struct *fsp,
                       SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid)
 {
        bool result;
 
-       result = SMB_VFS_NEXT_GETLOCK(handle, fsp, fd, poffset, pcount, ptype, ppid);
+       result = SMB_VFS_NEXT_GETLOCK(handle, fsp, poffset, pcount, ptype, ppid);
 
        do_log(SMB_VFS_OP_GETLOCK, result, handle, "%s", fsp->fsp_name);
 
@@ -1525,13 +1522,12 @@ static struct file_id smb_full_audit_file_id_create(struct vfs_handle_struct *ha
 }
 
 static NTSTATUS smb_full_audit_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
-                               int fd, uint32 security_info,
+                               uint32 security_info,
                                SEC_DESC **ppdesc)
 {
        NTSTATUS result;
 
-       result = SMB_VFS_NEXT_FGET_NT_ACL(handle, fsp, fd, security_info,
-                                         ppdesc);
+       result = SMB_VFS_NEXT_FGET_NT_ACL(handle, fsp, security_info, ppdesc);
 
        do_log(SMB_VFS_OP_FGET_NT_ACL, NT_STATUS_IS_OK(result), handle,
               "%s", fsp->fsp_name);
@@ -1547,8 +1543,7 @@ static NTSTATUS smb_full_audit_get_nt_acl(vfs_handle_struct *handle,
 {
        NTSTATUS result;
 
-       result = SMB_VFS_NEXT_GET_NT_ACL(handle, fsp, name, security_info,
-                                        ppdesc);
+       result = SMB_VFS_NEXT_GET_NT_ACL(handle, name, security_info, ppdesc);
 
        do_log(SMB_VFS_OP_GET_NT_ACL, NT_STATUS_IS_OK(result), handle,
               "%s", fsp->fsp_name);
@@ -1557,13 +1552,12 @@ static NTSTATUS smb_full_audit_get_nt_acl(vfs_handle_struct *handle,
 }
 
 static NTSTATUS smb_full_audit_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
-                             int fd, uint32 security_info_sent,
+                             uint32 security_info_sent,
                              SEC_DESC *psd)
 {
        NTSTATUS result;
 
-       result = SMB_VFS_NEXT_FSET_NT_ACL(handle, fsp, fd, security_info_sent,
-                                         psd);
+       result = SMB_VFS_NEXT_FSET_NT_ACL(handle, fsp, security_info_sent, psd);
 
        do_log(SMB_VFS_OP_FSET_NT_ACL, NT_STATUS_IS_OK(result), handle, "%s", fsp->fsp_name);
 
@@ -1598,11 +1592,11 @@ static int smb_full_audit_chmod_acl(vfs_handle_struct *handle,
 }
 
 static int smb_full_audit_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp,
-                           int fd, mode_t mode)
+                                    mode_t mode)
 {
        int result;
        
-       result = SMB_VFS_NEXT_FCHMOD_ACL(handle, fsp, fd, mode);
+       result = SMB_VFS_NEXT_FCHMOD_ACL(handle, fsp, mode);
 
        do_log(SMB_VFS_OP_FCHMOD_ACL, (result >= 0), handle,
               "%s|%o", fsp->fsp_name, mode);
@@ -1687,11 +1681,11 @@ static SMB_ACL_T smb_full_audit_sys_acl_get_file(vfs_handle_struct *handle,
 }
 
 static SMB_ACL_T smb_full_audit_sys_acl_get_fd(vfs_handle_struct *handle,
-                                     files_struct *fsp, int fd)
+                                     files_struct *fsp)
 {
        SMB_ACL_T result;
 
-       result = SMB_VFS_NEXT_SYS_ACL_GET_FD(handle, fsp, fd);
+       result = SMB_VFS_NEXT_SYS_ACL_GET_FD(handle, fsp);
 
        do_log(SMB_VFS_OP_SYS_ACL_GET_FD, (result != NULL), handle,
               "%s", fsp->fsp_name);
@@ -1847,11 +1841,11 @@ static int smb_full_audit_sys_acl_set_file(vfs_handle_struct *handle,
 }
 
 static int smb_full_audit_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
-                               int fd, SMB_ACL_T theacl)
+                               SMB_ACL_T theacl)
 {
        int result;
 
-       result = SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, fd, theacl);
+       result = SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, theacl);
 
        do_log(SMB_VFS_OP_SYS_ACL_SET_FD, (result >= 0), handle,
               "%s", fsp->fsp_name);
@@ -1960,12 +1954,12 @@ static ssize_t smb_full_audit_lgetxattr(struct vfs_handle_struct *handle,
 }
 
 static ssize_t smb_full_audit_fgetxattr(struct vfs_handle_struct *handle,
-                              struct files_struct *fsp, int fd,
+                              struct files_struct *fsp,
                               const char *name, void *value, size_t size)
 {
        ssize_t result;
 
-       result = SMB_VFS_NEXT_FGETXATTR(handle, fsp, fd, name, value, size);
+       result = SMB_VFS_NEXT_FGETXATTR(handle, fsp, name, value, size);
 
        do_log(SMB_VFS_OP_FGETXATTR, (result >= 0), handle,
               "%s|%s", fsp->fsp_name, name);
@@ -1998,12 +1992,12 @@ static ssize_t smb_full_audit_llistxattr(struct vfs_handle_struct *handle,
 }
 
 static ssize_t smb_full_audit_flistxattr(struct vfs_handle_struct *handle,
-                               struct files_struct *fsp, int fd, char *list,
+                               struct files_struct *fsp, char *list,
                                size_t size)
 {
        ssize_t result;
 
-       result = SMB_VFS_NEXT_FLISTXATTR(handle, fsp, fd, list, size);
+       result = SMB_VFS_NEXT_FLISTXATTR(handle, fsp, list, size);
 
        do_log(SMB_VFS_OP_FLISTXATTR, (result >= 0), handle,
               "%s", fsp->fsp_name);
@@ -2040,12 +2034,12 @@ static int smb_full_audit_lremovexattr(struct vfs_handle_struct *handle,
 }
 
 static int smb_full_audit_fremovexattr(struct vfs_handle_struct *handle,
-                             struct files_struct *fsp, int fd,
+                             struct files_struct *fsp,
                              const char *name)
 {
        int result;
 
-       result = SMB_VFS_NEXT_FREMOVEXATTR(handle, fsp, fd, name);
+       result = SMB_VFS_NEXT_FREMOVEXATTR(handle, fsp, name);
 
        do_log(SMB_VFS_OP_FREMOVEXATTR, (result >= 0), handle,
               "%s|%s", fsp->fsp_name, name);
@@ -2086,13 +2080,12 @@ static int smb_full_audit_lsetxattr(struct vfs_handle_struct *handle,
 }
 
 static int smb_full_audit_fsetxattr(struct vfs_handle_struct *handle,
-                          struct files_struct *fsp, int fd, const char *name,
+                          struct files_struct *fsp, const char *name,
                           const void *value, size_t size, int flags)
 {
        int result;
 
-       result = SMB_VFS_NEXT_FSETXATTR(handle, fsp, fd, name, value, size,
-                                       flags);
+       result = SMB_VFS_NEXT_FSETXATTR(handle, fsp, name, value, size, flags);
 
        do_log(SMB_VFS_OP_FSETXATTR, (result >= 0), handle,
               "%s|%s", fsp->fsp_name, name);
@@ -2133,11 +2126,11 @@ static ssize_t smb_full_audit_aio_return(struct vfs_handle_struct *handle, struc
        return result;
 }
 
-static int smb_full_audit_aio_cancel(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, SMB_STRUCT_AIOCB *aiocb)
+static int smb_full_audit_aio_cancel(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb)
 {
        int result;
 
-       result = SMB_VFS_NEXT_AIO_CANCEL(handle, fsp, fd, aiocb);
+       result = SMB_VFS_NEXT_AIO_CANCEL(handle, fsp, aiocb);
        do_log(SMB_VFS_OP_AIO_CANCEL, (result >= 0), handle,
                "%s", fsp->fsp_name);
 
index c207bbfe2dd7ae34b452f557abb55f224c1383bd..d10906dfb1e07da32a85d06f92dab0d2f322ff05 100644 (file)
 
 #include <gpfs_gpl.h>
 #include "nfs4_acls.h"
-
+#include "vfs_gpfs.h"
 
 static int vfs_gpfs_kernel_flock(vfs_handle_struct *handle, files_struct *fsp, 
-                                int fd, uint32 share_mode)
+                                uint32 share_mode)
 {
 
        START_PROFILE(syscall_kernel_flock);
@@ -52,21 +52,21 @@ static int vfs_gpfs_kernel_flock(vfs_handle_struct *handle, files_struct *fsp,
 }
 
 static int vfs_gpfs_setlease(vfs_handle_struct *handle, files_struct *fsp, 
-                                int fd, int leasetype)
+                            int leasetype)
 {
        int ret;
        
        START_PROFILE(syscall_linux_setlease);
        
-       if ( linux_set_lease_sighandler(fd) == -1)
+       if ( linux_set_lease_sighandler(fsp->fh->fd) == -1)
                return -1;
 
-       ret = set_gpfs_lease(fd,leasetype);
+       ret = set_gpfs_lease(fsp->fh->fd,leasetype);
        
        if ( ret < 0 ) {
                /* This must have come from GPFS not being available */
                /* or some other error, hence call the default */
-               ret = linux_setlease(fd, leasetype);
+               ret = linux_setlease(fsp->fh->fd, leasetype);
        }
 
        END_PROFILE(syscall_linux_setlease);
@@ -153,7 +153,7 @@ static int gpfs_get_nfs4_acl(const char *fname, SMB4ACL_T **ppacl)
        DEBUG(10, ("gpfs_get_nfs4_acl invoked for %s\n", fname));
 
        /* First get the real acl length */
-       gacl = gpfs_getacl_alloc(fname, GPFS_ACL_TYPE_NFS4);
+       gacl = gpfs_getacl_alloc(fname, 0);
        if (gacl == NULL) {
                DEBUG(9, ("gpfs_getacl failed for %s with %s\n",
                           fname, strerror(errno)));
@@ -208,10 +208,10 @@ static int gpfs_get_nfs4_acl(const char *fname, SMB4ACL_T **ppacl)
                if (i > 0 && gace->aceType == SMB_ACE4_ACCESS_DENIED_ACE_TYPE) {
                        struct gpfs_ace_v4 *prev = &gacl->ace_v4[i-1];
                        if (prev->aceType == SMB_ACE4_ACCESS_ALLOWED_ACE_TYPE &&
-                                       prev->aceFlags == gace->aceFlags &&
-                                       prev->aceIFlags == gace->aceIFlags &&
-                                       (gace->aceMask & prev->aceMask) == 0 &&
-                                       gace->aceWho == prev->aceWho) {
+                           prev->aceFlags == gace->aceFlags &&
+                           prev->aceIFlags == gace->aceIFlags &&
+                           (gace->aceMask & prev->aceMask) == 0 &&
+                           gace->aceWho == prev->aceWho) {
                                /* its redundent - skip it */
                                continue;
                        }                                                
@@ -226,8 +226,9 @@ static int gpfs_get_nfs4_acl(const char *fname, SMB4ACL_T **ppacl)
        return 0;
 }
 
-static NTSTATUS gpfsacl_get_nt_acl_common(files_struct *fsp,
-       uint32 security_info, SEC_DESC **ppdesc)
+static NTSTATUS gpfsacl_fget_nt_acl(vfs_handle_struct *handle,
+       files_struct *fsp, uint32 security_info,
+       SEC_DESC **ppdesc)
 {
        SMB4ACL_T *pacl = NULL;
        int     result;
@@ -236,29 +237,37 @@ static NTSTATUS gpfsacl_get_nt_acl_common(files_struct *fsp,
        result = gpfs_get_nfs4_acl(fsp->fsp_name, &pacl);
 
        if (result == 0)
-               return smb_get_nt_acl_nfs4(fsp, security_info, ppdesc, pacl);
+               return smb_fget_nt_acl_nfs4(fsp, security_info, ppdesc, pacl);
 
        if (result > 0) {
                DEBUG(10, ("retrying with posix acl...\n"));
-               return get_nt_acl(fsp, security_info, ppdesc);
+               return posix_fget_nt_acl(fsp, security_info, ppdesc);
        }
-       
+
        /* GPFS ACL was not read, something wrong happened, error code is set in errno */
        return map_nt_error_from_unix(errno);
 }
 
-NTSTATUS gpfsacl_fget_nt_acl(vfs_handle_struct *handle,
-       files_struct *fsp, int fd, uint32 security_info,
-       SEC_DESC **ppdesc)
-{
-        return gpfsacl_get_nt_acl_common(fsp, security_info, ppdesc);
-}
-
-NTSTATUS gpfsacl_get_nt_acl(vfs_handle_struct *handle,
-       files_struct *fsp, const char *name,
+static NTSTATUS gpfsacl_get_nt_acl(vfs_handle_struct *handle,
+       const char *name,
        uint32 security_info, SEC_DESC **ppdesc)
 {
-       return gpfsacl_get_nt_acl_common(fsp, security_info, ppdesc);
+       SMB4ACL_T *pacl = NULL;
+       int     result;
+
+       *ppdesc = NULL;
+       result = gpfs_get_nfs4_acl(name, &pacl);
+
+       if (result == 0)
+               return smb_get_nt_acl_nfs4(handle->conn, name, security_info, ppdesc, pacl);
+
+       if (result > 0) {
+               DEBUG(10, ("retrying with posix acl...\n"));
+               return posix_get_nt_acl(handle->conn, name, security_info, ppdesc);
+       }
+
+       /* GPFS ACL was not read, something wrong happened, error code is set in errno */
+       return map_nt_error_from_unix(errno);
 }
 
 static bool gpfsacl_process_smbacl(files_struct *fsp, SMB4ACL_T *smbacl)
@@ -292,8 +301,31 @@ static bool gpfsacl_process_smbacl(files_struct *fsp, SMB4ACL_T *smbacl)
                gace->aceType = aceprop->aceType;
                gace->aceFlags = aceprop->aceFlags;
                gace->aceMask = aceprop->aceMask;
+               
+               /*
+                * GPFS can't distinguish between WRITE and APPEND on
+                * files, so one being set without the other is an
+                * error. Sorry for the many ()'s :-)
+                */
+               
+               if (!fsp->is_directory
+                   &&
+                   ((((gace->aceMask & ACE4_MASK_WRITE) == 0)
+                     && ((gace->aceMask & ACE4_MASK_APPEND) != 0))
+                    ||
+                    (((gace->aceMask & ACE4_MASK_WRITE) != 0)
+                     && ((gace->aceMask & ACE4_MASK_APPEND) == 0)))
+                   &&
+                   lp_parm_bool(fsp->conn->params->service, "gpfs",
+                                "merge_writeappend", True)) {
+                       DEBUG(2, ("vfs_gpfs.c: file [%s]: ACE contains "
+                                 "WRITE^APPEND, setting WRITE|APPEND\n",
+                                 fsp->fsp_name));
+                       gace->aceMask |= ACE4_MASK_WRITE|ACE4_MASK_APPEND;
+               }
+               
                gace->aceIFlags = (aceprop->flags&SMB_ACE4_ID_SPECIAL) ? ACE4_IFLAG_SPECIAL_ID : 0;
-
+               
                if (aceprop->flags&SMB_ACE4_ID_SPECIAL)
                {
                        switch(aceprop->who.special_id)
@@ -338,7 +370,7 @@ static NTSTATUS gpfsacl_set_nt_acl_internal(files_struct *fsp, uint32 security_i
        struct gpfs_acl *acl;
        NTSTATUS result = NT_STATUS_ACCESS_DENIED;
 
-       acl = gpfs_getacl_alloc(fsp->fsp_name, GPFS_ACL_TYPE_ACCESS);
+       acl = gpfs_getacl_alloc(fsp->fsp_name, 0);
        if (acl == NULL)
                return result;
 
@@ -354,7 +386,7 @@ static NTSTATUS gpfsacl_set_nt_acl_internal(files_struct *fsp, uint32 security_i
        return result;
 }
 
-static NTSTATUS gpfsacl_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, int fd, uint32 security_info_sent, SEC_DESC *psd)
+static NTSTATUS gpfsacl_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, uint32 security_info_sent, SEC_DESC *psd)
 {
        return gpfsacl_set_nt_acl_internal(fsp, security_info_sent, psd);
 }
@@ -492,8 +524,7 @@ SMB_ACL_T gpfsacl_sys_acl_get_file(vfs_handle_struct *handle,
 }
 
 SMB_ACL_T gpfsacl_sys_acl_get_fd(vfs_handle_struct *handle,
-                                 files_struct *fsp,
-                                 int fd)
+                                files_struct *fsp)
 {
        return gpfsacl_get_posix_acl(fsp->fsp_name, GPFS_ACL_TYPE_ACCESS);
 }
@@ -607,7 +638,7 @@ int gpfsacl_sys_acl_set_file(vfs_handle_struct *handle,
 
 int gpfsacl_sys_acl_set_fd(vfs_handle_struct *handle,
                            files_struct *fsp,
-                           int fd, SMB_ACL_T theacl)
+                           SMB_ACL_T theacl)
 {
        return gpfsacl_sys_acl_set_file(handle, fsp->fsp_name, SMB_ACL_TYPE_ACCESS, theacl);
 }
@@ -620,75 +651,225 @@ int gpfsacl_sys_acl_delete_def_file(vfs_handle_struct *handle,
        return -1;
 }
 
+/*
+ * Assumed: mode bits are shiftable and standard
+ * Output: the new aceMask field for an smb nfs4 ace
+ */
+static uint32 gpfsacl_mask_filter(uint32 aceType, uint32 aceMask, uint32 rwx)
+{
+       const uint32 posix_nfs4map[3] = {
+                SMB_ACE4_EXECUTE, /* execute */
+               SMB_ACE4_WRITE_DATA | SMB_ACE4_APPEND_DATA, /* write; GPFS specific */
+                SMB_ACE4_READ_DATA /* read */
+       };
+       int     i;
+       uint32_t        posix_mask = 0x01;
+       uint32_t        posix_bit;
+       uint32_t        nfs4_bits;
+       
+       for(i=0; i<3; i++) {
+               nfs4_bits = posix_nfs4map[i];
+               posix_bit = rwx & posix_mask;
+               
+               if (aceType==SMB_ACE4_ACCESS_ALLOWED_ACE_TYPE) {
+                       if (posix_bit)
+                               aceMask |= nfs4_bits;
+                       else
+                               aceMask &= ~nfs4_bits;
+               } else {
+                       /* add deny bits when suitable */
+                       if (!posix_bit)
+                               aceMask |= nfs4_bits;
+                       else
+                               aceMask &= ~nfs4_bits;
+               } /* other ace types are unexpected */
+               
+               posix_mask <<= 1;
+       }
+       
+       return aceMask;
+}
+
+static int gpfsacl_emu_chmod(const char *path, mode_t mode)
+{
+       SMB4ACL_T *pacl = NULL;
+       int     result;
+       bool    haveAllowEntry[SMB_ACE4_WHO_EVERYONE + 1] = {False, False, False, False};
+       int     i;
+       files_struct    fake_fsp; /* TODO: rationalize parametrization */
+       SMB4ACE_T       *smbace;
+       
+       DEBUG(10, ("gpfsacl_emu_chmod invoked for %s mode %o\n", path, mode));
+       
+       result = gpfs_get_nfs4_acl(path, &pacl);
+       if (result)
+               return result;
+       
+       if (mode & ~(S_IRWXU | S_IRWXG | S_IRWXO)) {
+               DEBUG(2, ("WARNING: cutting extra mode bits %o on %s\n", mode, path));
+       }
+       
+       for (smbace=smb_first_ace4(pacl); smbace!=NULL; smbace = smb_next_ace4(smbace)) {
+               SMB_ACE4PROP_T  *ace = smb_get_ace4(smbace);
+               uint32_t        specid = ace->who.special_id;
+               
+               if (ace->flags&SMB_ACE4_ID_SPECIAL &&
+                   ace->aceType<=SMB_ACE4_ACCESS_DENIED_ACE_TYPE &&
+                   specid <= SMB_ACE4_WHO_EVERYONE) {
+                       
+                       uint32_t newMask;
+                       
+                       if (ace->aceType==SMB_ACE4_ACCESS_ALLOWED_ACE_TYPE)
+                               haveAllowEntry[specid] = True;
+                       
+                       /* mode >> 6 for @owner, mode >> 3 for @group,
+                        * mode >> 0 for @everyone */
+                       newMask = gpfsacl_mask_filter(ace->aceType, ace->aceMask,
+                                                     mode >> ((SMB_ACE4_WHO_EVERYONE - specid) * 3));
+                       if (ace->aceMask!=newMask) {
+                               DEBUG(10, ("ace changed for %s (%o -> %o) id=%d\n",
+                                          path, ace->aceMask, newMask, specid));
+                       }
+                       ace->aceMask = newMask;
+               }
+       }
+
+       /* make sure we have at least ALLOW entries
+        * for all the 3 special ids (@EVERYONE, @OWNER, @GROUP)
+        * - if necessary
+        */
+       for(i = SMB_ACE4_WHO_OWNER; i<=SMB_ACE4_WHO_EVERYONE; i++) {
+               SMB_ACE4PROP_T  ace;
+               
+               if (haveAllowEntry[i]==True)
+                       continue;
+               
+               memset(&ace, 0, sizeof(SMB_ACE4PROP_T));
+               ace.aceType = SMB_ACE4_ACCESS_ALLOWED_ACE_TYPE;
+               ace.flags |= SMB_ACE4_ID_SPECIAL;
+               ace.who.special_id = i;
+               
+               if (i==SMB_ACE4_WHO_GROUP) /* not sure it's necessary... */
+                       ace.aceFlags |= SMB_ACE4_IDENTIFIER_GROUP;
+               
+               ace.aceMask = gpfsacl_mask_filter(ace.aceType, ace.aceMask,
+                                                 mode >> ((SMB_ACE4_WHO_EVERYONE - i) * 3));
+               
+               /* don't add unnecessary aces */
+               if (!ace.aceMask)
+                       continue;
+               
+               /* we add it to the END - as windows expects allow aces */
+               smb_add_ace4(pacl, &ace);
+               DEBUG(10, ("Added ALLOW ace for %s, mode=%o, id=%d, aceMask=%x\n",
+                          path, mode, i, ace.aceMask));
+       }
+       
+       /* don't add complementary DENY ACEs here */
+       memset(&fake_fsp, 0, sizeof(struct files_struct));
+       fake_fsp.fsp_name = (char *)path; /* no file_new is needed here */
+       
+       /* put the acl */
+       if (gpfsacl_process_smbacl(&fake_fsp, pacl) == False)
+               return -1;
+       return 0; /* ok for [f]chmod */
+}
+
 static int vfs_gpfs_chmod(vfs_handle_struct *handle, const char *path, mode_t mode)
 {
                 SMB_STRUCT_STAT st;
+                int rc;
+                
                 if (SMB_VFS_NEXT_STAT(handle, path, &st) != 0) {
-                                return -1;
+                        return -1;
                 }
+                
                 /* avoid chmod() if possible, to preserve acls */
                 if ((st.st_mode & ~S_IFMT) == mode) {
-                                return 0;
+                        return 0;
                 }
-                return SMB_VFS_NEXT_CHMOD(handle, path, mode);
+
+                rc = gpfsacl_emu_chmod(path, mode);
+                if (rc == 1)
+                        return SMB_VFS_NEXT_CHMOD(handle, path, mode);
+                return rc;
 }
 
-static int vfs_gpfs_fchmod(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode)
+static int vfs_gpfs_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t mode)
 {
                 SMB_STRUCT_STAT st;
-                if (SMB_VFS_NEXT_FSTAT(handle, fsp, fd, &st) != 0) {
-                                return -1;
+                int rc;
+                
+                if (SMB_VFS_NEXT_FSTAT(handle, fsp, &st) != 0) {
+                        return -1;
                 }
+
                 /* avoid chmod() if possible, to preserve acls */
                 if ((st.st_mode & ~S_IFMT) == mode) {
-                                return 0;
+                        return 0;
                 }
-                return SMB_VFS_NEXT_FCHMOD(handle, fsp, fd, mode);
+
+                rc = gpfsacl_emu_chmod(fsp->fsp_name, mode);
+                if (rc == 1)
+                        return SMB_VFS_NEXT_FCHMOD(handle, fsp, mode);
+                return rc;
 }
 
 /* VFS operations structure */
 
 static vfs_op_tuple gpfs_op_tuples[] = {
-
-               { SMB_VFS_OP(vfs_gpfs_kernel_flock), SMB_VFS_OP_KERNEL_FLOCK,
-                               SMB_VFS_LAYER_OPAQUE },
-
-        { SMB_VFS_OP(vfs_gpfs_setlease), SMB_VFS_OP_LINUX_SETLEASE,
-                       SMB_VFS_LAYER_OPAQUE },
-
-        { SMB_VFS_OP(gpfsacl_fget_nt_acl), SMB_VFS_OP_FGET_NT_ACL,
-                       SMB_VFS_LAYER_TRANSPARENT },
-
-        { SMB_VFS_OP(gpfsacl_get_nt_acl), SMB_VFS_OP_GET_NT_ACL,
-                       SMB_VFS_LAYER_TRANSPARENT },
-
-        { SMB_VFS_OP(gpfsacl_fset_nt_acl), SMB_VFS_OP_FSET_NT_ACL,
-                       SMB_VFS_LAYER_TRANSPARENT },
-
-        { SMB_VFS_OP(gpfsacl_set_nt_acl), SMB_VFS_OP_SET_NT_ACL,
-                       SMB_VFS_LAYER_TRANSPARENT },
-
-        { SMB_VFS_OP(gpfsacl_sys_acl_get_file), SMB_VFS_OP_SYS_ACL_GET_FILE,
-                       SMB_VFS_LAYER_TRANSPARENT },
-
-        { SMB_VFS_OP(gpfsacl_sys_acl_get_fd), SMB_VFS_OP_SYS_ACL_GET_FD,
-                       SMB_VFS_LAYER_TRANSPARENT },
-
-        { SMB_VFS_OP(gpfsacl_sys_acl_set_file), SMB_VFS_OP_SYS_ACL_SET_FILE,
-                       SMB_VFS_LAYER_TRANSPARENT },
-
-        { SMB_VFS_OP(gpfsacl_sys_acl_set_fd), SMB_VFS_OP_SYS_ACL_SET_FD,
-                       SMB_VFS_LAYER_TRANSPARENT },
-
+       
+       { SMB_VFS_OP(vfs_gpfs_kernel_flock), 
+         SMB_VFS_OP_KERNEL_FLOCK,
+         SMB_VFS_LAYER_OPAQUE },
+       
+        { SMB_VFS_OP(vfs_gpfs_setlease), 
+         SMB_VFS_OP_LINUX_SETLEASE,
+         SMB_VFS_LAYER_OPAQUE },
+       
+        { SMB_VFS_OP(gpfsacl_fget_nt_acl), 
+         SMB_VFS_OP_FGET_NT_ACL,
+         SMB_VFS_LAYER_TRANSPARENT },
+       
+        { SMB_VFS_OP(gpfsacl_get_nt_acl), 
+         SMB_VFS_OP_GET_NT_ACL,
+         SMB_VFS_LAYER_TRANSPARENT },
+       
+        { SMB_VFS_OP(gpfsacl_fset_nt_acl), 
+         SMB_VFS_OP_FSET_NT_ACL,
+         SMB_VFS_LAYER_TRANSPARENT },
+       
+        { SMB_VFS_OP(gpfsacl_set_nt_acl), 
+         SMB_VFS_OP_SET_NT_ACL,
+         SMB_VFS_LAYER_TRANSPARENT },
+       
+        { SMB_VFS_OP(gpfsacl_sys_acl_get_file), 
+         SMB_VFS_OP_SYS_ACL_GET_FILE,
+         SMB_VFS_LAYER_TRANSPARENT },
+       
+        { SMB_VFS_OP(gpfsacl_sys_acl_get_fd), 
+         SMB_VFS_OP_SYS_ACL_GET_FD,
+         SMB_VFS_LAYER_TRANSPARENT },
+       
+        { SMB_VFS_OP(gpfsacl_sys_acl_set_file), 
+         SMB_VFS_OP_SYS_ACL_SET_FILE,
+         SMB_VFS_LAYER_TRANSPARENT },
+       
+        { SMB_VFS_OP(gpfsacl_sys_acl_set_fd), 
+         SMB_VFS_OP_SYS_ACL_SET_FD,
+         SMB_VFS_LAYER_TRANSPARENT },
+       
         { SMB_VFS_OP(gpfsacl_sys_acl_delete_def_file),
-                SMB_VFS_OP_SYS_ACL_DELETE_DEF_FILE,
-                SMB_VFS_LAYER_TRANSPARENT },
-
-        { SMB_VFS_OP(vfs_gpfs_chmod), SMB_VFS_OP_CHMOD,
-                SMB_VFS_LAYER_TRANSPARENT },
-
-        { SMB_VFS_OP(vfs_gpfs_fchmod), SMB_VFS_OP_FCHMOD,
-                SMB_VFS_LAYER_TRANSPARENT },
+         SMB_VFS_OP_SYS_ACL_DELETE_DEF_FILE,
+         SMB_VFS_LAYER_TRANSPARENT },
+       
+        { SMB_VFS_OP(vfs_gpfs_chmod), 
+         SMB_VFS_OP_CHMOD,
+         SMB_VFS_LAYER_TRANSPARENT },
+       
+        { SMB_VFS_OP(vfs_gpfs_fchmod), 
+         SMB_VFS_OP_FCHMOD,
+         SMB_VFS_LAYER_TRANSPARENT },
 
         { SMB_VFS_OP(NULL), SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP }
 
diff --git a/source/modules/vfs_gpfs.h b/source/modules/vfs_gpfs.h
new file mode 100644 (file)
index 0000000..3c499b0
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+   Unix SMB/CIFS implementation.
+   Wrap gpfs calls in vfs functions.
+   Copyright (C) Christian Ambach <cambach1@de.ibm.com> 2006
+   
+   Major code contributions by Chetan Shringarpure <chetan.sh@in.ibm.com>
+                            and Gomati Mohanan <gomati.mohanan@in.ibm.com>
+   
+   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 2 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, write to the Free Software
+   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+  
+
+*/
+
+bool set_gpfs_sharemode(files_struct *fsp, uint32 access_mask,
+                       uint32 share_access);
+int set_gpfs_lease(int fd, int leasetype);
+int smbd_gpfs_getacl(char *pathname, int flags, void *acl);
+int smbd_gpfs_putacl(char *pathname, int flags, void *acl);
+void init_gpfs(void);
index edce161c19eb215a728055bd956189b289db240e..f9293405fb41912083fd98330b54e0bcabadca4c 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Unix SMB/Netbios implementation.
  * VFS module to get and set HP-UX ACLs
- * Copyright (C) Michael Adam 2006
+ * Copyright (C) Michael Adam 2006,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
@@ -140,7 +140,7 @@ SMB_ACL_T hpuxacl_sys_acl_get_file(vfs_handle_struct *handle,
 {
        SMB_ACL_T result = NULL;
        int count;
-       HPUX_ACL_T hpux_acl;
+       HPUX_ACL_T hpux_acl = NULL;
        
        DEBUG(10, ("hpuxacl_sys_acl_get_file called for file '%s'.\n", 
                   path_p));
@@ -182,15 +182,14 @@ SMB_ACL_T hpuxacl_sys_acl_get_file(vfs_handle_struct *handle,
  * get the access ACL of a file referred to by a fd
  */
 SMB_ACL_T hpuxacl_sys_acl_get_fd(vfs_handle_struct *handle,
-                                files_struct *fsp,
-                                int fd)
+                                files_struct *fsp)
 {
         /* 
         * HPUX doesn't have the facl call. Fake it using the path.... JRA. 
         */
        /* For all I see, the info should already be in the fsp
         * parameter, but get it again to be safe --- necessary? */
-        files_struct *file_struct_p = file_find_fd(fd);
+        files_struct *file_struct_p = file_find_fd(fsp->fh->fd);
         if (file_struct_p == NULL) {
                 errno = EBADF;
                 return NULL;
@@ -214,7 +213,7 @@ int hpuxacl_sys_acl_set_file(vfs_handle_struct *handle,
 {
        int ret = -1;
        SMB_STRUCT_STAT s;
-       HPUX_ACL_T hpux_acl;
+       HPUX_ACL_T hpux_acl = NULL;
        int count;
        
        DEBUG(10, ("hpuxacl_sys_acl_set_file called for file '%s'\n",
@@ -307,14 +306,14 @@ int hpuxacl_sys_acl_set_file(vfs_handle_struct *handle,
  */
 int hpuxacl_sys_acl_set_fd(vfs_handle_struct *handle,
                              files_struct *fsp,
-                             int fd, SMB_ACL_T theacl)
+                             SMB_ACL_T theacl)
 {
         /*
          * HPUX doesn't have the facl call. Fake it using the path.... JRA.
          */
        /* For all I see, the info should already be in the fsp
         * parameter, but get it again to be safe --- necessary? */
-        files_struct *file_struct_p = file_find_fd(fd);
+        files_struct *file_struct_p = file_find_fd(fsp->fh->fd);
         if (file_struct_p == NULL) {
                 errno = EBADF;
                 return -1;
index dab6deb747eed806c073cc1dc7ab83ad3c54b625..6484e8f3eb927e246d3eaec0e8bab63ab2cc539a 100644 (file)
@@ -1,7 +1,7 @@
 /*
    Unix SMB/Netbios implementation.
    VFS module to get and set irix acls
-   Copyright (C) Michael Adam 2006
+   Copyright (C) Michael Adam 2006,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
@@ -32,8 +32,7 @@ SMB_ACL_T irixacl_sys_acl_get_file(vfs_handle_struct *handle,
 }
 
 SMB_ACL_T irixacl_sys_acl_get_fd(vfs_handle_struct *handle,
-                                 files_struct *fsp,
-                                 int fd)
+                                files_struct *fsp)
 {
        errno = ENOTSUP;
        return NULL;
@@ -50,7 +49,7 @@ int irixacl_sys_acl_set_file(vfs_handle_struct *handle,
 
 int irixacl_sys_acl_set_fd(vfs_handle_struct *handle,
                            files_struct *fsp,
-                           int fd, SMB_ACL_T theacl)
+                           SMB_ACL_T theacl)
 {
        errno = ENOTSUP;
        return -1;
index fb0c0bc8e906cf176f43ed2cf2028756ccd10d3e..21fb2ada3196d2f2903ee0b7a608edb088b0040c 100644 (file)
@@ -63,11 +63,10 @@ SMB_ACL_T posixacl_sys_acl_get_file(vfs_handle_struct *handle,
 }
 
 SMB_ACL_T posixacl_sys_acl_get_fd(vfs_handle_struct *handle,
-                                 files_struct *fsp,
-                                 int fd)
+                                 files_struct *fsp)
 {
        struct smb_acl_t *result;
-       acl_t acl = acl_get_fd(fd);
+       acl_t acl = acl_get_fd(fsp->fh->fd);
 
        if (acl == NULL) {
                return NULL;
@@ -114,14 +113,14 @@ int posixacl_sys_acl_set_file(vfs_handle_struct *handle,
 
 int posixacl_sys_acl_set_fd(vfs_handle_struct *handle,
                            files_struct *fsp,
-                           int fd, SMB_ACL_T theacl)
+                           SMB_ACL_T theacl)
 {
        int res;
        acl_t acl = smb_acl_to_posix(theacl);
        if (acl == NULL) {
                return -1;
        }
-       res =  acl_set_fd(fd, acl);
+       res =  acl_set_fd(fsp->fh->fd, acl);
        acl_free(acl);
        return res;
 }
index cebf3a3933747a1281813ae6e67e2bbdbfbde0b9..cb3508dc30f7dd291759c34854fb932cb764122a 100644 (file)
 #define lock_type struct flock64
 #endif
 
+#ifdef HAVE_GPFS
+#include "gpfs_gpl.h"
+#endif
+
 #define MODULE "prealloc"
 static int module_debug;
 
 static int preallocate_space(int fd, SMB_OFF_T size)
 {
+#ifndef HAVE_GPFS
        lock_type fl = {0};
        int err;
 
@@ -78,6 +83,9 @@ static int preallocate_space(int fd, SMB_OFF_T size)
        err = -1;
        errno = ENOSYS;
 #endif
+#else /* GPFS uses completely different interface */
+       err = gpfs_prealloc(fd, (gpfs_off64_t)0, (gpfs_off64_t)size);
+#endif
 
        if (err) {
                DEBUG(module_debug,
@@ -184,11 +192,10 @@ normal_open:
 
 static int prealloc_ftruncate(vfs_handle_struct * handle,
                        files_struct *  fsp,
-                       int             fd,
                        SMB_OFF_T       offset)
 {
        SMB_OFF_T *psize;
-       int ret = SMB_VFS_NEXT_FTRUNCATE(handle, fsp, fd, offset);
+       int ret = SMB_VFS_NEXT_FTRUNCATE(handle, fsp, offset);
 
        /* Maintain the allocated space even in the face of truncates. */
        if ((psize = VFS_FETCH_FSP_EXTENSION(handle, fsp))) {
index 5b663a7b260041fa7f485a217f581ec16f349952..df75814b7248dd6932601bbb1ac7424e087a45a7 100644 (file)
 
 #include "includes.h"
 
-#if !defined(HAVE_LINUX_READAHEAD) && !defined(HAVE_POSIX_FADVISE)
-static bool didmsg;
-#endif
-
 struct readahead_data {
        SMB_OFF_T off_bound;
        SMB_OFF_T len;
@@ -39,8 +35,7 @@ struct readahead_data {
 
 static ssize_t readahead_sendfile(struct vfs_handle_struct *handle,
                                        int tofd,
-                                       files_struct *fsp,
-                                       int fromfd,
+                                       files_struct *fromfsp,
                                        const DATA_BLOB *header,
                                        SMB_OFF_T offset,
                                        size_t count)
@@ -49,16 +44,16 @@ static ssize_t readahead_sendfile(struct vfs_handle_struct *handle,
 
        if ( offset % rhd->off_bound == 0) {
 #if defined(HAVE_LINUX_READAHEAD)
-               int err = readahead(fromfd, offset, (size_t)rhd->len);
+               int err = readahead(fromfsp->fh->fd, offset, (size_t)rhd->len);
                DEBUG(10,("readahead_sendfile: readahead on fd %u, offset %llu, len %u returned %d\n",
-                       (unsigned int)fromfd,
+                       (unsigned int)fromfsp->fh->fd,
                        (unsigned long long)offset,
                        (unsigned int)rhd->len,
                        err ));
 #elif defined(HAVE_POSIX_FADVISE)
-               int err = posix_fadvise(fromfd, offset, (off_t)rhd->len, POSIX_FADV_WILLNEED);
+               int err = posix_fadvise(fromfsp->fh->fd, offset, (off_t)rhd->len, POSIX_FADV_WILLNEED);
                DEBUG(10,("readahead_sendfile: posix_fadvise on fd %u, offset %llu, len %u returned %d\n",
-                       (unsigned int)fromfd,
+                       (unsigned int)fromfsp->fh->fd,
                        (unsigned long long)offset,
                        (unsigned int)rhd->len,
                        err ));
@@ -71,8 +66,7 @@ static ssize_t readahead_sendfile(struct vfs_handle_struct *handle,
        }
        return SMB_VFS_NEXT_SENDFILE(handle,
                                        tofd,
-                                       fsp,
-                                       fromfd,
+                                       fromfsp,
                                        header,
                                        offset,
                                        count);
@@ -84,7 +78,6 @@ static ssize_t readahead_sendfile(struct vfs_handle_struct *handle,
 
 static ssize_t readahead_pread(vfs_handle_struct *handle,
                                files_struct *fsp,
-                               int fd,
                                void *data,
                                size_t count,
                                SMB_OFF_T offset)
@@ -93,16 +86,16 @@ static ssize_t readahead_pread(vfs_handle_struct *handle,
 
        if ( offset % rhd->off_bound == 0) {
 #if defined(HAVE_LINUX_READAHEAD)
-               int err = readahead(fd, offset, (size_t)rhd->len);
+               int err = readahead(fsp->fh->fd, offset, (size_t)rhd->len);
                DEBUG(10,("readahead_pread: readahead on fd %u, offset %llu, len %u returned %d\n",
-                       (unsigned int)fd,
+                       (unsigned int)fsp->fh->fd,
                        (unsigned long long)offset,
                        (unsigned int)rhd->len,
                        err ));
 #elif defined(HAVE_POSIX_FADVISE)
-               int err = posix_fadvise(fd, offset, (off_t)rhd->len, POSIX_FADV_WILLNEED);
+               int err = posix_fadvise(fsp->fh->fd, offset, (off_t)rhd->len, POSIX_FADV_WILLNEED);
                DEBUG(10,("readahead_pread: posix_fadvise on fd %u, offset %llu, len %u returned %d\n",
-                       (unsigned int)fd,
+                       (unsigned int)fsp->fh->fd,
                        (unsigned long long)offset,
                        (unsigned int)rhd->len,
                        err ));
@@ -113,7 +106,7 @@ static ssize_t readahead_pread(vfs_handle_struct *handle,
                }
 #endif
         }
-        return SMB_VFS_NEXT_PREAD(handle, fsp, fd, data, count, offset);
+        return SMB_VFS_NEXT_PREAD(handle, fsp, data, count, offset);
 }
 
 /*******************************************************************
index fef65efa7790cd52ea79673e2fd5f1a7cb1bfc13..da1716719ae5a9d09ec1d08e0e0db9a49c1e5ae0 100644 (file)
@@ -269,6 +269,7 @@ static bool recycle_create_dir(vfs_handle_struct *handle, const char *dname)
        char *token;
        char *tok_str;
        bool ret = False;
+       char *saveptr;
 
        mode = recycle_directory_mode(handle);
 
@@ -286,7 +287,8 @@ static bool recycle_create_dir(vfs_handle_struct *handle, const char *dname)
        }
 
        /* Create directory tree if neccessary */
-       for(token = strtok(tok_str, "/"); token; token = strtok(NULL, "/")) {
+       for(token = strtok_r(tok_str, "/", &saveptr); token;
+           token = strtok_r(NULL, "/", &saveptr)) {
                safe_strcat(new_dir, token, len);
                if (recycle_directory_exist(handle, new_dir))
                        DEBUG(10, ("recycle: dir %s already exists\n", new_dir));
diff --git a/source/modules/vfs_shadow_copy2.c b/source/modules/vfs_shadow_copy2.c
new file mode 100644 (file)
index 0000000..ddbc5aa
--- /dev/null
@@ -0,0 +1,637 @@
+/* 
+ * implementation of an Shadow Copy module - version 2
+ *
+ * Copyright (C) Andrew Tridgell     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 2 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, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include "includes.h"
+
+/*
+
+  This is a 2nd implemetation of a shadow copy module for exposing
+  snapshots to windows clients as shadow copies. This version has the
+  following features:
+
+     1) you don't need to populate your shares with symlinks to the
+     snapshots. This can be very important when you have thousands of
+     shares, or use [homes]
+
+     2) the inode number of the files is altered so it is different
+     from the original. This allows the 'restore' button to work
+     without a sharing violation
+
+  Module options:
+
+      shadow:snapdir = <directory where snapshots are kept>
+
+      This is the directory containing the @GMT-* snapshot directories. If it is an absolute
+      path it is used as-is. If it is a relative path, then it is taken relative to the mount
+      point of the filesystem that the root of this share is on
+
+      shadow:basedir = <base directory that snapshots are from>
+
+      This is an optional parameter that specifies the directory that
+      the snapshots are relative to. It defaults to the filesystem
+      mount point
+
+      shadow:fixinodes = yes/no
+
+      If you enable shadow:fixinodes then this module will modify the
+      apparent inode number of files in the snapshot directories using
+      a hash of the files path. This is needed for snapshot systems
+      where the snapshots have the same device:inode number as the
+      original files (such as happens with GPFS snapshots). If you
+      don't set this option then the 'restore' button in the shadow
+      copy UI will fail with a sharing violation.
+
+  Note that the directory names in the snapshot directory must take the form
+  @GMT-YYYY.MM.DD-HH.MM.SS
+  
+  The following command would generate a correctly formatted directory name:
+     date -u +@GMT-%Y.%m.%d-%H.%M.%S
+  
+ */
+
+static int vfs_shadow_copy2_debug_level = DBGC_VFS;
+
+#undef DBGC_CLASS
+#define DBGC_CLASS vfs_shadow_copy2_debug_level
+
+#define GMT_NAME_LEN 24 /* length of a @GMT- name */
+
+/*
+  make very sure it is one of our special names 
+ */
+static inline bool shadow_copy2_match_name(const char *name)
+{
+       unsigned year, month, day, hr, min, sec;
+       if (name[0] != '@') return False;
+       if (strncmp(name, "@GMT-", 5) != 0) return False;
+       if (sscanf(name, "@GMT-%04u.%02u.%02u-%02u.%02u.%02u", &year, &month,
+                  &day, &hr, &min, &sec) != 6) {
+               return False;
+       }
+       if (name[24] != 0 && name[24] != '/') {
+               return False;
+       }
+       return True;
+}
+
+/*
+  convert a name to the shadow directory
+ */
+
+#define _SHADOW2_NEXT(op, args, rtype, eret, extra) do { \
+       const char *name = fname; \
+       if (shadow_copy2_match_name(fname)) { \
+               char *name2; \
+               rtype ret; \
+               name2 = convert_shadow2_name(handle, fname); \
+               if (name2 == NULL) { \
+                       errno = EINVAL; \
+                       return eret; \
+               } \
+               name = name2; \
+               ret = SMB_VFS_NEXT_ ## op args; \
+               talloc_free(name2); \
+               if (ret != eret) extra; \
+               return ret; \
+       } else { \
+               return SMB_VFS_NEXT_ ## op args; \
+       } \
+} while (0)
+
+/*
+  convert a name to the shadow directory: NTSTATUS-specific handling
+ */
+
+#define _SHADOW2_NTSTATUS_NEXT(op, args, eret, extra) do { \
+        const char *name = fname; \
+        if (shadow_copy2_match_name(fname)) { \
+                char *name2; \
+                NTSTATUS ret; \
+                name2 = convert_shadow2_name(handle, fname); \
+                if (name2 == NULL) { \
+                        errno = EINVAL; \
+                        return eret; \
+                } \
+                name = name2; \
+                ret = SMB_VFS_NEXT_ ## op args; \
+                talloc_free(name2); \
+                if (!NT_STATUS_EQUAL(ret, eret)) extra; \
+                return ret; \
+        } else { \
+                return SMB_VFS_NEXT_ ## op args; \
+        } \
+} while (0)
+
+#define SHADOW2_NTSTATUS_NEXT(op, args, eret) _SHADOW2_NTSTATUS_NEXT(op, args, eret, )
+
+#define SHADOW2_NEXT(op, args, rtype, eret) _SHADOW2_NEXT(op, args, rtype, eret, )
+
+#define SHADOW2_NEXT2(op, args) do { \
+       if (shadow_copy2_match_name(oldname) || shadow_copy2_match_name(newname)) { \
+               errno = EROFS; \
+               return -1; \
+       } else { \
+               return SMB_VFS_NEXT_ ## op args; \
+       } \
+} while (0)
+
+
+/*
+  find the mount point of a filesystem
+ */
+static char *find_mount_point(TALLOC_CTX *mem_ctx, vfs_handle_struct *handle)
+{
+       char *path = talloc_strdup(mem_ctx, handle->conn->connectpath);
+       dev_t dev;
+       struct stat st;
+       char *p;
+
+       if (stat(path, &st) != 0) {
+               talloc_free(path);
+               return NULL;
+       }
+
+       dev = st.st_dev;
+
+       while ((p = strrchr(path, '/')) && p > path) {
+               *p = 0;
+               if (stat(path, &st) != 0) {
+                       talloc_free(path);
+                       return NULL;
+               }
+               if (st.st_dev != dev) {
+                       *p = '/';
+                       break;
+               }
+       }
+
+       return path;    
+}
+
+/*
+  work out the location of the snapshot for this share
+ */
+static const char *shadow_copy2_find_snapdir(TALLOC_CTX *mem_ctx, vfs_handle_struct *handle)
+{
+       const char *snapdir;
+       char *mount_point;
+       const char *ret;
+
+       snapdir = lp_parm_const_string(SNUM(handle->conn), "shadow", "snapdir", NULL);
+       if (snapdir == NULL) {
+               return NULL;
+       }
+       /* if its an absolute path, we're done */
+       if (*snapdir == '/') {
+               return snapdir;
+       }
+
+       /* other its relative to the filesystem mount point */
+       mount_point = find_mount_point(mem_ctx, handle);
+       if (mount_point == NULL) {
+               return NULL;
+       }
+
+       ret = talloc_asprintf(mem_ctx, "%s/%s", mount_point, snapdir);
+       talloc_free(mount_point);
+       return ret;
+}
+
+/*
+  work out the location of the base directory for snapshots of this share
+ */
+static const char *shadow_copy2_find_basedir(TALLOC_CTX *mem_ctx, vfs_handle_struct *handle)
+{
+       const char *basedir = lp_parm_const_string(SNUM(handle->conn), "shadow", "basedir", NULL);
+
+       /* other its the filesystem mount point */
+       if (basedir == NULL) {
+               basedir = find_mount_point(mem_ctx, handle);
+       }
+
+       return basedir;
+}
+
+/*
+  convert a filename from a share relative path, to a path in the
+  snapshot directory
+ */
+static char *convert_shadow2_name(vfs_handle_struct *handle, const char *fname)
+{
+       TALLOC_CTX *tmp_ctx = talloc_new(handle->data);
+       const char *snapdir, *relpath, *baseoffset, *basedir;
+       size_t baselen;
+       char *ret;
+
+       snapdir = shadow_copy2_find_snapdir(tmp_ctx, handle);
+       if (snapdir == NULL) {
+               DEBUG(2,("no snapdir found for share at %s\n", handle->conn->connectpath));
+               talloc_free(tmp_ctx);
+               return NULL;
+       }
+
+       basedir = shadow_copy2_find_basedir(tmp_ctx, handle);
+       if (basedir == NULL) {
+               DEBUG(2,("no basedir found for share at %s\n", handle->conn->connectpath));
+               talloc_free(tmp_ctx);
+               return NULL;
+       }
+
+       relpath = fname + GMT_NAME_LEN;
+       baselen = strlen(basedir);
+       baseoffset = handle->conn->connectpath + baselen;
+
+       /* some sanity checks */
+       if (strncmp(basedir, handle->conn->connectpath, baselen) != 0 ||
+           (handle->conn->connectpath[baselen] != 0 && handle->conn->connectpath[baselen] != '/')) {
+               DEBUG(0,("convert_shadow2_name: basedir %s is not a parent of %s\n",
+                        basedir, handle->conn->connectpath));
+               talloc_free(tmp_ctx);
+               return NULL;
+       }
+
+       if (*relpath == '/') relpath++;
+       if (*baseoffset == '/') baseoffset++;
+
+       ret = talloc_asprintf(handle->data, "%s/%.*s/%s/%s", 
+                             snapdir, 
+                             GMT_NAME_LEN, fname, 
+                             baseoffset, 
+                             relpath);
+       DEBUG(6,("convert_shadow2_name: '%s' -> '%s'\n", fname, ret));
+       talloc_free(tmp_ctx);
+       return ret;
+}
+
+
+/*
+  simple string hash
+ */
+static uint32 string_hash(const char *s)
+{
+        uint32 n = 0;
+       while (*s) {
+                n = ((n << 5) + n) ^ (uint32)(*s++);
+        }
+        return n;
+}
+
+/*
+  modify a sbuf return to ensure that inodes in the shadow directory
+  are different from those in the main directory
+ */
+static void convert_sbuf(vfs_handle_struct *handle, const char *fname, SMB_STRUCT_STAT *sbuf)
+{
+       if (lp_parm_bool(SNUM(handle->conn), "shadow", "fixinodes", False)) {           
+               /* some snapshot systems, like GPFS, return the name
+                  device:inode for the snapshot files as the current
+                  files. That breaks the 'restore' button in the shadow copy
+                  GUI, as the client gets a sharing violation.
+
+                  This is a crude way of allowing both files to be
+                  open at once. It has a slight chance of inode
+                  number collision, but I can't see a better approach
+                  without significant VFS changes
+               */
+               uint32_t shash = string_hash(fname) & 0xFF000000;
+               if (shash == 0) {
+                       shash = 1;
+               }
+               sbuf->st_ino ^= shash;
+       }
+}
+
+static int shadow_copy2_rename(vfs_handle_struct *handle,
+                       const char *oldname, const char *newname)
+{
+       SHADOW2_NEXT2(RENAME, (handle, oldname, newname));
+}
+
+static int shadow_copy2_symlink(vfs_handle_struct *handle,
+                               const char *oldname, const char *newname)
+{
+       SHADOW2_NEXT2(SYMLINK, (handle, oldname, newname));
+}
+
+static int shadow_copy2_link(vfs_handle_struct *handle,
+                         const char *oldname, const char *newname)
+{
+       SHADOW2_NEXT2(LINK, (handle, oldname, newname));
+}
+
+static int shadow_copy2_open(vfs_handle_struct *handle,
+                            const char *fname, files_struct *fsp, int flags, mode_t mode)
+{
+       SHADOW2_NEXT(OPEN, (handle, name, fsp, flags, mode), int, -1);
+}
+
+static SMB_STRUCT_DIR *shadow_copy2_opendir(vfs_handle_struct *handle,
+                         const char *fname, const char *mask, uint32 attr)
+{
+        SHADOW2_NEXT(OPENDIR, (handle, name, mask, attr), SMB_STRUCT_DIR *, NULL);
+}
+
+static int shadow_copy2_stat(vfs_handle_struct *handle,
+                     const char *fname, SMB_STRUCT_STAT *sbuf)
+{
+        _SHADOW2_NEXT(STAT, (handle, name, sbuf), int, -1, convert_sbuf(handle, fname, sbuf));
+}
+
+static int shadow_copy2_lstat(vfs_handle_struct *handle,
+                      const char *fname, SMB_STRUCT_STAT *sbuf)
+{
+        _SHADOW2_NEXT(LSTAT, (handle, name, sbuf), int, -1, convert_sbuf(handle, fname, sbuf));
+}
+
+static int shadow_copy2_fstat(vfs_handle_struct *handle, files_struct *fsp, SMB_STRUCT_STAT *sbuf)
+{
+       int ret = SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf);
+       if (ret == 0 && shadow_copy2_match_name(fsp->fsp_name)) {
+               convert_sbuf(handle, fsp->fsp_name, sbuf);
+       }
+       return ret;
+}
+
+static int shadow_copy2_unlink(vfs_handle_struct *handle, const char *fname)
+{
+        SHADOW2_NEXT(UNLINK, (handle, name), int, -1);
+}
+
+static int shadow_copy2_chmod(vfs_handle_struct *handle,
+                      const char *fname, mode_t mode)
+{
+        SHADOW2_NEXT(CHMOD, (handle, name, mode), int, -1);
+}
+
+static int shadow_copy2_chown(vfs_handle_struct *handle,
+                      const char *fname, uid_t uid, gid_t gid)
+{
+        SHADOW2_NEXT(CHOWN, (handle, name, uid, gid), int, -1);
+}
+
+static int shadow_copy2_chdir(vfs_handle_struct *handle,
+                      const char *fname)
+{
+       SHADOW2_NEXT(CHDIR, (handle, name), int, -1);
+}
+
+static int shadow_copy2_ntimes(vfs_handle_struct *handle,
+                      const char *fname, const struct timespec ts[2])
+{
+        SHADOW2_NEXT(NTIMES, (handle, name, ts), int, -1);
+}
+
+static int shadow_copy2_readlink(vfs_handle_struct *handle,
+                                const char *fname, char *buf, size_t bufsiz)
+{
+        SHADOW2_NEXT(READLINK, (handle, name, buf, bufsiz), int, -1);
+}
+
+static int shadow_copy2_mknod(vfs_handle_struct *handle,
+                      const char *fname, mode_t mode, SMB_DEV_T dev)
+{
+        SHADOW2_NEXT(MKNOD, (handle, name, mode, dev), int, -1);
+}
+
+static char *shadow_copy2_realpath(vfs_handle_struct *handle,
+                           const char *fname, char *resolved_path)
+{
+        SHADOW2_NEXT(REALPATH, (handle, name, resolved_path), char *, NULL);
+}
+
+static NTSTATUS shadow_copy2_get_nt_acl(vfs_handle_struct *handle,
+                              const char *fname, uint32 security_info,
+                              struct security_descriptor **ppdesc)
+{
+        SHADOW2_NTSTATUS_NEXT(GET_NT_ACL, (handle, name, security_info, ppdesc), NT_STATUS_ACCESS_DENIED);
+}
+
+static NTSTATUS shadow_copy2_set_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
+                            const char *fname, uint32 security_info_sent,
+                            struct security_descriptor *psd)
+{
+        SHADOW2_NTSTATUS_NEXT(SET_NT_ACL, (handle, fsp, name, security_info_sent, psd), NT_STATUS_ACCESS_DENIED);
+}
+
+static int shadow_copy2_mkdir(vfs_handle_struct *handle,  const char *fname, mode_t mode)
+{
+        SHADOW2_NEXT(MKDIR, (handle, name, mode), int, -1);
+}
+
+static int shadow_copy2_rmdir(vfs_handle_struct *handle,  const char *fname)
+{
+        SHADOW2_NEXT(RMDIR, (handle, name), int, -1);
+}
+
+static int shadow_copy2_chflags(vfs_handle_struct *handle, const char *fname, int flags)
+{
+        SHADOW2_NEXT(CHFLAGS, (handle, name, flags), int, -1);
+}
+
+static ssize_t shadow_copy2_getxattr(vfs_handle_struct *handle,
+                                 const char *fname, const char *aname, void *value, size_t size)
+{
+        SHADOW2_NEXT(GETXATTR, (handle, name, aname, value, size), ssize_t, -1);
+}
+
+static ssize_t shadow_copy2_lgetxattr(vfs_handle_struct *handle,
+                                     const char *fname, const char *aname, void *value, size_t size)
+{
+        SHADOW2_NEXT(LGETXATTR, (handle, name, aname, value, size), ssize_t, -1);
+}
+
+static ssize_t shadow_copy2_listxattr(struct vfs_handle_struct *handle, const char *fname, 
+                                     char *list, size_t size)
+{
+       SHADOW2_NEXT(LISTXATTR, (handle, name, list, size), ssize_t, -1);
+}
+
+static int shadow_copy2_removexattr(struct vfs_handle_struct *handle, const char *fname, 
+                                   const char *aname)
+{
+       SHADOW2_NEXT(REMOVEXATTR, (handle, name, aname), int, -1);
+}
+
+static int shadow_copy2_lremovexattr(struct vfs_handle_struct *handle, const char *fname, 
+                                    const char *aname)
+{
+       SHADOW2_NEXT(LREMOVEXATTR, (handle, name, aname), int, -1);
+}
+
+static int shadow_copy2_setxattr(struct vfs_handle_struct *handle, const char *fname, 
+                                const char *aname, const void *value, size_t size, int flags)
+{
+       SHADOW2_NEXT(SETXATTR, (handle, name, aname, value, size, flags), int, -1);
+}
+
+static int shadow_copy2_lsetxattr(struct vfs_handle_struct *handle, const char *fname, 
+                                 const char *aname, const void *value, size_t size, int flags)
+{
+       SHADOW2_NEXT(LSETXATTR, (handle, name, aname, value, size, flags), int, -1);
+}
+
+static int shadow_copy2_chmod_acl(vfs_handle_struct *handle,
+                          const char *fname, mode_t mode)
+{
+        /* If the underlying VFS doesn't have ACL support... */
+        if (!handle->vfs_next.ops.chmod_acl) {
+                errno = ENOSYS;
+                return -1;
+        }
+        SHADOW2_NEXT(CHMOD_ACL, (handle, name, mode), int, -1);
+}
+
+static int shadow_copy2_get_shadow_copy2_data(vfs_handle_struct *handle, 
+                                             files_struct *fsp, 
+                                             SHADOW_COPY_DATA *shadow_copy2_data, 
+                                             bool labels)
+{
+       SMB_STRUCT_DIR *p;
+       const char *snapdir;
+       SMB_STRUCT_DIRENT *d;
+       TALLOC_CTX *tmp_ctx = talloc_new(handle->data);
+
+       snapdir = shadow_copy2_find_snapdir(tmp_ctx, handle);
+       if (snapdir == NULL) {
+               DEBUG(0,("shadow:snapdir not found for %s in get_shadow_copy_data\n",
+                        handle->conn->connectpath));
+               errno = EINVAL;
+               talloc_free(tmp_ctx);
+               return -1;
+       }
+
+       p = SMB_VFS_NEXT_OPENDIR(handle, snapdir, NULL, 0);
+
+       if (!p) {
+               DEBUG(0,("shadow_copy2: SMB_VFS_NEXT_OPENDIR() failed for '%s' - %s\n", 
+                        snapdir, strerror(errno)));
+               talloc_free(tmp_ctx);
+               return -1;
+       }
+
+       talloc_free(tmp_ctx);
+
+       shadow_copy2_data->num_volumes = 0;
+       shadow_copy2_data->labels      = NULL;
+
+       while ((d = SMB_VFS_NEXT_READDIR(handle, p))) {
+               SHADOW_COPY_LABEL *tlabels;
+
+               /* ignore names not of the right form in the snapshot directory */
+               if (!shadow_copy2_match_name(d->d_name)) {
+                       continue;
+               }
+
+               if (!labels) {
+                       /* the caller doesn't want the labels */
+                       shadow_copy2_data->num_volumes++;
+                       continue;
+               }
+
+               tlabels = talloc_realloc(shadow_copy2_data->mem_ctx,
+                                        shadow_copy2_data->labels,
+                                        SHADOW_COPY_LABEL, shadow_copy2_data->num_volumes+1);
+               if (tlabels == NULL) {
+                       DEBUG(0,("shadow_copy2: out of memory\n"));
+                       SMB_VFS_NEXT_CLOSEDIR(handle, p);
+                       return -1;
+               }
+
+               strlcpy(tlabels[shadow_copy2_data->num_volumes], d->d_name, sizeof(*tlabels));
+               shadow_copy2_data->num_volumes++;
+               shadow_copy2_data->labels = tlabels;
+       }
+
+       SMB_VFS_NEXT_CLOSEDIR(handle,p);
+       return 0;
+}
+
+/* VFS operations structure */
+
+static vfs_op_tuple shadow_copy2_ops[] = {
+        {SMB_VFS_OP(shadow_copy2_opendir),  SMB_VFS_OP_OPENDIR,  SMB_VFS_LAYER_TRANSPARENT},
+
+       /* directory operations */
+        {SMB_VFS_OP(shadow_copy2_mkdir),       SMB_VFS_OP_MKDIR,       SMB_VFS_LAYER_TRANSPARENT},
+        {SMB_VFS_OP(shadow_copy2_rmdir),       SMB_VFS_OP_RMDIR,       SMB_VFS_LAYER_TRANSPARENT},
+
+       /* xattr and flags operations */
+        {SMB_VFS_OP(shadow_copy2_chflags),     SMB_VFS_OP_CHFLAGS,     SMB_VFS_LAYER_TRANSPARENT},
+        {SMB_VFS_OP(shadow_copy2_getxattr),    SMB_VFS_OP_GETXATTR,    SMB_VFS_LAYER_TRANSPARENT},
+        {SMB_VFS_OP(shadow_copy2_lgetxattr),   SMB_VFS_OP_LGETXATTR,   SMB_VFS_LAYER_TRANSPARENT},
+        {SMB_VFS_OP(shadow_copy2_listxattr),   SMB_VFS_OP_LISTXATTR,   SMB_VFS_LAYER_TRANSPARENT},
+        {SMB_VFS_OP(shadow_copy2_removexattr), SMB_VFS_OP_REMOVEXATTR, SMB_VFS_LAYER_TRANSPARENT},
+        {SMB_VFS_OP(shadow_copy2_lremovexattr),SMB_VFS_OP_LREMOVEXATTR,SMB_VFS_LAYER_TRANSPARENT},
+        {SMB_VFS_OP(shadow_copy2_setxattr),    SMB_VFS_OP_SETXATTR,    SMB_VFS_LAYER_TRANSPARENT},
+        {SMB_VFS_OP(shadow_copy2_lsetxattr),   SMB_VFS_OP_LSETXATTR,   SMB_VFS_LAYER_TRANSPARENT},
+
+        /* File operations */
+        {SMB_VFS_OP(shadow_copy2_open),       SMB_VFS_OP_OPEN,     SMB_VFS_LAYER_TRANSPARENT},
+        {SMB_VFS_OP(shadow_copy2_rename),     SMB_VFS_OP_RENAME,   SMB_VFS_LAYER_TRANSPARENT},
+        {SMB_VFS_OP(shadow_copy2_stat),       SMB_VFS_OP_STAT,     SMB_VFS_LAYER_TRANSPARENT},
+        {SMB_VFS_OP(shadow_copy2_lstat),      SMB_VFS_OP_LSTAT,    SMB_VFS_LAYER_TRANSPARENT},
+        {SMB_VFS_OP(shadow_copy2_fstat),      SMB_VFS_OP_FSTAT,    SMB_VFS_LAYER_TRANSPARENT},
+        {SMB_VFS_OP(shadow_copy2_unlink),     SMB_VFS_OP_UNLINK,   SMB_VFS_LAYER_TRANSPARENT},
+        {SMB_VFS_OP(shadow_copy2_chmod),      SMB_VFS_OP_CHMOD,    SMB_VFS_LAYER_TRANSPARENT},
+        {SMB_VFS_OP(shadow_copy2_chown),      SMB_VFS_OP_CHOWN,    SMB_VFS_LAYER_TRANSPARENT},
+        {SMB_VFS_OP(shadow_copy2_chdir),      SMB_VFS_OP_CHDIR,    SMB_VFS_LAYER_TRANSPARENT},
+        {SMB_VFS_OP(shadow_copy2_ntimes),     SMB_VFS_OP_NTIMES,   SMB_VFS_LAYER_TRANSPARENT},
+        {SMB_VFS_OP(shadow_copy2_symlink),    SMB_VFS_OP_SYMLINK,  SMB_VFS_LAYER_TRANSPARENT},
+        {SMB_VFS_OP(shadow_copy2_readlink),   SMB_VFS_OP_READLINK, SMB_VFS_LAYER_TRANSPARENT},
+        {SMB_VFS_OP(shadow_copy2_link),       SMB_VFS_OP_LINK,     SMB_VFS_LAYER_TRANSPARENT},
+        {SMB_VFS_OP(shadow_copy2_mknod),      SMB_VFS_OP_MKNOD,    SMB_VFS_LAYER_TRANSPARENT},
+        {SMB_VFS_OP(shadow_copy2_realpath),   SMB_VFS_OP_REALPATH, SMB_VFS_LAYER_TRANSPARENT},
+
+        /* NT File ACL operations */
+        {SMB_VFS_OP(shadow_copy2_get_nt_acl), SMB_VFS_OP_GET_NT_ACL, SMB_VFS_LAYER_TRANSPARENT},
+        {SMB_VFS_OP(shadow_copy2_set_nt_acl), SMB_VFS_OP_SET_NT_ACL, SMB_VFS_LAYER_TRANSPARENT},
+
+        /* POSIX ACL operations */
+        {SMB_VFS_OP(shadow_copy2_chmod_acl), SMB_VFS_OP_CHMOD_ACL, SMB_VFS_LAYER_TRANSPARENT},
+
+       /* special shadown copy op */
+       {SMB_VFS_OP(shadow_copy2_get_shadow_copy2_data), 
+        SMB_VFS_OP_GET_SHADOW_COPY_DATA,SMB_VFS_LAYER_OPAQUE},
+
+       {SMB_VFS_OP(NULL), SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP}
+};
+
+NTSTATUS vfs_shadow_copy2_init(void);
+NTSTATUS vfs_shadow_copy2_init(void)
+{
+       NTSTATUS ret;
+
+       ret = smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "shadow_copy2", shadow_copy2_ops);
+
+       if (!NT_STATUS_IS_OK(ret))
+               return ret;
+
+       vfs_shadow_copy2_debug_level = debug_add_class("shadow_copy2");
+       if (vfs_shadow_copy2_debug_level == -1) {
+               vfs_shadow_copy2_debug_level = DBGC_VFS;
+               DEBUG(0, ("%s: Couldn't register custom debugging class!\n",
+                       "vfs_shadow_copy2_init"));
+       } else {
+               DEBUG(10, ("%s: Debug class number of '%s': %d\n", 
+                       "vfs_shadow_copy2_init","shadow_copy2",vfs_shadow_copy2_debug_level));
+       }
+
+       return ret;
+}
index 673b6805afb5c7fa0fd7023b5870ecd94b4c12f2..7bdfe8465b1bbdba5380c6bc68ef17cf49980ef8 100644 (file)
@@ -1,7 +1,7 @@
 /*
    Unix SMB/Netbios implementation.
    VFS module to get and set Solaris ACLs
-   Copyright (C) Michael Adam 2006
+   Copyright (C) Michael Adam 2006,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
@@ -100,8 +100,7 @@ SMB_ACL_T solarisacl_sys_acl_get_file(vfs_handle_struct *handle,
  * get the access ACL of a file referred to by a fd
  */
 SMB_ACL_T solarisacl_sys_acl_get_fd(vfs_handle_struct *handle,
-                                   files_struct *fsp,
-                                   int fd)
+                                   files_struct *fsp)
 {
        SMB_ACL_T result = NULL;
        int count;
@@ -109,7 +108,7 @@ SMB_ACL_T solarisacl_sys_acl_get_fd(vfs_handle_struct *handle,
 
        DEBUG(10, ("entering solarisacl_sys_acl_get_fd.\n"));
 
-       if (!solaris_acl_get_fd(fd, &solaris_acl, &count)) {
+       if (!solaris_acl_get_fd(fsp->fh->fd, &solaris_acl, &count)) {
                goto done;
        }
        /* 
@@ -219,7 +218,7 @@ int solarisacl_sys_acl_set_file(vfs_handle_struct *handle,
  */
 int solarisacl_sys_acl_set_fd(vfs_handle_struct *handle,
                              files_struct *fsp,
-                             int fd, SMB_ACL_T theacl)
+                             SMB_ACL_T theacl)
 {
        SOLARIS_ACL_T solaris_acl = NULL;
        SOLARIS_ACL_T default_acl = NULL;
@@ -242,7 +241,7 @@ int solarisacl_sys_acl_set_fd(vfs_handle_struct *handle,
                           strerror(errno)));
                goto done;
        }
-       if (!solaris_acl_get_fd(fd, &default_acl, &default_count)) {
+       if (!solaris_acl_get_fd(fsp->fh->fd, &default_acl, &default_count)) {
                DEBUG(10, ("error getting (default) acl from fd\n"));
                goto done;
        }
@@ -258,14 +257,14 @@ int solarisacl_sys_acl_set_fd(vfs_handle_struct *handle,
                goto done;
        }
 
-       ret = facl(fd, SETACL, count, solaris_acl);
+       ret = facl(fsp->fh->fd, SETACL, count, solaris_acl);
        if (ret != 0) {
                DEBUG(10, ("call of facl failed (%s).\n", strerror(errno)));
        }
 
  done:
-       DEBUG(10, ("solarisacl_sys_acl_st_fd %s.\n",
-                  ((ret == 0) ? "succeded" : "failed" )));
+       DEBUG(10, ("solarisacl_sys_acl_set_fd %s.\n",
+                  ((ret == 0) ? "succeeded" : "failed" )));
        SAFE_FREE(solaris_acl);
        SAFE_FREE(default_acl);
        return ret;
diff --git a/source/modules/vfs_streams_depot.c b/source/modules/vfs_streams_depot.c
new file mode 100644 (file)
index 0000000..fa85ea4
--- /dev/null
@@ -0,0 +1,641 @@
+/*
+ * Store streams in a separate subdirectory
+ *
+ * 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"
+
+#undef DBGC_CLASS
+#define DBGC_CLASS DBGC_VFS
+
+/*
+ * Excerpt from a mail from tridge:
+ *
+ * Volker, what I'm thinking of is this:
+ * /mount-point/.streams/XX/YY/aaaa.bbbb/namedstream1
+ * /mount-point/.streams/XX/YY/aaaa.bbbb/namedstream2
+ *
+ * where XX/YY is a 2 level hash based on the fsid/inode. "aaaa.bbbb"
+ * is the fsid/inode. "namedstreamX" is a file named after the stream
+ * name.
+ */
+
+static uint32_t hash_fn(DATA_BLOB key)
+{
+       uint32_t value; /* Used to compute the hash value.  */
+       uint32_t i;     /* Used to cycle through random values. */
+
+       /* Set the initial value from the key size. */
+       for (value = 0x238F13AF * key.length, i=0; i < key.length; i++)
+               value = (value + (key.data[i] << (i*5 % 24)));
+
+       return (1103515243 * value + 12345);
+}
+
+/*
+ * With the hashing scheme based on the inode we need to protect against
+ * streams showing up on files with re-used inodes. This can happen if we
+ * create a stream directory from within Samba, and a local process or NFS
+ * client deletes the file without deleting the streams directory. When the
+ * inode is re-used and the stream directory is still around, the streams in
+ * there would be show up as belonging to the new file.
+ *
+ * There are several workarounds for this, probably the easiest one is on
+ * systems which have a true birthtime stat element: When the file has a later
+ * birthtime than the streams directory, then we have to recreate the
+ * directory.
+ *
+ * The other workaround is to somehow mark the file as generated by Samba with
+ * something that a NFS client would not do. The closest one is a special
+ * xattr value being set. On systems which do not support xattrs, it might be
+ * an option to put in a special ACL entry for a non-existing group.
+ */
+
+#define SAMBA_XATTR_MARKER "user.SAMBA_STREAMS"
+
+static bool file_is_valid(vfs_handle_struct *handle, const char *path)
+{
+       char buf;
+
+       DEBUG(10, ("file_is_valid (%s) called\n", path));
+
+       if (SMB_VFS_NEXT_GETXATTR(handle, path, SAMBA_XATTR_MARKER,
+                                 &buf, sizeof(buf)) != sizeof(buf)) {
+               DEBUG(10, ("GETXATTR failed: %s\n", strerror(errno)));
+               return false;
+       }
+
+       if (buf != '1') {
+               DEBUG(10, ("got wrong buffer content: '%c'\n", buf));
+               return false;
+       }
+
+       return true;
+}
+
+static bool mark_file_valid(vfs_handle_struct *handle, const char *path)
+{
+       char buf = '1';
+       int ret;
+
+       DEBUG(10, ("marking file %s as valid\n", path));
+
+       ret = SMB_VFS_NEXT_SETXATTR(handle, path, SAMBA_XATTR_MARKER,
+                                   &buf, sizeof(buf), 0);
+
+       if (ret == -1) {
+               DEBUG(10, ("SETXATTR failed: %s\n", strerror(errno)));
+               return false;
+       }
+
+       return true;
+}
+
+static char *stream_dir(vfs_handle_struct *handle, const char *base_path,
+                       const SMB_STRUCT_STAT *base_sbuf, bool create_it)
+{
+       uint32_t hash;
+       char *result = NULL;
+       SMB_STRUCT_STAT sbuf;
+       uint8_t first, second;
+       char *tmp;
+       char *id_hex;
+       struct file_id id;
+       uint8 id_buf[16];
+
+       const char *rootdir = lp_parm_const_string(
+               SNUM(handle->conn), "streams", "directory",
+               handle->conn->connectpath);
+
+       if (base_sbuf == NULL) {
+               if (SMB_VFS_NEXT_STAT(handle, base_path, &sbuf) == -1) {
+                       /*
+                        * base file is not there
+                        */
+                       goto fail;
+               }
+               base_sbuf = &sbuf;
+       }
+
+       id = SMB_VFS_FILE_ID_CREATE(handle->conn, base_sbuf->st_dev,
+                                   base_sbuf->st_ino);
+
+       push_file_id_16((char *)id_buf, &id);
+
+       hash = hash_fn(data_blob_const(id_buf, sizeof(id_buf)));
+
+       first = hash & 0xff;
+       second = (hash >> 8) & 0xff;
+
+       id_hex = hex_encode(talloc_tos(), id_buf, sizeof(id_buf));
+
+       if (id_hex == NULL) {
+               errno = ENOMEM;
+               goto fail;
+       }
+
+       result = talloc_asprintf(talloc_tos(), "%s/%2.2X/%2.2X/%s", rootdir,
+                                first, second, id_hex);
+
+       TALLOC_FREE(id_hex);
+
+       if (result == NULL) {
+               errno = ENOMEM;
+               return NULL;
+       }
+
+       if (SMB_VFS_NEXT_STAT(handle, result, &sbuf) == 0) {
+               char *newname;
+
+               if (!S_ISDIR(sbuf.st_mode)) {
+                       errno = EINVAL;
+                       goto fail;
+               }
+
+               if (file_is_valid(handle, base_path)) {
+                       return result;
+               }
+
+               /*
+                * Someone has recreated a file under an existing inode
+                * without deleting the streams directory. For now, just move
+                * it away.
+                */
+
+       again:
+               newname = talloc_asprintf(talloc_tos(), "lost-%lu", random());
+               if (newname == NULL) {
+                       errno = ENOMEM;
+                       goto fail;
+               }
+
+               if (SMB_VFS_NEXT_RENAME(handle, result, newname) == -1) {
+                       if ((errno == EEXIST) || (errno == ENOTEMPTY)) {
+                               TALLOC_FREE(newname);
+                               goto again;
+                       }
+                       goto fail;
+               }
+
+               TALLOC_FREE(newname);
+       }
+
+       if (!create_it) {
+               errno = ENOENT;
+               goto fail;
+       }
+
+       if ((SMB_VFS_NEXT_MKDIR(handle, rootdir, 0755) != 0)
+           && (errno != EEXIST)) {
+               goto fail;
+       }
+
+       tmp = talloc_asprintf(result, "%s/%2.2X", rootdir, first);
+       if (tmp == NULL) {
+               errno = ENOMEM;
+               goto fail;
+       }
+
+       if ((SMB_VFS_NEXT_MKDIR(handle, tmp, 0755) != 0)
+           && (errno != EEXIST)) {
+               goto fail;
+       }
+
+       TALLOC_FREE(tmp);
+
+       tmp = talloc_asprintf(result, "%s/%2.2X/%2.2X", rootdir, first,
+                             second);
+       if (tmp == NULL) {
+               errno = ENOMEM;
+               goto fail;
+       }
+
+       if ((SMB_VFS_NEXT_MKDIR(handle, tmp, 0755) != 0)
+           && (errno != EEXIST)) {
+               goto fail;
+       }
+
+       TALLOC_FREE(tmp);
+
+       if ((SMB_VFS_NEXT_MKDIR(handle, result, 0755) != 0)
+           && (errno != EEXIST)) {
+               goto fail;
+       }
+
+       if (!mark_file_valid(handle, base_path)) {
+               goto fail;
+       }
+
+       return result;
+
+ fail:
+       TALLOC_FREE(result);
+       return NULL;
+}
+
+static char *stream_name(vfs_handle_struct *handle, const char *fname,
+                        bool create_dir)
+{
+       char *base = NULL;
+       char *sname = NULL;
+       char *id_hex = NULL;
+       char *dirname, *stream_fname;
+
+       if (!NT_STATUS_IS_OK(split_ntfs_stream_name(talloc_tos(), fname,
+                                                   &base, &sname))) {
+               DEBUG(10, ("split_ntfs_stream_name failed\n"));
+               errno = ENOMEM;
+               goto fail;
+       }
+
+       dirname = stream_dir(handle, base, NULL, create_dir);
+
+       if (dirname == NULL) {
+               goto fail;
+       }
+
+       stream_fname = talloc_asprintf(talloc_tos(), "%s/:%s", dirname, sname);
+
+       if (stream_fname == NULL) {
+               errno = ENOMEM;
+               goto fail;
+       }
+
+       DEBUG(10, ("stream filename = %s\n", stream_fname));
+
+       TALLOC_FREE(base);
+       TALLOC_FREE(sname);
+       TALLOC_FREE(id_hex);
+
+       return stream_fname;
+
+ fail:
+       DEBUG(5, ("stream_name failed: %s\n", strerror(errno)));
+       TALLOC_FREE(base);
+       TALLOC_FREE(sname);
+       TALLOC_FREE(id_hex);
+       return NULL;
+}
+
+static NTSTATUS walk_streams(vfs_handle_struct *handle,
+                            const char *fname,
+                            const SMB_STRUCT_STAT *sbuf,
+                            char **pdirname,
+                            bool (*fn)(const char *dirname,
+                                       const char *dirent,
+                                       void *private_data),
+                            void *private_data)
+{
+       char *dirname;
+       SMB_STRUCT_DIR *dirhandle = NULL;
+       char *dirent;
+
+       dirname = stream_dir(handle, fname, sbuf, false);
+
+       if (dirname == NULL) {
+               if (errno == ENOENT) {
+                       /*
+                        * no stream around
+                        */
+                       return NT_STATUS_OK;
+               }
+               return map_nt_error_from_unix(errno);
+       }
+
+       DEBUG(10, ("walk_streams: dirname=%s\n", dirname));
+
+       dirhandle = SMB_VFS_NEXT_OPENDIR(handle, dirname, NULL, 0);
+
+       if (dirhandle == NULL) {
+               TALLOC_FREE(dirname);
+               return map_nt_error_from_unix(errno);
+       }
+
+       while ((dirent = vfs_readdirname(handle->conn, dirhandle)) != NULL) {
+
+               if (ISDOT(dirent) || ISDOTDOT(dirent)) {
+                       continue;
+               }
+
+               DEBUG(10, ("walk_streams: dirent=%s\n", dirent));
+
+               if (!fn(dirname, dirent, private_data)) {
+                       break;
+               }
+       }
+
+       SMB_VFS_NEXT_CLOSEDIR(handle, dirhandle);
+
+       if (pdirname != NULL) {
+               *pdirname = dirname;
+       }
+       else {
+               TALLOC_FREE(dirname);
+       }
+
+       return NT_STATUS_OK;
+}
+
+static int streams_depot_stat(vfs_handle_struct *handle, const char *fname,
+                             SMB_STRUCT_STAT *sbuf)
+{
+       char *stream_fname;
+       int ret = -1;
+
+       DEBUG(10, ("streams_depot_stat called for [%s]\n", fname));
+
+       if (!is_ntfs_stream_name(fname)) {
+               return SMB_VFS_NEXT_STAT(handle, fname, sbuf);
+       }
+
+       stream_fname = stream_name(handle, fname, false);
+       if (stream_fname == NULL) {
+               goto done;
+       }
+
+       ret = SMB_VFS_NEXT_STAT(handle, stream_fname, sbuf);
+
+ done:
+       TALLOC_FREE(stream_fname);
+       return ret;
+}
+
+static int streams_depot_lstat(vfs_handle_struct *handle, const char *fname,
+                              SMB_STRUCT_STAT *sbuf)
+{
+       char *stream_fname;
+       int ret = -1;
+
+       if (!is_ntfs_stream_name(fname)) {
+               return SMB_VFS_NEXT_LSTAT(handle, fname, sbuf);
+       }
+
+       stream_fname = stream_name(handle, fname, false);
+       if (stream_fname == NULL) {
+               goto done;
+       }
+
+       ret = SMB_VFS_NEXT_LSTAT(handle, stream_fname, sbuf);
+
+ done:
+       TALLOC_FREE(stream_fname);
+       return ret;
+}
+
+static int streams_depot_open(vfs_handle_struct *handle,  const char *fname,
+                             files_struct *fsp, int flags, mode_t mode)
+{
+       TALLOC_CTX *frame;
+       char *base = NULL;
+       SMB_STRUCT_STAT base_sbuf;
+       char *stream_fname;
+       int ret = -1;
+
+       if (!is_ntfs_stream_name(fname)) {
+               return SMB_VFS_NEXT_OPEN(handle, fname, fsp, flags, mode);
+       }
+
+       frame = talloc_stackframe();
+
+       if (!NT_STATUS_IS_OK(split_ntfs_stream_name(talloc_tos(), fname,
+                                                   &base, NULL))) {
+               errno = ENOMEM;
+               goto done;
+       }
+
+       ret = SMB_VFS_NEXT_STAT(handle, base, &base_sbuf);
+
+       if (ret == -1) {
+               goto done;
+       }
+
+       TALLOC_FREE(base);
+
+       stream_fname = stream_name(handle, fname, true);
+       if (stream_fname == NULL) {
+               goto done;
+       }
+
+       ret = SMB_VFS_NEXT_OPEN(handle, stream_fname, fsp, flags, mode);
+
+ done:
+       TALLOC_FREE(frame);
+       return ret;
+}
+
+static int streams_depot_unlink(vfs_handle_struct *handle,  const char *fname)
+{
+       int ret = -1;
+       SMB_STRUCT_STAT sbuf;
+
+       DEBUG(10, ("streams_depot_unlink called for %s\n", fname));
+
+       if (is_ntfs_stream_name(fname)) {
+               char *stream_fname;
+
+               stream_fname = stream_name(handle, fname, false);
+               if (stream_fname == NULL) {
+                       return -1;
+               }
+
+               ret = SMB_VFS_NEXT_UNLINK(handle, stream_fname);
+
+               TALLOC_FREE(stream_fname);
+               return ret;
+       }
+
+       /*
+        * We potentially need to delete the per-inode streams directory
+        */
+
+       if (SMB_VFS_NEXT_STAT(handle, fname, &sbuf) == -1) {
+               return -1;
+       }
+
+       if (sbuf.st_nlink == 1) {
+               char *dirname = stream_dir(handle, fname, &sbuf, false);
+
+               if (dirname != NULL) {
+                       SMB_VFS_NEXT_RMDIR(handle, dirname);
+               }
+               TALLOC_FREE(dirname);
+       }
+
+       return SMB_VFS_NEXT_UNLINK(handle, fname);
+}
+
+static bool add_one_stream(TALLOC_CTX *mem_ctx, unsigned int *num_streams,
+                          struct stream_struct **streams,
+                          const char *name, SMB_OFF_T size,
+                          SMB_OFF_T alloc_size)
+{
+       struct stream_struct *tmp;
+
+       tmp = TALLOC_REALLOC_ARRAY(mem_ctx, *streams, struct stream_struct,
+                                  (*num_streams)+1);
+       if (tmp == NULL) {
+               return false;
+       }
+
+       tmp[*num_streams].name = talloc_strdup(tmp, name);
+       if (tmp[*num_streams].name == NULL) {
+               return false;
+       }
+
+       tmp[*num_streams].size = size;
+       tmp[*num_streams].alloc_size = alloc_size;
+
+       *streams = tmp;
+       *num_streams += 1;
+       return true;
+}
+
+struct streaminfo_state {
+       TALLOC_CTX *mem_ctx;
+       vfs_handle_struct *handle;
+       unsigned int num_streams;
+       struct stream_struct *streams;
+       NTSTATUS status;
+};
+
+static bool collect_one_stream(const char *dirname,
+                              const char *dirent,
+                              void *private_data)
+{
+       struct streaminfo_state *state =
+               (struct streaminfo_state *)private_data;
+       char *full_sname;
+       SMB_STRUCT_STAT sbuf;
+
+       if (asprintf(&full_sname, "%s/%s", dirname, dirent) == -1) {
+               state->status = NT_STATUS_NO_MEMORY;
+               return false;
+       }
+       if (SMB_VFS_NEXT_STAT(state->handle, full_sname, &sbuf) == -1) {
+               DEBUG(10, ("Could not stat %s: %s\n", full_sname,
+                          strerror(errno)));
+               SAFE_FREE(full_sname);
+               return true;
+       }
+
+       SAFE_FREE(full_sname);
+
+       if (!add_one_stream(state->mem_ctx,
+                           &state->num_streams, &state->streams,
+                           dirent, sbuf.st_size,
+                           get_allocation_size(
+                                   state->handle->conn, NULL, &sbuf))) {
+               state->status = NT_STATUS_NO_MEMORY;
+               return false;
+       }
+
+       return true;
+}
+
+static NTSTATUS streams_depot_streaminfo(vfs_handle_struct *handle,
+                                        struct files_struct *fsp,
+                                        const char *fname,
+                                        TALLOC_CTX *mem_ctx,
+                                        unsigned int *pnum_streams,
+                                        struct stream_struct **pstreams)
+{
+       SMB_STRUCT_STAT sbuf;
+       int ret;
+       NTSTATUS status;
+       struct streaminfo_state state;
+
+       if ((fsp != NULL) && (fsp->fh->fd != -1)) {
+               if (is_ntfs_stream_name(fsp->fsp_name)) {
+                       return NT_STATUS_INVALID_PARAMETER;
+               }
+               ret = SMB_VFS_NEXT_FSTAT(handle, fsp, &sbuf);
+       }
+       else {
+               if (is_ntfs_stream_name(fname)) {
+                       return NT_STATUS_INVALID_PARAMETER;
+               }
+               ret = SMB_VFS_NEXT_STAT(handle, fname, &sbuf);
+       }
+
+       if (ret == -1) {
+               return map_nt_error_from_unix(errno);
+       }
+
+       state.streams = NULL;
+       state.num_streams = 0;
+
+       if (!S_ISDIR(sbuf.st_mode)) {
+               if (!add_one_stream(mem_ctx,
+                                   &state.num_streams, &state.streams,
+                                   "::$DATA", sbuf.st_size,
+                                   get_allocation_size(handle->conn, fsp,
+                                                       &sbuf))) {
+                       return NT_STATUS_NO_MEMORY;
+               }
+       }
+
+       state.mem_ctx = mem_ctx;
+       state.handle = handle;
+       state.status = NT_STATUS_OK;
+
+       status = walk_streams(handle, fname, &sbuf, NULL, collect_one_stream,
+                             &state);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               TALLOC_FREE(state.streams);
+               return status;
+       }
+
+       if (!NT_STATUS_IS_OK(state.status)) {
+               TALLOC_FREE(state.streams);
+               return state.status;
+       }
+
+       *pnum_streams = state.num_streams;
+       *pstreams = state.streams;
+       return NT_STATUS_OK;
+}
+
+static uint32_t streams_depot_fs_capabilities(struct vfs_handle_struct *handle)
+{
+       return SMB_VFS_NEXT_FS_CAPABILITIES(handle) | FILE_NAMED_STREAMS;
+}
+
+/* VFS operations structure */
+
+static vfs_op_tuple streams_depot_ops[] = {
+       {SMB_VFS_OP(streams_depot_fs_capabilities), SMB_VFS_OP_FS_CAPABILITIES,
+        SMB_VFS_LAYER_TRANSPARENT},
+       {SMB_VFS_OP(streams_depot_open), SMB_VFS_OP_OPEN,
+        SMB_VFS_LAYER_TRANSPARENT},
+       {SMB_VFS_OP(streams_depot_stat), SMB_VFS_OP_STAT,
+        SMB_VFS_LAYER_TRANSPARENT},
+       {SMB_VFS_OP(streams_depot_lstat), SMB_VFS_OP_LSTAT,
+        SMB_VFS_LAYER_TRANSPARENT},
+       {SMB_VFS_OP(streams_depot_unlink), SMB_VFS_OP_UNLINK,
+        SMB_VFS_LAYER_TRANSPARENT},
+       {SMB_VFS_OP(streams_depot_streaminfo), SMB_VFS_OP_STREAMINFO,
+        SMB_VFS_LAYER_OPAQUE},
+       {SMB_VFS_OP(NULL), SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP}
+};
+
+NTSTATUS vfs_streams_depot_init(void);
+NTSTATUS vfs_streams_depot_init(void)
+{
+       return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "streams_depot",
+                               streams_depot_ops);
+}
diff --git a/source/modules/vfs_streams_xattr.c b/source/modules/vfs_streams_xattr.c
new file mode 100644 (file)
index 0000000..766e7d1
--- /dev/null
@@ -0,0 +1,685 @@
+/*
+ * Store streams in xattrs
+ *
+ * Copyright (C) Volker Lendecke, 2008
+ *
+ * Partly based on James Peach's Darwin module, which is
+ *
+ * Copyright (C) James Peach 2006-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"
+
+#undef DBGC_CLASS
+#define DBGC_CLASS DBGC_VFS
+
+struct stream_io {
+       char *base;
+       char *xattr_name;
+};
+
+static SMB_INO_T stream_inode(const SMB_STRUCT_STAT *sbuf, const char *sname)
+{
+       struct MD5Context ctx;
+        unsigned char hash[16];
+       SMB_INO_T result;
+       char *upper_sname;
+
+       DEBUG(10, ("stream_inode called for %lu/%lu [%s]\n",
+                  (unsigned long)sbuf->st_dev,
+                  (unsigned long)sbuf->st_ino, sname));
+
+       upper_sname = talloc_strdup_upper(talloc_tos(), sname);
+       SMB_ASSERT(upper_sname != NULL);
+
+        MD5Init(&ctx);
+        MD5Update(&ctx, (unsigned char *)&(sbuf->st_dev),
+                 sizeof(sbuf->st_dev));
+        MD5Update(&ctx, (unsigned char *)&(sbuf->st_ino),
+                 sizeof(sbuf->st_ino));
+        MD5Update(&ctx, (unsigned char *)upper_sname,
+                 talloc_get_size(upper_sname)-1);
+        MD5Final(hash, &ctx);
+
+       TALLOC_FREE(upper_sname);
+
+        /* Hopefully all the variation is in the lower 4 (or 8) bytes! */
+       memcpy(&result, hash, sizeof(result));
+
+       DEBUG(10, ("stream_inode returns %lu\n", (unsigned long)result));
+
+       return result;
+}
+
+static ssize_t get_xattr_size(connection_struct *conn, const char *fname,
+                             const char *xattr_name)
+{
+       NTSTATUS status;
+       struct ea_struct ea;
+       ssize_t result;
+
+       status = get_ea_value(talloc_tos(), conn, NULL, fname,
+                             xattr_name, &ea);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return -1;
+       }
+
+       result = ea.value.length-1;
+       TALLOC_FREE(ea.value.data);
+       return result;
+}
+
+
+static int streams_xattr_fstat(vfs_handle_struct *handle, files_struct *fsp,
+                              SMB_STRUCT_STAT *sbuf)
+{
+       struct stream_io *io = (struct stream_io *)
+               VFS_FETCH_FSP_EXTENSION(handle, fsp);
+
+       DEBUG(10, ("streams_xattr_fstat called for %d\n", fsp->fh->fd));
+
+       if (io == NULL) {
+               return SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf);
+       }
+
+       if (SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf) == -1) {
+               return -1;
+       }
+
+       sbuf->st_size = get_xattr_size(handle->conn, io->base, io->xattr_name);
+       if (sbuf->st_size == -1) {
+               return -1;
+       }
+
+       DEBUG(10, ("sbuf->st_size = %d\n", (int)sbuf->st_size));
+
+       sbuf->st_ino = stream_inode(sbuf, io->xattr_name);
+       sbuf->st_mode &= ~S_IFMT;
+        sbuf->st_mode |= S_IFREG;
+        sbuf->st_blocks = sbuf->st_size % STAT_ST_BLOCKSIZE + 1;
+
+       return 0;
+}
+
+static int streams_xattr_stat(vfs_handle_struct *handle, const char *fname,
+                             SMB_STRUCT_STAT *sbuf)
+{
+       NTSTATUS status;
+       char *base = NULL, *sname = NULL;
+       int result = -1;
+       char *xattr_name;
+
+       if (!is_ntfs_stream_name(fname)) {
+               return SMB_VFS_NEXT_STAT(handle, fname, sbuf);
+       }
+
+       status = split_ntfs_stream_name(talloc_tos(), fname, &base, &sname);
+       if (!NT_STATUS_IS_OK(status)) {
+               errno = EINVAL;
+               return -1;
+       }
+
+       if (SMB_VFS_STAT(handle->conn, base, sbuf) == -1) {
+               goto fail;
+       }
+
+       xattr_name = talloc_asprintf(talloc_tos(), "%s%s",
+                                    SAMBA_XATTR_DOSSTREAM_PREFIX, sname);
+       if (xattr_name == NULL) {
+               errno = ENOMEM;
+               goto fail;
+       }
+
+       sbuf->st_size = get_xattr_size(handle->conn, base, xattr_name);
+       if (sbuf->st_size == -1) {
+               errno = ENOENT;
+               goto fail;
+       }
+
+       sbuf->st_ino = stream_inode(sbuf, xattr_name);
+       sbuf->st_mode &= ~S_IFMT;
+        sbuf->st_mode |= S_IFREG;
+        sbuf->st_blocks = sbuf->st_size % STAT_ST_BLOCKSIZE + 1;
+
+       result = 0;
+ fail:
+       TALLOC_FREE(base);
+       TALLOC_FREE(sname);
+       return result;
+}
+
+static int streams_xattr_lstat(vfs_handle_struct *handle, const char *fname,
+                              SMB_STRUCT_STAT *sbuf)
+{
+       NTSTATUS status;
+       char *base, *sname;
+       int result = -1;
+       char *xattr_name;
+
+       if (!is_ntfs_stream_name(fname)) {
+               return SMB_VFS_NEXT_LSTAT(handle, fname, sbuf);
+       }
+
+       status = split_ntfs_stream_name(talloc_tos(), fname, &base, &sname);
+       if (!NT_STATUS_IS_OK(status)) {
+               errno = EINVAL;
+               goto fail;
+       }
+
+       if (SMB_VFS_LSTAT(handle->conn, base, sbuf) == -1) {
+               goto fail;
+       }
+
+       xattr_name = talloc_asprintf(talloc_tos(), "%s%s",
+                                    SAMBA_XATTR_DOSSTREAM_PREFIX, sname);
+       if (xattr_name == NULL) {
+               errno = ENOMEM;
+               goto fail;
+       }
+
+       sbuf->st_size = get_xattr_size(handle->conn, base, xattr_name);
+       if (sbuf->st_size == -1) {
+               errno = ENOENT;
+               goto fail;
+       }
+
+       sbuf->st_ino = stream_inode(sbuf, xattr_name);
+       sbuf->st_mode &= ~S_IFMT;
+        sbuf->st_mode |= S_IFREG;
+        sbuf->st_blocks = sbuf->st_size % STAT_ST_BLOCKSIZE + 1;
+
+       result = 0;
+ fail:
+       TALLOC_FREE(base);
+       TALLOC_FREE(sname);
+       return result;
+}
+
+static int streams_xattr_open(vfs_handle_struct *handle,  const char *fname,
+                             files_struct *fsp, int flags, mode_t mode)
+{
+       TALLOC_CTX *frame;
+       NTSTATUS status;
+       struct stream_io *sio;
+       char *base, *sname;
+       struct ea_struct ea;
+       char *xattr_name;
+       int baseflags;
+       int hostfd = -1;
+
+       DEBUG(10, ("streams_xattr_open called for %s\n", fname));
+
+       if (!is_ntfs_stream_name(fname)) {
+               return SMB_VFS_NEXT_OPEN(handle, fname, fsp, flags, mode);
+       }
+
+       frame = talloc_stackframe();
+
+       status = split_ntfs_stream_name(talloc_tos(), fname,
+                                       &base, &sname);
+       if (!NT_STATUS_IS_OK(status)) {
+               errno = EINVAL;
+               goto fail;
+       }
+
+       xattr_name = talloc_asprintf(talloc_tos(), "%s%s",
+                                    SAMBA_XATTR_DOSSTREAM_PREFIX, sname);
+       if (xattr_name == NULL) {
+               errno = ENOMEM;
+               goto fail;
+       }
+
+       /*
+        * We use baseflags to turn off nasty side-effects when opening the
+        * underlying file.
+         */
+        baseflags = flags;
+        baseflags &= ~O_TRUNC;
+        baseflags &= ~O_EXCL;
+        baseflags &= ~O_CREAT;
+
+        hostfd = SMB_VFS_OPEN(handle->conn, base, fsp, baseflags, mode);
+
+        /* It is legit to open a stream on a directory, but the base
+         * fd has to be read-only.
+         */
+        if ((hostfd == -1) && (errno == EISDIR)) {
+                baseflags &= ~O_ACCMODE;
+                baseflags |= O_RDONLY;
+                hostfd = SMB_VFS_OPEN(handle->conn, fname, fsp, baseflags,
+                                     mode);
+        }
+
+        if (hostfd == -1) {
+               goto fail;
+        }
+
+       status = get_ea_value(talloc_tos(), handle->conn, NULL, base,
+                             xattr_name, &ea);
+
+       DEBUG(10, ("get_ea_value returned %s\n", nt_errstr(status)));
+
+       if (!NT_STATUS_IS_OK(status)
+           && !NT_STATUS_EQUAL(status, NT_STATUS_NOT_FOUND)) {
+               /*
+                * The base file is not there. This is an error even if we got
+                * O_CREAT, the higher levels should have created the base
+                * file for us.
+                */
+               DEBUG(10, ("streams_xattr_open: base file %s not around, "
+                          "returning ENOENT\n", base));
+               errno = ENOENT;
+               goto fail;
+       }
+
+       if (!NT_STATUS_IS_OK(status)) {
+               /*
+                * The attribute does not exist
+                */
+
+                if (flags & O_CREAT) {
+                       /*
+                        * Darn, xattrs need at least 1 byte
+                        */
+                        char null = '\0';
+
+                       DEBUG(10, ("creating attribute %s on file %s\n",
+                                  xattr_name, base));
+
+                        if (SMB_VFS_SETXATTR(
+                               handle->conn, base, xattr_name,
+                               &null, sizeof(null),
+                               flags & O_EXCL ? XATTR_CREATE : 0) == -1) {
+                               goto fail;
+                       }
+               }
+       }
+
+       if (flags & O_TRUNC) {
+               char null = '\0';
+               if (SMB_VFS_SETXATTR(
+                           handle->conn, base, xattr_name,
+                           &null, sizeof(null),
+                           flags & O_EXCL ? XATTR_CREATE : 0) == -1) {
+                       goto fail;
+               }
+       }
+
+        sio = (struct stream_io *)VFS_ADD_FSP_EXTENSION(handle, fsp,
+                                                       struct stream_io);
+        if (sio == NULL) {
+                errno = ENOMEM;
+                goto fail;
+        }
+
+        sio->xattr_name = talloc_strdup(VFS_MEMCTX_FSP_EXTENSION(handle, fsp),
+                                       xattr_name);
+        sio->base = talloc_strdup(VFS_MEMCTX_FSP_EXTENSION(handle, fsp),
+                                 base);
+
+       if ((sio->xattr_name == NULL) || (sio->base == NULL)) {
+               errno = ENOMEM;
+               goto fail;
+       }
+
+       TALLOC_FREE(frame);
+       return hostfd;
+
+ fail:
+       if (hostfd >= 0) {
+               /*
+                * BUGBUGBUG -- we would need to call fd_close_posix here, but
+                * we don't have a full fsp yet
+                */
+               SMB_VFS_CLOSE(fsp, hostfd);
+       }
+
+       TALLOC_FREE(frame);
+       return -1;
+}
+
+static int streams_xattr_unlink(vfs_handle_struct *handle,  const char *fname)
+{
+       NTSTATUS status;
+       char *base = NULL;
+       char *sname = NULL;
+       int ret = -1;
+       char *xattr_name;
+
+       if (!is_ntfs_stream_name(fname)) {
+               return SMB_VFS_NEXT_UNLINK(handle, fname);
+       }
+
+       status = split_ntfs_stream_name(talloc_tos(), fname, &base, &sname);
+       if (!NT_STATUS_IS_OK(status)) {
+               errno = EINVAL;
+               goto fail;
+       }
+
+       xattr_name = talloc_asprintf(talloc_tos(), "%s%s",
+                                    SAMBA_XATTR_DOSSTREAM_PREFIX, sname);
+       if (xattr_name == NULL) {
+               errno = ENOMEM;
+               goto fail;
+       }
+
+       ret = SMB_VFS_REMOVEXATTR(handle->conn, base, xattr_name);
+
+       if ((ret == -1) && (errno == ENOATTR)) {
+               errno = ENOENT;
+               goto fail;
+       }
+
+       ret = 0;
+
+ fail:
+       TALLOC_FREE(base);
+       TALLOC_FREE(sname);
+       return ret;
+}
+
+static NTSTATUS walk_xattr_streams(connection_struct *conn, files_struct *fsp,
+                                  const char *fname,
+                                  bool (*fn)(struct ea_struct *ea,
+                                             void *private_data),
+                                  void *private_data)
+{
+       NTSTATUS status;
+       char **names;
+       size_t i, num_names;
+       size_t prefix_len = strlen(SAMBA_XATTR_DOSSTREAM_PREFIX);
+
+       status = get_ea_names_from_file(talloc_tos(), conn, fsp, fname,
+                                       &names, &num_names);
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       for (i=0; i<num_names; i++) {
+               struct ea_struct ea;
+
+               if (strncmp(names[i], SAMBA_XATTR_DOSSTREAM_PREFIX,
+                           prefix_len) != 0) {
+                       continue;
+               }
+
+               status = get_ea_value(names, conn, fsp, fname, names[i], &ea);
+               if (!NT_STATUS_IS_OK(status)) {
+                       DEBUG(10, ("Could not get ea %s for file %s: %s\n",
+                                  names[i], fname, nt_errstr(status)));
+                       continue;
+               }
+
+               ea.name = talloc_asprintf(ea.value.data, ":%s",
+                                         names[i] + prefix_len);
+               if (ea.name == NULL) {
+                       DEBUG(0, ("talloc failed\n"));
+                       continue;
+               }
+
+               if (!fn(&ea, private_data)) {
+                       TALLOC_FREE(ea.value.data);
+                       return NT_STATUS_OK;
+               }
+
+               TALLOC_FREE(ea.value.data);
+       }
+
+       TALLOC_FREE(names);
+       return NT_STATUS_OK;
+}
+
+static bool add_one_stream(TALLOC_CTX *mem_ctx, unsigned int *num_streams,
+                          struct stream_struct **streams,
+                          const char *name, SMB_OFF_T size,
+                          SMB_OFF_T alloc_size)
+{
+       struct stream_struct *tmp;
+
+       tmp = TALLOC_REALLOC_ARRAY(mem_ctx, *streams, struct stream_struct,
+                                  (*num_streams)+1);
+       if (tmp == NULL) {
+               return false;
+       }
+
+       tmp[*num_streams].name = talloc_strdup(tmp, name);
+       if (tmp[*num_streams].name == NULL) {
+               return false;
+       }
+
+       tmp[*num_streams].size = size;
+       tmp[*num_streams].alloc_size = alloc_size;
+
+       *streams = tmp;
+       *num_streams += 1;
+       return true;
+}
+
+struct streaminfo_state {
+       TALLOC_CTX *mem_ctx;
+       vfs_handle_struct *handle;
+       unsigned int num_streams;
+       struct stream_struct *streams;
+       NTSTATUS status;
+};
+
+static bool collect_one_stream(struct ea_struct *ea, void *private_data)
+{
+       struct streaminfo_state *state =
+               (struct streaminfo_state *)private_data;
+
+       if (!add_one_stream(state->mem_ctx,
+                           &state->num_streams, &state->streams,
+                           ea->name, ea->value.length-1,
+                           smb_roundup(state->handle->conn,
+                                       ea->value.length-1))) {
+               state->status = NT_STATUS_NO_MEMORY;
+               return false;
+       }
+
+       return true;
+}
+
+static NTSTATUS streams_xattr_streaminfo(vfs_handle_struct *handle,
+                                        struct files_struct *fsp,
+                                        const char *fname,
+                                        TALLOC_CTX *mem_ctx,
+                                        unsigned int *pnum_streams,
+                                        struct stream_struct **pstreams)
+{
+       SMB_STRUCT_STAT sbuf;
+       int ret;
+       NTSTATUS status;
+       struct streaminfo_state state;
+
+       if ((fsp != NULL) && (fsp->fh->fd != -1)) {
+               if (is_ntfs_stream_name(fsp->fsp_name)) {
+                       return NT_STATUS_INVALID_PARAMETER;
+               }
+               ret = SMB_VFS_FSTAT(fsp, &sbuf);
+       }
+       else {
+               if (is_ntfs_stream_name(fname)) {
+                       return NT_STATUS_INVALID_PARAMETER;
+               }
+               ret = SMB_VFS_STAT(handle->conn, fname, &sbuf);
+       }
+
+       if (ret == -1) {
+               return map_nt_error_from_unix(errno);
+       }
+
+       state.streams = NULL;
+       state.num_streams = 0;
+
+       if (!S_ISDIR(sbuf.st_mode)) {
+               if (!add_one_stream(mem_ctx,
+                                   &state.num_streams, &state.streams,
+                                   "::$DATA", sbuf.st_size,
+                                   get_allocation_size(handle->conn, fsp,
+                                                       &sbuf))) {
+                       return NT_STATUS_NO_MEMORY;
+               }
+       }
+
+       state.mem_ctx = mem_ctx;
+       state.handle = handle;
+       state.status = NT_STATUS_OK;
+
+       status = walk_xattr_streams(handle->conn, fsp, fname,
+                                   collect_one_stream, &state);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               TALLOC_FREE(state.streams);
+               return status;
+       }
+
+       if (!NT_STATUS_IS_OK(state.status)) {
+               TALLOC_FREE(state.streams);
+               return state.status;
+       }
+
+       *pnum_streams = state.num_streams;
+       *pstreams = state.streams;
+       return NT_STATUS_OK;
+}
+
+static uint32_t streams_xattr_fs_capabilities(struct vfs_handle_struct *handle)
+{
+       return SMB_VFS_NEXT_FS_CAPABILITIES(handle) | FILE_NAMED_STREAMS;
+}
+
+static ssize_t streams_xattr_pwrite(vfs_handle_struct *handle,
+                                   files_struct *fsp, const void *data,
+                                   size_t n, SMB_OFF_T offset)
+{
+        struct stream_io *sio =
+               (struct stream_io *)VFS_FETCH_FSP_EXTENSION(handle, fsp);
+       struct ea_struct ea;
+       NTSTATUS status;
+       int ret;
+
+       DEBUG(10, ("streams_xattr_pwrite called for %d bytes\n", (int)n));
+
+       if (sio == NULL) {
+               return SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, offset);
+       }
+
+       status = get_ea_value(talloc_tos(), handle->conn, fsp->base_fsp,
+                             sio->base, sio->xattr_name, &ea);
+       if (!NT_STATUS_IS_OK(status)) {
+               return -1;
+       }
+
+        if ((offset + n) > ea.value.length-1) {
+               uint8 *tmp;
+
+               tmp = TALLOC_REALLOC_ARRAY(talloc_tos(), ea.value.data, uint8,
+                                          offset + n + 1);
+
+               if (tmp == NULL) {
+                       TALLOC_FREE(ea.value.data);
+                        errno = ENOMEM;
+                        return -1;
+                }
+               ea.value.data = tmp;
+               ea.value.length = offset + n + 1;
+               ea.value.data[offset+n] = 0;
+        }
+
+        memcpy(ea.value.data + offset, data, n);
+
+       ret = SMB_VFS_SETXATTR(fsp->conn, fsp->base_fsp->fsp_name,
+                               sio->xattr_name,
+                               ea.value.data, ea.value.length, 0);
+
+       TALLOC_FREE(ea.value.data);
+
+       if (ret == -1) {
+               return -1;
+       }
+
+       return n;
+}
+
+static ssize_t streams_xattr_pread(vfs_handle_struct *handle,
+                                  files_struct *fsp, void *data,
+                                  size_t n, SMB_OFF_T offset)
+{
+        struct stream_io *sio =
+               (struct stream_io *)VFS_FETCH_FSP_EXTENSION(handle, fsp);
+       struct ea_struct ea;
+       NTSTATUS status;
+        size_t length, overlap;
+
+       if (sio == NULL) {
+               return SMB_VFS_NEXT_PREAD(handle, fsp, data, n, offset);
+       }
+
+       status = get_ea_value(talloc_tos(), handle->conn, fsp->base_fsp,
+                             sio->base, sio->xattr_name, &ea);
+       if (!NT_STATUS_IS_OK(status)) {
+               return -1;
+       }
+
+       length = ea.value.length-1;
+
+        /* Attempt to read past EOF. */
+        if (length <= offset) {
+                errno = EINVAL;
+                return -1;
+        }
+
+        overlap = (offset + n) > length ? (length - offset) : n;
+        memcpy(data, ea.value.data + offset, overlap);
+
+       TALLOC_FREE(ea.value.data);
+        return overlap;
+}
+
+/* VFS operations structure */
+
+static vfs_op_tuple streams_xattr_ops[] = {
+       {SMB_VFS_OP(streams_xattr_fs_capabilities), SMB_VFS_OP_FS_CAPABILITIES,
+        SMB_VFS_LAYER_TRANSPARENT},
+       {SMB_VFS_OP(streams_xattr_open), SMB_VFS_OP_OPEN,
+        SMB_VFS_LAYER_TRANSPARENT},
+       {SMB_VFS_OP(streams_xattr_stat), SMB_VFS_OP_STAT,
+        SMB_VFS_LAYER_TRANSPARENT},
+       {SMB_VFS_OP(streams_xattr_fstat), SMB_VFS_OP_FSTAT,
+        SMB_VFS_LAYER_TRANSPARENT},
+       {SMB_VFS_OP(streams_xattr_lstat), SMB_VFS_OP_LSTAT,
+        SMB_VFS_LAYER_TRANSPARENT},
+       {SMB_VFS_OP(streams_xattr_pread), SMB_VFS_OP_PREAD,
+        SMB_VFS_LAYER_TRANSPARENT},
+       {SMB_VFS_OP(streams_xattr_pwrite), SMB_VFS_OP_PWRITE,
+        SMB_VFS_LAYER_TRANSPARENT},
+       {SMB_VFS_OP(streams_xattr_lstat), SMB_VFS_OP_LSTAT,
+        SMB_VFS_LAYER_TRANSPARENT},
+       {SMB_VFS_OP(streams_xattr_unlink), SMB_VFS_OP_UNLINK,
+        SMB_VFS_LAYER_TRANSPARENT},
+       {SMB_VFS_OP(streams_xattr_streaminfo), SMB_VFS_OP_STREAMINFO,
+        SMB_VFS_LAYER_OPAQUE},
+       {SMB_VFS_OP(NULL), SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP}
+};
+
+NTSTATUS vfs_streams_xattr_init(void);
+NTSTATUS vfs_streams_xattr_init(void)
+{
+       return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "streams_xattr",
+                               streams_xattr_ops);
+}
index 43cae0f8266b3a96f1d4ab128b65249e25216b04..b23a7ddcfab2d85402518486cf3e3aa10a88c943 100644 (file)
@@ -1,7 +1,7 @@
 /*
    Unix SMB/Netbios implementation.
    VFS module to get and set Tru64 acls
-   Copyright (C) Michael Adam 2006
+   Copyright (C) Michael Adam 2006,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
@@ -67,11 +67,10 @@ SMB_ACL_T tru64acl_sys_acl_get_file(vfs_handle_struct *handle,
 }
 
 SMB_ACL_T tru64acl_sys_acl_get_fd(vfs_handle_struct *handle,
-                                 files_struct *fsp,
-                                 int fd)
+                                 files_struct *fsp)
 {
        struct smb_acl_t *result;
-       acl_t tru64_acl = acl_get_fd(fd, ACL_TYPE_ACCESS);
+       acl_t tru64_acl = acl_get_fd(fsp->fh->fd, ACL_TYPE_ACCESS);
 
        if (tru64_acl == NULL) {
                return NULL;
@@ -129,14 +128,14 @@ fail:
 
 int tru64acl_sys_acl_set_fd(vfs_handle_struct *handle,
                            files_struct *fsp,
-                           int fd, SMB_ACL_T theacl)
+                           SMB_ACL_T theacl)
 {
         int res;
         acl_t tru64_acl = smb_acl_to_tru64_acl(theacl);
         if (tru64_acl == NULL) {
                 return -1;
         }
-        res =  acl_set_fd(fd, ACL_TYPE_ACCESS, tru64_acl);
+        res =  acl_set_fd(fsp->fh->fd, ACL_TYPE_ACCESS, tru64_acl);
         acl_free(tru64_acl);
         return res;
 
diff --git a/source/modules/vfs_tsmsm.c b/source/modules/vfs_tsmsm.c
new file mode 100644 (file)
index 0000000..2805488
--- /dev/null
@@ -0,0 +1,341 @@
+/*
+  Unix SMB/CIFS implementation.
+  Samba VFS module for handling offline files
+  with Tivoli Storage Manager Space Management
+
+  (c) Alexander Bokovoy, 2007
+  (c) Andrew Tridgell, 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/>.
+ */
+/*
+  This VFS module accepts following options:
+  tsmsm: hsm script = <path to hsm script> (/bin/true by default, i.e. does nothing)
+         hsm script should point to a shell script which accepts two arguments:
+        <operation> <filepath>
+        where <operation> is currently 'offline' to set offline status of the <filepath>
+
+  tsmsm: online ratio = ratio to check reported size against actual file size (0.5 by default)
+
+  The TSMSM VFS module tries to avoid calling expensive DMAPI calls with some heuristics
+  based on the fact that number of blocks reported of a file multiplied by 512 will be
+  bigger than 'online ratio' of actual size for online (non-migrated) files.
+
+  If checks fail, we call DMAPI and ask for specific IBM attribute which present for
+  offline (migrated) files. If this attribute presents, we consider file offline.
+ */
+
+#include "includes.h"
+
+#ifndef USE_DMAPI
+#error "This module requires DMAPI support!"
+#endif
+
+#ifdef HAVE_XFS_DMAPI_H
+#include <xfs/dmapi.h>
+#elif defined(HAVE_SYS_DMI_H)
+#include <sys/dmi.h>
+#elif defined(HAVE_SYS_JFSDMAPI_H)
+#include <sys/jfsdmapi.h>
+#elif defined(HAVE_SYS_DMAPI_H)
+#include <sys/dmapi.h>
+#elif defined(HAVE_DMAPI_H)
+#include <dmapi.h>
+#endif
+
+#ifndef _ISOC99_SOURCE
+#define _ISOC99_SOURCE 
+#endif
+
+#include <math.h> 
+
+/* optimisation tunables - used to avoid the DMAPI slow path */
+#define FILE_IS_ONLINE_RATIO      0.5
+#define DM_ATTRIB_OBJECT "IBMObj"
+#define DM_ATTRIB_MIGRATED "IBMMig"
+
+struct tsmsm_struct {
+       dm_sessid_t sid;
+       float online_ratio;
+       char *hsmscript;
+};
+
+#define TSM_STRINGIFY(a) #a
+#define TSM_TOSTRING(a) TSM_STRINGIFY(a)
+
+static void tsmsm_free_data(void **pptr) {
+       struct tsmsm_struct **tsmd = (struct tsmsm_struct **)pptr;
+       if(!tsmd) return;
+       TALLOC_FREE(*tsmd);
+}
+
+static int tsmsm_connect(struct vfs_handle_struct *handle,
+                        const char *service,
+                        const char *user) {
+       struct tsmsm_struct *tsmd = TALLOC_ZERO_P(handle, struct tsmsm_struct);
+       const char *hsmscript, *tsmname;
+       const char *fres;
+       
+       if (!tsmd) {
+               DEBUG(0,("tsmsm_connect: out of memory!\n"));
+               return -1;
+       }
+
+       tsmd->sid = *(dm_sessid_t*) dmapi_get_current_session();
+
+       if (tsmd->sid == DM_NO_SESSION) {
+               DEBUG(0,("tsmsm_connect: no DMAPI session for Samba is available!\n"));
+               TALLOC_FREE(tsmd);
+               return -1;
+       }
+
+       tsmname = (handle->param ? handle->param : "tsmsm");
+       hsmscript = lp_parm_const_string(SNUM(handle->conn), tsmname,
+                                        "hsm script", NULL);
+       if (hsmscript) {
+               tsmd->hsmscript = talloc_strdup(tsmd, hsmscript);
+               if(!tsmd->hsmscript) {
+                       DEBUG(1, ("tsmsm_connect: can't allocate memory for hsm script path"));
+                       TALLOC_FREE(tsmd);
+                       return -1;
+               }
+       } else {
+               DEBUG(1, ("tsmsm_connect: can't call hsm script because it "
+                         "is not set to anything in the smb.conf\n"
+                         "Use %s: 'hsm script = path' to set it\n",
+                         tsmname));
+               TALLOC_FREE(tsmd);
+               return -1;
+       }
+
+       fres = lp_parm_const_string(SNUM(handle->conn), tsmname, 
+                                   "online ratio", TSM_TOSTRING(FILE_IS_ONLINE_RATIO));
+       tsmd->online_ratio = strtof(fres, NULL);
+       if((tsmd->online_ratio == (float)0) || ((errno == ERANGE) &&
+                                               ((tsmd->online_ratio == HUGE_VALF) ||
+                                                (tsmd->online_ratio == HUGE_VALL)))) {
+               DEBUG(1, ("tsmsm_connect: error while getting online ratio from smb.conf."
+                         "Default to %s.\n", TSM_TOSTRING(FILE_IS_ONLINE_RATIO)));
+               tsmd->online_ratio = FILE_IS_ONLINE_RATIO;
+       }
+
+        /* Store the private data. */
+        SMB_VFS_HANDLE_SET_DATA(handle, tsmd, tsmsm_free_data,
+                                struct tsmsm_struct, return -1);
+        return SMB_VFS_NEXT_CONNECT(handle, service, user); 
+}
+
+static bool tsmsm_is_offline(struct vfs_handle_struct *handle, 
+                           const char *path,
+                           SMB_STRUCT_STAT *stbuf) {
+       struct tsmsm_struct *tsmd = (struct tsmsm_struct *) handle->data;
+       void *dmhandle = NULL;
+       size_t dmhandle_len = 0;
+       size_t rlen;
+       dm_attrname_t dmname;
+       int ret;
+       bool offline;
+
+        /* if the file has more than FILE_IS_ONLINE_RATIO of blocks available,
+          then assume it is not offline (it may not be 100%, as it could be sparse) */
+       if (512 * (off_t)stbuf->st_blocks >= stbuf->st_size * tsmd->online_ratio) {
+               DEBUG(10,("%s not offline: st_blocks=%ld st_size=%ld online_ratio=%.2f\n", 
+                         path, stbuf->st_blocks, stbuf->st_size, tsmd->online_ratio));
+               return false;
+       }
+       
+        /* using POSIX capabilities does not work here. It's a slow path, so 
+        * become_root() is just as good anyway (tridge) 
+        */
+
+       /* Also, AIX has DMAPI but no POSIX capablities support. In this case,
+        * we need to be root to do DMAPI manipulations.
+        */
+       become_root();
+
+       /* go the slow DMAPI route */
+       if (dm_path_to_handle((char*)path, &dmhandle, &dmhandle_len) != 0) {
+               DEBUG(2,("dm_path_to_handle failed - assuming offline (%s) - %s\n", 
+                        path, strerror(errno)));
+               offline = true;
+               goto done;
+       }
+
+       memset(&dmname, 0, sizeof(dmname));
+       strlcpy((char *)&dmname.an_chars[0], DM_ATTRIB_OBJECT, sizeof(dmname.an_chars));
+
+       ret = dm_get_dmattr(tsmd->sid, dmhandle, dmhandle_len, 
+                           DM_NO_TOKEN, &dmname, 0, NULL, &rlen);
+
+       /* its offline if the IBMObj attribute exists */
+       offline = (ret == 0 || (ret == -1 && errno == E2BIG));
+
+       DEBUG(10,("dm_get_dmattr %s ret=%d (%s)\n", path, ret, strerror(errno)));
+
+       ret = 0;
+
+       dm_handle_free(dmhandle, dmhandle_len); 
+
+done:
+       unbecome_root();
+       return offline;
+}
+
+
+static bool tsmsm_aio_force(struct vfs_handle_struct *handle, struct files_struct *fsp)
+{
+       SMB_STRUCT_STAT sbuf;
+       struct tsmsm_struct *tsmd = (struct tsmsm_struct *) handle->data;
+       /* see if the file might be offline. This is called before each IO
+          to ensure we use AIO if the file is offline. We don't do the full dmapi
+          call as that would be too slow, instead we err on the side of using AIO
+          if the file might be offline
+       */
+       if(SMB_VFS_FSTAT(fsp, &sbuf) == 0) {
+               DEBUG(10,("tsmsm_aio_force st_blocks=%ld st_size=%ld online_ratio=%.2f\n", 
+                         sbuf.st_blocks, sbuf.st_size, tsmd->online_ratio));
+               return !(512 * (off_t)sbuf.st_blocks >= sbuf.st_size * tsmd->online_ratio);
+       }
+       return false;
+}
+
+static ssize_t tsmsm_aio_return(struct vfs_handle_struct *handle, struct files_struct *fsp, 
+                               SMB_STRUCT_AIOCB *aiocb)
+{
+       ssize_t result;
+
+       result = SMB_VFS_NEXT_AIO_RETURN(handle, fsp, aiocb);
+       if(result >= 0) {
+               notify_fname(handle->conn, NOTIFY_ACTION_MODIFIED,
+                            FILE_NOTIFY_CHANGE_ATTRIBUTES,
+                            fsp->fsp_name);
+       }
+
+       return result;
+}
+
+static ssize_t tsmsm_sendfile(vfs_handle_struct *handle, int tofd, files_struct *fsp, const DATA_BLOB *hdr,
+                             SMB_OFF_T offset, size_t n)
+{
+       bool file_online = tsmsm_aio_force(handle, fsp);
+
+       if(!file_online) 
+           return ENOSYS;
+           
+       return SMB_VFS_NEXT_SENDFILE(handle, tofd, fsp, hdr, offset, n);
+}
+
+/* We do overload pread to allow notification when file becomes online after offline status */
+/* We don't intercept SMB_VFS_READ here because all file I/O now goes through SMB_VFS_PREAD instead */
+static ssize_t tsmsm_pread(struct vfs_handle_struct *handle, struct files_struct *fsp, 
+                          void *data, size_t n, SMB_OFF_T offset) {
+       ssize_t result;
+       bool notify_online = tsmsm_aio_force(handle, fsp);
+
+       result = SMB_VFS_NEXT_PREAD(handle, fsp, data, n, offset);
+       if((result != -1) && notify_online) {
+           /* We can't actually force AIO at this point (came here not from reply_read_and_X) 
+              what we can do is to send notification that file became online
+           */
+               notify_fname(handle->conn, NOTIFY_ACTION_MODIFIED,
+                            FILE_NOTIFY_CHANGE_ATTRIBUTES,
+                            fsp->fsp_name);
+       }
+
+       return result;
+}
+
+static ssize_t tsmsm_pwrite(struct vfs_handle_struct *handle, struct files_struct *fsp, 
+                          void *data, size_t n, SMB_OFF_T offset) {
+       ssize_t result;
+       bool notify_online = tsmsm_aio_force(handle, fsp);
+
+       result = SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, offset);
+       if((result != -1) && notify_online) {
+           /* We can't actually force AIO at this point (came here not from reply_read_and_X) 
+              what we can do is to send notification that file became online
+           */
+               notify_fname(handle->conn, NOTIFY_ACTION_MODIFIED,
+                            FILE_NOTIFY_CHANGE_ATTRIBUTES,
+                            fsp->fsp_name);
+       }
+
+       return result;
+}
+
+static int tsmsm_set_offline(struct vfs_handle_struct *handle, 
+                            const char *path) {
+       struct tsmsm_struct *tsmd = (struct tsmsm_struct *) handle->data;
+       int result = 0;
+       char *command;
+
+       /* Now, call the script */
+       command = talloc_asprintf(tsmd, "%s offline \"%s\"", tsmd->hsmscript, path);
+       if(!command) {
+               DEBUG(1, ("tsmsm_set_offline: can't allocate memory to run hsm script"));
+               return -1;
+       }
+       DEBUG(10, ("tsmsm_set_offline: Running [%s]\n", command));
+       if((result = smbrun(command, NULL)) != 0) {
+               DEBUG(1,("tsmsm_set_offline: Running [%s] returned %d\n", command, result));
+       }
+       TALLOC_FREE(command);
+       return result;
+}
+
+static bool tsmsm_statvfs(struct vfs_handle_struct *handle,  const char *path, vfs_statvfs_struct *statbuf)
+{
+       bool result;
+
+       result = SMB_VFS_NEXT_STATVFS(handle, path, statbuf);
+       statbuf->FsCapabilities | = FILE_SUPPORTS_REMOTE_STORAGE | FILE_SUPPORTS_REPARSE_POINTS;
+
+       return result;
+}
+
+static vfs_op_tuple vfs_tsmsm_ops[] = {
+
+       /* Disk operations */
+
+       {SMB_VFS_OP(tsmsm_connect),     SMB_VFS_OP_CONNECT,
+        SMB_VFS_LAYER_TRANSPARENT},
+       {SMB_VFS_OP(tsmsm_statvfs),     SMB_VFS_OP_STATVFS,
+        SMB_VFS_LAYER_TRANSPARENT},
+       {SMB_VFS_OP(tsmsm_aio_force),   SMB_VFS_OP_AIO_FORCE,
+        SMB_VFS_LAYER_TRANSPARENT},
+       {SMB_VFS_OP(tsmsm_aio_return),  SMB_VFS_OP_AIO_RETURN,
+        SMB_VFS_LAYER_TRANSPARENT},
+       {SMB_VFS_OP(tsmsm_pread),       SMB_VFS_OP_PREAD,
+        SMB_VFS_LAYER_TRANSPARENT},
+       {SMB_VFS_OP(tsmsm_pwrite),      SMB_VFS_OP_PWRITE,
+        SMB_VFS_LAYER_TRANSPARENT},
+       {SMB_VFS_OP(tsmsm_sendfile),    SMB_VFS_OP_SENDFILE,
+        SMB_VFS_LAYER_TRANSPARENT},
+       {SMB_VFS_OP(tsmsm_is_offline),  SMB_VFS_OP_IS_OFFLINE,
+        SMB_VFS_LAYER_OPAQUE},
+       {SMB_VFS_OP(tsmsm_set_offline), SMB_VFS_OP_SET_OFFLINE,
+        SMB_VFS_LAYER_OPAQUE},
+
+       /* Finish VFS operations definition */
+
+       {SMB_VFS_OP(NULL),              SMB_VFS_OP_NOOP,
+        SMB_VFS_LAYER_NOOP}
+};
+
+NTSTATUS vfs_tsmsm_init(void);
+NTSTATUS vfs_tsmsm_init(void)
+{
+       return smb_register_vfs(SMB_VFS_INTERFACE_VERSION,
+                               "tsmsm", vfs_tsmsm_ops);
+}
diff --git a/source/modules/vfs_xattr_tdb.c b/source/modules/vfs_xattr_tdb.c
new file mode 100644 (file)
index 0000000..171022b
--- /dev/null
@@ -0,0 +1,755 @@
+/*
+ * 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 status;
+}
+
+/*
+ * 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 = tdb_null;
+       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;
+
+       DEBUG(10, ("xattr_tdb_getattr called for file %s, name %s\n",
+                  file_id_string_tos(id), name));
+
+       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;
+
+       DEBUG(10, ("xattr_tdb_setattr called for file %s, name %s\n",
+                  file_id_string_tos(id), name));
+
+       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) {
+                       if (flags & XATTR_CREATE) {
+                               TALLOC_FREE(rec);
+                               errno = EEXIST;
+                               return -1;
+                       }
+                       break;
+               }
+       }
+
+       if (i == attribs->num_xattrs) {
+               struct tdb_xattr *tmp;
+
+               if (flags & XATTR_REPLACE) {
+                       TALLOC_FREE(rec);
+                       errno = ENOATTR;
+                       return -1;
+               }
+
+               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, "xattr", "tdb",
+                                     lock_path("xattr.tdb"));
+
+       if (dbname == NULL) {
+               errno = ENOSYS;
+               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_xattr_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 xattr 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_xattr_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);
+}
index 0fe21b2909883483d76160544d96eb209f3e4276..ce2e28771f7ca1193b6c037dd4d379602250b26a 100644 (file)
@@ -34,8 +34,9 @@
  * read the local file's acls and return it in NT form
  * using the NFSv4 format conversion
  */
-static NTSTATUS zfs_get_nt_acl(struct files_struct *fsp, uint32 security_info,
-                            struct security_descriptor **ppdesc)
+static NTSTATUS zfs_get_nt_acl_common(const char *name,
+                                     uint32 security_info,
+                                     SMB4ACL_T **ppacl)
 {
        int naces, i;
        ace_t *acebuf;
@@ -43,11 +44,13 @@ static NTSTATUS zfs_get_nt_acl(struct files_struct *fsp, uint32 security_info,
        TALLOC_CTX      *mem_ctx;
 
        /* read the number of file aces */
-       if((naces = acl(fsp->fsp_name, ACE_GETACLCNT, 0, NULL)) == -1) {
+       if((naces = acl(name, ACE_GETACLCNT, 0, NULL)) == -1) {
                if(errno == ENOSYS) {
-                       DEBUG(9, ("acl(ACE_GETACLCNT, %s): Operation is not supported on the filesystem where the file reside"));
+                       DEBUG(9, ("acl(ACE_GETACLCNT, %s): Operation is not "
+                                 "supported on the filesystem where the file "
+                                 "reside", name));
                } else {
-                       DEBUG(9, ("acl(ACE_GETACLCNT, %s): %s ", fsp->fsp_name,
+                       DEBUG(9, ("acl(ACE_GETACLCNT, %s): %s ", name,
                                        strerror(errno)));
                }
                return map_nt_error_from_unix(errno);
@@ -59,8 +62,8 @@ static NTSTATUS zfs_get_nt_acl(struct files_struct *fsp, uint32 security_info,
                return NT_STATUS_NO_MEMORY;
        }
        /* read the aces into the field */
-       if(acl(fsp->fsp_name, ACE_GETACL, naces, acebuf) < 0) {
-               DEBUG(9, ("acl(ACE_GETACL, %s): %s ", fsp->fsp_name,
+       if(acl(name, ACE_GETACL, naces, acebuf) < 0) {
+               DEBUG(9, ("acl(ACE_GETACL, %s): %s ", name,
                                strerror(errno)));
                return map_nt_error_from_unix(errno);
        }
@@ -92,7 +95,8 @@ static NTSTATUS zfs_get_nt_acl(struct files_struct *fsp, uint32 security_info,
                        return NT_STATUS_NO_MEMORY;
        }
 
-       return smb_get_nt_acl_nfs4(fsp, security_info, ppdesc, pacl);
+       *ppacl = pacl;
+       return NT_STATUS_OK;
 }
 
 /* call-back function processing the NT acl -> ZFS acl using NFSv4 conv. */
@@ -143,7 +147,9 @@ static bool zfs_process_smbacl(files_struct *fsp, SMB4ACL_T *smbacl)
        /* store acl */
        if(acl(fsp->fsp_name, ACE_SETACL, naces, acebuf)) {
                if(errno == ENOSYS) {
-                       DEBUG(9, ("acl(ACE_SETACL, %s): Operation is not supported on the filesystem where the file reside"));
+                       DEBUG(9, ("acl(ACE_SETACL, %s): Operation is not "
+                                 "supported on the filesystem where the file "
+                                 "reside", fsp->fsp_name));
                } else {
                        DEBUG(9, ("acl(ACE_SETACL, %s): %s ", fsp->fsp_name,
                                        strerror(errno)));
@@ -168,23 +174,39 @@ static NTSTATUS zfs_set_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
 
 static NTSTATUS zfsacl_fget_nt_acl(struct vfs_handle_struct *handle,
                                 struct files_struct *fsp,
-                                int fd,  uint32 security_info,
+                                uint32 security_info,
                                 struct security_descriptor **ppdesc)
 {
-       return zfs_get_nt_acl(fsp, security_info, ppdesc);
+       SMB4ACL_T *pacl;
+       NTSTATUS status;
+
+       status = zfs_get_nt_acl_common(fsp->fsp_name, security_info, &pacl);
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       return smb_fget_nt_acl_nfs4(fsp, security_info, ppdesc, pacl);
 }
 
 static NTSTATUS zfsacl_get_nt_acl(struct vfs_handle_struct *handle,
-                               struct files_struct *fsp,
                                const char *name,  uint32 security_info,
                                struct security_descriptor **ppdesc)
 {
-       return zfs_get_nt_acl(fsp, security_info, ppdesc);
+       SMB4ACL_T *pacl;
+       NTSTATUS status;
+
+       status = zfs_get_nt_acl_common(name, security_info, &pacl);
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       return smb_get_nt_acl_nfs4(handle->conn, name, security_info, ppdesc,
+                                  pacl);
 }
 
 static NTSTATUS zfsacl_fset_nt_acl(vfs_handle_struct *handle,
                         files_struct *fsp,
-                        int fd, uint32 security_info_sent,
+                        uint32 security_info_sent,
                         SEC_DESC *psd)
 {
        return zfs_set_nt_acl(handle, fsp, security_info_sent, psd);
@@ -200,7 +222,7 @@ static NTSTATUS zfsacl_set_nt_acl(vfs_handle_struct *handle,
 
 /* VFS operations structure */
 
-static vfs_op_tuple zfsacl_ops[] = {   
+static vfs_op_tuple zfsacl_ops[] = {
        {SMB_VFS_OP(zfsacl_fget_nt_acl), SMB_VFS_OP_FGET_NT_ACL,
         SMB_VFS_LAYER_OPAQUE},
        {SMB_VFS_OP(zfsacl_get_nt_acl), SMB_VFS_OP_GET_NT_ACL,
index 344831ddca77cd2ed37ae908da01d1ce6098e69e..378b6f3dbe078627bc1b7779f73b6e7e8be6432b 100644 (file)
@@ -676,11 +676,18 @@ static bool open_sockets(bool isdaemon, int port)
                ClientNMB = 0;
        }
 
+       if (ClientNMB == -1) {
+               return false;
+       }
+
        ClientDGRAM = open_socket_in(SOCK_DGRAM, DGRAM_PORT,
                                           3, &ss,
                                           true);
 
-       if (ClientNMB == -1) {
+       if (ClientDGRAM == -1) {
+               if (ClientNMB != 0) {
+                       close(ClientNMB);
+               }
                return false;
        }
 
index bafe87c044412b66e2d011d3fada52df75054b93..b50d215b91d57c37b5287ceb9f076782c932561a 100644 (file)
@@ -336,7 +336,9 @@ bool check_elections(void)
        for (subrec = FIRST_SUBNET; subrec; subrec = NEXT_SUBNET_EXCLUDING_UNICAST(subrec)) {
                struct work_record *work;
                for (work = subrec->workgrouplist; work; work = work->next) {
-                       run_any_election |= work->RunningElection;
+                       if (work->RunningElection) {
+                               run_any_election = work->RunningElection;
+                       }
 
                        /* 
                         * Start an election if we have any chance of winning.
index c0aa385ff699077ddd7d192052f9cc761d21b2d0..75ab9419c2fddd21c9fdc135b9b6e9de24217b1d 100644 (file)
@@ -257,7 +257,7 @@ void process_local_master_announce(struct subnet_record *subrec, struct packet_s
        uint32 servertype = IVAL(buf,23);
        fstring comment;
        unstring work_name;
-       struct work_record *work;
+       struct work_record *work = NULL;
        struct server_record *servrec;
        unstring source_name;
 
@@ -344,7 +344,7 @@ a local master browser for workgroup %s and we think we are master. Forcing elec
                 * This server is announcing it is going down. Remove it from the
                 * workgroup.
                 */
-               if(!is_myname(server_name) && (work != NULL) &&
+               if(!is_myname(server_name) &&
                                ((servrec = find_server_in_workgroup( work, server_name))!=NULL)) {
                        remove_server_from_workgroup( work, servrec);
                }
index 90773c13951fbe036f440e3a0366c2f09d24fb55..ebe194814109096d963cfbc74acf16592f83e986 100644 (file)
@@ -331,7 +331,7 @@ subnet %s - name not found.\n", nmb_namestr(&nmb->question.question_name),
  
        /* this is not an exact calculation. the 46 is for the stats buffer
                and the 60 is to leave room for the header etc */
-       bufend = &rdata[MAX_DGRAM_SIZE] - (18 + 46 + 60);
+       bufend = &rdata[MAX_DGRAM_SIZE-1] - (18 + 46 + 60);
        countptr = buf = rdata;
        buf += 1;
        buf0 = buf;
index 349d36ce70df1a5d2ccc3e888076a4962273b3a3..c1d373aa189038af44a036c8eb70b70381138ba4 100644 (file)
@@ -1613,6 +1613,8 @@ void retransmit_or_expire_response_records(time_t t)
        for (subrec = FIRST_SUBNET; subrec; subrec = get_next_subnet_maybe_unicast_or_wins_server(subrec)) {
                struct response_record *rrec, *nextrrec;
 
+  restart:
+
                for (rrec = subrec->responselist; rrec; rrec = nextrrec) {
                        nextrrec = rrec->next;
 
@@ -1651,6 +1653,9 @@ on subnet %s\n", rrec->response_id, inet_ntoa(rrec->packet->ip), subrec->subnet_
                                                                        no timeout function. */
                                                        remove_response_record(subrec, rrec);
                                                }
+                                               /* We have changed subrec->responselist,
+                                                * restart from the beginning of this list. */
+                                               goto restart;
                                        } /* !rrec->in_expitation_processing */
                                } /* rrec->repeat_count > 0 */
                        } /* rrec->repeat_time <= t */
@@ -1924,7 +1929,7 @@ bool send_mailslot(bool unique, const char *mailslot,char *buf, size_t len,
                return false;
        }
 
-       set_message(ptr,17,strlen(mailslot) + 1 + len,True);
+       cli_set_message(ptr,17,strlen(mailslot) + 1 + len,True);
        memcpy(ptr,tmp,4);
 
        SCVAL(ptr,smb_com,SMBtrans);
index 0ff0afd12d7337992223f46aeb457c239e92e842..10833e80890305c00402e6487a54a28b7751929d 100644 (file)
@@ -399,6 +399,7 @@ reporting %s domain %s 0x%x ntversion=%x lm_nt token=%x lm_20 token=%x\n",
                                        char *component, *dc, *q1;
                                        char *q_orig = q;
                                        int str_offset;
+                                       char *saveptr;
 
                                        domain = get_mydnsdomname(talloc_tos());
                                        if (!domain) {
@@ -444,7 +445,7 @@ reporting %s domain %s 0x%x ntversion=%x lm_nt token=%x lm_20 token=%x\n",
                                        str_offset = q - q_orig;
                                        dc = domain;
                                        q1 = q;
-                                       while ((component = strtok(dc, "."))) {
+                                       while ((component = strtok_r(dc, ".", &saveptr)) != NULL) {
                                                dc = NULL;
                                                if (sizeof(outbuf) - PTR_DIFF(q, outbuf) < 1) {
                                                        return;
index 22a038ef2ea8496b2a98fd835219ae4695329a98..6498ce04cf32485c389092fdfde7626a66e2bf6a 100644 (file)
@@ -31,26 +31,12 @@ int num_response_packets = 0;
 static void add_response_record(struct subnet_record *subrec,
                                struct response_record *rrec)
 {
-       struct response_record *rrec2;
-
        num_response_packets++; /* count of total number of packets still around */
 
        DEBUG(4,("add_response_record: adding response record id:%hu to subnet %s. num_records:%d\n",
                rrec->response_id, subrec->subnet_name, num_response_packets));
 
-       if (!subrec->responselist) {
-               subrec->responselist = rrec;
-               rrec->prev = NULL;
-               rrec->next = NULL;
-               return;
-       }
-  
-       for (rrec2 = subrec->responselist; rrec2->next; rrec2 = rrec2->next) 
-               ;
-  
-       rrec2->next = rrec;
-       rrec->next = NULL;
-       rrec->prev = rrec2;
+       DLIST_ADD_END(subrec->responselist, rrec, struct response_record *);
 }
 
 /***************************************************************************
@@ -60,13 +46,7 @@ static void add_response_record(struct subnet_record *subrec,
 void remove_response_record(struct subnet_record *subrec,
                                struct response_record *rrec)
 {
-       if (rrec->prev)
-               rrec->prev->next = rrec->next;
-       if (rrec->next)
-               rrec->next->prev = rrec->prev;
-
-       if (subrec->responselist == rrec) 
-               subrec->responselist = rrec->next; 
+       DLIST_REMOVE(subrec->responselist, rrec);
 
        if(rrec->userdata) {
                if(rrec->userdata->free_fn) {
index 147df68a69d9787ebf039ed68ed80c5d4278c546..5a2f5c46b4b296b640f45ed2351f2a26f9495c26 100644 (file)
@@ -81,12 +81,14 @@ static void sync_child(char *name, int nm_type,
        }
 
        if (!cli_set_port(cli, 139)) {
+               cli_shutdown(cli);
                return;
        }
 
        in_addr_to_sockaddr_storage(&ss, ip);
        status = cli_connect(cli, name, &ss);
        if (!NT_STATUS_IS_OK(status)) {
+               cli_shutdown(cli);
                return;
        }
 
diff --git a/source/nsswitch/libwbclient/Doxyfile b/source/nsswitch/libwbclient/Doxyfile
new file mode 100644 (file)
index 0000000..e12c2b0
--- /dev/null
@@ -0,0 +1,1297 @@
+# Doxyfile 1.5.3
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+#       TAG = value [value, ...]
+# For lists items can also be appended using:
+#       TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file that 
+# follow. The default is UTF-8 which is also the encoding used for all text before 
+# the first occurrence of this tag. Doxygen uses libiconv (or the iconv built into 
+# libc) for the transcoding. See http://www.gnu.org/software/libiconv for the list of 
+# possible encodings.
+
+DOXYFILE_ENCODING      = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded 
+# by quotes) that should identify the project.
+
+PROJECT_NAME           = Samba
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number. 
+# This could be handy for archiving the generated documentation or 
+# if some version control system is used.
+
+PROJECT_NUMBER         = HEAD
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) 
+# base path where the generated documentation will be put. 
+# If a relative path is entered, it will be relative to the location 
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY       = dox
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 
+# 4096 sub-directories (in 2 levels) under the output directory of each output 
+# format and will distribute the generated files over these directories. 
+# Enabling this option can be useful when feeding doxygen a huge amount of 
+# source files, where putting all generated files in the same directory would 
+# otherwise cause performance problems for the file system.
+
+CREATE_SUBDIRS         = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all 
+# documentation generated by doxygen is written. Doxygen will use this 
+# information to generate all constant output in the proper language. 
+# The default language is English, other supported languages are: 
+# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, 
+# Croatian, Czech, Danish, Dutch, Finnish, French, German, Greek, Hungarian, 
+# Italian, Japanese, Japanese-en (Japanese with English messages), Korean, 
+# Korean-en, Lithuanian, Norwegian, Polish, Portuguese, Romanian, Russian, 
+# Serbian, Slovak, Slovene, Spanish, Swedish, and Ukrainian.
+
+OUTPUT_LANGUAGE        = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will 
+# include brief member descriptions after the members that are listed in 
+# the file and class documentation (similar to JavaDoc). 
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC      = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend 
+# the brief description of a member or function before the detailed description. 
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the 
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF           = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator 
+# that is used to form the text in various listings. Each string 
+# in this list, if found as the leading text of the brief description, will be 
+# stripped from the text and the result after processing the whole list, is 
+# used as the annotated text. Otherwise, the brief description is used as-is. 
+# If left blank, the following values are used ("$name" is automatically 
+# replaced with the name of the entity): "The $name class" "The $name widget" 
+# "The $name file" "is" "provides" "specifies" "contains" 
+# "represents" "a" "an" "the"
+
+ABBREVIATE_BRIEF       = 
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then 
+# Doxygen will generate a detailed section even if there is only a brief 
+# description.
+
+ALWAYS_DETAILED_SEC    = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all 
+# inherited members of a class in the documentation of that class as if those 
+# members were ordinary class members. Constructors, destructors and assignment 
+# operators of the base classes will not be shown.
+
+INLINE_INHERITED_MEMB  = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full 
+# path before files name in the file list and in the header files. If set 
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES        = YES
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag 
+# can be used to strip a user-defined part of the path. Stripping is 
+# only done if one of the specified strings matches the left-hand part of 
+# the path. The tag can be used to show relative paths in the file list. 
+# If left blank the directory from which doxygen is run is used as the 
+# path to strip.
+
+STRIP_FROM_PATH        = $(PWD)/
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of 
+# the path mentioned in the documentation of a class, which tells 
+# the reader which header file to include in order to use a class. 
+# If left blank only the name of the header file containing the class 
+# definition is used. Otherwise one should specify the include paths that 
+# are normally passed to the compiler using the -I flag.
+
+STRIP_FROM_INC_PATH    = 
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter 
+# (but less readable) file names. This can be useful is your file systems 
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES            = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen 
+# will interpret the first line (until the first dot) of a JavaDoc-style 
+# comment as the brief description. If set to NO, the JavaDoc 
+# comments will behave just like regular Qt-style comments 
+# (thus requiring an explicit @brief command for a brief description.)
+
+JAVADOC_AUTOBRIEF      = YES
+
+# If the QT_AUTOBRIEF tag is set to YES then Doxygen will 
+# interpret the first line (until the first dot) of a Qt-style 
+# comment as the brief description. If set to NO, the comments 
+# will behave just like regular Qt-style comments (thus requiring 
+# an explicit \brief command for a brief description.)
+
+QT_AUTOBRIEF           = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen 
+# treat a multi-line C++ special comment block (i.e. a block of //! or /// 
+# comments) as a brief description. This used to be the default behaviour. 
+# The new default is to treat a multi-line C++ comment block as a detailed 
+# description. Set this tag to YES if you prefer the old behaviour instead.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the DETAILS_AT_TOP tag is set to YES then Doxygen 
+# will output the detailed description near the top, like JavaDoc.
+# If set to NO, the detailed description appears after the member 
+# documentation.
+
+DETAILS_AT_TOP         = NO
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented 
+# member inherits the documentation from any documented member that it 
+# re-implements.
+
+INHERIT_DOCS           = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce 
+# a new page for each member. If set to NO, the documentation of a member will 
+# be part of the file/class/namespace that contains it.
+
+SEPARATE_MEMBER_PAGES  = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab. 
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE               = 8
+
+# This tag can be used to specify a number of aliases that acts 
+# as commands in the documentation. An alias has the form "name=value". 
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to 
+# put the command \sideeffect (or @sideeffect) in the documentation, which 
+# will result in a user-defined paragraph with heading "Side Effects:". 
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES                = 
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C 
+# sources only. Doxygen will then generate output that is more tailored for C. 
+# For instance, some of the names that are used will be different. The list 
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C  = YES
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java 
+# sources only. Doxygen will then generate output that is more tailored for Java. 
+# For instance, namespaces will be presented as packages, qualified scopes 
+# will look different, etc.
+
+OPTIMIZE_OUTPUT_JAVA   = NO
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want to 
+# include (a tag file for) the STL sources as input, then you should 
+# set this tag to YES in order to let doxygen match functions declarations and 
+# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. 
+# func(std::string) {}). This also make the inheritance and collaboration 
+# diagrams that involve STL classes more complete and accurate.
+
+BUILTIN_STL_SUPPORT    = NO
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+
+CPP_CLI_SUPPORT        = NO
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC 
+# tag is set to YES, then doxygen will reuse the documentation of the first 
+# member in the group (if any) for the other members of the group. By default 
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC   = NO
+
+# Set the SUBGROUPING tag to YES (the default) to allow class member groups of 
+# the same type (for instance a group of public functions) to be put as a 
+# subgroup of that type (e.g. under the Public Functions section). Set it to 
+# NO to prevent subgrouping. Alternatively, this can be done per class using 
+# the \nosubgrouping command.
+
+SUBGROUPING            = YES
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in 
+# documentation are documented, even if no documentation was available. 
+# Private class members and static file members will be hidden unless 
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL            = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class 
+# will be included in the documentation.
+
+EXTRACT_PRIVATE        = YES
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file 
+# will be included in the documentation.
+
+EXTRACT_STATIC         = YES
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) 
+# defined locally in source files will be included in the documentation. 
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES  = YES
+
+# This flag is only useful for Objective-C code. When set to YES local 
+# methods, which are defined in the implementation section but not in 
+# the interface are included in the documentation. 
+# If set to NO (the default) only methods in the interface are included.
+
+EXTRACT_LOCAL_METHODS  = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be extracted 
+# and appear in the documentation as a namespace called 'anonymous_namespace{file}', 
+# where file will be replaced with the base name of the file that contains the anonymous 
+# namespace. By default anonymous namespace are hidden.
+
+EXTRACT_ANON_NSPACES   = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all 
+# undocumented members of documented classes, files or namespaces. 
+# If set to NO (the default) these members will be included in the 
+# various overviews, but no documentation section is generated. 
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS     = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all 
+# undocumented classes that are normally visible in the class hierarchy. 
+# If set to NO (the default) these classes will be included in the various 
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES     = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all 
+# friend (class|struct|union) declarations. 
+# If set to NO (the default) these declarations will be included in the 
+# documentation.
+
+HIDE_FRIEND_COMPOUNDS  = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any 
+# documentation blocks found inside the body of a function. 
+# If set to NO (the default) these blocks will be appended to the 
+# function's detailed documentation block.
+
+HIDE_IN_BODY_DOCS      = NO
+
+# The INTERNAL_DOCS tag determines if documentation 
+# that is typed after a \internal command is included. If the tag is set 
+# to NO (the default) then the documentation will be excluded. 
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS          = YES
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate 
+# file names in lower-case letters. If set to YES upper-case letters are also 
+# allowed. This is useful if you have classes or files whose names only differ 
+# in case and if your file system supports case sensitive file names. Windows 
+# and Mac users are advised to set this option to NO.
+
+CASE_SENSE_NAMES       = YES
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen 
+# will show members with their full class and namespace scopes in the 
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES       = YES
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen 
+# will put a list of the files that are included by a file in the documentation 
+# of that file.
+
+SHOW_INCLUDE_FILES     = YES
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] 
+# is inserted in the documentation for inline members.
+
+INLINE_INFO            = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen 
+# will sort the (detailed) documentation of file and class members 
+# alphabetically by member name. If set to NO the members will appear in 
+# declaration order.
+
+SORT_MEMBER_DOCS       = NO
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the 
+# brief documentation of file, namespace and class members alphabetically 
+# by member name. If set to NO (the default) the members will appear in 
+# declaration order.
+
+SORT_BRIEF_DOCS        = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be 
+# sorted by fully-qualified names, including namespaces. If set to 
+# NO (the default), the class list will be sorted only by class name, 
+# not including the namespace part. 
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the 
+# alphabetical list.
+
+SORT_BY_SCOPE_NAME     = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or 
+# disable (NO) the todo list. This list is created by putting \todo 
+# commands in the documentation.
+
+GENERATE_TODOLIST      = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or 
+# disable (NO) the test list. This list is created by putting \test 
+# commands in the documentation.
+
+GENERATE_TESTLIST      = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or 
+# disable (NO) the bug list. This list is created by putting \bug 
+# commands in the documentation.
+
+GENERATE_BUGLIST       = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or 
+# disable (NO) the deprecated list. This list is created by putting 
+# \deprecated commands in the documentation.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional 
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS       = 
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines 
+# the initial value of a variable or define consists of for it to appear in 
+# the documentation. If the initializer consists of more lines than specified 
+# here it will be hidden. Use a value of 0 to hide initializers completely. 
+# The appearance of the initializer of individual variables and defines in the 
+# documentation can be controlled using \showinitializer or \hideinitializer 
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES  = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated 
+# at the bottom of the documentation of classes and structs. If set to YES the 
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES        = YES
+
+# If the sources in your project are distributed over multiple directories 
+# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy 
+# in the documentation. The default is NO.
+
+SHOW_DIRECTORIES       = NO
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that 
+# doxygen should invoke to get the current version for each file (typically from the 
+# version control system). Doxygen will invoke the program by executing (via 
+# popen()) the command <command> <input-file>, where <command> is the value of 
+# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file 
+# provided by doxygen. Whatever the program writes to standard output 
+# is used as the file version. See the manual for examples.
+
+FILE_VERSION_FILTER    = 
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated 
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET                  = YES
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are 
+# generated by doxygen. Possible values are YES and NO. If left blank 
+# NO is used.
+
+WARNINGS               = NO
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings 
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will 
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED   = NO
+
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for 
+# potential errors in the documentation, such as not documenting some 
+# parameters in a documented function, or documenting parameters that 
+# don't exist or using markup commands wrongly.
+
+WARN_IF_DOC_ERROR      = YES
+
+# This WARN_NO_PARAMDOC option can be abled to get warnings for 
+# functions that are documented, but have no documentation for their parameters 
+# or return value. If set to NO (the default) doxygen will only warn about 
+# wrong or incomplete parameter documentation, but not about the absence of 
+# documentation.
+
+WARN_NO_PARAMDOC       = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that 
+# doxygen can produce. The string should contain the $file, $line, and $text 
+# tags, which will be replaced by the file and line number from which the 
+# warning originated and the warning text. Optionally the format may contain 
+# $version, which will be replaced by the version of the file (if it could 
+# be obtained via FILE_VERSION_FILTER)
+
+WARN_FORMAT            = "$file:$line: $text "
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning 
+# and error messages should be written. If left blank the output is written 
+# to stderr.
+
+WARN_LOGFILE           = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain 
+# documented source files. You may enter file names like "myfile.cpp" or 
+# directories like "/usr/src/myproject". Separate the files or directories 
+# with spaces.
+
+INPUT                  = .
+
+# This tag can be used to specify the character encoding of the source files that 
+# doxygen parses. Internally doxygen uses the UTF-8 encoding, which is also the default 
+# input encoding. Doxygen uses libiconv (or the iconv built into libc) for the transcoding. 
+# See http://www.gnu.org/software/libiconv for the list of possible encodings.
+
+INPUT_ENCODING         = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the 
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
+# and *.h) to filter out the source-files in the directories. If left 
+# blank the following patterns are tested: 
+# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx 
+# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py
+
+FILE_PATTERNS          = *.c \
+                         *.h \
+                         *.idl
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories 
+# should be searched for input files as well. Possible values are YES and NO. 
+# If left blank NO is used.
+
+RECURSIVE              = YES
+
+# The EXCLUDE tag can be used to specify files and/or directories that should 
+# excluded from the INPUT source files. This way you can easily exclude a 
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+
+EXCLUDE                = include/includes.h \
+                         include/proto.h
+
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or 
+# directories that are symbolic links (a Unix filesystem feature) are excluded 
+# from the input.
+
+EXCLUDE_SYMLINKS       = NO
+
+# If the value of the INPUT tag contains directories, you can use the 
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude 
+# certain files from those directories. Note that the wildcards are matched 
+# against the file with absolute path, so to exclude all test directories 
+# for example use the pattern */test/*
+
+EXCLUDE_PATTERNS       = 
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names 
+# (namespaces, classes, functions, etc.) that should be excluded from the output. 
+# The symbol name can be a fully qualified name, a word, or if the wildcard * is used, 
+# a substring. Examples: ANamespace, AClass, AClass::ANamespace, ANamespace::*Test
+
+EXCLUDE_SYMBOLS        = 
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or 
+# directories that contain example code fragments that are included (see 
+# the \include command).
+
+EXAMPLE_PATH           = 
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the 
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
+# and *.h) to filter out the source-files in the directories. If left 
+# blank all files are included.
+
+EXAMPLE_PATTERNS       = 
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be 
+# searched for input files to be used with the \include or \dontinclude 
+# commands irrespective of the value of the RECURSIVE tag. 
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE      = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or 
+# directories that contain image that are included in the documentation (see 
+# the \image command).
+
+IMAGE_PATH             = 
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should 
+# invoke to filter for each input file. Doxygen will invoke the filter program 
+# by executing (via popen()) the command <filter> <input-file>, where <filter> 
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an 
+# input file. Doxygen will then use the output that the filter program writes 
+# to standard output.  If FILTER_PATTERNS is specified, this tag will be 
+# ignored.
+
+INPUT_FILTER           = 
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern 
+# basis.  Doxygen will compare the file name with each pattern and apply the 
+# filter if there is a match.  The filters are a list of the form: 
+# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further 
+# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER 
+# is applied to all files.
+
+FILTER_PATTERNS        = 
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using 
+# INPUT_FILTER) will be used to filter the input files when producing source 
+# files to browse (i.e. when SOURCE_BROWSER is set to YES).
+
+FILTER_SOURCE_FILES    = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will 
+# be generated. Documented entities will be cross-referenced with these sources. 
+# Note: To get rid of all source code in the generated output, make sure also 
+# VERBATIM_HEADERS is set to NO. If you have enabled CALL_GRAPH or CALLER_GRAPH 
+# then you must also enable this option. If you don't then doxygen will produce 
+# a warning and turn it on anyway
+
+SOURCE_BROWSER         = YES
+
+# Setting the INLINE_SOURCES tag to YES will include the body 
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES         = YES
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct 
+# doxygen to hide any special comment blocks from generated source code 
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS    = NO
+
+# If the REFERENCED_BY_RELATION tag is set to YES (the default) 
+# then for each documented function all documented 
+# functions referencing it will be listed.
+
+REFERENCED_BY_RELATION = YES
+
+# If the REFERENCES_RELATION tag is set to YES (the default) 
+# then for each documented function all documented entities 
+# called/used by that function will be listed.
+
+REFERENCES_RELATION    = YES
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
+# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
+# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
+# link to the source code.  Otherwise they will link to the documentstion.
+
+REFERENCES_LINK_SOURCE = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code 
+# will point to the HTML generated by the htags(1) tool instead of doxygen 
+# built-in source browser. The htags tool is part of GNU's global source 
+# tagging system (see http://www.gnu.org/software/global/global.html). You 
+# will need version 4.8.6 or higher.
+
+USE_HTAGS              = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen 
+# will generate a verbatim copy of the header file for each class for 
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS       = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index 
+# of all compounds will be generated. Enable this if the project 
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX     = YES
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then 
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns 
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX    = 1
+
+# In case all classes in a project start with a common prefix, all 
+# classes will be put under the same header in the alphabetical index. 
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that 
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX          = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will 
+# generate HTML output.
+
+GENERATE_HTML          = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT            = .
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for 
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank 
+# doxygen will generate files with .html extension.
+
+HTML_FILE_EXTENSION    = .html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for 
+# each generated HTML page. If it is left blank doxygen will generate a 
+# standard header.
+
+HTML_HEADER            = 
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for 
+# each generated HTML page. If it is left blank doxygen will generate a 
+# standard footer.
+
+HTML_FOOTER            = 
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading 
+# style sheet that is used by each HTML page. It can be used to 
+# fine-tune the look of the HTML output. If the tag is left blank doxygen 
+# will generate a default style sheet. Note that doxygen will try to copy 
+# the style sheet file to the HTML output directory, so don't put your own 
+# stylesheet in the HTML output directory as well, or it will be erased!
+
+HTML_STYLESHEET        = 
+
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, 
+# files or namespaces will be aligned in HTML using tables. If set to 
+# NO a bullet list will be used.
+
+HTML_ALIGN_MEMBERS     = YES
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files 
+# will be generated that can be used as input for tools like the 
+# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) 
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP      = NO
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML 
+# documentation will contain sections that can be hidden and shown after the 
+# page has loaded. For this to work a browser that supports 
+# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox 
+# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
+
+HTML_DYNAMIC_SECTIONS  = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can 
+# be used to specify the file name of the resulting .chm file. You 
+# can add a path in front of the file if the result should not be 
+# written to the html output directory.
+
+CHM_FILE               = 
+
+# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can 
+# be used to specify the location (absolute path including file name) of 
+# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run 
+# the HTML help compiler on the generated index.hhp.
+
+HHC_LOCATION           = 
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag 
+# controls if a separate .chi index file is generated (YES) or that 
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI           = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag 
+# controls whether a binary table of contents is generated (YES) or a 
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC             = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members 
+# to the contents of the HTML help documentation and to the tree view.
+
+TOC_EXPAND             = NO
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at 
+# top of each HTML page. The value NO (the default) enables the index and 
+# the value YES disables it.
+
+DISABLE_INDEX          = NO
+
+# This tag can be used to set the number of enum values (range [1..20]) 
+# that doxygen will group on one line in the generated HTML documentation.
+
+ENUM_VALUES_PER_LINE   = 3
+
+# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be
+# generated containing a tree-like index structure (just like the one that 
+# is generated for HTML Help). For this to work a browser that supports 
+# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, 
+# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are 
+# probably better off using the HTML help feature.
+
+GENERATE_TREEVIEW      = NO
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be 
+# used to set the initial width (in pixels) of the frame in which the tree 
+# is shown.
+
+TREEVIEW_WIDTH         = 250
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will 
+# generate Latex output.
+
+GENERATE_LATEX         = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT           = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be 
+# invoked. If left blank `latex' will be used as the default command name.
+
+LATEX_CMD_NAME         = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to 
+# generate index for LaTeX. If left blank `makeindex' will be used as the 
+# default command name.
+
+MAKEINDEX_CMD_NAME     = makeindex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact 
+# LaTeX documents. This may be useful for small projects and may help to 
+# save some trees in general.
+
+COMPACT_LATEX          = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used 
+# by the printer. Possible values are: a4, a4wide, letter, legal and 
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE             = a4wide
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX 
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES         = 
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for 
+# the generated latex document. The header should contain everything until 
+# the first chapter. If it is left blank doxygen will generate a 
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER           = 
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated 
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will 
+# contain links (just like the HTML output) instead of page references 
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS         = YES
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of 
+# plain latex in the generated Makefile. Set this option to YES to get a 
+# higher quality PDF documentation.
+
+USE_PDFLATEX           = YES
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. 
+# command to the generated LaTeX files. This will instruct LaTeX to keep 
+# running if errors occur, instead of asking the user for help. 
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE        = YES
+
+# If LATEX_HIDE_INDICES is set to YES then doxygen will not 
+# include the index chapters (such as File Index, Compound Index, etc.) 
+# in the output.
+
+LATEX_HIDE_INDICES     = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output 
+# The RTF output is optimized for Word 97 and may not look very pretty with 
+# other RTF readers or editors.
+
+GENERATE_RTF           = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT             = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact 
+# RTF documents. This may be useful for small projects and may help to 
+# save some trees in general.
+
+COMPACT_RTF            = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated 
+# will contain hyperlink fields. The RTF file will 
+# contain links (just like the HTML output) instead of page references. 
+# This makes the output suitable for online browsing using WORD or other 
+# programs which support those fields. 
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS         = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's 
+# config file, i.e. a series of assignments. You only have to provide 
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE    = 
+
+# Set optional variables used in the generation of an rtf document. 
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE    = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will 
+# generate man pages
+
+GENERATE_MAN           = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT             = man
+
+# The MAN_EXTENSION tag determines the extension that is added to 
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION          = .3
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output, 
+# then it will generate one additional man file for each entity 
+# documented in the real man page(s). These additional files 
+# only source the real man page, but without them the man command 
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS              = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will 
+# generate an XML file that captures the structure of 
+# the code including all documentation.
+
+GENERATE_XML           = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `xml' will be used as the default path.
+
+XML_OUTPUT             = xml
+
+# The XML_SCHEMA tag can be used to specify an XML schema, 
+# which can be used by a validating XML parser to check the 
+# syntax of the XML files.
+
+XML_SCHEMA             = 
+
+# The XML_DTD tag can be used to specify an XML DTD, 
+# which can be used by a validating XML parser to check the 
+# syntax of the XML files.
+
+XML_DTD                = 
+
+# If the XML_PROGRAMLISTING tag is set to YES Doxygen will 
+# dump the program listings (including syntax highlighting 
+# and cross-referencing information) to the XML output. Note that 
+# enabling this will significantly increase the size of the XML output.
+
+XML_PROGRAMLISTING     = YES
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will 
+# generate an AutoGen Definitions (see autogen.sf.net) file 
+# that captures the structure of the code including all 
+# documentation. Note that this feature is still experimental 
+# and incomplete at the moment.
+
+GENERATE_AUTOGEN_DEF   = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES Doxygen will 
+# generate a Perl module file that captures the structure of 
+# the code including all documentation. Note that this 
+# feature is still experimental and incomplete at the 
+# moment.
+
+GENERATE_PERLMOD       = NO
+
+# If the PERLMOD_LATEX tag is set to YES Doxygen will generate 
+# the necessary Makefile rules, Perl scripts and LaTeX code to be able 
+# to generate PDF and DVI output from the Perl module output.
+
+PERLMOD_LATEX          = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be 
+# nicely formatted so it can be parsed by a human reader.  This is useful 
+# if you want to understand what is going on.  On the other hand, if this 
+# tag is set to NO the size of the Perl module output will be much smaller 
+# and Perl will parse it just the same.
+
+PERLMOD_PRETTY         = YES
+
+# The names of the make variables in the generated doxyrules.make file 
+# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. 
+# This is useful so different doxyrules.make files included by the same 
+# Makefile don't overwrite each other's variables.
+
+PERLMOD_MAKEVAR_PREFIX = 
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor   
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will 
+# evaluate all C-preprocessor directives found in the sources and include 
+# files.
+
+ENABLE_PREPROCESSING   = NO
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro 
+# names in the source code. If set to NO (the default) only conditional 
+# compilation will be performed. Macro expansion can be done in a controlled 
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION        = NO
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES 
+# then the macro expansion is limited to the macros specified with the 
+# PREDEFINED and EXPAND_AS_DEFINED tags.
+
+EXPAND_ONLY_PREDEF     = NO
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files 
+# in the INCLUDE_PATH (see below) will be search if a #include is found.
+
+SEARCH_INCLUDES        = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that 
+# contain include files that are not input files but should be processed by 
+# the preprocessor.
+
+INCLUDE_PATH           = 
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard 
+# patterns (like *.h and *.hpp) to filter out the header-files in the 
+# directories. If left blank, the patterns specified with FILE_PATTERNS will 
+# be used.
+
+INCLUDE_FILE_PATTERNS  = 
+
+# The PREDEFINED tag can be used to specify one or more macro names that 
+# are defined before the preprocessor is started (similar to the -D option of 
+# gcc). The argument of the tag is a list of macros of the form: name 
+# or name=definition (no spaces). If the definition and the = are 
+# omitted =1 is assumed. To prevent a macro definition from being 
+# undefined via #undef or recursively expanded use the := operator 
+# instead of the = operator.
+
+PREDEFINED             = 
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then 
+# this tag can be used to specify a list of macro names that should be expanded. 
+# The macro definition that is found in the sources will be used. 
+# Use the PREDEFINED tag if you want to use a different macro definition.
+
+EXPAND_AS_DEFINED      = 
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then 
+# doxygen's preprocessor will remove all function-like macros that are alone 
+# on a line, have an all uppercase name, and do not end with a semicolon. Such 
+# function macros are typically used for boiler-plate code, and will confuse 
+# the parser if not removed.
+
+SKIP_FUNCTION_MACROS   = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references   
+#---------------------------------------------------------------------------
+
+# The TAGFILES option can be used to specify one or more tagfiles. 
+# Optionally an initial location of the external documentation 
+# can be added for each tagfile. The format of a tag file without 
+# this location is as follows: 
+#   TAGFILES = file1 file2 ... 
+# Adding location for the tag files is done as follows: 
+#   TAGFILES = file1=loc1 "file2 = loc2" ... 
+# where "loc1" and "loc2" can be relative or absolute paths or 
+# URLs. If a location is present for each tag, the installdox tool 
+# does not have to be run to correct the links.
+# Note that each tag file must have a unique name
+# (where the name does NOT include the path)
+# If a tag file is not located in the directory in which doxygen 
+# is run, you must also specify the path to the tagfile here.
+
+TAGFILES               = 
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create 
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE       = 
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed 
+# in the class index. If set to NO only the inherited external classes 
+# will be listed.
+
+ALLEXTERNALS           = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed 
+# in the modules index. If set to NO, only the current project's groups will 
+# be listed.
+
+EXTERNAL_GROUPS        = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script 
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH              = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool   
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will 
+# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base 
+# or super classes. Setting the tag to NO turns the diagrams off. Note that 
+# this option is superseded by the HAVE_DOT option below. This is only a 
+# fallback. It is recommended to install and use dot, since it yields more 
+# powerful graphs.
+
+CLASS_DIAGRAMS         = YES
+
+# You can define message sequence charts within doxygen comments using the \msc 
+# command. Doxygen will then run the mscgen tool (see http://www.mcternan.me.uk/mscgen/) to 
+# produce the chart and insert it in the documentation. The MSCGEN_PATH tag allows you to 
+# specify the directory where the mscgen tool resides. If left empty the tool is assumed to 
+# be found in the default search path.
+
+MSCGEN_PATH            = 
+
+# If set to YES, the inheritance and collaboration graphs will hide 
+# inheritance and usage relations if the target is undocumented 
+# or is not a class.
+
+HIDE_UNDOC_RELATIONS   = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is 
+# available from the path. This tool is part of Graphviz, a graph visualization 
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section 
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT               = NO
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graph for each documented class showing the direct and 
+# indirect inheritance relations. Setting this tag to YES will force the 
+# the CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH            = YES
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graph for each documented class showing the direct and 
+# indirect implementation dependencies (inheritance, containment, and 
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH    = YES
+
+# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graph for groups, showing the direct groups dependencies
+
+GROUP_GRAPHS           = YES
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and 
+# collaboration diagrams in a style similar to the OMG's Unified Modeling 
+# Language.
+
+UML_LOOK               = NO
+
+# If set to YES, the inheritance and collaboration graphs will show the 
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS     = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT 
+# tags are set to YES then doxygen will generate a graph for each documented 
+# file showing the direct and indirect include dependencies of the file with 
+# other documented files.
+
+INCLUDE_GRAPH          = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and 
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each 
+# documented header file showing the documented files that directly or 
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH      = YES
+
+# If the CALL_GRAPH, SOURCE_BROWSER and HAVE_DOT tags are set to YES then doxygen will 
+# generate a call dependency graph for every global function or class method. 
+# Note that enabling this option will significantly increase the time of a run. 
+# So in most cases it will be better to enable call graphs for selected 
+# functions only using the \callgraph command.
+
+CALL_GRAPH             = NO
+
+# If the CALLER_GRAPH, SOURCE_BROWSER and HAVE_DOT tags are set to YES then doxygen will 
+# generate a caller dependency graph for every global function or class method. 
+# Note that enabling this option will significantly increase the time of a run. 
+# So in most cases it will be better to enable caller graphs for selected 
+# functions only using the \callergraph command.
+
+CALLER_GRAPH           = NO
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen 
+# will graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY    = YES
+
+# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES 
+# then doxygen will show the dependencies a directory has on other directories 
+# in a graphical way. The dependency relations are determined by the #include
+# relations between the files in the directories.
+
+DIRECTORY_GRAPH        = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images 
+# generated by dot. Possible values are png, jpg, or gif
+# If left blank png will be used.
+
+DOT_IMAGE_FORMAT       = png
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be 
+# found. If left blank, it is assumed the dot tool can be found in the path.
+
+DOT_PATH               = 
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that 
+# contain dot files that are included in the documentation (see the 
+# \dotfile command).
+
+DOTFILE_DIRS           = 
+
+# The MAX_DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of 
+# nodes that will be shown in the graph. If the number of nodes in a graph 
+# becomes larger than this value, doxygen will truncate the graph, which is 
+# visualized by representing a node as a red box. Note that doxygen if the number 
+# of direct children of the root node in a graph is already larger than 
+# MAX_DOT_GRAPH_NOTES then the graph will not be shown at all. Also note 
+# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+
+DOT_GRAPH_MAX_NODES    = 50
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the 
+# graphs generated by dot. A depth value of 3 means that only nodes reachable 
+# from the root by following a path via at most 3 edges will be shown. Nodes 
+# that lay further from the root node will be omitted. Note that setting this 
+# option to 1 or 2 may greatly reduce the computation time needed for large 
+# code bases. Also note that the size of a graph can be further restricted by 
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+
+MAX_DOT_GRAPH_DEPTH    = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent 
+# background. This is disabled by default, which results in a white background. 
+# Warning: Depending on the platform used, enabling this option may lead to 
+# badly anti-aliased labels on the edges of a graph (i.e. they become hard to 
+# read).
+
+DOT_TRANSPARENT        = NO
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output 
+# files in one run (i.e. multiple -o and -T options on the command line). This 
+# makes dot run faster, but since only newer versions of dot (>1.8.10) 
+# support this, this feature is disabled by default.
+
+DOT_MULTI_TARGETS      = NO
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will 
+# generate a legend page explaining the meaning of the various boxes and 
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND        = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will 
+# remove the intermediate dot files that are used to generate 
+# the various graphs.
+
+DOT_CLEANUP            = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to the search engine   
+#---------------------------------------------------------------------------
+
+# The SEARCHENGINE tag specifies whether or not a search engine should be 
+# used. If set to NO the values of all tags below this one will be ignored.
+
+SEARCHENGINE           = NO
diff --git a/source/nsswitch/libwbclient/libwbclient.h b/source/nsswitch/libwbclient/libwbclient.h
new file mode 100644 (file)
index 0000000..74cba7e
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+   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 _LIBWBCLIENT_H
+#define _LIBWBCLIENT_H
+
+/* Super header including necessary public and private header files
+   for building the wbclient library.  __DO NOT__ define anything
+   in this file.  Only include other headers. */
+
+/* Winbind headers */
+
+#include "nsswitch/winbind_nss_config.h"
+#include "nsswitch/winbind_struct_protocol.h"
+
+#include <talloc.h>
+
+/* Public headers */
+
+#include "wbclient.h"
+
+/* Private headers */
+
+#include "wbc_err_internal.h"
+#include "wbclient_internal.h"
+
+
+#endif      /* _LIBWBCLIENT_H */
diff --git a/source/nsswitch/libwbclient/wbc_err_internal.h b/source/nsswitch/libwbclient/wbc_err_internal.h
new file mode 100644 (file)
index 0000000..ea501cb
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+   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_INTERNAL_H
+#define _WBC_ERR_INTERNAL_H
+
+/* Private macros */
+
+#define BAIL_ON_WBC_ERROR(x)                \
+       do {                                \
+               if ((x) != WBC_ERR_SUCCESS) \
+                       goto done;          \
+       } while(0);
+
+#define BAIL_ON_PTR_ERROR(x, status)                    \
+       do {                                            \
+               if ((x) == NULL) {                      \
+                       status = WBC_ERR_NO_MEMORY;     \
+                       goto done;                      \
+               } else {                                \
+                       status = WBC_ERR_SUCCESS;       \
+               }                                       \
+       } while (0);
+
+
+#endif /* _WBC_ERR_INTERNAL_H */
diff --git a/source/nsswitch/libwbclient/wbc_idmap.c b/source/nsswitch/libwbclient/wbc_idmap.c
new file mode 100644 (file)
index 0000000..53f9678
--- /dev/null
@@ -0,0 +1,274 @@
+/*
+   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/>.
+*/
+
+/* Required Headers */
+
+#include "libwbclient.h"
+
+/** @brief Convert a Windows SID to a Unix uid
+ *
+ * @param *sid        Pointer to the domain SID to be resolved
+ * @param *puid       Pointer to the resolved uid_t value
+ *
+ * @return #wbcErr
+ *
+ **/
+
+wbcErr wbcSidToUid(const struct wbcDomainSid *sid, uid_t *puid)
+{
+       struct winbindd_request request;
+       struct winbindd_response response;
+       char *sid_string = NULL;
+       wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
+
+       if (!sid || !puid) {
+               wbc_status = WBC_ERR_INVALID_PARAM;
+               BAIL_ON_WBC_ERROR(wbc_status);
+       }
+
+       /* Initialize request */
+
+       ZERO_STRUCT(request);
+       ZERO_STRUCT(response);
+
+       wbc_status = wbcSidToString(sid, &sid_string);
+       BAIL_ON_WBC_ERROR(wbc_status);
+
+       strncpy(request.data.sid, sid_string, sizeof(request.data.sid)-1);
+       wbcFreeMemory(sid_string);
+
+       /* Make request */
+
+       wbc_status = wbcRequestResponse(WINBINDD_SID_TO_UID,
+                                       &request,
+                                       &response);
+       BAIL_ON_WBC_ERROR(wbc_status);
+
+       *puid = response.data.uid;
+
+       wbc_status = WBC_ERR_SUCCESS;
+
+ done:
+       return wbc_status;
+}
+
+/** @brief Convert a Unix uid to a Windows SID
+ *
+ * @param uid         Unix uid to be resolved
+ * @param *sid        Pointer to the resolved domain SID
+ *
+ * @return #wbcErr
+ *
+ **/
+
+wbcErr wbcUidToSid(uid_t uid, struct wbcDomainSid *sid)
+{
+       wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
+       struct winbindd_request request;
+       struct winbindd_response response;
+
+       if (!sid) {
+               wbc_status = WBC_ERR_INVALID_PARAM;
+               BAIL_ON_WBC_ERROR(wbc_status);
+       }
+
+       /* Initialize request */
+
+       ZERO_STRUCT(request);
+       ZERO_STRUCT(response);
+
+       request.data.uid = uid;
+
+       /* Make request */
+
+       wbc_status = wbcRequestResponse(WINBINDD_UID_TO_SID,
+                                       &request,
+                                       &response);
+       BAIL_ON_WBC_ERROR(wbc_status);
+
+       wbc_status = wbcStringToSid(response.data.sid.sid, sid);
+       BAIL_ON_WBC_ERROR(wbc_status);
+
+done:
+       return wbc_status;
+}
+
+/** @brief Convert a Windows SID to a Unix gid
+ *
+ * @param *sid        Pointer to the domain SID to be resolved
+ * @param *pgid       Pointer to the resolved gid_t value
+ *
+ * @return #wbcErr
+ *
+ **/
+
+wbcErr wbcSidToGid(const struct wbcDomainSid *sid, gid_t *pgid)
+{
+       struct winbindd_request request;
+       struct winbindd_response response;
+       wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
+       char *sid_string = NULL;
+
+       if (!sid || !pgid) {
+               wbc_status = WBC_ERR_INVALID_PARAM;
+               BAIL_ON_WBC_ERROR(wbc_status);
+       }
+
+       /* Initialize request */
+
+       ZERO_STRUCT(request);
+       ZERO_STRUCT(response);
+
+       wbc_status = wbcSidToString(sid, &sid_string);
+       BAIL_ON_WBC_ERROR(wbc_status);
+
+       strncpy(request.data.sid, sid_string, sizeof(request.data.sid)-1);
+       wbcFreeMemory(sid_string);
+
+       /* Make request */
+
+       wbc_status = wbcRequestResponse(WINBINDD_SID_TO_GID,
+                                       &request,
+                                       &response);
+       BAIL_ON_WBC_ERROR(wbc_status);
+
+       *pgid = response.data.gid;
+
+       wbc_status = WBC_ERR_SUCCESS;
+
+ done:
+       return wbc_status;
+}
+
+/** @brief Convert a Unix uid to a Windows SID
+ *
+ * @param gid         Unix gid to be resolved
+ * @param *sid        Pointer to the resolved domain SID
+ *
+ * @return #wbcErr
+ *
+ **/
+
+wbcErr wbcGidToSid(gid_t gid, struct wbcDomainSid *sid)
+{
+       struct winbindd_request request;
+       struct winbindd_response response;
+       wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
+
+       if (!sid) {
+               wbc_status = WBC_ERR_INVALID_PARAM;
+               BAIL_ON_WBC_ERROR(wbc_status);
+       }
+
+       /* Initialize request */
+
+       ZERO_STRUCT(request);
+       ZERO_STRUCT(response);
+
+       request.data.gid = gid;
+
+       /* Make request */
+
+       wbc_status = wbcRequestResponse(WINBINDD_GID_TO_SID,
+                                       &request,
+                                       &response);
+       BAIL_ON_WBC_ERROR(wbc_status);
+
+       wbc_status = wbcStringToSid(response.data.sid.sid, sid);
+       BAIL_ON_WBC_ERROR(wbc_status);
+
+done:
+       return wbc_status;
+}
+
+/** @brief Obtain a new uid from Winbind
+ *
+ * @param *puid      *pointer to the allocated uid
+ *
+ * @return #wbcErr
+ **/
+
+wbcErr wbcAllocateUid(uid_t *puid)
+{
+       struct winbindd_request request;
+       struct winbindd_response response;
+       wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
+
+       if (!puid)
+               return WBC_ERR_INVALID_PARAM;
+
+       /* Initialise request */
+
+       ZERO_STRUCT(request);
+       ZERO_STRUCT(response);
+
+       /* Make request */
+
+       wbc_status = wbcRequestResponse(WINBINDD_ALLOCATE_UID,
+                                          &request, &response);
+       BAIL_ON_WBC_ERROR(wbc_status);
+
+       /* Copy out result */
+       *puid = response.data.uid;
+
+       wbc_status = WBC_ERR_SUCCESS;
+
+ done:
+       return wbc_status;
+}
+
+/** @brief Obtain a new gid from Winbind
+ *
+ * @param *pgid      Pointer to the allocated gid
+ *
+ * @return #wbcErr
+ **/
+
+wbcErr wbcAllocateGid(uid_t *pgid)
+{
+       struct winbindd_request request;
+       struct winbindd_response response;
+       wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
+
+       if (!pgid)
+               return WBC_ERR_INVALID_PARAM;
+
+       /* Initialise request */
+
+       ZERO_STRUCT(request);
+       ZERO_STRUCT(response);
+
+       /* Make request */
+
+       wbc_status = wbcRequestResponse(WINBINDD_ALLOCATE_GID,
+                                          &request, &response);
+       BAIL_ON_WBC_ERROR(wbc_status);
+
+       /* Copy out result */
+       *pgid = response.data.gid;
+
+       wbc_status = WBC_ERR_SUCCESS;
+
+ done:
+       return wbc_status;
+}
+
diff --git a/source/nsswitch/libwbclient/wbc_pam.c b/source/nsswitch/libwbclient/wbc_pam.c
new file mode 100644 (file)
index 0000000..7f7c7b8
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+   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/>.
+*/
+
+/* Required Headers */
+
+#include "libwbclient.h"
+
+/** @brief Authenticate a username/password pair
+ *
+ * @param username     Name of user to authenticate
+ * @param password     Clear text password os user
+ *
+ * @return #wbcErr
+ **/
+
+wbcErr wbcAuthenticateUser(const char *username,
+                          const char *password)
+{
+       wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
+       struct winbindd_request request;
+       struct winbindd_response response;
+
+       if (!username) {
+               wbc_status = WBC_ERR_INVALID_PARAM;
+               BAIL_ON_WBC_ERROR(wbc_status);
+       }
+
+       /* Initialize request */
+
+       ZERO_STRUCT(request);
+       ZERO_STRUCT(response);
+
+       /* dst is already null terminated from the memset above */
+
+       strncpy(request.data.auth.user, username,
+               sizeof(request.data.auth.user)-1);
+       strncpy(request.data.auth.pass, password,
+               sizeof(request.data.auth.user)-1);
+
+       wbc_status = wbcRequestResponse(WINBINDD_PAM_AUTH,
+                                       &request,
+                                       &response);
+       BAIL_ON_WBC_ERROR(wbc_status);
+
+done:
+       return wbc_status;
+}
diff --git a/source/nsswitch/libwbclient/wbc_pwd.c b/source/nsswitch/libwbclient/wbc_pwd.c
new file mode 100644 (file)
index 0000000..b7febcc
--- /dev/null
@@ -0,0 +1,376 @@
+/*
+   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/>.
+*/
+
+/* Required Headers */
+
+#include "libwbclient.h"
+
+/**
+ *
+ **/
+
+static struct passwd *copy_passwd_entry(struct winbindd_pw *p)
+{
+       struct passwd *pwd = NULL;
+       wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
+
+       pwd = talloc(NULL, struct passwd);
+       BAIL_ON_PTR_ERROR(pwd, wbc_status);
+
+       pwd->pw_name = talloc_strdup(pwd,p->pw_name);
+       BAIL_ON_PTR_ERROR(pwd->pw_name, wbc_status);
+
+       pwd->pw_passwd = talloc_strdup(pwd, p->pw_passwd);
+       BAIL_ON_PTR_ERROR(pwd->pw_passwd, wbc_status);
+
+       pwd->pw_gecos = talloc_strdup(pwd, p->pw_gecos);
+       BAIL_ON_PTR_ERROR(pwd->pw_gecos, wbc_status);
+
+       pwd->pw_shell = talloc_strdup(pwd, p->pw_shell);
+       BAIL_ON_PTR_ERROR(pwd->pw_shell, wbc_status);
+
+       pwd->pw_dir = talloc_strdup(pwd, p->pw_dir);
+       BAIL_ON_PTR_ERROR(pwd->pw_dir, wbc_status);
+
+       pwd->pw_uid = p->pw_uid;
+       pwd->pw_gid = p->pw_gid;
+
+done:
+       if (!WBC_ERROR_IS_OK(wbc_status)) {
+               talloc_free(pwd);
+               pwd = NULL;
+       }
+
+       return pwd;
+}
+
+/**
+ *
+ **/
+
+static struct group *copy_group_entry(struct winbindd_gr *g,
+                                     char *mem_buf)
+{
+       struct group *grp = NULL;
+       wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
+       int i;
+       char *mem_p, *mem_q;
+
+       grp = talloc(NULL, struct group);
+       BAIL_ON_PTR_ERROR(grp, wbc_status);
+
+       grp->gr_name = talloc_strdup(grp, g->gr_name);
+       BAIL_ON_PTR_ERROR(grp->gr_name, wbc_status);
+
+       grp->gr_passwd = talloc_strdup(grp, g->gr_passwd);
+       BAIL_ON_PTR_ERROR(grp->gr_passwd, wbc_status);
+
+       grp->gr_gid = g->gr_gid;
+
+       grp->gr_mem = talloc_array(grp, char*, g->num_gr_mem+1);
+
+       mem_p = mem_q = mem_buf;
+       for (i=0; i<g->num_gr_mem && mem_p; i++) {
+               if ((mem_q = strchr(mem_p, ',')) != NULL) {
+                       *mem_q = '\0';
+               }
+
+               grp->gr_mem[i] = talloc_strdup(grp, mem_p);
+               BAIL_ON_PTR_ERROR(grp->gr_mem[i], wbc_status);
+
+               *mem_q = ',';
+               mem_p++;
+               mem_p = mem_q;
+       }
+       grp->gr_mem[g->num_gr_mem] = NULL;
+
+       wbc_status = WBC_ERR_SUCCESS;
+
+done:
+       if (!WBC_ERROR_IS_OK(wbc_status)) {
+               talloc_free(grp);
+               grp = NULL;
+       }
+
+       return grp;
+}
+
+/** @brief Fill in a struct passwd* for a domain user based
+ *   on username
+ *
+ * @param *name     Username to lookup
+ * @param **pwd     Pointer to resulting struct passwd* from the query.
+ *
+ * @return #wbcErr
+ **/
+
+wbcErr wbcGetpwnam(const char *name, struct passwd **pwd)
+{
+       wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
+       struct winbindd_request request;
+       struct winbindd_response response;
+
+       if (!name || !pwd) {
+               wbc_status = WBC_ERR_INVALID_PARAM;
+               BAIL_ON_WBC_ERROR(wbc_status);
+       }
+
+       /* Initialize request */
+
+       ZERO_STRUCT(request);
+       ZERO_STRUCT(response);
+
+       /* dst is already null terminated from the memset above */
+
+       strncpy(request.data.username, name, sizeof(request.data.username)-1);
+
+       wbc_status = wbcRequestResponse(WINBINDD_GETPWNAM,
+                                       &request,
+                                       &response);
+       BAIL_ON_WBC_ERROR(wbc_status);
+
+       *pwd = copy_passwd_entry(&response.data.pw);
+       BAIL_ON_PTR_ERROR(*pwd, wbc_status);
+
+ done:
+       return wbc_status;
+}
+
+/** @brief Fill in a struct passwd* for a domain user based
+ *   on uid
+ *
+ * @param uid       Uid to lookup
+ * @param **pwd     Pointer to resulting struct passwd* from the query.
+ *
+ * @return #wbcErr
+ **/
+
+wbcErr wbcGetpwuid(uid_t uid, struct passwd **pwd)
+{
+       wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
+       struct winbindd_request request;
+       struct winbindd_response response;
+
+       if (!pwd) {
+               wbc_status = WBC_ERR_INVALID_PARAM;
+               BAIL_ON_WBC_ERROR(wbc_status);
+       }
+
+       /* Initialize request */
+
+       ZERO_STRUCT(request);
+       ZERO_STRUCT(response);
+
+       request.data.uid = uid;
+
+       wbc_status = wbcRequestResponse(WINBINDD_GETPWUID,
+                                       &request,
+                                       &response);
+       BAIL_ON_WBC_ERROR(wbc_status);
+
+       *pwd = copy_passwd_entry(&response.data.pw);
+       BAIL_ON_PTR_ERROR(*pwd, wbc_status);
+
+ done:
+       return wbc_status;
+}
+
+/** @brief Fill in a struct passwd* for a domain user based
+ *   on username
+ *
+ * @param *name     Username to lookup
+ * @param **grp     Pointer to resulting struct group* from the query.
+ *
+ * @return #wbcErr
+ **/
+
+wbcErr wbcGetgrnam(const char *name, struct group **grp)
+{
+       wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
+       struct winbindd_request request;
+       struct winbindd_response response;
+
+       /* Initialize request */
+
+       ZERO_STRUCT(request);
+       ZERO_STRUCT(response);
+
+       if (!name || !grp) {
+               wbc_status = WBC_ERR_INVALID_PARAM;
+               BAIL_ON_WBC_ERROR(wbc_status);
+       }
+
+       /* dst is already null terminated from the memset above */
+
+       strncpy(request.data.groupname, name, sizeof(request.data.groupname)-1);
+
+       wbc_status = wbcRequestResponse(WINBINDD_GETGRNAM,
+                                       &request,
+                                       &response);
+       BAIL_ON_WBC_ERROR(wbc_status);
+
+       *grp = copy_group_entry(&response.data.gr,
+                               (char*)response.extra_data.data);
+       BAIL_ON_PTR_ERROR(*grp, wbc_status);
+
+ done:
+       if (response.extra_data.data)
+               free(response.extra_data.data);
+
+       return wbc_status;
+}
+
+/** @brief Fill in a struct passwd* for a domain user based
+ *   on uid
+ *
+ * @param gid       Uid to lookup
+ * @param **grp     Pointer to resulting struct group* from the query.
+ *
+ * @return #wbcErr
+ **/
+
+wbcErr wbcGetgrgid(gid_t gid, struct group **grp)
+{
+       wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
+       struct winbindd_request request;
+       struct winbindd_response response;
+
+       /* Initialize request */
+
+       ZERO_STRUCT(request);
+       ZERO_STRUCT(response);
+
+       if (!grp) {
+               wbc_status = WBC_ERR_INVALID_PARAM;
+               BAIL_ON_WBC_ERROR(wbc_status);
+       }
+
+       request.data.gid = gid;
+
+       wbc_status = wbcRequestResponse(WINBINDD_GETGRGID,
+                                       &request,
+                                       &response);
+       BAIL_ON_WBC_ERROR(wbc_status);
+
+       *grp = copy_group_entry(&response.data.gr,
+                               (char*)response.extra_data.data);
+       BAIL_ON_PTR_ERROR(*grp, wbc_status);
+
+ done:
+       if (response.extra_data.data)
+               free(response.extra_data.data);
+
+       return wbc_status;
+}
+
+/** @brief Reset the passwd iterator
+ *
+ * @return #wbcErr
+ **/
+
+wbcErr wbcSetpwent(void)
+{
+       wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
+
+       wbc_status = wbcRequestResponse(WINBINDD_SETPWENT,
+                                       NULL, NULL);
+       BAIL_ON_WBC_ERROR(wbc_status);
+
+ done:
+       return wbc_status;
+}
+
+/** @brief Close the passwd iterator
+ *
+ * @return #wbcErr
+ **/
+
+wbcErr wbcEndpwent(void)
+{
+       wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
+
+       wbc_status = wbcRequestResponse(WINBINDD_ENDPWENT,
+                                       NULL, NULL);
+       BAIL_ON_WBC_ERROR(wbc_status);
+
+ done:
+       return wbc_status;
+}
+
+/** @brief Return the next struct passwd* entry from the pwent iterator
+ *
+ * @param **pwd       Pointer to resulting struct group* from the query.
+ *
+ * @return #wbcErr
+ **/
+
+wbcErr wbcGetpwent(struct passwd **pwd)
+{
+       return WBC_ERR_NOT_IMPLEMENTED;
+}
+
+/** @brief Reset the group iterator
+ *
+ * @return #wbcErr
+ **/
+
+wbcErr wbcSetgrent(void)
+{
+       wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
+
+       wbc_status = wbcRequestResponse(WINBINDD_SETGRENT,
+                                       NULL, NULL);
+       BAIL_ON_WBC_ERROR(wbc_status);
+
+ done:
+       return wbc_status;
+}
+
+/** @brief Close the group iterator
+ *
+ * @return #wbcErr
+ **/
+
+wbcErr wbcEndgrent(void)
+{
+       wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
+
+       wbc_status = wbcRequestResponse(WINBINDD_ENDGRENT,
+                                       NULL, NULL);
+       BAIL_ON_WBC_ERROR(wbc_status);
+
+ done:
+       return wbc_status;
+}
+
+/** @brief Return the next struct passwd* entry from the pwent iterator
+ *
+ * @param **grp       Pointer to resulting struct group* from the query.
+ *
+ * @return #wbcErr
+ **/
+
+wbcErr wbcGetgrent(struct group **grp)
+{
+       return WBC_ERR_NOT_IMPLEMENTED;
+}
+
diff --git a/source/nsswitch/libwbclient/wbc_sid.c b/source/nsswitch/libwbclient/wbc_sid.c
new file mode 100644 (file)
index 0000000..0519d8b
--- /dev/null
@@ -0,0 +1,425 @@
+/*
+   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/>.
+*/
+
+/* Required Headers */
+
+#include "libwbclient.h"
+
+
+/** @brief Convert a binary SID to a character string
+ *
+ * @param sid           Binary Security Identifier
+ * @param **sid_string  Resulting character string
+ *
+ * @return #wbcErr
+ **/
+
+wbcErr wbcSidToString(const struct wbcDomainSid *sid,
+                     char **sid_string)
+{
+       wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
+       uint32_t id_auth;
+       int i;
+       char *tmp = NULL;
+       TALLOC_CTX *ctx = NULL;
+
+       if (!sid) {
+               wbc_status = WBC_ERR_INVALID_SID;
+               BAIL_ON_WBC_ERROR(wbc_status);
+       }
+
+       ctx = talloc_init("wbcSidToString");
+       BAIL_ON_PTR_ERROR(ctx, wbc_status);
+
+       id_auth = sid->id_auth[5] +
+               (sid->id_auth[4] << 8) +
+               (sid->id_auth[3] << 16) +
+               (sid->id_auth[2] << 24);
+
+       tmp = talloc_asprintf(ctx, "S-%d-%d", sid->sid_rev_num, id_auth);
+       BAIL_ON_PTR_ERROR(tmp, wbc_status);
+
+       for (i=0; i<sid->num_auths; i++) {
+               char *tmp2 =
+               tmp2 = talloc_asprintf_append(tmp, "-%u", sid->sub_auths[i]);
+               BAIL_ON_PTR_ERROR(tmp2, wbc_status);
+
+               tmp = tmp2;
+       }
+
+       *sid_string=talloc_strdup(NULL, tmp);
+       BAIL_ON_PTR_ERROR((*sid_string), wbc_status);
+
+       wbc_status = WBC_ERR_SUCCESS;
+
+done:
+       talloc_free(ctx);
+
+       return wbc_status;
+}
+
+/** @brief Convert a character string to a binary SID
+ *
+ * @param *str          Character string in the form of S-...
+ * @param sid           Resulting binary SID
+ *
+ * @return #wbcErr
+ **/
+
+wbcErr wbcStringToSid(const char *str,
+                     struct wbcDomainSid *sid)
+{
+       const char *p;
+       char *q;
+       uint32_t x;
+       wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
+
+       if (!sid) {
+               wbc_status = WBC_ERR_INVALID_PARAM;
+               BAIL_ON_WBC_ERROR(wbc_status);
+       }
+
+       /* Sanity check for either "S-" or "s-" */
+
+       if (!str
+           || (str[0]!='S' && str[0]!='s')
+           || (str[1]!='-')
+           || (strlen(str)<2))
+       {
+               wbc_status = WBC_ERR_INVALID_PARAM;
+               BAIL_ON_WBC_ERROR(wbc_status);
+       }
+
+       /* Get the SID revision number */
+
+       p = str+2;
+       x = (uint32_t)strtol(p, &q, 10);
+       if (x==0 || !q || *q!='-') {
+               wbc_status = WBC_ERR_INVALID_SID;
+               BAIL_ON_WBC_ERROR(wbc_status);
+       }
+       sid->sid_rev_num = (uint8_t)x;
+
+       /* Next the Identifier Authority.  This is stored in big-endian
+          in a 6 byte array. */
+
+       p = q+1;
+       x = (uint32_t)strtol(p, &q, 10);
+       if (x==0 || !q || *q!='-') {
+               wbc_status = WBC_ERR_INVALID_SID;
+               BAIL_ON_WBC_ERROR(wbc_status);
+       }
+       sid->id_auth[5] = (x & 0x000000ff);
+       sid->id_auth[4] = (x & 0x0000ff00) >> 8;
+       sid->id_auth[3] = (x & 0x00ff0000) >> 16;
+       sid->id_auth[2] = (x & 0xff000000) >> 24;
+       sid->id_auth[1] = 0;
+       sid->id_auth[0] = 0;
+
+       /* now read the the subauthorities */
+
+       p = q +1;
+       sid->num_auths = 0;
+       while (sid->num_auths < MAXSUBAUTHS) {
+               if ((x=(uint32_t)strtoul(p, &q, 10)) == 0)
+                       break;
+               sid->sub_auths[sid->num_auths++] = x;
+
+               if (q && ((*q!='-') || (*q=='\0')))
+                       break;
+               p = q + 1;
+       }
+
+       /* IF we ended early, then the SID could not be converted */
+
+       if (q && *q!='\0') {
+               wbc_status = WBC_ERR_INVALID_SID;
+               BAIL_ON_WBC_ERROR(wbc_status);
+       }
+
+       wbc_status = WBC_ERR_SUCCESS;
+
+done:
+       return wbc_status;
+
+}
+
+/** @brief Convert a domain and name to SID
+ *
+ * @param domain      Domain name (possibly "")
+ * @param name        User or group name
+ * @param *sid        Pointer to the resolved domain SID
+ * @param *name_type  Pointet to the SID type
+ *
+ * @return #wbcErr
+ *
+ **/
+
+wbcErr wbcLookupName(const char *domain,
+                    const char *name,
+                    struct wbcDomainSid *sid,
+                    enum wbcSidType *name_type)
+{
+       struct winbindd_request request;
+       struct winbindd_response response;
+       wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
+
+       if (!sid || !name_type) {
+               wbc_status = WBC_ERR_INVALID_PARAM;
+               BAIL_ON_WBC_ERROR(wbc_status);
+       }
+
+       /* Initialize request */
+
+       ZERO_STRUCT(request);
+       ZERO_STRUCT(response);
+
+       /* dst is already null terminated from the memset above */
+
+       strncpy(request.data.name.dom_name, domain,
+               sizeof(request.data.name.dom_name)-1);
+       strncpy(request.data.name.name, name,
+               sizeof(request.data.name.name)-1);
+
+       wbc_status = wbcRequestResponse(WINBINDD_LOOKUPNAME,
+                                       &request,
+                                       &response);
+       BAIL_ON_WBC_ERROR(wbc_status);
+
+       wbc_status = wbcStringToSid(response.data.sid.sid, sid);
+       BAIL_ON_WBC_ERROR(wbc_status);
+
+       *name_type = (enum wbcSidType)response.data.sid.type;
+
+       wbc_status = WBC_ERR_SUCCESS;
+
+ done:
+       return wbc_status;
+}
+
+/** @brief Convert a SID to a domain and name
+ *
+ * @param *sid        Pointer to the domain SID to be resolved
+ * @param domain      Resolved Domain name (possibly "")
+ * @param name        Resolved User or group name
+ * @param *name_type  Pointet to the resolved SID type
+ *
+ * @return #wbcErr
+ *
+ **/
+
+wbcErr wbcLookupSid(const struct wbcDomainSid *sid,
+                   char **domain,
+                   char **name,
+                   enum wbcSidType *name_type)
+{
+       struct winbindd_request request;
+       struct winbindd_response response;
+       wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
+       char *sid_string = NULL;
+
+       if (!sid) {
+               wbc_status = WBC_ERR_INVALID_PARAM;
+               BAIL_ON_WBC_ERROR(wbc_status);
+       }
+
+       /* Initialize request */
+
+       ZERO_STRUCT(request);
+       ZERO_STRUCT(response);
+
+       /* dst is already null terminated from the memset above */
+
+       wbc_status = wbcSidToString(sid, &sid_string);
+       BAIL_ON_WBC_ERROR(wbc_status);
+
+       strncpy(request.data.sid, sid_string, sizeof(request.data.sid)-1);
+       wbcFreeMemory(sid_string);
+
+       /* Make request */
+
+       wbc_status = wbcRequestResponse(WINBINDD_LOOKUPSID,
+                                          &request,
+                                          &response);
+       BAIL_ON_WBC_ERROR(wbc_status);
+
+       /* Copy out result */
+
+       if (domain != NULL) {
+               *domain = talloc_strdup(NULL, response.data.name.dom_name);
+               BAIL_ON_PTR_ERROR((*domain), wbc_status);
+       }
+
+       if (name != NULL) {
+               *name = talloc_strdup(NULL, response.data.name.name);
+               BAIL_ON_PTR_ERROR((*name), wbc_status);
+       }
+
+       if (name_type) {
+               *name_type = (enum wbcSidType)response.data.name.type;
+       }
+
+       wbc_status = WBC_ERR_SUCCESS;
+
+ done:
+       if (!WBC_ERROR_IS_OK(wbc_status)) {
+               if (*domain)
+                       talloc_free(*domain);
+               if (*name)
+                       talloc_free(*name);
+       }
+
+       return wbc_status;
+}
+
+/** @brief Translate a collection of RIDs within a domain to names
+ *
+ **/
+
+wbcErr wbcLookupRids(struct wbcDomainSid *dom_sid,
+                    int num_rids,
+                    uint32_t *rids,
+                    const char **pp_domain_name,
+                    const char ***names,
+                    enum wbcSidType **types)
+{
+       size_t i, len, ridbuf_size;
+       char *ridlist;
+       char *p;
+       struct winbindd_request request;
+       struct winbindd_response response;
+       char *sid_string = NULL;
+       char *domain_name = NULL;
+       wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
+
+       /* Initialise request */
+
+       ZERO_STRUCT(request);
+       ZERO_STRUCT(response);
+
+       if (!dom_sid || (num_rids == 0)) {
+               wbc_status = WBC_ERR_INVALID_PARAM;
+               BAIL_ON_WBC_ERROR(wbc_status);
+       }
+
+       wbc_status = wbcSidToString(dom_sid, &sid_string);
+       BAIL_ON_WBC_ERROR(wbc_status);
+
+       strncpy(request.data.sid, sid_string, sizeof(request.data.sid)-1);
+       wbcFreeMemory(sid_string);
+
+       /* Even if all the Rids were of maximum 32bit values,
+          we would only have 11 bytes per rid in the final array
+          ("4294967296" + \n).  Add one more byte for the
+          terminating '\0' */
+
+       ridbuf_size = (sizeof(char)*11) * num_rids + 1;
+
+       ridlist = talloc_zero_array(NULL, char, ridbuf_size);
+       BAIL_ON_PTR_ERROR(ridlist, wbc_status);
+
+       len = 0;
+       for (i=0; i<num_rids && (len-1)>0; i++) {
+               char ridstr[12];
+
+               len = strlen(ridlist);
+               p = ridlist + len;
+
+               snprintf( ridstr, sizeof(ridstr)-1, "%u\n", rids[i]);
+               strncat(p, ridstr, ridbuf_size-len-1);
+       }
+
+       request.extra_data.data = ridlist;
+       request.extra_len = strlen(ridlist)+1;
+
+       wbc_status = wbcRequestResponse(WINBINDD_LOOKUPRIDS,
+                                       &request,
+                                       &response);
+       talloc_free(ridlist);
+       BAIL_ON_WBC_ERROR(wbc_status);
+
+       domain_name = talloc_strdup(NULL, response.data.domain_name);
+       BAIL_ON_PTR_ERROR(domain_name, wbc_status);
+
+       *names = talloc_array(NULL, const char*, num_rids);
+       BAIL_ON_PTR_ERROR((*names), wbc_status);
+
+       *types = talloc_array(NULL, enum wbcSidType, num_rids);
+       BAIL_ON_PTR_ERROR((*types), wbc_status);
+
+       p = (char *)response.extra_data.data;
+
+       for (i=0; i<num_rids; i++) {
+               char *q;
+
+               if (*p == '\0') {
+                       wbc_status = WBC_INVALID_RESPONSE;
+                       BAIL_ON_WBC_ERROR(wbc_status);
+               }
+
+               (*types)[i] = (enum wbcSidType)strtoul(p, &q, 10);
+
+               if (*q != ' ') {
+                       wbc_status = WBC_INVALID_RESPONSE;
+                       BAIL_ON_WBC_ERROR(wbc_status);
+               }
+
+               p = q+1;
+
+               if ((q = strchr(p, '\n')) == NULL) {
+                       wbc_status = WBC_INVALID_RESPONSE;
+                       BAIL_ON_WBC_ERROR(wbc_status);
+               }
+
+               *q = '\0';
+
+               (*names)[i] = talloc_strdup((*names), p);
+               BAIL_ON_PTR_ERROR(((*names)[i]), wbc_status);
+
+               p = q+1;
+       }
+
+       if (*p != '\0') {
+               wbc_status = WBC_INVALID_RESPONSE;
+               BAIL_ON_WBC_ERROR(wbc_status);
+       }
+
+       wbc_status = WBC_ERR_SUCCESS;
+
+ done:
+       if (response.extra_data.data) {
+               free(response.extra_data.data);
+       }
+
+       if (!WBC_ERROR_IS_OK(wbc_status)) {
+               if (domain_name)
+                       talloc_free(domain_name);
+               if (*names)
+                       talloc_free(*names);
+               if (*types)
+                       talloc_free(*types);
+       } else {
+               *pp_domain_name = domain_name;
+       }
+
+       return wbc_status;
+}
diff --git a/source/nsswitch/libwbclient/wbc_util.c b/source/nsswitch/libwbclient/wbc_util.c
new file mode 100644 (file)
index 0000000..ff3cec8
--- /dev/null
@@ -0,0 +1,114 @@
+/*
+   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/>.
+*/
+
+/* Required Headers */
+
+#include "libwbclient.h"
+
+
+
+/** @brief Ping winbindd to see if the daemon is running
+ *
+ * @return #wbcErr
+ **/
+
+wbcErr wbcPing(void)
+{
+       struct winbindd_request request;
+       struct winbindd_response response;
+
+       /* Initialize request */
+
+       ZERO_STRUCT(request);
+       ZERO_STRUCT(response);
+
+       return wbcRequestResponse(WINBINDD_PING, &request, &response);
+}
+
+/** @brief Lookup the current status of a trusted domain
+ *
+ * @param domain      Domain to query
+ * @param *dinfo       Pointer to returned domain_info struct
+ *
+ * @return #wbcErr
+ *
+ **/
+
+
+wbcErr wbcDomainInfo(const char *domain, struct wbcDomainInfo **dinfo)
+{
+       struct winbindd_request request;
+       struct winbindd_response response;
+       wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
+       struct wbcDomainInfo *info = NULL;
+
+       if (!domain || !dinfo) {
+               wbc_status = WBC_ERR_INVALID_PARAM;
+               BAIL_ON_WBC_ERROR(wbc_status);
+       }
+
+       /* Initialize request */
+
+       ZERO_STRUCT(request);
+       ZERO_STRUCT(response);
+
+       strncpy(request.domain_name, domain,
+               sizeof(request.domain_name)-1);
+
+       wbc_status = wbcRequestResponse(WINBINDD_DOMAIN_INFO,
+                                       &request,
+                                       &response);
+       BAIL_ON_WBC_ERROR(wbc_status);
+
+       info = talloc(NULL, struct wbcDomainInfo);
+       BAIL_ON_PTR_ERROR(info, wbc_status);
+
+       info->short_name = talloc_strdup(info,
+                                        response.data.domain_info.name);
+       BAIL_ON_PTR_ERROR(info->short_name, wbc_status);
+
+       info->dns_name = talloc_strdup(info,
+                                      response.data.domain_info.alt_name);
+       BAIL_ON_PTR_ERROR(info->dns_name, wbc_status);
+
+       wbc_status = wbcStringToSid(response.data.domain_info.sid,
+                                   &info->sid);
+       BAIL_ON_WBC_ERROR(wbc_status);
+
+       if (response.data.domain_info.native_mode)
+               info->flags |= WBC_DOMINFO_NATIVE;
+       if (response.data.domain_info.active_directory)
+               info->flags |= WBC_DOMINFO_AD;
+       if (response.data.domain_info.primary)
+               info->flags |= WBC_DOMINFO_PRIMARY;
+
+       *dinfo = info;
+
+       wbc_status = WBC_ERR_SUCCESS;
+
+ done:
+       if (!WBC_ERROR_IS_OK(wbc_status)) {
+               talloc_free(info);
+       }
+
+       return wbc_status;
+}
diff --git a/source/nsswitch/libwbclient/wbclient.c b/source/nsswitch/libwbclient/wbclient.c
new file mode 100644 (file)
index 0000000..2f76f76
--- /dev/null
@@ -0,0 +1,100 @@
+/*
+   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/>.
+*/
+
+/* Required Headers */
+
+#include "libwbclient.h"
+
+/* From wb_common.c */
+
+NSS_STATUS winbindd_request_response(int req_type,
+                                    struct winbindd_request *request,
+                                    struct winbindd_response *response);
+
+/** @brief Wrapper around Winbind's send/receive API call
+ *
+ * @param cmd       Winbind command operation to perform
+ * @param request   Send structure
+ * @param response  Receive structure
+ *
+ * @return #wbcErr
+ **/
+
+/**********************************************************************
+ result == NSS_STATUS_UNAVAIL: winbind not around
+ result == NSS_STATUS_NOTFOUND: winbind around, but domain missing
+
+ Due to a bad API NSS_STATUS_NOTFOUND is returned both when winbind_off
+ and when winbind return WINBINDD_ERROR. So the semantics of this
+ routine depends on winbind_on. Grepping for winbind_off I just
+ found 3 places where winbind is turned off, and this does not conflict
+ (as far as I have seen) with the callers of is_trusted_domains.
+
+ --Volker
+**********************************************************************/
+
+wbcErr wbcRequestResponse(int cmd,
+                         struct winbindd_request *request,
+                         struct winbindd_response *response)
+{
+       wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
+       NSS_STATUS nss_status;
+
+       /* for some calls the request and/or response cna be NULL */
+
+       nss_status = winbindd_request_response(cmd, request, response);
+
+       switch (nss_status) {
+       case NSS_STATUS_SUCCESS:
+               wbc_status = WBC_ERR_SUCCESS;
+               break;
+       case NSS_STATUS_UNAVAIL:
+               wbc_status = WBC_ERR_WINBIND_NOT_AVAILABLE;
+               break;
+       case NSS_STATUS_NOTFOUND:
+               wbc_status = WBC_ERR_DOMAIN_NOT_FOUND;
+               break;
+       default:
+               wbc_status = WBC_ERR_NSS_ERROR;
+               break;
+       }
+
+       return wbc_status;
+}
+
+/** @brief Free library allocated memory
+ *
+ * @param *p Pointer to free
+ *
+ * @return void
+ **/
+
+void wbcFreeMemory(void *p)
+{
+       if (p)
+               talloc_free(p);
+
+       return;
+}
+
+
+
diff --git a/source/nsswitch/libwbclient/wbclient.h b/source/nsswitch/libwbclient/wbclient.h
new file mode 100644 (file)
index 0000000..0b256d3
--- /dev/null
@@ -0,0 +1,209 @@
+/*
+   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 _WBCLIENT_H
+#define _WBCLIENT_H
+
+#include <pwd.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
+ */
+
+#ifndef MAXSUBAUTHS
+#define MAXSUBAUTHS 15 /* max sub authorities in a SID */
+#endif
+
+/**
+ *  @brief Windows Security Identifier
+ *
+ **/
+
+struct wbcDomainSid {
+       uint8_t   sid_rev_num;
+       uint8_t   num_auths;
+       uint8_t   id_auth[6];
+       uint32_t  sub_auths[MAXSUBAUTHS];
+};
+
+/**
+ * @brief Security Identifier type
+ **/
+
+enum wbcSidType {
+       WBC_SID_NAME_USE_NONE=0,
+       WBC_SID_NAME_USER=1,
+       WBC_SID_NAME_DOM_GRP=2,
+       WBC_SID_NAME_DOMAIN=3,
+       WBC_SID_NAME_ALIAS=4,
+       WBC_SID_NAME_WKN_GRP=5,
+       WBC_SID_NAME_DELETED=6,
+       WBC_SID_NAME_INVALID=7,
+       WBC_SID_NAME_UNKNOWN=8,
+       WBC_SID_NAME_COMPUTER=9
+};
+
+/**
+ * @brief Domain Information
+ **/
+
+struct wbcDomainInfo {
+       char *short_name;
+       char *dns_name;
+       struct wbcDomainSid sid;
+       uint32_t flags;
+};
+
+/* wbcDomainInfo->flags */
+
+#define WBC_DOMINFO_NATIVE            0x00000001
+#define WBC_DOMINFO_AD                0x00000002
+#define WBC_DOMINFO_PRIMARY           0x00000004
+
+/*
+ * Memory Management
+ */
+
+void wbcFreeMemory(void*);
+
+
+/*
+ * Utility functions for dealing with SIDs
+ */
+
+wbcErr wbcSidToString(const struct wbcDomainSid *sid,
+                     char **sid_string);
+
+wbcErr wbcStringToSid(const char *sid_string,
+                     struct wbcDomainSid *sid);
+
+wbcErr wbcPing(void);
+
+/*
+ * Name/SID conversion
+ */
+
+wbcErr wbcLookupName(const char *dom_name,
+                    const char *name,
+                    struct wbcDomainSid *sid,
+                    enum wbcSidType *name_type);
+
+wbcErr wbcLookupSid(const struct wbcDomainSid *sid,
+                   char **domain,
+                   char **name,
+                   enum wbcSidType *name_type);
+
+wbcErr wbcLookupRids(struct wbcDomainSid *dom_sid,
+                    int num_rids,
+                    uint32_t *rids,
+                    const char **domain_name,
+                    const char ***names,
+                    enum wbcSidType **types);
+
+/*
+ * SID/uid/gid Mappings
+ */
+
+wbcErr wbcSidToUid(const struct wbcDomainSid *sid,
+                  uid_t *puid);
+
+wbcErr wbcUidToSid(uid_t uid,
+                  struct wbcDomainSid *sid);
+
+wbcErr wbcSidToGid(const struct wbcDomainSid *sid,
+                  gid_t *pgid);
+
+wbcErr wbcGidToSid(gid_t gid,
+                  struct wbcDomainSid *sid);
+
+wbcErr wbcAllocateUid(uid_t *puid);
+
+wbcErr wbcAllocateGid(uid_t *pgid);
+
+/*
+ * NSS Lookup User/Group details
+ */
+
+wbcErr wbcGetpwnam(const char *name, struct passwd **pwd);
+
+wbcErr wbcGetpwuid(uid_t uid, struct passwd **pwd);
+
+wbcErr wbcGetgrnam(const char *name, struct group **grp);
+
+wbcErr wbcGetgrgid(gid_t gid, struct group **grp);
+
+wbcErr wbcSetpwent(void);
+
+wbcErr wbcEndpwent(void);
+
+wbcErr wbcGetpwent(struct passwd **pwd);
+
+wbcErr wbcSetgrent(void);
+
+wbcErr wbcEndgrent(void);
+
+wbcErr wbcGetgrent(struct group **grp);
+
+
+/*
+ * Lookup Domain information
+ */
+
+wbcErr wbcDomainInfo(const char *domain,
+                    struct wbcDomainInfo **info);
+
+wbcErr wbcDomainSequenceNumbers(void);
+
+/*
+ * Athenticate functions
+ */
+
+wbcErr wbcAuthenticateUser(const char *username,
+                          const char *password);
+
+
+#endif      /* _WBCLIENT_H */
diff --git a/source/nsswitch/libwbclient/wbclient_internal.h b/source/nsswitch/libwbclient/wbclient_internal.h
new file mode 100644 (file)
index 0000000..fc03c54
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+   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 _WBCLIENT_INTERNAL_H
+#define _WBCLIENT_INTERNAL_H
+
+/* Private functions */
+
+wbcErr wbcRequestResponse(int cmd,
+                         struct winbindd_request *request,
+                         struct winbindd_response *response);
+
+
+#endif      /* _WBCLIENT_INTERNAL_H */
index f00db39b45be19dd26af7178711e45a743826ebc..89db0773ae9fdcf0ca646a52833689bd1453b9ed 100644 (file)
@@ -1201,6 +1201,7 @@ static int winbind_auth_request(pam_handle_t * pamh,
        request.data.auth.uid = -1;
 
        request.flags = WBFLAG_PAM_INFO3_TEXT |
+                       WBFLAG_PAM_GET_PWD_POLICY |
                        WBFLAG_PAM_CONTACT_TRUSTDOM;
 
        if (ctrl & (WINBIND_KRB5_AUTH|WINBIND_CACHED_LOGIN)) {
@@ -1430,22 +1431,22 @@ static int winbind_chauthtok_request(pam_handle_t * pamh,
                switch (reject_reason) {
                        case -1:
                                break;
-                       case REJECT_REASON_OTHER:
+                       case SAMR_REJECT_OTHER:
                                if ((min_pwd_age > 0) &&
                                    (pwd_last_set + min_pwd_age > time(NULL))) {
                                        PAM_WB_REMARK_DIRECT(pamh, ctrl,
                                             "NT_STATUS_PWD_TOO_RECENT");
                                }
                                break;
-                       case REJECT_REASON_TOO_SHORT:
+                       case SAMR_REJECT_TOO_SHORT:
                                PAM_WB_REMARK_DIRECT(pamh, ctrl,
                                        "NT_STATUS_PWD_TOO_SHORT");
                                break;
-                       case REJECT_REASON_IN_HISTORY:
+                       case SAMR_REJECT_IN_HISTORY:
                                PAM_WB_REMARK_DIRECT(pamh, ctrl,
                                        "NT_STATUS_PWD_HISTORY_CONFLICT");
                                break;
-                       case REJECT_REASON_NOT_COMPLEX:
+                       case SAMR_REJECT_COMPLEXITY:
                                _make_remark(pamh, ctrl, PAM_ERROR_MSG,
                                             "Password does not meet "
                                             "complexity requirements");
index 59a2f39584cd7bb1a4cd0a480fca629260eb618b..a1d32726f5c3512c39de1016ed539585dc5fee78 100644 (file)
@@ -12,6 +12,7 @@
 #define PAM_SM_AUTH
 #define PAM_SM_ACCOUNT
 #define PAM_SM_PASSWORD
+#define PAM_SM_SESSION
 
 #ifndef PAM_WINBIND_CONFIG_FILE
 #define PAM_WINBIND_CONFIG_FILE "/etc/security/pam_winbind.conf"
@@ -179,22 +180,23 @@ do {                             \
        };\
 };
 
-/* from include/rpc_samr.h */
-#define DOMAIN_PASSWORD_COMPLEX            0x00000001
+/* from samr.idl */
+#define DOMAIN_PASSWORD_COMPLEX                0x00000001
 
-#define REJECT_REASON_OTHER            0x00000000
-#define REJECT_REASON_TOO_SHORT                0x00000001
-#define REJECT_REASON_IN_HISTORY       0x00000002
-#define REJECT_REASON_NOT_COMPLEX      0x00000005
+#define SAMR_REJECT_OTHER              0x00000000
+#define SAMR_REJECT_TOO_SHORT          0x00000001
+#define SAMR_REJECT_IN_HISTORY         0x00000002
+#define SAMR_REJECT_COMPLEXITY         0x00000005
 
-/* from include/smb.h */
 #define ACB_PWNOEXP                    0x00000200
 
+/* from netlogon.idl */
+#define NETLOGON_CACHED_ACCOUNT                0x00000004
+#define NETLOGON_GRACE_LOGON           0x01000000
+
 /* from include/rpc_netlogon.h */
-#define LOGON_CACHED_ACCOUNT           0x00000004
-#define LOGON_GRACE_LOGON              0x01000000
 #define LOGON_KRB5_FAIL_CLOCK_SKEW     0x02000000
 
-#define PAM_WB_CACHED_LOGON(x) (x & LOGON_CACHED_ACCOUNT)
+#define PAM_WB_CACHED_LOGON(x) (x & NETLOGON_CACHED_ACCOUNT)
 #define PAM_WB_KRB5_CLOCK_SKEW(x) (x & LOGON_KRB5_FAIL_CLOCK_SKEW)
-#define PAM_WB_GRACE_LOGON(x)  ((LOGON_CACHED_ACCOUNT|LOGON_GRACE_LOGON) == ( x & (LOGON_CACHED_ACCOUNT|LOGON_GRACE_LOGON)))
+#define PAM_WB_GRACE_LOGON(x)  ((NETLOGON_CACHED_ACCOUNT|NETLOGON_GRACE_LOGON) == ( x & (NETLOGON_CACHED_ACCOUNT|NETLOGON_GRACE_LOGON)))
index d24bba2fe14671ccaa35fa5d9b455342bd2f3b2e..5e1a5d8ad465eb8f9ebde0d2902db21cb1e601b6 100644 (file)
@@ -22,6 +22,7 @@
 
 #include "includes.h"
 #include "nsswitch/winbind_nss.h"
+#include "libwbclient/wbclient.h"
 
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_WINBIND
@@ -30,431 +31,6 @@ NSS_STATUS winbindd_request_response(int req_type,
                                  struct winbindd_request *request,
                                  struct winbindd_response *response);
 
-/* Call winbindd to convert a name to a sid */
-
-bool winbind_lookup_name(const char *dom_name, const char *name, DOM_SID *sid, 
-                         enum lsa_SidType *name_type)
-{
-       struct winbindd_request request;
-       struct winbindd_response response;
-       NSS_STATUS result;
-       
-       if (!sid || !name_type)
-               return False;
-
-       /* Send off request */
-
-       ZERO_STRUCT(request);
-       ZERO_STRUCT(response);
-
-       fstrcpy(request.data.name.dom_name, dom_name);
-       fstrcpy(request.data.name.name, name);
-
-       if ((result = winbindd_request_response(WINBINDD_LOOKUPNAME, &request, 
-                                      &response)) == NSS_STATUS_SUCCESS) {
-               if (!string_to_sid(sid, response.data.sid.sid))
-                       return False;
-               *name_type = (enum lsa_SidType)response.data.sid.type;
-       }
-
-       return result == NSS_STATUS_SUCCESS;
-}
-
-/* Call winbindd to convert sid to name */
-
-bool winbind_lookup_sid(TALLOC_CTX *mem_ctx, const DOM_SID *sid, 
-                       const char **domain, const char **name,
-                        enum lsa_SidType *name_type)
-{
-       struct winbindd_request request;
-       struct winbindd_response response;
-       NSS_STATUS result;
-       
-       /* Initialise request */
-
-       ZERO_STRUCT(request);
-       ZERO_STRUCT(response);
-
-       sid_to_fstring(request.data.sid, sid);
-       
-       /* Make request */
-
-       result = winbindd_request_response(WINBINDD_LOOKUPSID, &request,
-                                          &response);
-
-       if (result != NSS_STATUS_SUCCESS) {
-               return False;
-       }
-
-       /* Copy out result */
-
-       if (domain != NULL) {
-               *domain = talloc_strdup(mem_ctx, response.data.name.dom_name);
-               if (*domain == NULL) {
-                       DEBUG(0, ("talloc failed\n"));
-                       return False;
-               }
-       }
-       if (name != NULL) {
-               *name = talloc_strdup(mem_ctx, response.data.name.name);
-               if (*name == NULL) {
-                       DEBUG(0, ("talloc failed\n"));
-                       return False;
-               }
-       }
-
-       *name_type = (enum lsa_SidType)response.data.name.type;
-
-       DEBUG(10, ("winbind_lookup_sid: SUCCESS: SID %s -> %s %s\n", 
-                  sid_string_dbg(sid), response.data.name.dom_name,
-                  response.data.name.name));
-       return True;
-}
-
-bool winbind_lookup_rids(TALLOC_CTX *mem_ctx,
-                        const DOM_SID *domain_sid,
-                        int num_rids, uint32 *rids,
-                        const char **domain_name,
-                        const char ***names, enum lsa_SidType **types)
-{
-       size_t i, buflen;
-       ssize_t len;
-       char *ridlist;
-       char *p;
-       struct winbindd_request request;
-       struct winbindd_response response;
-       NSS_STATUS result;
-
-       if (num_rids == 0) {
-               return False;
-       }
-
-       /* Initialise request */
-
-       ZERO_STRUCT(request);
-       ZERO_STRUCT(response);
-
-       sid_to_fstring(request.data.sid, domain_sid);
-       
-       len = 0;
-       buflen = 0;
-       ridlist = NULL;
-
-       for (i=0; i<num_rids; i++) {
-               sprintf_append(mem_ctx, &ridlist, &len, &buflen,
-                              "%ld\n", rids[i]);
-       }
-
-       if (ridlist == NULL) {
-               return False;
-       }
-
-       request.extra_data.data = ridlist;
-       request.extra_len = strlen(ridlist)+1;
-
-       result = winbindd_request_response(WINBINDD_LOOKUPRIDS,
-                                          &request, &response);
-
-       TALLOC_FREE(ridlist);
-
-       if (result != NSS_STATUS_SUCCESS) {
-               return False;
-       }
-
-       *domain_name = talloc_strdup(mem_ctx, response.data.domain_name);
-
-       *names = TALLOC_ARRAY(mem_ctx, const char *, num_rids);
-       *types = TALLOC_ARRAY(mem_ctx, enum lsa_SidType, num_rids);
-
-       if ((*names == NULL) || (*types == NULL)) {
-               goto fail;
-       }
-
-       p = (char *)response.extra_data.data;
-
-       for (i=0; i<num_rids; i++) {
-               char *q;
-
-               if (*p == '\0') {
-                       DEBUG(10, ("Got invalid reply: %s\n",
-                                  (char *)response.extra_data.data));
-                       goto fail;
-               }
-                       
-               (*types)[i] = (enum lsa_SidType)strtoul(p, &q, 10);
-
-               if (*q != ' ') {
-                       DEBUG(10, ("Got invalid reply: %s\n",
-                                  (char *)response.extra_data.data));
-                       goto fail;
-               }
-
-               p = q+1;
-
-               q = strchr(p, '\n');
-               if (q == NULL) {
-                       DEBUG(10, ("Got invalid reply: %s\n",
-                                  (char *)response.extra_data.data));
-                       goto fail;
-               }
-
-               *q = '\0';
-
-               (*names)[i] = talloc_strdup(*names, p);
-
-               p = q+1;
-       }
-
-       if (*p != '\0') {
-               DEBUG(10, ("Got invalid reply: %s\n",
-                          (char *)response.extra_data.data));
-               goto fail;
-       }
-
-       SAFE_FREE(response.extra_data.data);
-
-       return True;
-
- fail:
-       TALLOC_FREE(*names);
-       TALLOC_FREE(*types);
-       return False;
-}
-
-/* Call winbindd to convert SID to uid */
-
-bool winbind_sid_to_uid(uid_t *puid, const DOM_SID *sid)
-{
-       struct winbindd_request request;
-       struct winbindd_response response;
-       int result;
-       fstring sid_str;
-
-       if (!puid)
-               return False;
-
-       /* Initialise request */
-
-       ZERO_STRUCT(request);
-       ZERO_STRUCT(response);
-
-       sid_to_fstring(sid_str, sid);
-       fstrcpy(request.data.sid, sid_str);
-       
-       /* Make request */
-
-       result = winbindd_request_response(WINBINDD_SID_TO_UID, &request, &response);
-
-       /* Copy out result */
-
-       if (result == NSS_STATUS_SUCCESS) {
-               *puid = response.data.uid;
-       }
-
-       return (result == NSS_STATUS_SUCCESS);
-}
-
-/* Call winbindd to convert uid to sid */
-
-bool winbind_uid_to_sid(DOM_SID *sid, uid_t uid)
-{
-       struct winbindd_request request;
-       struct winbindd_response response;
-       int result;
-
-       if (!sid)
-               return False;
-
-       /* Initialise request */
-
-       ZERO_STRUCT(request);
-       ZERO_STRUCT(response);
-
-       request.data.uid = uid;
-
-       /* Make request */
-
-       result = winbindd_request_response(WINBINDD_UID_TO_SID, &request, &response);
-
-       /* Copy out result */
-
-       if (result == NSS_STATUS_SUCCESS) {
-               if (!string_to_sid(sid, response.data.sid.sid))
-                       return False;
-       } else {
-               sid_copy(sid, &global_sid_NULL);
-       }
-
-       return (result == NSS_STATUS_SUCCESS);
-}
-
-/* Call winbindd to convert SID to gid */
-
-bool winbind_sid_to_gid(gid_t *pgid, const DOM_SID *sid)
-{
-       struct winbindd_request request;
-       struct winbindd_response response;
-       int result;
-       fstring sid_str;
-
-       if (!pgid)
-               return False;
-
-       /* Initialise request */
-
-       ZERO_STRUCT(request);
-       ZERO_STRUCT(response);
-
-       sid_to_fstring(sid_str, sid);
-       fstrcpy(request.data.sid, sid_str);
-       
-       /* Make request */
-
-       result = winbindd_request_response(WINBINDD_SID_TO_GID, &request, &response);
-
-       /* Copy out result */
-
-       if (result == NSS_STATUS_SUCCESS) {
-               *pgid = response.data.gid;
-       }
-
-       return (result == NSS_STATUS_SUCCESS);
-}
-
-/* Call winbindd to convert gid to sid */
-
-bool winbind_gid_to_sid(DOM_SID *sid, gid_t gid)
-{
-       struct winbindd_request request;
-       struct winbindd_response response;
-       int result;
-
-       if (!sid)
-               return False;
-
-       /* Initialise request */
-
-       ZERO_STRUCT(request);
-       ZERO_STRUCT(response);
-
-       request.data.gid = gid;
-
-       /* Make request */
-
-       result = winbindd_request_response(WINBINDD_GID_TO_SID, &request, &response);
-
-       /* Copy out result */
-
-       if (result == NSS_STATUS_SUCCESS) {
-               if (!string_to_sid(sid, response.data.sid.sid))
-                       return False;
-       } else {
-               sid_copy(sid, &global_sid_NULL);
-       }
-
-       return (result == NSS_STATUS_SUCCESS);
-}
-
-/* Call winbindd to convert SID to uid */
-
-bool winbind_sids_to_unixids(struct id_map *ids, int num_ids)
-{
-       struct winbindd_request request;
-       struct winbindd_response response;
-       int result;
-       DOM_SID *sids;
-       int i;
-
-       /* Initialise request */
-
-       ZERO_STRUCT(request);
-       ZERO_STRUCT(response);
-
-       request.extra_len = num_ids * sizeof(DOM_SID);
-
-       sids = (DOM_SID *)SMB_MALLOC(request.extra_len);
-       for (i = 0; i < num_ids; i++) {
-               sid_copy(&sids[i], ids[i].sid);
-       }
-
-       request.extra_data.data = (char *)sids;
-       
-       /* Make request */
-
-       result = winbindd_request_response(WINBINDD_SIDS_TO_XIDS, &request, &response);
-
-       /* Copy out result */
-
-       if (result == NSS_STATUS_SUCCESS) {
-               struct unixid *wid = (struct unixid *)response.extra_data.data;
-               
-               for (i = 0; i < num_ids; i++) {
-                       if (wid[i].type == -1) {
-                               ids[i].status = ID_UNMAPPED;
-                       } else {
-                               ids[i].status = ID_MAPPED;
-                               ids[i].xid.type = wid[i].type;
-                               ids[i].xid.id = wid[i].id;
-                       }
-               }
-       }
-
-       SAFE_FREE(request.extra_data.data);
-       SAFE_FREE(response.extra_data.data);
-
-       return (result == NSS_STATUS_SUCCESS);
-}
-
-bool winbind_allocate_uid(uid_t *uid)
-{
-       struct winbindd_request request;
-       struct winbindd_response response;
-       int result;
-
-       /* Initialise request */
-
-       ZERO_STRUCT(request);
-       ZERO_STRUCT(response);
-
-       /* Make request */
-
-       result = winbindd_request_response(WINBINDD_ALLOCATE_UID,
-                                          &request, &response);
-
-       if (result != NSS_STATUS_SUCCESS)
-               return False;
-
-       /* Copy out result */
-       *uid = response.data.uid;
-
-       return True;
-}
-
-bool winbind_allocate_gid(gid_t *gid)
-{
-       struct winbindd_request request;
-       struct winbindd_response response;
-       int result;
-
-       /* Initialise request */
-
-       ZERO_STRUCT(request);
-       ZERO_STRUCT(response);
-
-       /* Make request */
-
-       result = winbindd_request_response(WINBINDD_ALLOCATE_GID,
-                                          &request, &response);
-
-       if (result != NSS_STATUS_SUCCESS)
-               return False;
-
-       /* Copy out result */
-       *gid = response.data.gid;
-
-       return True;
-}
-
 bool winbind_set_mapping(const struct id_map *map)
 {
        struct winbindd_request request;
@@ -518,49 +94,3 @@ bool winbind_set_gid_hwm(unsigned long id)
 
        return (result == NSS_STATUS_SUCCESS);
 }
-
-/**********************************************************************
- simple wrapper function to see if winbindd is alive
-**********************************************************************/
-
-bool winbind_ping( void )
-{
-       NSS_STATUS result;
-
-       result = winbindd_request_response(WINBINDD_PING, NULL, NULL);
-
-       return result == NSS_STATUS_SUCCESS;
-}
-
-/**********************************************************************
- Is a domain trusted?
-
- result == NSS_STATUS_UNAVAIL: winbind not around
- result == NSS_STATUS_NOTFOUND: winbind around, but domain missing
-
- Due to a bad API NSS_STATUS_NOTFOUND is returned both when winbind_off and
- when winbind return WINBINDD_ERROR. So the semantics of this routine depends
- on winbind_on. Grepping for winbind_off I just found 3 places where winbind
- is turned off, and this does not conflict (as far as I have seen) with the
- callers of is_trusted_domains.
-
- I *hate* global variables....
-
- Volker
-
-**********************************************************************/
-
-NSS_STATUS wb_is_trusted_domain(const char *domain)
-{
-       struct winbindd_request request;
-       struct winbindd_response response;
-
-       /* Call winbindd */
-
-       ZERO_STRUCT(request);
-       ZERO_STRUCT(response);
-
-       fstrcpy(request.domain_name, domain);
-
-       return winbindd_request_response(WINBINDD_DOMAIN_INFO, &request, &response);
-}
index 37ff8a78c72bdde348979cfdacbbf85e3548fcb3..3410668fcd445b40fad45964fd2d8faab5411ace 100644 (file)
@@ -22,6 +22,7 @@
 
 #include "includes.h"
 #include "winbind_client.h"
+#include "libwbclient/wbclient.h"
 
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_WINBIND
@@ -73,25 +74,26 @@ static char winbind_separator(void)
 
 static const char *get_winbind_domain(void)
 {
-       struct winbindd_response response;
+       wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;    
+       struct wbcDomainInfo *dinfo = NULL;
        static fstring winbind_domain;
 
-       ZERO_STRUCT(response);
-
-       /* Send off request */
+       ZERO_STRUCT(dinfo);
+       
+       wbc_status = wbcDomainInfo(".", &dinfo);
 
-       if (winbindd_request_response(WINBINDD_DOMAIN_NAME, NULL, &response) !=
-           NSS_STATUS_SUCCESS) {
+       if (!WBC_ERROR_IS_OK(wbc_status)) {
                d_fprintf(stderr, "could not obtain winbind domain name!\n");
                
                /* HACK: (this module should not call lp_ funtions) */
                return lp_workgroup();
        }
 
-       fstrcpy(winbind_domain, response.data.domain_name);
+       fstrcpy(winbind_domain, dinfo->short_name);     
 
-       return winbind_domain;
+       wbcFreeMemory(dinfo);
 
+       return winbind_domain;
 }
 
 /* Copy of parse_domain_user from winbindd_util.c.  Parse a string of the
@@ -128,61 +130,47 @@ static bool parse_wbinfo_domain_user(const char *domuser, fstring domain,
 
 static bool wbinfo_get_userinfo(char *user)
 {
-       struct winbindd_request request;
-       struct winbindd_response response;
-       NSS_STATUS result;
-       
-       ZERO_STRUCT(request);
-       ZERO_STRUCT(response);
-
-       /* Send request */
-       
-       fstrcpy(request.data.username, user);
+       wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
+       struct passwd *pwd = NULL;      
 
-       result = winbindd_request_response(WINBINDD_GETPWNAM, &request, &response);
-       
-       if (result != NSS_STATUS_SUCCESS)
-               return False;
+       wbc_status = wbcGetpwnam(user, &pwd);
+       if (!WBC_ERROR_IS_OK(wbc_status)) {
+               return false;
+       }
        
-       d_printf( "%s:%s:%d:%d:%s:%s:%s\n",
-                         response.data.pw.pw_name,
-                         response.data.pw.pw_passwd,
-                         response.data.pw.pw_uid,
-                         response.data.pw.pw_gid,
-                         response.data.pw.pw_gecos,
-                         response.data.pw.pw_dir,
-                         response.data.pw.pw_shell );
+       d_printf("%s:%s:%d:%d:%s:%s:%s\n",
+                pwd->pw_name,
+                pwd->pw_passwd,
+                pwd->pw_uid,
+                pwd->pw_gid,
+                pwd->pw_gecos,
+                pwd->pw_dir,
+                pwd->pw_shell);
        
-       return True;
+       return true;
 }
 
 /* pull pwent info for a given uid */
 static bool wbinfo_get_uidinfo(int uid)
 {
-       struct winbindd_request request;
-       struct winbindd_response response;
-       NSS_STATUS result;
-
-       ZERO_STRUCT(request);
-       ZERO_STRUCT(response);
-
-       request.data.uid = uid;
-
-       result = winbindd_request_response(WINBINDD_GETPWUID, &request, &response);
+       wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
+       struct passwd *pwd = NULL;      
 
-       if (result != NSS_STATUS_SUCCESS)
-               return False;
-
-       d_printf( "%s:%s:%d:%d:%s:%s:%s\n",
-               response.data.pw.pw_name,
-               response.data.pw.pw_passwd,
-               response.data.pw.pw_uid,
-               response.data.pw.pw_gid,
-               response.data.pw.pw_gecos,
-               response.data.pw.pw_dir,
-               response.data.pw.pw_shell );
-
-       return True;
+       wbc_status = wbcGetpwuid(uid, &pwd);
+       if (!WBC_ERROR_IS_OK(wbc_status)) {
+               return false;
+       }
+       
+       d_printf("%s:%s:%d:%d:%s:%s:%s\n",
+                pwd->pw_name,
+                pwd->pw_passwd,
+                pwd->pw_uid,
+                pwd->pw_gid,
+                pwd->pw_gecos,
+                pwd->pw_dir,
+                pwd->pw_shell);
+       
+       return true;
 }
 
 /* pull grent for a given group */
@@ -855,8 +843,8 @@ static bool wbinfo_auth_krb5(char *username, const char *cctype, uint32 flags)
        if (result == NSS_STATUS_SUCCESS) {
 
                if (request.flags & WBFLAG_PAM_INFO3_TEXT) {
-                       if (response.data.auth.info3.user_flgs & LOGON_CACHED_ACCOUNT) {
-                               d_printf("user_flgs: LOGON_CACHED_ACCOUNT\n");
+                       if (response.data.auth.info3.user_flgs & NETLOGON_CACHED_ACCOUNT) {
+                               d_printf("user_flgs: NETLOGON_CACHED_ACCOUNT\n");
                        }
                }
 
@@ -874,40 +862,40 @@ static bool wbinfo_auth_krb5(char *username, const char *cctype, uint32 flags)
 
 static bool wbinfo_auth(char *username)
 {
-       struct winbindd_request request;
-       struct winbindd_response response;
-        NSS_STATUS result;
-        char *p;
-
-       /* Send off request */
-
-       ZERO_STRUCT(request);
-       ZERO_STRUCT(response);
-
-        p = strchr(username, '%');
+       wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
+       char *s = NULL; 
+        char *p = NULL;        
+       char *password = NULL;
+       char *name = NULL;      
+
+       if ((s = SMB_STRDUP(username)) == NULL) {
+               return false;
+       }
 
-        if (p) {
+       if ((p = strchr(s, '%')) != NULL) {
                 *p = 0;
-                fstrcpy(request.data.auth.user, username);
-                fstrcpy(request.data.auth.pass, p + 1);
-                *p = '%';
-        } else
-                fstrcpy(request.data.auth.user, username);
+               p++;
+       }
 
-       result = winbindd_request_response(WINBINDD_PAM_AUTH, &request, &response);
+       name = s;
+       password = p;   
 
-       /* Display response */
+       wbc_status = wbcAuthenticateUser(name, password);
 
         d_printf("plaintext password authentication %s\n", 
-               (result == NSS_STATUS_SUCCESS) ? "succeeded" : "failed");
+                WBC_ERROR_IS_OK(wbc_status) ? "succeeded" : "failed");
 
+#if 0
        if (response.data.auth.nt_status)
                d_fprintf(stderr, "error code was %s (0x%x)\nerror messsage was: %s\n", 
                         response.data.auth.nt_status_string, 
                         response.data.auth.nt_status,
                         response.data.auth.error_string);
+#endif
 
-        return result == NSS_STATUS_SUCCESS;
+       SAFE_FREE(s);
+
+        return WBC_ERROR_IS_OK(wbc_status);
 }
 
 /* Authenticate a user with a challenge/response */
index 7f0e4b92e00d18dc7b4f902a7ea3b32e00d1db97..64d52af771ec5f5a24a1c83b22c0d30039d4e839 100644 (file)
 #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 */
 
index 5b663c63f79caf31ab53041cb495641f4b479f7b..12ca1e55c89a02df4833671d5e597c70a7643e1c 100644 (file)
@@ -194,7 +194,7 @@ typedef struct winbindd_gr {
 #define WBFLAG_PAM_KRB5                        0x00001000
 #define WBFLAG_PAM_FALLBACK_AFTER_KRB5 0x00002000
 #define WBFLAG_PAM_CACHED_LOGIN                0x00004000
-#define WBFLAG_PAM_GET_PWD_POLICY      0x00008000      /* not used */
+#define WBFLAG_PAM_GET_PWD_POLICY      0x00008000
 
 /* generic request flags */
 #define WBFLAG_QUERY_ONLY              0x00000020      /* not used */
index 59ed4eee8bf6c36f9c57ba76973d7ac147cdf39e..b9bcb31091269fdd1e035b43c4f8c301be088a34 100644 (file)
@@ -78,7 +78,7 @@ int pam_sm_acct_mgmt( pam_handle_t *pamh, int flags,
        }
 
        if (geteuid() != 0) {
-               _log_err(pamh, LOG_DEBUG, "Cannot access samba password database, not running as root.");
+               _log_err( LOG_DEBUG, "Cannot access samba password database, not running as root.");
                return PAM_AUTHINFO_UNAVAIL;
        }
 
index de5310761f7cb765db8fab5f0db572907ae56005..326a0b59e7c1c87648a7d1aff252ec996b72e8a8 100644 (file)
@@ -130,7 +130,7 @@ int pam_sm_chauthtok(pam_handle_t *pamh, int flags,
     }
 
     if (geteuid() != 0) {
-       _log_err(pamh, LOG_DEBUG, "Cannot access samba password database, not running as root.");
+       _log_err( LOG_DEBUG, "Cannot access samba password database, not running as root.");
        return PAM_AUTHINFO_UNAVAIL;
     }
 
index 881bcece7cdbf13558ef21476b1d926cc73f9014..c1d26af98977690fdfd483a81cd69747191d0652 100644 (file)
@@ -9,6 +9,7 @@
    Copyright (C) Alexander Bokovoy 2002
    Copyright (C) Stefan (metze) Metzmacher 2002
    Copyright (C) Jim McDonough <jmcd@us.ibm.com> 2003
+   Copyright (C) Michael Adam 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
@@ -70,16 +71,12 @@ extern userdom_struct current_user_info;
 #define HOMES_NAME "homes"
 #endif
 
-/* the special value for the include parameter
- * to be interpreted not as a file name but to
- * trigger loading of the global smb.conf options
- * from registry. */
-#ifndef INCLUDE_REGISTRY_NAME
-#define INCLUDE_REGISTRY_NAME "registry"
-#endif
-
 static int regdb_last_seqnum = 0;
-static bool include_registry_globals = False;
+
+#define CONFIG_BACKEND_FILE 0
+#define CONFIG_BACKEND_REGISTRY 1
+
+static int config_backend = CONFIG_BACKEND_FILE;
 
 /* some helpful bits */
 #define LP_SNUM_OK(i) (((i) >= 0) && ((i) < iNumServices) && (ServicePtrs != NULL) && ServicePtrs[(i)]->valid)
@@ -88,8 +85,6 @@ static bool include_registry_globals = False;
 #define USERSHARE_VALID 1
 #define USERSHARE_PENDING_DELETE 2
 
-bool use_getwd_cache = True;
-
 extern int extra_time_offset;
 
 static bool defaults_saved = False;
@@ -106,6 +101,7 @@ struct _param_opt_struct {
  * This structure describes global (ie., server-wide) parameters.
  */
 typedef struct {
+       int ConfigBackend;
        char *smb_ports;
        char *dos_charset;
        char *unix_charset;
@@ -215,6 +211,7 @@ typedef struct {
        int pwordlevel;
        int unamelevel;
        int deadtime;
+       bool getwd_cache;
        int maxprotocol;
        int minprotocol;
        int security;
@@ -473,6 +470,7 @@ typedef struct {
        int iAioWriteSize;
        int iMap_readonly;
        int iDirectoryNameCacheSize;
+       int ismb_encrypt;
        param_opt_struct *param_opt;
 
        char dummy[3];          /* for alignment */
@@ -618,6 +616,7 @@ static service sDefault = {
 #else
        100,                    /* iDirectoryNameCacheSize */
 #endif
+       Auto,                   /* ismb_encrypt */
        NULL,                   /* Parametric options */
 
        ""                      /* dummy */
@@ -841,6 +840,14 @@ static const struct enum_list enum_map_to_guest[] = {
        {-1, NULL}
 };
 
+/* Config backend options */
+
+static const struct enum_list enum_config_backend[] = {
+       {CONFIG_BACKEND_FILE, "file"},
+       {CONFIG_BACKEND_REGISTRY, "registry"},
+       {-1, NULL}
+};
+
 /* Note: We do not initialise the defaults union - it is not allowed in ANSI C
  *
  * The FLAG_HIDE is explicit. Paramters set this way do NOT appear in any edit
@@ -879,6 +886,8 @@ static struct parm_struct parm_table[] = {
        {"interfaces", P_LIST, P_GLOBAL, &Globals.szInterfaces, NULL, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD}, 
        {"bind interfaces only", P_BOOL, P_GLOBAL, &Globals.bBindInterfacesOnly, NULL, NULL, FLAG_ADVANCED | FLAG_WIZARD}, 
 
+       {"config backend", P_ENUM, P_GLOBAL, &Globals.ConfigBackend, NULL, enum_config_backend, FLAG_ADVANCED},
+
        {N_("Security Options"), P_SEP, P_SEPARATOR}, 
 
        {"security", P_ENUM, P_GLOBAL, &Globals.security, NULL, enum_security, FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD}, 
@@ -1028,6 +1037,7 @@ static struct parm_struct parm_table[] = {
        {"use spnego", P_BOOL, P_GLOBAL, &Globals.bUseSpnego, NULL, NULL, FLAG_ADVANCED}, 
        {"client signing", P_ENUM, P_GLOBAL, &Globals.client_signing, NULL, enum_smb_signing_vals, FLAG_ADVANCED}, 
        {"server signing", P_ENUM, P_GLOBAL, &Globals.server_signing, NULL, enum_smb_signing_vals, FLAG_ADVANCED}, 
+       {"smb encrypt", P_ENUM, P_LOCAL, &sDefault.ismb_encrypt, NULL, enum_smb_signing_vals, FLAG_ADVANCED},
        {"client use spnego", P_BOOL, P_GLOBAL, &Globals.bClientUseSpnego, NULL, NULL, FLAG_ADVANCED}, 
        {"client ldap sasl wrapping", P_ENUM, P_GLOBAL, &Globals.client_ldap_sasl_wrapping, NULL, enum_ldap_sasl_wrapping, FLAG_ADVANCED},
        {"enable asu support", P_BOOL, P_GLOBAL, &Globals.bASUSupport, NULL, NULL, FLAG_ADVANCED}, 
@@ -1037,7 +1047,7 @@ static struct parm_struct parm_table[] = {
 
        {"block size", P_INTEGER, P_LOCAL, &sDefault.iBlock_size, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL}, 
        {"deadtime", P_INTEGER, P_GLOBAL, &Globals.deadtime, NULL, NULL, FLAG_ADVANCED}, 
-       {"getwd cache", P_BOOL, P_GLOBAL, &use_getwd_cache, NULL, NULL, FLAG_ADVANCED}, 
+       {"getwd cache", P_BOOL, P_GLOBAL, &Globals.getwd_cache, NULL, NULL, FLAG_ADVANCED},
        {"keepalive", P_INTEGER, P_GLOBAL, &Globals.iKeepalive, NULL, NULL, FLAG_ADVANCED},
        {"change notify", P_BOOL, P_LOCAL, &sDefault.bChangeNotify, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE },
        {"directory name cache size", P_INTEGER, P_LOCAL, &sDefault.iDirectoryNameCacheSize, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE },
@@ -1213,14 +1223,14 @@ static struct parm_struct parm_table[] = {
        {"ldap page size", P_INTEGER, P_GLOBAL, &Globals.ldap_page_size, NULL, NULL, FLAG_ADVANCED},
        {"ldap user suffix", P_STRING, P_GLOBAL, &Globals.szLdapUserSuffix, NULL, NULL, FLAG_ADVANCED}, 
 
+       {N_("EventLog Options"), P_SEP, P_SEPARATOR}, 
+       {"eventlog list",  P_LIST, P_GLOBAL, &Globals.szEventLogs, NULL, NULL, FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE}, 
+
        {N_("Miscellaneous Options"), P_SEP, P_SEPARATOR}, 
        {"add share command", P_STRING, P_GLOBAL, &Globals.szAddShareCommand, NULL, NULL, FLAG_ADVANCED}, 
        {"change share command", P_STRING, P_GLOBAL, &Globals.szChangeShareCommand, NULL, NULL, FLAG_ADVANCED}, 
        {"delete share command", P_STRING, P_GLOBAL, &Globals.szDeleteShareCommand, NULL, NULL, FLAG_ADVANCED}, 
 
-       {N_("EventLog Options"), P_SEP, P_SEPARATOR}, 
-       {"eventlog list",  P_LIST, P_GLOBAL, &Globals.szEventLogs, NULL, NULL, FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE}, 
-       
        {"config file", P_STRING, P_GLOBAL, &Globals.szConfigFile, NULL, NULL, FLAG_HIDE}, 
        {"preload", P_STRING, P_GLOBAL, &Globals.szAutoServices, NULL, NULL, FLAG_ADVANCED}, 
        {"auto services", P_STRING, P_GLOBAL, &Globals.szAutoServices, NULL, NULL, FLAG_ADVANCED}, 
@@ -1292,6 +1302,8 @@ static struct parm_struct parm_table[] = {
        {"vfs object", P_LIST, P_LOCAL, &sDefault.szVfsObjects, NULL, NULL, FLAG_HIDE}, 
 
 
+       {N_("MSDFS options"), P_SEP, P_SEPARATOR},
+
        {"msdfs root", P_BOOL, P_LOCAL, &sDefault.bMSDfsRoot, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE}, 
        {"msdfs proxy", P_STRING, P_LOCAL, &sDefault.szMSDfsProxy, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE}, 
        {"host msdfs", P_BOOL, P_GLOBAL, &Globals.bHostMSDfs, NULL, NULL, FLAG_ADVANCED}, 
@@ -1525,6 +1537,8 @@ static void init_globals(bool first_time_only)
        Globals.bLoadPrinters = True;
        Globals.PrintcapCacheTime = 750;        /* 12.5 minutes */
 
+       Globals.ConfigBackend = config_backend;
+
        /* Was 65535 (0xFFFF). 0x4101 matches W2K and causes major speed improvements... */
        /* Discovered by 2 days of pain by Don McCall @ HP :-). */
        Globals.max_xmit = 0x4104;
@@ -1535,6 +1549,7 @@ static void init_globals(bool first_time_only)
        Globals.pwordlevel = 0;
        Globals.unamelevel = 0;
        Globals.deadtime = 0;
+       Globals.getwd_cache = true;
        Globals.bLargeReadwrite = True;
        Globals.max_log_size = 5000;
        Globals.max_open_files = MAX_OPEN_FILES;
@@ -1585,7 +1600,7 @@ static void init_globals(bool first_time_only)
        Globals.bNTPipeSupport = True;  /* Do NT pipes by default. */
        Globals.bNTStatusSupport = True; /* Use NT status by default. */
        Globals.bStatCache = True;      /* use stat cache by default */
-       Globals.iMaxStatCacheSize = 1024; /* one Meg by default. */
+       Globals.iMaxStatCacheSize = 256; /* 256k by default */
        Globals.restrict_anonymous = 0;
        Globals.bClientLanManAuth = False;      /* Do NOT use the LanMan hash if it is available */
        Globals.bClientPlaintextAuth = False;   /* Do NOT use a plaintext password even if is requested by the server */
@@ -2023,6 +2038,7 @@ FN_GLOBAL_INTEGER(lp_maxmux, &Globals.max_mux)
 FN_GLOBAL_INTEGER(lp_passwordlevel, &Globals.pwordlevel)
 FN_GLOBAL_INTEGER(lp_usernamelevel, &Globals.unamelevel)
 FN_GLOBAL_INTEGER(lp_deadtime, &Globals.deadtime)
+FN_GLOBAL_BOOL(lp_getwd_cache, &Globals.getwd_cache)
 FN_GLOBAL_INTEGER(lp_maxprotocol, &Globals.maxprotocol)
 FN_GLOBAL_INTEGER(lp_minprotocol, &Globals.minprotocol)
 FN_GLOBAL_INTEGER(lp_security, &Globals.security)
@@ -2042,6 +2058,7 @@ FN_GLOBAL_INTEGER(lp_oplock_break_wait_time, &Globals.oplock_break_wait_time)
 FN_GLOBAL_INTEGER(lp_lock_spin_time, &Globals.iLockSpinTime)
 FN_GLOBAL_INTEGER(lp_usershare_max_shares, &Globals.iUsershareMaxShares)
 FN_GLOBAL_CONST_STRING(lp_socket_options, &Globals.szSocketOptions)
+FN_GLOBAL_INTEGER(lp_config_backend, &Globals.ConfigBackend);
 
 FN_LOCAL_STRING(lp_preexec, szPreExec)
 FN_LOCAL_STRING(lp_postexec, szPostExec)
@@ -2172,6 +2189,7 @@ FN_LOCAL_INTEGER(lp_aio_read_size, iAioReadSize)
 FN_LOCAL_INTEGER(lp_aio_write_size, iAioWriteSize)
 FN_LOCAL_INTEGER(lp_map_readonly, iMap_readonly)
 FN_LOCAL_INTEGER(lp_directory_name_cache_size, iDirectoryNameCacheSize)
+FN_LOCAL_INTEGER(lp_smb_encrypt, ismb_encrypt)
 FN_LOCAL_CHAR(lp_magicchar, magic_char)
 FN_GLOBAL_INTEGER(lp_winbind_cache_time, &Globals.winbind_cache_time)
 FN_GLOBAL_LIST(lp_winbind_nss_info, &Globals.szWinbindNssInfo)
@@ -3417,8 +3435,6 @@ static bool process_registry_globals(bool (*pfunc)(const char *, const char *))
        char * valstr;
        struct registry_value *value = NULL;
 
-       include_registry_globals = True;
-
        ZERO_STRUCT(data);
 
        reg_tdb = lp_regdb_open();
@@ -3472,7 +3488,7 @@ static bool process_registry_globals(bool (*pfunc)(const char *, const char *))
                if (size && data_p) {
                        err = registry_pull_value(reg_tdb,
                                                  &value,
-                                                 type,
+                                                 (enum winreg_Type)type,
                                                  data_p,
                                                  size,
                                                  size);
@@ -3509,7 +3525,9 @@ done:
 /*
  * this is process_registry_globals as it _should_ be (roughly)
  * using the reg_api functions...
- * 
+ *
+ * We are *not* currently doing it like this due to the large
+ * linker dependecies of the registry code (see above).
  */
 static bool process_registry_globals(bool (*pfunc)(const char *, const char *))
 {
@@ -3522,22 +3540,21 @@ static bool process_registry_globals(bool (*pfunc)(const char *, const char *))
        char *valname = NULL;
        char *valstr = NULL;
        uint32 idx = 0;
-       NT_USER_TOKEN *token;
+       NT_USER_TOKEN *token = NULL;
 
        ctx = talloc_init("process_registry_globals");
        if (!ctx) {
                smb_panic("Failed to create talloc context!");
        }
 
-       include_registry_globals = True;
-
        if (!registry_init_regdb()) {
                DEBUG(1, ("Error initializing the registry.\n"));
                goto done;
        }
 
-       if (!(token = registry_create_admin_token(ctx))) {
-               DEBUG(1, ("Error creating admin token\n"));
+       werr = ntstatus_to_werror(registry_create_admin_token(ctx, &token));
+       if (!W_ERROR_IS_OK(werr)) {
+               DEBUG(1, ("Error creating admin token: %s\n",dos_errstr(werr)));
                goto done;
        }
 
@@ -3629,9 +3646,12 @@ static void add_to_file_list(const char *fname, const char *subfname)
        }
 }
 
-bool lp_include_registry_globals(void)
+/**
+ * Utility function for outsiders to check if we're running on registry.
+ */
+bool lp_config_backend_is_registry(void)
 {
-       return include_registry_globals;
+       return (lp_config_backend() == CONFIG_BACKEND_REGISTRY);
 }
 
 /*******************************************************************
@@ -3645,7 +3665,7 @@ bool lp_file_list_changed(void)
 
        DEBUG(6, ("lp_file_list_changed()\n"));
 
-       if (include_registry_globals) {
+       if (lp_config_backend() == CONFIG_BACKEND_REGISTRY) {
                reg_tdb = lp_regdb_open();
                if (reg_tdb && (regdb_last_seqnum != tdb_get_seqnum(reg_tdb->tdb)))
                {
@@ -3653,6 +3673,15 @@ bool lp_file_list_changed(void)
                                    regdb_last_seqnum, tdb_get_seqnum(reg_tdb->tdb)));
                        TALLOC_FREE(reg_tdb);
                        return true;
+               } else {
+                       /*
+                        * Don't check files when config_backend is registry.
+                        * Remove this to obtain checking of files even with
+                        * registry config backend. That would enable switching
+                        * off registry configuration by changing smb.conf even
+                        * without restarting smbd.
+                        */
+                       return false;
                }
        }
 
@@ -3688,6 +3717,7 @@ bool lp_file_list_changed(void)
        return (False);
 }
 
+
 /***************************************************************************
  Run standard_sub_basic on netbios name... needed because global_myname
  is not accessed through any lp_ macro.
@@ -3757,17 +3787,6 @@ static bool handle_include(int snum, const char *pszParmValue, char **ptr)
 {
        char *fname;
 
-       if (strequal(pszParmValue, INCLUDE_REGISTRY_NAME)) {
-               if (bInGlobalSection) {
-                       return process_registry_globals(do_parameter);
-               }
-               else {
-                       DEBUG(1, ("\"include = registry\" only effective "
-                                 "in %s section\n", GLOBAL_NAME));
-                       return false;
-               }
-       }
-
        fname = alloc_sub_basic(get_current_username(),
                                current_user_info.domain,
                                pszParmValue);
@@ -4690,6 +4709,7 @@ static void lp_add_auto_services(char *str)
        char *s;
        char *p;
        int homes;
+       char *saveptr;
 
        if (!str)
                return;
@@ -4700,14 +4720,19 @@ static void lp_add_auto_services(char *str)
 
        homes = lp_servicenumber(HOMES_NAME);
 
-       for (p = strtok(s, LIST_SEP); p; p = strtok(NULL, LIST_SEP)) {
-               char *home = get_user_home_dir(p);
+       for (p = strtok_r(s, LIST_SEP, &saveptr); p;
+            p = strtok_r(NULL, LIST_SEP, &saveptr)) {
+               char *home;
 
                if (lp_servicenumber(p) >= 0)
                        continue;
 
+               home = get_user_home_dir(talloc_tos(), p);
+
                if (home && homes >= 0)
                        lp_add_home(p, homes, p, home);
+
+               TALLOC_FREE(home);
        }
        SAFE_FREE(s);
 }
@@ -5642,15 +5667,6 @@ bool lp_load(const char *pszFname,
        bool bRetval;
        param_opt_struct *data, *pdata;
 
-       n2 = alloc_sub_basic(get_current_username(),
-                               current_user_info.domain,
-                               pszFname);
-       if (!n2) {
-               smb_panic("lp_load: out of memory");
-       }
-
-       add_to_file_list(pszFname, n2);
-
        bRetval = False;
 
        DEBUG(3, ("lp_load: refreshing parameters\n"));
@@ -5679,17 +5695,48 @@ bool lp_load(const char *pszFname,
                Globals.param_opt = NULL;
        }
 
-       /* We get sections first, so have to start 'behind' to make up */
-       iServiceIndex = -1;
-       bRetval = pm_process(n2, do_section, do_parameter);
-       SAFE_FREE(n2);
+       if (lp_config_backend() == CONFIG_BACKEND_FILE) {
+               n2 = alloc_sub_basic(get_current_username(),
+                                       current_user_info.domain,
+                                       pszFname);
+               if (!n2) {
+                       smb_panic("lp_load: out of memory");
+               }
+
+               add_to_file_list(pszFname, n2);
 
-       /* finish up the last section */
-       DEBUG(4, ("pm_process() returned %s\n", BOOLSTR(bRetval)));
-       if (bRetval) {
-               if (iServiceIndex >= 0) {
-                       bRetval = service_ok(iServiceIndex);
+               /* We get sections first, so have to start 'behind' to make up */
+               iServiceIndex = -1;
+               bRetval = pm_process(n2, do_section, do_parameter);
+               SAFE_FREE(n2);
+
+               /* finish up the last section */
+               DEBUG(4, ("pm_process() returned %s\n", BOOLSTR(bRetval)));
+               if (bRetval) {
+                       if (iServiceIndex >= 0) {
+                               bRetval = service_ok(iServiceIndex);
+                       }
+               }
+
+               if (lp_config_backend() == CONFIG_BACKEND_REGISTRY) {
+                       /*
+                        * We need to use this extra global variable here to
+                        * survive restart: init_globals usese this as a default
+                        * for ConfigBackend. Otherwise, init_globals would
+                        *  send us into an endless loop here.
+                        */
+                       config_backend = CONFIG_BACKEND_REGISTRY;
+                       /* start over */
+                       init_globals(false);
+                       return lp_load(pszFname, global_only, save_defaults,
+                                      add_ipc, initialize_globals);
                }
+       } else if (lp_config_backend() == CONFIG_BACKEND_REGISTRY) {
+               bRetval = process_registry_globals(do_parameter);
+       } else {
+               DEBUG(0, ("Illegal config  backend given: %d\n",
+                         lp_config_backend()));
+               bRetval = false;
        }
 
        lp_add_auto_services(lp_auto_services());
@@ -6213,7 +6260,9 @@ bool lp_use_sendfile(int snum)
        if (Protocol < PROTOCOL_NT1) {
                return False;
        }
-       return (_lp_use_sendfile(snum) && (get_remote_arch() != RA_WIN95) && !srv_is_signing_active());
+       return (_lp_use_sendfile(snum) &&
+                       (get_remote_arch() != RA_WIN95) &&
+                       !srv_is_signing_active());
 }
 
 /*******************************************************************
index f5b03ffff06bcd74fa7c1bf454f29214c6e8aaf3..9f66eb934e46622337a1c1259bd9b5eedef5608f 100644 (file)
@@ -464,6 +464,9 @@ static bool lookup_rids(TALLOC_CTX *mem_ctx, const DOM_SID *domain_sid,
 {
        int i;
 
+       DEBUG(10, ("lookup_rids called for domain sid '%s'\n",
+                  sid_string_dbg(domain_sid)));
+
        if (num_rids) {
                *names = TALLOC_ARRAY(mem_ctx, const char *, num_rids);
                *types = TALLOC_ARRAY(mem_ctx, enum lsa_SidType, num_rids);
@@ -596,6 +599,16 @@ static bool lookup_as_domain(const DOM_SID *sid, TALLOC_CTX *mem_ctx,
                return true;
        }
 
+       if (sid_check_is_unix_users(sid)) {
+               *name = talloc_strdup(mem_ctx, unix_users_domain_name());
+               return true;
+       }
+
+       if (sid_check_is_unix_groups(sid)) {
+               *name = talloc_strdup(mem_ctx, unix_groups_domain_name());
+               return true;
+       }
+
        if (sid->num_auths != 4) {
                /* This can't be a domain */
                return false;
@@ -922,6 +935,8 @@ bool lookup_sid(TALLOC_CTX *mem_ctx, const DOM_SID *sid,
        TALLOC_CTX *tmp_ctx;
        bool ret = false;
 
+       DEBUG(10, ("lookup_sid called for SID '%s'\n", sid_string_dbg(sid)));
+
        if (!(tmp_ctx = talloc_new(mem_ctx))) {
                DEBUG(0, ("talloc_new failed\n"));
                return false;
@@ -971,184 +986,112 @@ bool lookup_sid(TALLOC_CTX *mem_ctx, const DOM_SID *sid,
  modified to use linked lists by jra.
 *****************************************************************/  
 
-#define MAX_UID_SID_CACHE_SIZE 100
-#define TURNOVER_UID_SID_CACHE_SIZE 10
-#define MAX_GID_SID_CACHE_SIZE 100
-#define TURNOVER_GID_SID_CACHE_SIZE 10
-
-static size_t n_uid_sid_cache = 0;
-static size_t n_gid_sid_cache = 0;
-
-static struct uid_sid_cache {
-       struct uid_sid_cache *next, *prev;
-       uid_t uid;
-       DOM_SID sid;
-       enum lsa_SidType sidtype;
-} *uid_sid_cache_head;
-
-static struct gid_sid_cache {
-       struct gid_sid_cache *next, *prev;
-       gid_t gid;
-       DOM_SID sid;
-       enum lsa_SidType sidtype;
-} *gid_sid_cache_head;
-
 /*****************************************************************
   Find a SID given a uid.
-*****************************************************************/  
+*****************************************************************/
 
 static bool fetch_sid_from_uid_cache(DOM_SID *psid, uid_t uid)
 {
-       struct uid_sid_cache *pc;
-
-       for (pc = uid_sid_cache_head; pc; pc = pc->next) {
-               if (pc->uid == uid) {
-                       *psid = pc->sid;
-                       DEBUG(3,("fetch sid from uid cache %u -> %s\n",
-                                (unsigned int)uid, sid_string_dbg(psid)));
-                       DLIST_PROMOTE(uid_sid_cache_head, pc);
-                       return true;
-               }
+       DATA_BLOB cache_value;
+
+       if (!memcache_lookup(NULL, UID_SID_CACHE,
+                            data_blob_const(&uid, sizeof(uid)),
+                            &cache_value)) {
+               return false;
        }
-       return false;
+
+       SMB_ASSERT(cache_value.length == sizeof(*psid));
+       memcpy(psid, cache_value.data, sizeof(*psid));
+
+       return true;
 }
 
 /*****************************************************************
   Find a uid given a SID.
-*****************************************************************/  
+*****************************************************************/
 
 static bool fetch_uid_from_cache( uid_t *puid, const DOM_SID *psid )
 {
-       struct uid_sid_cache *pc;
-
-       for (pc = uid_sid_cache_head; pc; pc = pc->next) {
-               if (sid_compare(&pc->sid, psid) == 0) {
-                       *puid = pc->uid;
-                       DEBUG(3,("fetch uid from cache %u -> %s\n",
-                                (unsigned int)*puid, sid_string_dbg(psid)));
-                       DLIST_PROMOTE(uid_sid_cache_head, pc);
-                       return true;
-               }
+       DATA_BLOB cache_value;
+
+       if (!memcache_lookup(NULL, SID_UID_CACHE,
+                            data_blob_const(psid, sizeof(*psid)),
+                            &cache_value)) {
+               return false;
        }
-       return false;
+
+       SMB_ASSERT(cache_value.length == sizeof(*puid));
+       memcpy(puid, cache_value.data, sizeof(*puid));
+
+       return true;
 }
 
 /*****************************************************************
  Store uid to SID mapping in cache.
-*****************************************************************/  
+*****************************************************************/
 
 void store_uid_sid_cache(const DOM_SID *psid, uid_t uid)
 {
-       struct uid_sid_cache *pc;
-
-       /* do not store SIDs in the "Unix Group" domain */
-       
-       if ( sid_check_is_in_unix_users( psid ) )
-               return;
-
-       if (n_uid_sid_cache >= MAX_UID_SID_CACHE_SIZE && n_uid_sid_cache > TURNOVER_UID_SID_CACHE_SIZE) {
-               /* Delete the last TURNOVER_UID_SID_CACHE_SIZE entries. */
-               struct uid_sid_cache *pc_next;
-               size_t i;
-
-               for (i = 0, pc = uid_sid_cache_head; i < (n_uid_sid_cache - TURNOVER_UID_SID_CACHE_SIZE); i++, pc = pc->next)
-                       ;
-               for(; pc; pc = pc_next) {
-                       pc_next = pc->next;
-                       DLIST_REMOVE(uid_sid_cache_head,pc);
-                       SAFE_FREE(pc);
-                       n_uid_sid_cache--;
-               }
-       }
-
-       pc = SMB_MALLOC_P(struct uid_sid_cache);
-       if (!pc)
-               return;
-       pc->uid = uid;
-       sid_copy(&pc->sid, psid);
-       DLIST_ADD(uid_sid_cache_head, pc);
-       n_uid_sid_cache++;
+       memcache_add(NULL, SID_UID_CACHE,
+                    data_blob_const(psid, sizeof(*psid)),
+                    data_blob_const(&uid, sizeof(uid)));
+       memcache_add(NULL, UID_SID_CACHE,
+                    data_blob_const(&uid, sizeof(uid)),
+                    data_blob_const(psid, sizeof(*psid)));
 }
 
 /*****************************************************************
   Find a SID given a gid.
-*****************************************************************/  
+*****************************************************************/
 
 static bool fetch_sid_from_gid_cache(DOM_SID *psid, gid_t gid)
 {
-       struct gid_sid_cache *pc;
-
-       for (pc = gid_sid_cache_head; pc; pc = pc->next) {
-               if (pc->gid == gid) {
-                       *psid = pc->sid;
-                       DEBUG(3,("fetch sid from gid cache %u -> %s\n",
-                                (unsigned int)gid, sid_string_dbg(psid)));
-                       DLIST_PROMOTE(gid_sid_cache_head, pc);
-                       return true;
-               }
+       DATA_BLOB cache_value;
+
+       if (!memcache_lookup(NULL, GID_SID_CACHE,
+                            data_blob_const(&gid, sizeof(gid)),
+                            &cache_value)) {
+               return false;
        }
-       return false;
+
+       SMB_ASSERT(cache_value.length == sizeof(*psid));
+       memcpy(psid, cache_value.data, sizeof(*psid));
+
+       return true;
 }
 
 /*****************************************************************
   Find a gid given a SID.
-*****************************************************************/  
+*****************************************************************/
 
 static bool fetch_gid_from_cache(gid_t *pgid, const DOM_SID *psid)
 {
-       struct gid_sid_cache *pc;
-
-       for (pc = gid_sid_cache_head; pc; pc = pc->next) {
-               if (sid_compare(&pc->sid, psid) == 0) {
-                       *pgid = pc->gid;
-                       DEBUG(3,("fetch gid from cache %u -> %s\n",
-                                (unsigned int)*pgid, sid_string_dbg(psid)));
-                       DLIST_PROMOTE(gid_sid_cache_head, pc);
-                       return true;
-               }
+       DATA_BLOB cache_value;
+
+       if (!memcache_lookup(NULL, SID_UID_CACHE,
+                            data_blob_const(psid, sizeof(*psid)),
+                            &cache_value)) {
+               return false;
        }
-       return false;
+
+       SMB_ASSERT(cache_value.length == sizeof(*pgid));
+       memcpy(pgid, cache_value.data, sizeof(*pgid));
+
+       return true;
 }
 
 /*****************************************************************
  Store gid to SID mapping in cache.
-*****************************************************************/  
+*****************************************************************/
 
 void store_gid_sid_cache(const DOM_SID *psid, gid_t gid)
 {
-       struct gid_sid_cache *pc;
-       
-       /* do not store SIDs in the "Unix Group" domain */
-       
-       if ( sid_check_is_in_unix_groups( psid ) )
-               return;
-
-       if (n_gid_sid_cache >= MAX_GID_SID_CACHE_SIZE && n_gid_sid_cache > TURNOVER_GID_SID_CACHE_SIZE) {
-               /* Delete the last TURNOVER_GID_SID_CACHE_SIZE entries. */
-               struct gid_sid_cache *pc_next;
-               size_t i;
-
-               for (i = 0, pc = gid_sid_cache_head; i < (n_gid_sid_cache - TURNOVER_GID_SID_CACHE_SIZE); i++, pc = pc->next)
-                       ;
-               for(; pc; pc = pc_next) {
-                       pc_next = pc->next;
-                       DLIST_REMOVE(gid_sid_cache_head,pc);
-                       SAFE_FREE(pc);
-                       n_gid_sid_cache--;
-               }
-       }
-
-       pc = SMB_MALLOC_P(struct gid_sid_cache);
-       if (!pc)
-               return;
-       pc->gid = gid;
-       sid_copy(&pc->sid, psid);
-       DLIST_ADD(gid_sid_cache_head, pc);
-
-       DEBUG(3,("store_gid_sid_cache: gid %u in cache -> %s\n",
-                (unsigned int)gid, sid_string_dbg(psid)));
-
-       n_gid_sid_cache++;
+       memcache_add(NULL, SID_GID_CACHE,
+                    data_blob_const(psid, sizeof(*psid)),
+                    data_blob_const(&gid, sizeof(gid)));
+       memcache_add(NULL, GID_SID_CACHE,
+                    data_blob_const(&gid, sizeof(gid)),
+                    data_blob_const(psid, sizeof(*psid)));
 }
 
 /*****************************************************************
index 9311b8a74e6a4663e7cf1926ef9d0cb393af68af..4228f6c32fbd37efbc59872b12870686453fb258 100644 (file)
@@ -1552,7 +1552,9 @@ bool get_trust_pw_clear(const char *domain, char **ret_pwd,
                        return false;
                }
 
-               *channel = SEC_CHAN_DOMAIN;
+               if (channel != NULL) {
+                       *channel = SEC_CHAN_DOMAIN;
+               }
 
                if (account_name != NULL) {
                        *account_name = lp_workgroup();
index ed6a91cb2b53312ae38bb7f0861d0cb61179536c..0ab45bafc31777c648e285c64079ee1e6992cda5 100644 (file)
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_PASSDB
 
-/* Cache of latest SAM lookup query */
-
-static struct samu *csamuser = NULL;
-
 static_decl_pdb;
 
 static struct pdb_init_function_entry *backends = NULL;
@@ -208,55 +204,32 @@ static struct pdb_methods *pdb_get_methods(void)
        return pdb_get_methods_reload(False);
 }
 
-/******************************************************************
- Backward compatibility functions for the original passdb interface
-*******************************************************************/
-
-bool pdb_setsampwent(bool update, uint16 acb_mask) 
-{
-       struct pdb_methods *pdb = pdb_get_methods();
-       return NT_STATUS_IS_OK(pdb->setsampwent(pdb, update, acb_mask));
-}
-
-void pdb_endsampwent(void) 
-{
-       struct pdb_methods *pdb = pdb_get_methods();
-       pdb->endsampwent(pdb);
-}
-
-bool pdb_getsampwent(struct samu *user) 
-{
-       struct pdb_methods *pdb = pdb_get_methods();
-
-       if ( !NT_STATUS_IS_OK(pdb->getsampwent(pdb, user) ) ) {
-               return False;
-       }
-
-       return True;
-}
-
 bool pdb_getsampwnam(struct samu *sam_acct, const char *username) 
 {
        struct pdb_methods *pdb = pdb_get_methods();
+       struct samu *cache_copy;
+       const struct dom_sid *user_sid;
 
        if (!NT_STATUS_IS_OK(pdb->getsampwnam(pdb, sam_acct, username))) {
                return False;
        }
 
-       if ( csamuser ) {
-               TALLOC_FREE(csamuser);
-       }
-
-       csamuser = samu_new( NULL );
-       if (!csamuser) {
+       cache_copy = samu_new(NULL);
+       if (cache_copy == NULL) {
                return False;
        }
 
-       if (!pdb_copy_sam_account(csamuser, sam_acct)) {
-               TALLOC_FREE(csamuser);
+       if (!pdb_copy_sam_account(cache_copy, sam_acct)) {
+               TALLOC_FREE(cache_copy);
                return False;
        }
 
+       user_sid = pdb_get_user_sid(cache_copy);
+
+       memcache_add_talloc(NULL, PDB_GETPWSID_CACHE,
+                           data_blob_const(user_sid, sizeof(*user_sid)),
+                           cache_copy);
+
        return True;
 }
 
@@ -289,6 +262,7 @@ bool pdb_getsampwsid(struct samu *sam_acct, const DOM_SID *sid)
 {
        struct pdb_methods *pdb = pdb_get_methods();
        uint32 rid;
+       void *cache_data;
 
        /* hard code the Guest RID of 501 */
 
@@ -301,9 +275,16 @@ bool pdb_getsampwsid(struct samu *sam_acct, const DOM_SID *sid)
        }
        
        /* check the cache first */
-       
-       if ( csamuser && sid_equal(sid, pdb_get_user_sid(csamuser) ) )
-               return pdb_copy_sam_account(sam_acct, csamuser);
+
+       cache_data = memcache_lookup_talloc(
+               NULL, PDB_GETPWSID_CACHE, data_blob_const(sid, sizeof(*sid)));
+
+       if (cache_data != NULL) {
+               struct samu *cache_copy = talloc_get_type_abort(
+                       cache_data, struct samu);
+
+               return pdb_copy_sam_account(sam_acct, cache_copy);
+       }
 
        return NT_STATUS_IS_OK(pdb->getsampwsid(pdb, sam_acct, sid));
 }
@@ -498,10 +479,7 @@ NTSTATUS pdb_update_sam_account(struct samu *sam_acct)
 {
        struct pdb_methods *pdb = pdb_get_methods();
 
-       if (csamuser != NULL) {
-               TALLOC_FREE(csamuser);
-               csamuser = NULL;
-       }
+       memcache_flush(NULL, PDB_GETPWSID_CACHE);
 
        return pdb->update_sam_account(pdb, sam_acct);
 }
@@ -510,10 +488,7 @@ NTSTATUS pdb_delete_sam_account(struct samu *sam_acct)
 {
        struct pdb_methods *pdb = pdb_get_methods();
 
-       if (csamuser != NULL) {
-               TALLOC_FREE(csamuser);
-               csamuser = NULL;
-       }
+       memcache_flush(NULL, PDB_GETPWSID_CACHE);
 
        return pdb->delete_sam_account(pdb, sam_acct);
 }
@@ -524,10 +499,7 @@ NTSTATUS pdb_rename_sam_account(struct samu *oldname, const char *newname)
        uid_t uid;
        NTSTATUS status;
 
-       if (csamuser != NULL) {
-               TALLOC_FREE(csamuser);
-               csamuser = NULL;
-       }
+       memcache_flush(NULL, PDB_GETPWSID_CACHE);
 
        /* sanity check to make sure we don't rename root */
 
@@ -1181,21 +1153,6 @@ static NTSTATUS pdb_default_update_login_attempts (struct pdb_methods *methods,
        return NT_STATUS_NOT_IMPLEMENTED;
 }
 
-static NTSTATUS pdb_default_setsampwent(struct pdb_methods *methods, bool update, uint32 acb_mask)
-{
-       return NT_STATUS_NOT_IMPLEMENTED;
-}
-
-static NTSTATUS pdb_default_getsampwent(struct pdb_methods *methods, struct samu *user)
-{
-       return NT_STATUS_NOT_IMPLEMENTED;
-}
-
-static void pdb_default_endsampwent(struct pdb_methods *methods)
-{
-       return; /* NT_STATUS_NOT_IMPLEMENTED; */
-}
-
 static NTSTATUS pdb_default_get_account_policy(struct pdb_methods *methods, int policy_index, uint32 *value)
 {
        return account_policy_get(policy_index, value) ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL;
@@ -1570,11 +1527,12 @@ static bool lookup_global_sam_rid(TALLOC_CTX *mem_ctx, uint32 rid,
                        return True;
                }
 
-               pw = Get_Pwnam(*name);
+               pw = Get_Pwnam_alloc(talloc_tos(), *name);
                if (pw == NULL) {
                        return False;
                }
                unix_id->uid = pw->pw_uid;
+               TALLOC_FREE(pw);
                return True;
        }
        TALLOC_FREE(sam_account);
@@ -1737,7 +1695,7 @@ static NTSTATUS pdb_default_lookup_names(struct pdb_methods *methods,
 }
 #endif
 
-static struct pdb_search *pdb_search_init(enum pdb_search_type type)
+struct pdb_search *pdb_search_init(enum pdb_search_type type)
 {
        TALLOC_CTX *mem_ctx;
        struct pdb_search *result;
@@ -1794,81 +1752,6 @@ static void fill_displayentry(TALLOC_CTX *mem_ctx, uint32 rid,
                entry->description = "";
 }
 
-static bool user_search_in_progress = False;
-struct user_search {
-       uint16 acct_flags;
-};
-
-static bool next_entry_users(struct pdb_search *s,
-                            struct samr_displayentry *entry)
-{
-       struct user_search *state = (struct user_search *)s->private_data;
-       struct samu *user = NULL;
-
- next:
-       if ( !(user = samu_new( NULL )) ) {
-               DEBUG(0, ("next_entry_users: samu_new() failed!\n"));
-               return False;
-       }
-
-       if (!pdb_getsampwent(user)) {
-               TALLOC_FREE(user);
-               return False;
-       }
-
-       if ((state->acct_flags != 0) &&
-           ((pdb_get_acct_ctrl(user) & state->acct_flags) == 0)) {
-               TALLOC_FREE(user);
-               goto next;
-       }
-
-       fill_displayentry(s->mem_ctx, pdb_get_user_rid(user),
-                         pdb_get_acct_ctrl(user), pdb_get_username(user),
-                         pdb_get_fullname(user), pdb_get_acct_desc(user),
-                         entry);
-
-       TALLOC_FREE(user);
-       return True;
-}
-
-static void search_end_users(struct pdb_search *search)
-{
-       pdb_endsampwent();
-       user_search_in_progress = False;
-}
-
-static bool pdb_default_search_users(struct pdb_methods *methods,
-                                    struct pdb_search *search,
-                                    uint32 acct_flags)
-{
-       struct user_search *state;
-
-       if (user_search_in_progress) {
-               DEBUG(1, ("user search in progress\n"));
-               return False;
-       }
-
-       if (!pdb_setsampwent(False, acct_flags)) {
-               DEBUG(5, ("Could not start search\n"));
-               return False;
-       }
-
-       user_search_in_progress = True;
-
-       state = TALLOC_P(search->mem_ctx, struct user_search);
-       if (state == NULL) {
-               DEBUG(0, ("talloc failed\n"));
-               return False;
-       }
-
-       state->acct_flags = acct_flags;
-
-       search->private_data = state;
-       search->next_entry = next_entry_users;
-       search->search_end = search_end_users;
-       return True;
-}
-
 struct group_search {
        GROUP_MAP *groups;
        size_t num_groups, current_group;
@@ -2135,9 +2018,6 @@ NTSTATUS make_pdb_method( struct pdb_methods **methods )
                return NT_STATUS_NO_MEMORY;
        }
 
-       (*methods)->setsampwent = pdb_default_setsampwent;
-       (*methods)->endsampwent = pdb_default_endsampwent;
-       (*methods)->getsampwent = pdb_default_getsampwent;
        (*methods)->getsampwnam = pdb_default_getsampwnam;
        (*methods)->getsampwsid = pdb_default_getsampwsid;
        (*methods)->create_user = pdb_default_create_user;
@@ -2179,7 +2059,6 @@ NTSTATUS make_pdb_method( struct pdb_methods **methods )
        (*methods)->gid_to_sid = pdb_default_gid_to_sid;
        (*methods)->sid_to_id = pdb_default_sid_to_id;
 
-       (*methods)->search_users = pdb_default_search_users;
        (*methods)->search_groups = pdb_default_search_groups;
        (*methods)->search_aliases = pdb_default_search_aliases;
 
index bc912ada29d2bcfe7675eb27ac54afbe2ae3d640..90a6ff011b35a385cbb7b28a61504f386ea88e99 100644 (file)
@@ -1453,79 +1453,6 @@ static bool init_ldap_from_sam (struct ldapsam_privates *ldap_state,
        return True;
 }
 
-/**********************************************************************
- Connect to LDAP server for password enumeration.
-*********************************************************************/
-
-static NTSTATUS ldapsam_setsampwent(struct pdb_methods *my_methods, bool update, uint32 acb_mask)
-{
-       struct ldapsam_privates *ldap_state = (struct ldapsam_privates *)my_methods->private_data;
-       int rc;
-       char *filter = NULL;
-       const char *suffix;
-       const char **attr_list;
-       bool machine_mask = False, user_mask = False;
-       NTSTATUS status = NT_STATUS_OK;
-       TALLOC_CTX *ctx = talloc_init("ldapsam_setsampwent");
-
-       if (!ctx) {
-               return NT_STATUS_NO_MEMORY;
-       }
-       filter = talloc_asprintf(ctx, "(&%s%s)", "(uid=%u)",
-               get_objclass_filter(ldap_state->schema_ver));
-       if (!filter) {
-               status = NT_STATUS_NO_MEMORY;
-               goto out;
-       }
-
-       filter = talloc_all_string_sub(ctx, filter, "%u", "*");
-       if (!filter) {
-               status = NT_STATUS_NO_MEMORY;
-               goto out;
-       }
-
-       machine_mask    = ((acb_mask != 0) && (acb_mask & (ACB_WSTRUST|ACB_SVRTRUST|ACB_DOMTRUST)));
-       user_mask       = ((acb_mask != 0) && (acb_mask & ACB_NORMAL));
-
-       if (machine_mask) {
-               suffix = lp_ldap_machine_suffix();
-       } else if (user_mask) {
-               suffix = lp_ldap_user_suffix();
-       } else {
-               suffix = lp_ldap_suffix();
-       }
-
-       DEBUG(10,("ldapsam_setsampwent: LDAP Query for acb_mask 0x%x will use suffix %s\n", 
-               acb_mask, suffix));
-
-       attr_list = get_userattr_list(NULL, ldap_state->schema_ver);
-       rc = smbldap_search(ldap_state->smbldap_state, suffix, LDAP_SCOPE_SUBTREE, filter, 
-                           attr_list, 0, &ldap_state->result);
-       TALLOC_FREE( attr_list );
-
-       if (rc != LDAP_SUCCESS) {
-               DEBUG(0, ("ldapsam_setsampwent: LDAP search failed: %s\n", ldap_err2string(rc)));
-               DEBUG(3, ("ldapsam_setsampwent: Query was: %s, %s\n", suffix, filter));
-               ldap_msgfree(ldap_state->result);
-               ldap_state->result = NULL;
-               status = NT_STATUS_UNSUCCESSFUL;
-               goto out;
-       }
-
-       DEBUG(2, ("ldapsam_setsampwent: %d entries in the base %s\n",
-               ldap_count_entries(ldap_state->smbldap_state->ldap_struct,
-               ldap_state->result), suffix));
-
-       ldap_state->entry = ldap_first_entry(ldap_state->smbldap_state->ldap_struct,
-                                ldap_state->result);
-       ldap_state->index = 0;
-
-  out:
-
-       TALLOC_FREE(ctx);
-       return status;
-}
-
 /**********************************************************************
  End enumeration of the LDAP password list.
 *********************************************************************/
@@ -1539,32 +1466,6 @@ static void ldapsam_endsampwent(struct pdb_methods *my_methods)
        }
 }
 
-/**********************************************************************
-Get the next entry in the LDAP password database.
-*********************************************************************/
-
-static NTSTATUS ldapsam_getsampwent(struct pdb_methods *my_methods,
-                                   struct samu *user)
-{
-       NTSTATUS ret = NT_STATUS_UNSUCCESSFUL;
-       struct ldapsam_privates *ldap_state =
-               (struct ldapsam_privates *)my_methods->private_data;
-       bool bret = False;
-
-       while (!bret) {
-               if (!ldap_state->entry)
-                       return ret;
-               
-               ldap_state->index++;
-               bret = init_sam_from_ldap(ldap_state, user, ldap_state->entry);
-               
-               ldap_state->entry = ldap_next_entry(priv2ld(ldap_state),
-                                                   ldap_state->entry); 
-       }
-
-       return NT_STATUS_OK;
-}
-
 static void append_attr(TALLOC_CTX *mem_ctx, const char ***attr_list,
                        const char *new_attr)
 {
@@ -1867,6 +1768,10 @@ static NTSTATUS ldapsam_modify_entry(struct pdb_methods *my_methods,
                                pdb_get_username(newpwd), ldap_err2string(rc), ld_error?ld_error:"unknown"));
                        SAFE_FREE(ld_error);
                        ber_bvfree(bv);
+#if defined(LDAP_CONSTRAINT_VIOLATION)
+                       if (rc == LDAP_CONSTRAINT_VIOLATION)
+                               return NT_STATUS_PASSWORD_RESTRICTION;
+#endif
                        return NT_STATUS_UNSUCCESSFUL;
                } else {
                        DEBUG(3,("ldapsam_modify_entry: LDAP Password changed for user %s\n",pdb_get_username(newpwd)));
@@ -2068,7 +1973,7 @@ static NTSTATUS ldapsam_rename_sam_account(struct pdb_methods *my_methods,
 
        /* rename the posix user */
        rename_script = SMB_STRDUP(lp_renameuser_script());
-       if (rename_script) {
+       if (rename_script == NULL) {
                return NT_STATUS_NO_MEMORY;
        }
 
@@ -2981,8 +2886,9 @@ static NTSTATUS ldapsam_enum_group_memberships(struct pdb_methods *methods,
 
        /* This sid will be replaced later */
 
-       if (!add_sid_to_array_unique(mem_ctx, &global_sid_NULL, pp_sids, &num_sids)) {
-               ret = NT_STATUS_NO_MEMORY;
+       ret = add_sid_to_array_unique(mem_ctx, &global_sid_NULL, pp_sids,
+                                     &num_sids);
+       if (!NT_STATUS_IS_OK(ret)) {
                goto done;
        }
 
@@ -3021,9 +2927,9 @@ static NTSTATUS ldapsam_enum_group_memberships(struct pdb_methods *methods,
                                ret = NT_STATUS_NO_MEMORY;
                                goto done;
                        }
-                       if (!add_sid_to_array_unique(mem_ctx, &sid, pp_sids,
-                                               &num_sids)) {
-                               ret = NT_STATUS_NO_MEMORY;
+                       ret = add_sid_to_array_unique(mem_ctx, &sid, pp_sids,
+                                                     &num_sids);
+                       if (!NT_STATUS_IS_OK(ret)) {
                                goto done;
                        }
                }
@@ -3741,14 +3647,17 @@ static NTSTATUS ldapsam_enum_aliasmem(struct pdb_methods *methods,
 
        for (i=0; i<count; i++) {
                DOM_SID member;
+               NTSTATUS status;
 
                if (!string_to_sid(&member, values[i]))
                        continue;
 
-               if (!add_sid_to_array(NULL, &member, pp_members, &num_members)) {
+               status = add_sid_to_array(NULL, &member, pp_members,
+                                         &num_members);
+               if (!NT_STATUS_IS_OK(status)) {
                        ldap_value_free(values);
                        ldap_msgfree(result);
-                       return NT_STATUS_NO_MEMORY;
+                       return status;
                }
        }
 
@@ -6172,9 +6081,6 @@ static NTSTATUS pdb_init_ldapsam_common(struct pdb_methods **pdb_method, const c
 
        (*pdb_method)->name = "ldapsam";
 
-       (*pdb_method)->setsampwent = ldapsam_setsampwent;
-       (*pdb_method)->endsampwent = ldapsam_endsampwent;
-       (*pdb_method)->getsampwent = ldapsam_getsampwent;
        (*pdb_method)->getsampwnam = ldapsam_getsampwnam;
        (*pdb_method)->getsampwsid = ldapsam_getsampwsid;
        (*pdb_method)->add_sam_account = ldapsam_add_sam_account;
index 6a3bdb80a2eaf86857224626cad06b9e14de6849..6cf54fbdf66bda3206111b29bd8dd7a97e4e7fc1 100644 (file)
@@ -1264,79 +1264,6 @@ static bool build_sam_account(struct smbpasswd_privates *smbpasswd_state,
  Functions to be implemented by the new passdb API 
  ****************************************************************/
 
-static NTSTATUS smbpasswd_setsampwent (struct pdb_methods *my_methods, bool update, uint32 acb_mask)
-{
-       struct smbpasswd_privates *smbpasswd_state = (struct smbpasswd_privates*)my_methods->private_data;
-       
-       smbpasswd_state->pw_file = startsmbfilepwent(smbpasswd_state->smbpasswd_file, 
-                                                      update ? PWF_UPDATE : PWF_READ, 
-                                                      &(smbpasswd_state->pw_file_lock_depth));
-                                  
-       /* did we fail?  Should we try to create it? */
-       if (!smbpasswd_state->pw_file && update && errno == ENOENT) {
-               FILE *fp;
-               /* slprintf(msg_str,msg_str_len-1,
-                  "smbpasswd file did not exist - attempting to create it.\n"); */
-               DEBUG(0,("smbpasswd file did not exist - attempting to create it.\n"));
-               fp = sys_fopen(smbpasswd_state->smbpasswd_file, "w");
-               if (fp) {
-                       fprintf(fp, "# Samba SMB password file\n");
-                       fclose(fp);
-               }
-               
-               smbpasswd_state->pw_file = startsmbfilepwent(smbpasswd_state->smbpasswd_file, 
-                                                            update ? PWF_UPDATE : PWF_READ, 
-                                                            &(smbpasswd_state->pw_file_lock_depth));
-       }
-       
-       if (smbpasswd_state->pw_file != NULL)
-               return NT_STATUS_OK;
-       else
-               return NT_STATUS_UNSUCCESSFUL;  
-}
-
-static void smbpasswd_endsampwent (struct pdb_methods *my_methods)
-{
-       struct smbpasswd_privates *smbpasswd_state = (struct smbpasswd_privates*)my_methods->private_data;
-       endsmbfilepwent(smbpasswd_state->pw_file, &(smbpasswd_state->pw_file_lock_depth));
-}
-/*****************************************************************
- ****************************************************************/
-
-static NTSTATUS smbpasswd_getsampwent(struct pdb_methods *my_methods, struct samu *user)
-{
-       NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
-       struct smbpasswd_privates *smbpasswd_state = (struct smbpasswd_privates*)my_methods->private_data;
-       struct smb_passwd *pw_buf=NULL;
-       bool done = False;
-
-       DEBUG(5,("pdb_getsampwent\n"));
-
-       if ( !user ) {
-               DEBUG(5,("pdb_getsampwent (smbpasswd): user is NULL\n"));
-               return nt_status;
-       }
-
-       while (!done) {
-               /* do we have an entry? */
-               pw_buf = getsmbfilepwent(smbpasswd_state, smbpasswd_state->pw_file);
-               if (pw_buf == NULL) 
-                       return nt_status;
-
-               /* build the struct samu entry from the smb_passwd struct. 
-                  We loop in case the user in the pdb does not exist in 
-                  the local system password file */
-               if (build_sam_account(smbpasswd_state, user, pw_buf))
-                       done = True;
-       }
-
-       DEBUG(5,("getsampwent (smbpasswd): done\n"));
-
-       /* success */
-       return NT_STATUS_OK;
-}
-
 /****************************************************************
  Search smbpasswd file by iterating over the entries.  Do not
  call getpwnam() for unix account information until we have found
@@ -1606,6 +1533,119 @@ static void free_private_data(void **vp)
        /* No need to free any further, as it is talloc()ed */
 }
 
+struct smbpasswd_search_state {
+       uint32_t acct_flags;
+
+       struct samr_displayentry *entries;
+       uint32_t num_entries;
+       ssize_t array_size;
+       uint32_t current;
+};
+
+static void smbpasswd_search_end(struct pdb_search *search)
+{
+       struct smbpasswd_search_state *state = talloc_get_type_abort(
+               search->private_data, struct smbpasswd_search_state);
+       TALLOC_FREE(state);
+}
+
+static bool smbpasswd_search_next_entry(struct pdb_search *search,
+                                       struct samr_displayentry *entry)
+{
+       struct smbpasswd_search_state *state = talloc_get_type_abort(
+               search->private_data, struct smbpasswd_search_state);
+
+       if (state->current == state->num_entries) {
+               return false;
+       }
+
+       *entry = state->entries[state->current++];
+
+       return true;
+}
+
+static bool smbpasswd_search_users(struct pdb_methods *methods,
+                                  struct pdb_search *search,
+                                  uint32_t acct_flags)
+{
+       struct smbpasswd_privates *smbpasswd_state =
+               (struct smbpasswd_privates*)methods->private_data;
+
+       struct smbpasswd_search_state *search_state;
+       struct smb_passwd *pwd;
+       FILE *fp;
+
+       search_state = TALLOC_ZERO_P(search->mem_ctx,
+                                    struct smbpasswd_search_state);
+       if (search_state == NULL) {
+               DEBUG(0, ("talloc failed\n"));
+               return false;
+       }
+       search_state->acct_flags = acct_flags;
+
+       fp = startsmbfilepwent(smbpasswd_state->smbpasswd_file, PWF_READ,
+                              &smbpasswd_state->pw_file_lock_depth);
+
+       if (fp == NULL) {
+               DEBUG(10, ("Unable to open smbpasswd file.\n"));
+               TALLOC_FREE(search_state);
+               return false;
+       }
+
+       while ((pwd = getsmbfilepwent(smbpasswd_state, fp)) != NULL) {
+               struct samr_displayentry entry;
+               struct samu *user;
+
+               if ((acct_flags != 0)
+                   && ((acct_flags & pwd->acct_ctrl) == 0)) {
+                       continue;
+               }
+
+               user = samu_new(talloc_tos());
+               if (user == NULL) {
+                       DEBUG(0, ("samu_new failed\n"));
+                       break;
+               }
+
+               if (!build_sam_account(smbpasswd_state, user, pwd)) {
+                       /* Already got debug msgs... */
+                       break;
+               }
+
+               ZERO_STRUCT(entry);
+
+               entry.acct_flags = pdb_get_acct_ctrl(user);
+               sid_peek_rid(pdb_get_user_sid(user), &entry.rid);
+               entry.account_name = talloc_strdup(
+                       search_state, pdb_get_username(user));
+               entry.fullname = talloc_strdup(
+                       search_state, pdb_get_fullname(user));
+               entry.description = talloc_strdup(
+                       search_state, pdb_get_acct_desc(user));
+
+               TALLOC_FREE(user);
+
+               if ((entry.account_name == NULL) || (entry.fullname == NULL)
+                   || (entry.description == NULL)) {
+                       DEBUG(0, ("talloc_strdup failed\n"));
+                       break;
+               }
+
+               ADD_TO_LARGE_ARRAY(search_state, struct samr_displayentry,
+                                  entry, &search_state->entries,
+                                  &search_state->num_entries,
+                                  &search_state->array_size);
+       }
+
+       endsmbfilepwent(fp, &(smbpasswd_state->pw_file_lock_depth));
+
+       search->private_data = search_state;
+       search->next_entry = smbpasswd_search_next_entry;
+       search->search_end = smbpasswd_search_end;
+
+       return true;
+}
+
 static NTSTATUS pdb_init_smbpasswd( struct pdb_methods **pdb_method, const char *location )
 {
        NTSTATUS nt_status;
@@ -1617,15 +1657,13 @@ static NTSTATUS pdb_init_smbpasswd( struct pdb_methods **pdb_method, const char
 
        (*pdb_method)->name = "smbpasswd";
 
-       (*pdb_method)->setsampwent = smbpasswd_setsampwent;
-       (*pdb_method)->endsampwent = smbpasswd_endsampwent;
-       (*pdb_method)->getsampwent = smbpasswd_getsampwent;
        (*pdb_method)->getsampwnam = smbpasswd_getsampwnam;
        (*pdb_method)->getsampwsid = smbpasswd_getsampwsid;
        (*pdb_method)->add_sam_account = smbpasswd_add_sam_account;
        (*pdb_method)->update_sam_account = smbpasswd_update_sam_account;
        (*pdb_method)->delete_sam_account = smbpasswd_delete_sam_account;
        (*pdb_method)->rename_sam_account = smbpasswd_rename_sam_account;
+       (*pdb_method)->search_users = smbpasswd_search_users;
 
        (*pdb_method)->rid_algorithm = smbpasswd_rid_algorithm;
 
index b4282b1278fc35618478b8462effba7c544b25f8..b05a42b32c4417d5d124019fafc77b782023823d 100644 (file)
@@ -44,13 +44,6 @@ static int tdbsam_debug_level = DBGC_ALL;
 #define RIDPREFIX              "RID_"
 #define PRIVPREFIX             "PRIV_"
 
-struct pwent_list {
-       struct pwent_list *prev, *next;
-       TDB_DATA key;
-};
-static struct pwent_list *tdbsam_pwent_list;
-static bool pwent_initialized;
-
 /* GLOBAL TDB SAM CONTEXT */
 
 static TDB_CONTEXT *tdbsam;
@@ -891,134 +884,6 @@ void tdbsam_close( void )
        return;
 }
 
-/****************************************************************************
- creates a list of user keys
-****************************************************************************/
-
-static int tdbsam_traverse_setpwent(TDB_CONTEXT *t, TDB_DATA key, TDB_DATA data, void *state)
-{
-       const char *prefix = USERPREFIX;
-       int  prefixlen = strlen (prefix);
-       struct pwent_list *ptr;
-       
-       if ( strncmp((const char *)key.dptr, prefix, prefixlen) == 0 ) {
-               if ( !(ptr=SMB_MALLOC_P(struct pwent_list)) ) {
-                       DEBUG(0,("tdbsam_traverse_setpwent: Failed to malloc new entry for list\n"));
-                       
-                       /* just return 0 and let the traversal continue */
-                       return 0;
-               }
-               ZERO_STRUCTP(ptr);
-               
-               /* save a copy of the key */
-               
-               ptr->key.dptr = (uint8 *)memdup( key.dptr, key.dsize );
-               if (!ptr->key.dptr) {
-                       DEBUG(0,("tdbsam_traverse_setpwent: memdup failed\n"));
-                       /* just return 0 and let the traversal continue */
-                       SAFE_FREE(ptr);
-                       return 0;
-               }
-
-               ptr->key.dsize = key.dsize;
-               
-               DLIST_ADD( tdbsam_pwent_list, ptr );
-       
-       }
-       
-       return 0;
-}
-
-/***************************************************************
- Open the TDB passwd database for SAM account enumeration.
- Save a list of user keys for iteration.
-****************************************************************/
-
-static NTSTATUS tdbsam_setsampwent(struct pdb_methods *my_methods, bool update, uint32 acb_mask)
-{
-       if ( !tdbsam_open( tdbsam_filename ) ) {
-               DEBUG(0,("tdbsam_getsampwnam: failed to open %s!\n", tdbsam_filename));
-               return NT_STATUS_ACCESS_DENIED;
-       }
-
-       tdb_traverse( tdbsam, tdbsam_traverse_setpwent, NULL );
-       pwent_initialized = True;
-
-       return NT_STATUS_OK;
-}
-
-
-/***************************************************************
- End enumeration of the TDB passwd list.
-****************************************************************/
-
-static void tdbsam_endsampwent(struct pdb_methods *my_methods)
-{
-       struct pwent_list *ptr, *ptr_next;
-       
-       /* close the tdb only if we have a valid pwent state */
-       
-       if ( pwent_initialized ) {
-               DEBUG(7, ("endtdbpwent: closed sam database.\n"));
-               tdbsam_close();
-       }
-       
-       /* clear out any remaining entries in the list */
-       
-       for ( ptr=tdbsam_pwent_list; ptr; ptr = ptr_next ) {
-               ptr_next = ptr->next;
-               DLIST_REMOVE( tdbsam_pwent_list, ptr );
-               SAFE_FREE( ptr->key.dptr);
-               SAFE_FREE( ptr );
-       }       
-       
-       pwent_initialized = False;
-}
-
-/*****************************************************************
- Get one struct samu from the TDB (next in line)
-*****************************************************************/
-
-static NTSTATUS tdbsam_getsampwent(struct pdb_methods *my_methods, struct samu *user)
-{
-       NTSTATUS                nt_status = NT_STATUS_UNSUCCESSFUL;
-       TDB_DATA                data;
-       struct pwent_list       *pkey;
-
-       if ( !user ) {
-               DEBUG(0,("tdbsam_getsampwent: struct samu is NULL.\n"));
-               return nt_status;
-       }
-
-       if ( !tdbsam_pwent_list ) {
-               DEBUG(4,("tdbsam_getsampwent: end of list\n"));
-               return nt_status;
-       }
-       
-       /* pull the next entry */
-               
-       pkey = tdbsam_pwent_list;
-       DLIST_REMOVE( tdbsam_pwent_list, pkey );
-       
-       data = tdb_fetch(tdbsam, pkey->key);
-
-       SAFE_FREE( pkey->key.dptr);
-       SAFE_FREE( pkey);
-       
-       if ( !data.dptr ) {
-               DEBUG(5,("pdb_getsampwent: database entry not found.  Was the user deleted?\n"));
-               return nt_status;
-       }
-  
-       if ( !init_sam_from_buffer(user, (unsigned char *)data.dptr, data.dsize) ) {
-               DEBUG(0,("pdb_getsampwent: Bad struct samu entry returned from TDB!\n"));
-       }
-       
-       SAFE_FREE( data.dptr );
-
-       return NT_STATUS_OK;
-}
-
 /******************************************************************
  Lookup a name in the SAM TDB
 ******************************************************************/
@@ -1306,10 +1171,6 @@ static bool tdb_update_sam(struct pdb_methods *my_methods, struct samu* newpwd,
 {
        bool            result = True;
 
-       /* invalidate the existing TDB iterator if it is open */
-       
-       tdbsam_endsampwent( my_methods );
-       
 #if 0 
        if ( !pdb_get_group_rid(newpwd) ) {
                DEBUG (0,("tdb_update_sam: Failing to store a struct samu for [%s] "
@@ -1396,10 +1257,6 @@ static NTSTATUS tdbsam_rename_sam_account(struct pdb_methods *my_methods,
                return NT_STATUS_ACCESS_DENIED;
        }
 
-       /* invalidate the existing TDB iterator if it is open */
-
-       tdbsam_endsampwent( my_methods );
-
        if ( !(new_acct = samu_new( NULL )) ) {
                return NT_STATUS_NO_MEMORY;
        }
@@ -1495,8 +1352,7 @@ done:
 
        tdbsam_close();
 
-       if (new_acct)
-               TALLOC_FREE(new_acct);
+       TALLOC_FREE(new_acct);
        
        return NT_STATUS_ACCESS_DENIED; 
 }
@@ -1592,6 +1448,139 @@ static bool tdbsam_new_rid(struct pdb_methods *methods, uint32 *prid)
        return ret;
 }
 
+struct tdbsam_search_state {
+       struct pdb_methods *methods;
+       uint32_t acct_flags;
+
+       uint32_t *rids;
+       uint32_t num_rids;
+       ssize_t array_size;
+       uint32_t current;
+};
+
+static int tdbsam_collect_rids(TDB_CONTEXT *t, TDB_DATA key, TDB_DATA data,
+                              void *private_data)
+{
+       struct tdbsam_search_state *state = talloc_get_type_abort(
+               private_data, struct tdbsam_search_state);
+       size_t prefixlen = strlen(RIDPREFIX);
+       uint32 rid;
+
+       if ((key.dsize < prefixlen)
+           || (strncmp((char *)key.dptr, RIDPREFIX, prefixlen))) {
+               return 0;
+       }
+
+       rid = strtoul((char *)key.dptr+prefixlen, NULL, 16);
+
+       ADD_TO_LARGE_ARRAY(state, uint32, rid, &state->rids, &state->num_rids,
+                          &state->array_size);
+
+       return 0;
+}
+
+static void tdbsam_search_end(struct pdb_search *search)
+{
+       struct tdbsam_search_state *state = talloc_get_type_abort(
+               search->private_data, struct tdbsam_search_state);
+       TALLOC_FREE(state);
+}
+
+static bool tdbsam_search_next_entry(struct pdb_search *search,
+                                    struct samr_displayentry *entry)
+{
+       struct tdbsam_search_state *state = talloc_get_type_abort(
+               search->private_data, struct tdbsam_search_state);
+       struct samu *user = NULL;
+       NTSTATUS status;
+       uint32_t rid;
+
+ again:
+       TALLOC_FREE(user);
+       user = samu_new(talloc_tos());
+       if (user == NULL) {
+               DEBUG(0, ("samu_new failed\n"));
+               return false;
+       }
+
+       if (state->current == state->num_rids) {
+               return false;
+       }
+
+       rid = state->rids[state->current++];
+
+       status = tdbsam_getsampwrid(state->methods, user, rid);
+
+       if (NT_STATUS_EQUAL(status, NT_STATUS_NO_SUCH_USER)) {
+               /*
+                * Someone has deleted that user since we listed the RIDs
+                */
+               goto again;
+       }
+
+       if (!NT_STATUS_IS_OK(status)) {
+               DEBUG(10, ("tdbsam_getsampwrid failed: %s\n",
+                          nt_errstr(status)));
+               TALLOC_FREE(user);
+               return false;
+       }
+
+       if ((state->acct_flags != 0) &&
+           ((state->acct_flags & pdb_get_acct_ctrl(user)) == 0)) {
+               goto again;
+       }
+
+       entry->acct_flags = pdb_get_acct_ctrl(user);
+       entry->rid = rid;
+       entry->account_name = talloc_strdup(
+               search->mem_ctx, pdb_get_username(user));
+       entry->fullname = talloc_strdup(
+               search->mem_ctx, pdb_get_fullname(user));
+       entry->description = talloc_strdup(
+               search->mem_ctx, pdb_get_acct_desc(user));
+
+       TALLOC_FREE(user);
+
+       if ((entry->account_name == NULL) || (entry->fullname == NULL)
+           || (entry->description == NULL)) {
+               DEBUG(0, ("talloc_strdup failed\n"));
+               return false;
+       }
+
+       return true;
+}
+
+static bool tdbsam_search_users(struct pdb_methods *methods,
+                               struct pdb_search *search,
+                               uint32 acct_flags)
+{
+       struct tdbsam_search_state *state;
+
+       if (!tdbsam_open(tdbsam_filename)) {
+               DEBUG(0,("tdbsam_getsampwnam: failed to open %s!\n",
+                        tdbsam_filename));
+               return false;
+       }
+
+       state = TALLOC_ZERO_P(search->mem_ctx, struct tdbsam_search_state);
+       if (state == NULL) {
+               DEBUG(0, ("talloc failed\n"));
+               return false;
+       }
+       state->acct_flags = acct_flags;
+       state->methods = methods;
+
+       tdb_traverse(tdbsam, tdbsam_collect_rids, state);
+
+       tdbsam_close();
+
+       search->private_data = state;
+       search->next_entry = tdbsam_search_next_entry;
+       search->search_end = tdbsam_search_end;
+
+       return true;
+}
+
 /*********************************************************************
  Initialize the tdb sam backend.  Setup the dispath table of methods,
  open the tdb, etc...
@@ -1609,15 +1598,13 @@ static NTSTATUS pdb_init_tdbsam(struct pdb_methods **pdb_method, const char *loc
 
        (*pdb_method)->name = "tdbsam";
 
-       (*pdb_method)->setsampwent = tdbsam_setsampwent;
-       (*pdb_method)->endsampwent = tdbsam_endsampwent;
-       (*pdb_method)->getsampwent = tdbsam_getsampwent;
        (*pdb_method)->getsampwnam = tdbsam_getsampwnam;
        (*pdb_method)->getsampwsid = tdbsam_getsampwsid;
        (*pdb_method)->add_sam_account = tdbsam_add_sam_account;
        (*pdb_method)->update_sam_account = tdbsam_update_sam_account;
        (*pdb_method)->delete_sam_account = tdbsam_delete_sam_account;
        (*pdb_method)->rename_sam_account = tdbsam_rename_sam_account;
+       (*pdb_method)->search_users = tdbsam_search_users;
 
        (*pdb_method)->rid_algorithm = tdbsam_rid_algorithm;
        (*pdb_method)->new_rid = tdbsam_new_rid;
@@ -1625,7 +1612,8 @@ static NTSTATUS pdb_init_tdbsam(struct pdb_methods **pdb_method, const char *loc
        /* save the path for later */
 
        if (!location) {
-               if (asprintf(&tdbfile, "%s/%s", get_dyn_STATEDIR(), PASSDB_FILE_NAME) < 0) {
+               if (asprintf(&tdbfile, "%s/%s", lp_private_dir(),
+                            PASSDB_FILE_NAME) < 0) {
                        return NT_STATUS_NO_MEMORY;
                }
                pfile = tdbfile;
index 0ea3887378db833f9d57a8f0553e9d3a569e18d6..330ffbc853261c65d7dcce411d1d42d45ec9fa1d 100644 (file)
@@ -94,6 +94,19 @@ bool secrets_init(void)
        return True;
 }
 
+/*
+ * close secrets.tdb
+ */
+void secrets_shutdown(void)
+{
+       if (!tdb) {
+               return;
+       }
+
+       tdb_close(tdb);
+       tdb = NULL;
+}
+
 /* read a entry from the secrets database - the caller must free the result
    if size is non-null then the size of the entry is put in there
  */
@@ -132,14 +145,31 @@ bool secrets_delete(const char *key)
        return tdb_trans_delete(tdb, string_tdb_data(key)) == 0;
 }
 
+/**
+ * Form a key for fetching the domain sid
+ *
+ * @param domain domain name
+ *
+ * @return keystring
+ **/
+static const char *domain_sid_keystr(const char *domain)
+{
+       char *keystr;
+
+       keystr = talloc_asprintf(talloc_tos(), "%s/%s",
+                                SECRETS_DOMAIN_SID, domain);
+       SMB_ASSERT(keystr != NULL);
+
+       strupper_m(keystr);
+
+       return keystr;
+}
+
 bool secrets_store_domain_sid(const char *domain, const DOM_SID *sid)
 {
-       fstring key;
        bool ret;
 
-       slprintf(key, sizeof(key)-1, "%s/%s", SECRETS_DOMAIN_SID, domain);
-       strupper_m(key);
-       ret = secrets_store(key, sid, sizeof(DOM_SID));
+       ret = secrets_store(domain_sid_keystr(domain), sid, sizeof(DOM_SID));
 
        /* Force a re-query, in case we modified our domain */
        if (ret)
@@ -150,12 +180,9 @@ bool secrets_store_domain_sid(const char *domain, const DOM_SID *sid)
 bool secrets_fetch_domain_sid(const char *domain, DOM_SID *sid)
 {
        DOM_SID *dyn_sid;
-       fstring key;
        size_t size = 0;
 
-       slprintf(key, sizeof(key)-1, "%s/%s", SECRETS_DOMAIN_SID, domain);
-       strupper_m(key);
-       dyn_sid = (DOM_SID *)secrets_fetch(key, &size);
+       dyn_sid = (DOM_SID *)secrets_fetch(domain_sid_keystr(domain), &size);
 
        if (dyn_sid == NULL)
                return False;
@@ -213,6 +240,67 @@ bool secrets_fetch_domain_guid(const char *domain, struct GUID *guid)
        return True;
 }
 
+/**
+ * Form a key for fetching the machine trust account sec channel type
+ *
+ * @param domain domain name
+ *
+ * @return keystring
+ **/
+static const char *machine_sec_channel_type_keystr(const char *domain)
+{
+       char *keystr;
+
+       keystr = talloc_asprintf(talloc_tos(), "%s/%s",
+                                SECRETS_MACHINE_SEC_CHANNEL_TYPE, domain);
+       SMB_ASSERT(keystr != NULL);
+
+       strupper_m(keystr);
+
+       return keystr;
+}
+
+/**
+ * Form a key for fetching the machine trust account last change time
+ *
+ * @param domain domain name
+ *
+ * @return keystring
+ **/
+static const char *machine_last_change_time_keystr(const char *domain)
+{
+       char *keystr;
+
+       keystr = talloc_asprintf(talloc_tos(), "%s/%s",
+                                SECRETS_MACHINE_LAST_CHANGE_TIME, domain);
+       SMB_ASSERT(keystr != NULL);
+
+       strupper_m(keystr);
+
+       return keystr;
+}
+
+
+/**
+ * Form a key for fetching the machine trust account password
+ *
+ * @param domain domain name
+ *
+ * @return keystring
+ **/
+static const char *machine_password_keystr(const char *domain)
+{
+       char *keystr;
+
+       keystr = talloc_asprintf(talloc_tos(), "%s/%s",
+                                SECRETS_MACHINE_PASSWORD, domain);
+       SMB_ASSERT(keystr != NULL);
+
+       strupper_m(keystr);
+
+       return keystr;
+}
+
 /**
  * Form a key for fetching the machine trust account password
  *
@@ -632,6 +720,40 @@ bool secrets_store_trusted_domain_password(const char* domain, const char* pwd,
        return ret;
 }
 
+/************************************************************************
+ Routine to delete the plaintext machine account password
+************************************************************************/
+
+bool secrets_delete_machine_password(const char *domain)
+{
+       return secrets_delete(machine_password_keystr(domain));
+}
+
+/************************************************************************
+ Routine to delete the plaintext machine account password, sec channel type and
+ last change time from secrets database
+************************************************************************/
+
+bool secrets_delete_machine_password_ex(const char *domain)
+{
+       if (!secrets_delete(machine_password_keystr(domain))) {
+               return false;
+       }
+       if (!secrets_delete(machine_sec_channel_type_keystr(domain))) {
+               return false;
+       }
+       return secrets_delete(machine_last_change_time_keystr(domain));
+}
+
+/************************************************************************
+ Routine to delete the domain sid
+************************************************************************/
+
+bool secrets_delete_domain_sid(const char *domain)
+{
+       return secrets_delete(domain_sid_keystr(domain));
+}
+
 /************************************************************************
  Routine to set the plaintext machine account password for a realm
 the password is assumed to be a null terminated ascii string
@@ -639,39 +761,19 @@ the password is assumed to be a null terminated ascii string
 
 bool secrets_store_machine_password(const char *pass, const char *domain, uint32 sec_channel)
 {
-       char *key = NULL;
        bool ret;
        uint32 last_change_time;
        uint32 sec_channel_type;
 
-       asprintf(&key, "%s/%s", SECRETS_MACHINE_PASSWORD, domain);
-       if (!key)
-               return False;
-       strupper_m(key);
-
-       ret = secrets_store(key, pass, strlen(pass)+1);
-       SAFE_FREE(key);
-
+       ret = secrets_store(machine_password_keystr(domain), pass, strlen(pass)+1);
        if (!ret)
                return ret;
 
-       asprintf(&key, "%s/%s", SECRETS_MACHINE_LAST_CHANGE_TIME, domain);
-       if (!key)
-               return False;
-       strupper_m(key);
-
        SIVAL(&last_change_time, 0, time(NULL));
-       ret = secrets_store(key, &last_change_time, sizeof(last_change_time));
-       SAFE_FREE(key);
-
-       asprintf(&key, "%s/%s", SECRETS_MACHINE_SEC_CHANNEL_TYPE, domain);
-       if (!key)
-               return False;
-       strupper_m(key);
+       ret = secrets_store(machine_last_change_time_keystr(domain), &last_change_time, sizeof(last_change_time));
 
        SIVAL(&sec_channel_type, 0, sec_channel);
-       ret = secrets_store(key, &sec_channel_type, sizeof(sec_channel_type));
-       SAFE_FREE(key);
+       ret = secrets_store(machine_sec_channel_type_keystr(domain), &sec_channel_type, sizeof(sec_channel_type));
 
        return ret;
 }
@@ -685,41 +787,31 @@ char *secrets_fetch_machine_password(const char *domain,
                                     time_t *pass_last_set_time,
                                     uint32 *channel)
 {
-       char *key = NULL;
        char *ret;
-       asprintf(&key, "%s/%s", SECRETS_MACHINE_PASSWORD, domain);
-       strupper_m(key);
-       ret = (char *)secrets_fetch(key, NULL);
-       SAFE_FREE(key);
+       ret = (char *)secrets_fetch(machine_password_keystr(domain), NULL);
 
        if (pass_last_set_time) {
                size_t size;
                uint32 *last_set_time;
-               asprintf(&key, "%s/%s", SECRETS_MACHINE_LAST_CHANGE_TIME, domain);
-               strupper_m(key);
-               last_set_time = (unsigned int *)secrets_fetch(key, &size);
+               last_set_time = (unsigned int *)secrets_fetch(machine_last_change_time_keystr(domain), &size);
                if (last_set_time) {
                        *pass_last_set_time = IVAL(last_set_time,0);
                        SAFE_FREE(last_set_time);
                } else {
                        *pass_last_set_time = 0;
                }
-               SAFE_FREE(key);
        }
 
        if (channel) {
                size_t size;
                uint32 *channel_type;
-               asprintf(&key, "%s/%s", SECRETS_MACHINE_SEC_CHANNEL_TYPE, domain);
-               strupper_m(key);
-               channel_type = (unsigned int *)secrets_fetch(key, &size);
+               channel_type = (unsigned int *)secrets_fetch(machine_sec_channel_type_keystr(domain), &size);
                if (channel_type) {
                        *channel = IVAL(channel_type,0);
                        SAFE_FREE(channel_type);
                } else {
                        *channel = get_default_sec_channel();
                }
-               SAFE_FREE(key);
        }
 
        return ret;
diff --git a/source/pkgconfig/netapi.pc.in b/source/pkgconfig/netapi.pc.in
new file mode 100644 (file)
index 0000000..b1f60b2
--- /dev/null
@@ -0,0 +1,14 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: Samba libnetapi
+Description: A library to control CIFS servers
+Version: 0
+URL: http://www.samba.org/
+#Libs: -L@libdir@ -lnetapi
+Libs: -lnetapi
+Libs.private: -lnetapi @KRB5_LIBS@ @LDAP_LIBS@ @LIBS@
+Cflags: -I@includedir@
+
diff --git a/source/pkgconfig/smbclient.pc.in b/source/pkgconfig/smbclient.pc.in
new file mode 100644 (file)
index 0000000..969abbe
--- /dev/null
@@ -0,0 +1,14 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: Samba libsmbclient
+Description: A library to access CIFS servers
+Version: 0
+URL: http://www.samba.org/
+#Libs: -L@libdir@ -lsmbclient
+Libs: -lsmbclient
+Libs.private: -lsmbclient @KRB5_LIBS@ @LDAP_LIBS@ @LIBS@
+Cflags: -I@includedir@
+
diff --git a/source/pkgconfig/smbsharemodes.pc.in b/source/pkgconfig/smbsharemodes.pc.in
new file mode 100644 (file)
index 0000000..dcb0d2e
--- /dev/null
@@ -0,0 +1,14 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: Samba libsmbsharemodes
+Description: A library
+Version: 0
+URL: http://www.samba.org/
+#Libs: -L@libdir@ -lsmbsharemodes
+Libs: -lsmbsharemodes
+Libs.private: -lsmbsharemodes @KRB5_LIBS@ @LDAP_LIBS@ @LIBS@
+Cflags: -I@includedir@
+
diff --git a/source/pkgconfig/wbclient.pc.in b/source/pkgconfig/wbclient.pc.in
new file mode 100644 (file)
index 0000000..158fa92
--- /dev/null
@@ -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@
index f8aba3996d47ec00de09f7d02d10a298994775ac..23144d5a9550dc9e6ba2bea5eaf94d6bccaf4427 100644 (file)
@@ -28,6 +28,7 @@ static void add_auto_printers(void)
        const char *p;
        int pnum = lp_servicenumber(PRINTERS_NAME);
        char *str;
+       char *saveptr;
 
        if (pnum < 0)
                return;
@@ -35,7 +36,8 @@ static void add_auto_printers(void)
        if ((str = SMB_STRDUP(lp_auto_services())) == NULL)
                return;
 
-       for (p = strtok(str, LIST_SEP); p; p = strtok(NULL, LIST_SEP)) {
+       for (p = strtok_r(str, LIST_SEP, &saveptr); p;
+            p = strtok_r(NULL, LIST_SEP, &saveptr)) {
                if (lp_servicenumber(p) >= 0)
                        continue;
                
index 56e228f2196885fcf6fd27b68ad2d7881d3254a8..afa3b4850a584e392f9560c34a80eb7ba4e223c2 100644 (file)
@@ -127,6 +127,7 @@ static bool parse_lpq_bsd(char *line,print_queue_struct *buf,bool first)
        int  count = 0;
        TALLOC_CTX *ctx = talloc_tos();
        char *line2 = NULL;
+       char *saveptr;
 
        line2 = talloc_strdup(ctx, line);
        if (!line2) {
@@ -144,10 +145,11 @@ static bool parse_lpq_bsd(char *line,print_queue_struct *buf,bool first)
 #endif /* OSF1 */
 
        /* FIXME: Use next_token_talloc rather than strtok! */
-       tok[0] = strtok(line2," \t");
+       tok[0] = strtok_r(line2," \t", &saveptr);
        count++;
 
-       while ((count < MAXTOK) && ((tok[count] = strtok(NULL," \t")) != NULL)) {
+       while ((count < MAXTOK)
+              && ((tok[count] = strtok_r(NULL, " \t", &saveptr)) != NULL)) {
                count++;
        }
 
@@ -444,7 +446,7 @@ static bool parse_lpq_hpux(char *line, print_queue_struct *buf, bool first)
 {
        /* must read two lines to process, therefore keep some values static */
        static bool header_line_ok=False, base_prio_reset=False;
-       static fstring jobuser;
+       static char *jobuser;
        static int jobid;
        static int jobprio;
        static time_t jobtime;
@@ -511,7 +513,11 @@ static bool parse_lpq_hpux(char *line, print_queue_struct *buf, bool first)
                buf->job = jobid;
                buf->status = jobstat;
                buf->priority = jobprio;
-               fstrcpy(buf->fs_user,jobuser);
+               if (jobuser) {
+                       fstrcpy(buf->fs_user,jobuser);
+               } else {
+                       buf->fs_user[0] = '\0';
+               }
 
                TALLOC_FREE(frame);
                return True;
@@ -548,7 +554,8 @@ static bool parse_lpq_hpux(char *line, print_queue_struct *buf, bool first)
                        return False;
                }
                jobid = atoi(tok[1]);
-               fstrcpy(jobuser,tok[2]);
+               SAFE_FREE(jobuser);
+               jobuser = SMB_STRDUP(tok[2]);
                jobprio = atoi(tok[4]);
 
                /* process time */
index ec4e8c59d50965499673a95502c633472053d7a3..d5803b711bd0366813ae0a5ea2a5db8eba348699 100644 (file)
@@ -429,7 +429,8 @@ static int sec_desc_upg_fn( TDB_CONTEXT *the_tdb, TDB_DATA key,
 
        /* store it back */
        
-       sd_size = sec_desc_size(sd_store->sd) + sizeof(SEC_DESC_BUF);
+       sd_size = ndr_size_security_descriptor(sd_store->sd, 0)
+               + sizeof(SEC_DESC_BUF);
        prs_init(&ps, sd_size, ctx, MARSHALL);
 
        if ( !sec_io_desc_buf( "sec_desc_upg_fn", &sd_store, &ps, 1 ) ) {
@@ -1096,7 +1097,7 @@ static int get_file_version(files_struct *fsp, char *fname,uint32 *major, uint32
        }
 
        /* Skip OEM header (if any) and the DOS stub to start of Windows header */
-       if (SMB_VFS_LSEEK(fsp, fsp->fh->fd, SVAL(buf,DOS_HEADER_LFANEW_OFFSET), SEEK_SET) == (SMB_OFF_T)-1) {
+       if (SMB_VFS_LSEEK(fsp, SVAL(buf,DOS_HEADER_LFANEW_OFFSET), SEEK_SET) == (SMB_OFF_T)-1) {
                DEBUG(3,("get_file_version: File [%s] too short, errno = %d\n",
                                fname, errno));
                /* Assume this isn't an error... the file just looks sort of like a PE/NE file */
@@ -1117,7 +1118,7 @@ static int get_file_version(files_struct *fsp, char *fname,uint32 *major, uint32
                unsigned int section_table_bytes;
 
                /* Just skip over optional header to get to section table */
-               if (SMB_VFS_LSEEK(fsp, fsp->fh->fd,
+               if (SMB_VFS_LSEEK(fsp,
                                SVAL(buf,PE_HEADER_OPTIONAL_HEADER_SIZE)-(NE_HEADER_SIZE-PE_HEADER_SIZE),
                                SEEK_CUR) == (SMB_OFF_T)-1) {
                        DEBUG(3,("get_file_version: File [%s] Windows optional header too short, errno = %d\n",
@@ -1163,7 +1164,7 @@ static int get_file_version(files_struct *fsp, char *fname,uint32 *major, uint32
                                }
 
                                /* Seek to the start of the .rsrc section info */
-                               if (SMB_VFS_LSEEK(fsp, fsp->fh->fd, section_pos, SEEK_SET) == (SMB_OFF_T)-1) {
+                               if (SMB_VFS_LSEEK(fsp, section_pos, SEEK_SET) == (SMB_OFF_T)-1) {
                                        DEBUG(3,("get_file_version: PE file [%s] too short for section info, errno = %d\n",
                                                        fname, errno));
                                        goto error_exit;
@@ -1259,7 +1260,7 @@ static int get_file_version(files_struct *fsp, char *fname,uint32 *major, uint32
                                 * twice, as it is simpler to read the code. */
                                if (strcmp(&buf[i], VS_SIGNATURE) == 0) {
                                        /* Compute skip alignment to next long address */
-                                       int skip = -(SMB_VFS_LSEEK(fsp, fsp->fh->fd, 0, SEEK_CUR) - (byte_count - i) +
+                                       int skip = -(SMB_VFS_LSEEK(fsp, 0, SEEK_CUR) - (byte_count - i) +
                                                                 sizeof(VS_SIGNATURE)) & 3;
                                        if (IVAL(buf,i+sizeof(VS_SIGNATURE)+skip) != 0xfeef04bd) continue;
 
@@ -1359,7 +1360,7 @@ static int file_version_is_newer(connection_struct *conn, fstring new_file, fstr
                        DEBUG(6,("file_version_is_newer: Version info not found [%s], use mod time\n",
                                         old_file));
                        use_version = false;
-                       if (SMB_VFS_FSTAT(fsp, fsp->fh->fd, &st) == -1) {
+                       if (SMB_VFS_FSTAT(fsp, &st) == -1) {
                                 goto error_exit;
                        }
                        old_create_time = st.st_mtime;
@@ -1399,7 +1400,7 @@ static int file_version_is_newer(connection_struct *conn, fstring new_file, fstr
                        DEBUG(6,("file_version_is_newer: Version info not found [%s], use mod time\n",
                                         new_file));
                        use_version = false;
-                       if (SMB_VFS_FSTAT(fsp, fsp->fh->fd, &st) == -1) {
+                       if (SMB_VFS_FSTAT(fsp, &st) == -1) {
                                goto error_exit;
                        }
                        new_create_time = st.st_mtime;
@@ -1866,7 +1867,7 @@ WERROR move_driver_to_download_area(NT_PRINTER_DRIVER_INFO_LEVEL driver_abstract
                goto err_exit;
        }
 
-       create_directory(conn, new_dir);
+       create_directory(conn, NULL, new_dir);
 
        /* For each driver file, archi\filexxx.yyy, if there is a duplicate file
         * listed for this driver which has already been moved, skip it (note:
@@ -3314,8 +3315,13 @@ static WERROR nt_printer_publish_ads(ADS_STRUCT *ads,
 
        /* publish it */
        ads_rc = ads_mod_printer_entry(ads, prt_dn, ctx, &mods);
-       if (ads_rc.err.rc == LDAP_NO_SUCH_OBJECT)
+       if (ads_rc.err.rc == LDAP_NO_SUCH_OBJECT) {
+               int i;
+               for (i=0; mods[i] != 0; i++)
+                       ;
+               mods[i] = (LDAPMod *)-1;
                ads_rc = ads_add_printer_entry(ads, prt_dn, ctx, &mods);
+       }
 
        if (!ADS_ERR_OK(ads_rc))
                DEBUG(3, ("error publishing %s: %s\n", printer->info_2->sharename, ads_errstr(ads_rc)));
@@ -3849,10 +3855,46 @@ static int unpack_values(NT_PRINTER_DATA *printer_data, const uint8 *buf, int bu
 /****************************************************************************
  ***************************************************************************/
 
+static char *last_from;
+static char *last_to;
+
+static const char *get_last_from(void)
+{
+       if (!last_from) {
+               return "";
+       }
+       return last_from;
+}
+
+static const char *get_last_to(void)
+{
+       if (!last_to) {
+               return "";
+       }
+       return last_to;
+}
+
+static bool set_last_from_to(const char *from, const char *to)
+{
+       char *orig_from = last_from;
+       char *orig_to = last_to;
+
+       last_from = SMB_STRDUP(from);
+       last_to = SMB_STRDUP(to);
+
+       SAFE_FREE(orig_from);
+       SAFE_FREE(orig_to);
+
+       if (!last_from || !last_to) {
+               SAFE_FREE(last_from);
+               SAFE_FREE(last_to);
+               return false;
+       }
+       return true;
+}
+
 static void map_to_os2_driver(fstring drivername)
 {
-       static bool initialised=False;
-       static fstring last_from,last_to;
        char *mapfile = lp_os2_driver_map();
        char **lines = NULL;
        int numlines = 0;
@@ -3864,14 +3906,10 @@ static void map_to_os2_driver(fstring drivername)
        if (!*mapfile)
                return;
 
-       if (!initialised) {
-               *last_from = *last_to = 0;
-               initialised = True;
-       }
-
-       if (strequal(drivername,last_from)) {
-               DEBUG(3,("Mapped Windows driver %s to OS/2 driver %s\n",drivername,last_to));
-               fstrcpy(drivername,last_to);
+       if (strequal(drivername,get_last_from())) {
+               DEBUG(3,("Mapped Windows driver %s to OS/2 driver %s\n",
+                       drivername,get_last_to()));
+               fstrcpy(drivername,get_last_to());
                return;
        }
 
@@ -3920,8 +3958,7 @@ static void map_to_os2_driver(fstring drivername)
 
                if (strequal(nt_name,drivername)) {
                        DEBUG(3,("Mapped windows driver %s to os2 driver%s\n",drivername,os2_name));
-                       fstrcpy(last_from,drivername);
-                       fstrcpy(last_to,os2_name);
+                       set_last_from_to(drivername,os2_name);
                        fstrcpy(drivername,os2_name);
                        file_lines_free(lines);
                        return;
@@ -5294,6 +5331,7 @@ WERROR nt_printing_setsec(const char *sharename, SEC_DESC_BUF *secdesc_ctr)
        SEC_DESC_BUF *new_secdesc_ctr = NULL;
        SEC_DESC_BUF *old_secdesc_ctr = NULL;
        prs_struct ps;
+       bool prs_init_done = false;
        TALLOC_CTX *mem_ctx = NULL;
        TDB_DATA kbuf;
        WERROR status;
@@ -5358,8 +5396,11 @@ WERROR nt_printing_setsec(const char *sharename, SEC_DESC_BUF *secdesc_ctr)
 
        /* Store the security descriptor in a tdb */
 
-       prs_init(&ps, (uint32)sec_desc_size(new_secdesc_ctr->sd) +
-                sizeof(SEC_DESC_BUF), mem_ctx, MARSHALL);
+       prs_init(&ps,
+                (uint32)ndr_size_security_descriptor(new_secdesc_ctr->sd, 0)
+                + sizeof(SEC_DESC_BUF), mem_ctx, MARSHALL);
+
+       prs_init_done = true;
 
        if (!sec_io_desc_buf("nt_printing_setsec", &new_secdesc_ctr,
                             &ps, 1)) {
@@ -5380,7 +5421,9 @@ WERROR nt_printing_setsec(const char *sharename, SEC_DESC_BUF *secdesc_ctr)
 
  out:
 
-       prs_mem_free(&ps);
+       if (prs_init_done) {
+               prs_mem_free(&ps);
+       }
        if (mem_ctx)
                talloc_destroy(mem_ctx);
        return status;
@@ -5503,7 +5546,7 @@ bool nt_printing_getsec(TALLOC_CTX *ctx, const char *sharename, SEC_DESC_BUF **s
 
                /* Save default security descriptor for later */
 
-               prs_init(&ps, (uint32)sec_desc_size((*secdesc_ctr)->sd) +
+               prs_init(&ps, (uint32)ndr_size_security_descriptor((*secdesc_ctr)->sd, 0) +
                                sizeof(SEC_DESC_BUF), ctx, MARSHALL);
 
                if (sec_io_desc_buf("nt_printing_getsec", secdesc_ctr, &ps, 1)) {
index fd85ca08336ba8e7f04a2172a7ec0b073e8dc462..57590cc39efd7a71bd281086f86431f2a5b2ab5d 100644 (file)
@@ -59,8 +59,9 @@ bool aix_cache_reload(void)
                                continue;
 
                        if ((p = strchr_m(line, ':'))) {
+                               char *saveptr;
                                *p = '\0';
-                               p = strtok(line, ":");
+                               p = strtok_r(line, ":", &saveptr);
                                if (strcmp(p, "bsh") != 0) {
                                        name = talloc_strdup(ctx, p);
                                        if (!name) {
index cc4b744a11c07ac1a32af1d8cd1a1ed5c41710a8..2a324fdd5c3d9aeefacd56faaa43898df012cf29 100644 (file)
@@ -41,15 +41,18 @@ static int print_run_command(int snum, const char* printername, bool do_sub,
        /* check for a valid system printername and valid command to run */
 
        if ( !printername || !*printername ) {
+               va_end(ap);
                return -1;
        }
 
        if (!command || !*command) {
+               va_end(ap);
                return -1;
        }
 
        syscmd = talloc_strdup(ctx, command);
        if (!syscmd) {
+               va_end(ap);
                return -1;
        }
 
@@ -57,6 +60,7 @@ static int print_run_command(int snum, const char* printername, bool do_sub,
                char *value = va_arg(ap,char *);
                syscmd = talloc_string_sub(ctx, syscmd, arg, value);
                if (!syscmd) {
+                       va_end(ap);
                        return -1;
                }
        }
index 337fd4f74b4cb63b71c00960a729a7ba638955f7..1fde16b802d79040876246cd542b308dbc9c37f2 100644 (file)
@@ -83,7 +83,7 @@ NTSTATUS print_fsp_open(connection_struct *conn, const char *fname,
        fsp->is_directory = False;
        string_set(&fsp->fsp_name,print_job_fname(lp_const_servicename(SNUM(conn)),jobid));
        fsp->wcp = NULL; 
-       SMB_VFS_FSTAT(fsp,fsp->fh->fd, &sbuf);
+       SMB_VFS_FSTAT(fsp, &sbuf);
        fsp->mode = sbuf.st_mode;
        fsp->file_id = vfs_file_id_from_sbuf(conn, &sbuf);
 
index fa6ed89eddc10f93bb621d5a8084ceaabb34435a..9f2c08629d6e5749afbd3eafc343108bf796e236 100644 (file)
@@ -373,13 +373,17 @@ static struct printjob *print_job_find(const char *sharename, uint32 jobid)
 
 /* Convert a unix jobid to a smb jobid */
 
-static uint32 sysjob_to_jobid_value;
+struct unixjob_traverse_state {
+       int sysjob;
+       uint32 sysjob_to_jobid_value;
+};
 
 static int unixjob_traverse_fn(TDB_CONTEXT *the_tdb, TDB_DATA key,
-                              TDB_DATA data, void *state)
+                              TDB_DATA data, void *private_data)
 {
        struct printjob *pjob;
-       int *sysjob = (int *)state;
+       struct unixjob_traverse_state *state =
+               (struct unixjob_traverse_state *)private_data;
 
        if (!data.dptr || data.dsize == 0)
                return 0;
@@ -388,10 +392,10 @@ static int unixjob_traverse_fn(TDB_CONTEXT *the_tdb, TDB_DATA key,
        if (key.dsize != sizeof(uint32))
                return 0;
 
-       if (*sysjob == pjob->sysjob) {
+       if (state->sysjob == pjob->sysjob) {
                uint32 jobid = IVAL(key.dptr,0);
 
-               sysjob_to_jobid_value = jobid;
+               state->sysjob_to_jobid_value = jobid;
                return 1;
        }
 
@@ -407,8 +411,10 @@ uint32 sysjob_to_jobid(int unix_jobid)
 {
        int services = lp_numservices();
        int snum;
+       struct unixjob_traverse_state state;
 
-       sysjob_to_jobid_value = (uint32)-1;
+       state.sysjob = unix_jobid;
+       state.sysjob_to_jobid_value = (uint32)-1;
 
        for (snum = 0; snum < services; snum++) {
                struct tdb_print_db *pdb;
@@ -418,10 +424,10 @@ uint32 sysjob_to_jobid(int unix_jobid)
                if (!pdb) {
                        continue;
                }
-               tdb_traverse(pdb->tdb, unixjob_traverse_fn, &unix_jobid);
+               tdb_traverse(pdb->tdb, unixjob_traverse_fn, &state);
                release_print_db(pdb);
-               if (sysjob_to_jobid_value != (uint32)-1)
-                       return sysjob_to_jobid_value;
+               if (state.sysjob_to_jobid_value != (uint32)-1)
+                       return state.sysjob_to_jobid_value;
        }
        return (uint32)-1;
 }
index b3d024d7b4fb44fec8d47292b272003fe15cb908..9c4009368d3b4f6f7e5fc1d07021dc5da443d23f 100644 (file)
@@ -1,33 +1,83 @@
-/* 
+/*
  *  Unix SMB/CIFS implementation.
  *  Virtual Windows Registry Layer
  *  Copyright (C) Volker Lendecke 2006
+ *  Copyright (C) Michael Adam 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/>.
  */
 
 /* Attempt to wrap the existing API in a more winreg.idl-like way */
 
+/*
+ * Here is a list of winreg.idl functions and corresponding implementations
+ * provided here:
+ *
+ * 0x00                winreg_OpenHKCR
+ * 0x01                winreg_OpenHKCU
+ * 0x02                winreg_OpenHKLM
+ * 0x03                winreg_OpenHKPD
+ * 0x04                winreg_OpenHKU
+ * 0x05                winreg_CloseKey
+ * 0x06                winreg_CreateKey                        reg_createkey
+ * 0x07                winreg_DeleteKey                        reg_deletekey
+ * 0x08                winreg_DeleteValue                      reg_deletevalue
+ * 0x09                winreg_EnumKey                          reg_enumkey
+ * 0x0a                winreg_EnumValue                        reg_enumvalue
+ * 0x0b                winreg_FlushKey
+ * 0x0c                winreg_GetKeySecurity                   reg_getkeysecurity
+ * 0x0d                winreg_LoadKey
+ * 0x0e                winreg_NotifyChangeKeyValue
+ * 0x0f                winreg_OpenKey                          reg_openkey
+ * 0x10                winreg_QueryInfoKey                     reg_queryinfokey
+ * 0x11                winreg_QueryValue                       reg_queryvalue
+ * 0x12                winreg_ReplaceKey
+ * 0x13                winreg_RestoreKey
+ * 0x14                winreg_SaveKey
+ * 0x15                winreg_SetKeySecurity                   reg_setkeysecurity
+ * 0x16                winreg_SetValue                         reg_setvalue
+ * 0x17                winreg_UnLoadKey
+ * 0x18                winreg_InitiateSystemShutdown
+ * 0x19                winreg_AbortSystemShutdown
+ * 0x1a                winreg_GetVersion                       reg_getversion
+ * 0x1b                winreg_OpenHKCC
+ * 0x1c                winreg_OpenHKDD
+ * 0x1d                winreg_QueryMultipleValues
+ * 0x1e                winreg_InitiateSystemShutdownEx
+ * 0x1f                winreg_SaveKeyEx
+ * 0x20                winreg_OpenHKPT
+ * 0x21                winreg_OpenHKPN
+ * 0x22                winreg_QueryMultipleValues2
+ *
+ */
+
 #include "includes.h"
 
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_REGISTRY
 
+
+/**********************************************************************
+ * Helper functions
+ **********************************************************************/
+
 static WERROR fill_value_cache(struct registry_key *key)
 {
        if (key->values != NULL) {
-               return WERR_OK;
+               if (!reg_values_need_update(key->key, key->values)) {
+                       return WERR_OK;
+               }
        }
 
        if (!(key->values = TALLOC_ZERO_P(key, REGVAL_CTR))) {
@@ -44,7 +94,9 @@ static WERROR fill_value_cache(struct registry_key *key)
 static WERROR fill_subkey_cache(struct registry_key *key)
 {
        if (key->subkeys != NULL) {
-               return WERR_OK;
+               if (!reg_subkeys_need_update(key->key, key->subkeys)) {
+                       return WERR_OK;
+               }
        }
 
        if (!(key->subkeys = TALLOC_ZERO_P(key, REGSUBKEY_CTR))) {
@@ -131,12 +183,12 @@ static WERROR regkey_open_onelevel(TALLOC_CTX *mem_ctx,
        /* Look up the table of registry I/O operations */
 
        if ( !(key->hook = reghook_cache_find( key->name )) ) {
-               DEBUG(0,("reg_open_onelevel: Failed to assigned a "
+               DEBUG(0,("reg_open_onelevel: Failed to assign a "
                         "REGISTRY_HOOK to [%s]\n", key->name ));
                result = WERR_BADFILE;
                goto done;
        }
-       
+
        /* check if the path really exists; failed is indicated by -1 */
        /* if the subkey count failed, bail out */
 
@@ -149,7 +201,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,
@@ -182,6 +234,11 @@ WERROR reg_openhive(TALLOC_CTX *mem_ctx, const char *hive,
                                    pkey);
 }
 
+
+/**********************************************************************
+ * The API functions
+ **********************************************************************/
+
 WERROR reg_openkey(TALLOC_CTX *mem_ctx, struct registry_key *parent,
                   const char *name, uint32 desired_access,
                   struct registry_key **pkey)
@@ -298,7 +355,7 @@ WERROR reg_enumvalue(TALLOC_CTX *mem_ctx, struct registry_key *key,
                SAFE_FREE(val);
                return WERR_NOMEM;
        }
-               
+
        *pval = val;
        return WERR_OK;
 }
@@ -378,7 +435,7 @@ WERROR reg_queryinfokey(struct registry_key *key, uint32_t *num_subkeys,
                return err;
        }
 
-       *secdescsize = sec_desc_size(secdesc);
+       *secdescsize = ndr_size_security_descriptor(secdesc, 0);
        TALLOC_FREE(mem_ctx);
 
        *last_changed_time = 0;
@@ -396,7 +453,6 @@ WERROR reg_createkey(TALLOC_CTX *ctx, struct registry_key *parent,
        TALLOC_CTX *mem_ctx;
        char *path, *end;
        WERROR err;
-       REGSUBKEY_CTR *subkeys;
 
        if (!(mem_ctx = talloc_new(ctx))) return WERR_NOMEM;
 
@@ -460,11 +516,6 @@ WERROR reg_createkey(TALLOC_CTX *ctx, struct registry_key *parent,
         * Actually create the subkey
         */
 
-       if (!(subkeys = TALLOC_ZERO_P(mem_ctx, REGSUBKEY_CTR))) {
-               err = WERR_NOMEM;
-               goto done;
-       }
-
        err = fill_subkey_cache(create_parent);
        if (!W_ERROR_IS_OK(err)) goto done;
 
@@ -490,7 +541,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)
 {
@@ -624,6 +674,32 @@ WERROR reg_deletevalue(struct registry_key *key, const char *name)
        return WERR_OK;
 }
 
+WERROR reg_getkeysecurity(TALLOC_CTX *mem_ctx, struct registry_key *key,
+                         struct security_descriptor **psecdesc)
+{
+       return regkey_get_secdesc(mem_ctx, key->key, psecdesc);
+}
+
+WERROR reg_setkeysecurity(struct registry_key *key,
+                         struct security_descriptor *psecdesc)
+{
+       return regkey_set_secdesc(key->key, psecdesc);
+}
+
+WERROR reg_getversion(uint32_t *version)
+{
+       if (version == NULL) {
+               return WERR_INVALID_PARAM;
+       }
+
+       *version = 0x00000005; /* Windows 2000 registry API version */
+       return WERR_OK;
+}
+
+/**********************************************************************
+ * Higher level utility functions
+ **********************************************************************/
+
 WERROR reg_deleteallvalues(struct registry_key *key)
 {
        WERROR err;
@@ -708,14 +784,14 @@ 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,
-                                       struct registry_key *parent,
-                                       const char *path,
-                                       bool del_key)
+static WERROR reg_deletekey_recursive_internal(TALLOC_CTX *ctx,
+                                              struct registry_key *parent,
+                                              const char *path,
+                                              bool del_key)
 {
        TALLOC_CTX *mem_ctx = NULL;
        WERROR werr = WERR_OK;
@@ -729,17 +805,17 @@ WERROR reg_deletekey_recursive_internal(TALLOC_CTX *ctx,
        }
 
        /* recurse through subkeys first */
-       werr = reg_openkey(mem_ctx, parent, path, REG_KEY_WRITE, &key);
+       werr = reg_openkey(mem_ctx, parent, path, REG_KEY_ALL, &key);
        if (!W_ERROR_IS_OK(werr)) {
                goto done;
        }
 
        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;
                }
@@ -767,12 +843,111 @@ 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);
+}
+
+#if 0
+/* these two functions are unused. */
+
+/**
+ * Utility function to create a registry key without opening the hive
+ * before. Assumes the hive already exists.
+ */
+
+WERROR reg_create_path(TALLOC_CTX *mem_ctx, const char *orig_path,
+                      uint32 desired_access,
+                      const struct nt_user_token *token,
+                      enum winreg_CreateAction *paction,
+                      struct registry_key **pkey)
+{
+       struct registry_key *hive;
+       char *path, *p;
+       WERROR err;
+
+       if (!(path = SMB_STRDUP(orig_path))) {
+               return WERR_NOMEM;
+       }
+
+       p = strchr(path, '\\');
+
+       if ((p == NULL) || (p[1] == '\0')) {
+               /*
+                * No key behind the hive, just return the hive
+                */
+
+               err = reg_openhive(mem_ctx, path, desired_access, token,
+                                  &hive);
+               if (!W_ERROR_IS_OK(err)) {
+                       SAFE_FREE(path);
+                       return err;
+               }
+               SAFE_FREE(path);
+               *pkey = hive;
+               *paction = REG_OPENED_EXISTING_KEY;
+               return WERR_OK;
+       }
+
+       *p = '\0';
+
+       err = reg_openhive(mem_ctx, path,
+                          (strchr(p+1, '\\') != NULL) ?
+                          SEC_RIGHTS_ENUM_SUBKEYS : SEC_RIGHTS_CREATE_SUBKEY,
+                          token, &hive);
+       if (!W_ERROR_IS_OK(err)) {
+               SAFE_FREE(path);
+               return err;
+       }
+
+       err = reg_createkey(mem_ctx, hive, p+1, desired_access, pkey, paction);
+       SAFE_FREE(path);
+       TALLOC_FREE(hive);
+       return err;
+}
+
+/*
+ * Utility function to create a registry key without opening the hive
+ * before. Will not delete a hive.
+ */
+
+WERROR reg_delete_path(const struct nt_user_token *token,
+                      const char *orig_path)
+{
+       struct registry_key *hive;
+       char *path, *p;
+       WERROR err;
+
+       if (!(path = SMB_STRDUP(orig_path))) {
+               return WERR_NOMEM;
+       }
+
+       p = strchr(path, '\\');
+
+       if ((p == NULL) || (p[1] == '\0')) {
+               SAFE_FREE(path);
+               return WERR_INVALID_PARAM;
+       }
+
+       *p = '\0';
+
+       err = reg_openhive(NULL, path,
+                          (strchr(p+1, '\\') != NULL) ?
+                          SEC_RIGHTS_ENUM_SUBKEYS : SEC_RIGHTS_CREATE_SUBKEY,
+                          token, &hive);
+       if (!W_ERROR_IS_OK(err)) {
+               SAFE_FREE(path);
+               return err;
+       }
+
+       err = reg_deletekey(hive, p+1);
+       SAFE_FREE(path);
+       TALLOC_FREE(hive);
+       return err;
 }
+#endif /* #if 0 */
diff --git a/source/registry/reg_backend_current_version.c b/source/registry/reg_backend_current_version.c
new file mode 100644 (file)
index 0000000..a9d281c
--- /dev/null
@@ -0,0 +1,81 @@
+/*
+ *  Unix SMB/CIFS implementation.
+ *  Virtual Windows Registry Layer
+ *  Copyright (C) Gerald Carter     2002-2005
+ *  Copyright (C) Michael Adam      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/>.
+ */
+
+/*
+ * CurrentVersion registry backend.
+ *
+ * This is a virtual overlay, dynamically presenting version information.
+ */
+
+#include "includes.h"
+
+#undef DBGC_CLASS
+#define DBGC_CLASS DBGC_REGISTRY
+
+extern REGISTRY_OPS regdb_ops;
+
+#define KEY_CURRENT_VERSION_NORM "HKLM/SOFTWARE/MICROSOFT/WINDOWS NT/CURRENTVERSION"
+
+static int current_version_fetch_values(const char *key, REGVAL_CTR *values)
+{
+       const char *sysroot_string = "c:\\Windows";
+       fstring sysversion;
+       fstring value;
+       uint32 value_length;
+       char *path = NULL;
+       TALLOC_CTX *ctx = talloc_tos();
+
+       path = talloc_strdup(ctx, key);
+       if (path == NULL) {
+               return -1;
+       }
+       path = normalize_reg_path(ctx, path);
+       if (path == NULL) {
+               return -1;
+       }
+
+       if (strncmp(path, KEY_CURRENT_VERSION_NORM, strlen(path)) != 0) {
+               return 0;
+       }
+
+       value_length = push_ucs2(value, value, sysroot_string, sizeof(value),
+                                STR_TERMINATE|STR_NOALIGN );
+       regval_ctr_addvalue(values, "SystemRoot", REG_SZ, value, value_length);
+
+       fstr_sprintf(sysversion, "%d.%d", lp_major_announce_version(),
+                    lp_minor_announce_version());
+       value_length = push_ucs2(value, value, sysversion, sizeof(value),
+                                STR_TERMINATE|STR_NOALIGN);
+       regval_ctr_addvalue(values, "CurrentVersion", REG_SZ, value,
+                           value_length);
+
+       return regval_ctr_numvals(values);
+}
+
+static int current_version_fetch_subkeys(const char *key,
+                                        REGSUBKEY_CTR *subkey_ctr)
+{
+       return regdb_ops.fetch_subkeys(key, subkey_ctr);
+}
+
+REGISTRY_OPS current_version_reg_ops = {
+       .fetch_values = current_version_fetch_values,
+       .fetch_subkeys = current_version_fetch_subkeys,
+};
similarity index 95%
rename from source/registry/reg_db.c
rename to source/registry/reg_backend_db.c
index 25c6557c87ae339fff16f6489420137f0d0dfc85..e162fb587f573f15b26d785c6f3a1bc82694c56e 100644 (file)
@@ -44,17 +44,17 @@ static const char *builtin_registry_paths[] = {
        KEY_SHARES,
        KEY_EVENTLOG,
        KEY_SMBCONF,
-       "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Perflib",
-       "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Perflib\\009",
+       KEY_PERFLIB,
+       KEY_PERFLIB_009,
        "HKLM\\SYSTEM\\CurrentControlSet\\Control\\Print\\Monitors",
-       "HKLM\\SYSTEM\\CurrentControlSet\\Control\\ProductOptions",
+       KEY_PROD_OPTIONS,
        "HKLM\\SYSTEM\\CurrentControlSet\\Control\\Terminal Server\\DefaultUserConfiguration",
-       "HKLM\\SYSTEM\\CurrentControlSet\\Services\\TcpIp\\Parameters",
-       "HKLM\\SYSTEM\\CurrentControlSet\\Services\\Netlogon\\Parameters",
-       "HKU",
-       "HKCR",
-       "HKPD",
-       "HKPT",
+       KEY_TCPIP_PARAMS,
+       KEY_NETLOGON_PARAMS,
+       KEY_HKU,
+       KEY_HKCR,
+       KEY_HKPD,
+       KEY_HKPT,
         NULL };
 
 struct builtin_regkey_value {
@@ -259,7 +259,7 @@ bool regdb_init( void )
        uint32 vers_id;
 
        if ( tdb_reg )
-               return True;
+               return true;
 
        if ( !(tdb_reg = tdb_wrap_open(NULL, state_path("registry.tdb"), 0, REG_TDB_FLAGS, O_RDWR, 0600)) )
        {
@@ -267,7 +267,7 @@ bool regdb_init( void )
                if ( !tdb_reg ) {
                        DEBUG(0,("regdb_init: Failed to open registry %s (%s)\n",
                                state_path("registry.tdb"), strerror(errno) ));
-                       return False;
+                       return false;
                }
                
                DEBUG(10,("regdb_init: Successfully created registry tdb\n"));
@@ -286,11 +286,11 @@ bool regdb_init( void )
        /* always setup the necessary keys and values */
 
        if ( !init_registry_data() ) {
-               DEBUG(0,("init_registry: Failed to initialize data in registry!\n"));
-               return False;
+               DEBUG(0,("regdb_init: Failed to initialize data in registry!\n"));
+               return false;
        }
 
-       return True;
+       return true;
 }
 
 /***********************************************************************
@@ -329,6 +329,10 @@ WERROR regdb_open( void )
 
 int regdb_close( void )
 {
+       if (tdb_refcount == 0) {
+               return 0;
+       }
+
        tdb_refcount--;
 
        DEBUG(10,("regdb_close: decrementing refcount (%d)\n", tdb_refcount));
@@ -364,7 +368,7 @@ static bool regdb_store_keys_internal(const char *key, REGSUBKEY_CTR *ctr)
        uint8 *buffer = NULL;
        int i = 0;
        uint32 len, buflen;
-       bool ret = True;
+       bool ret = true;
        uint32 num_subkeys = regsubkey_ctr_numkeys(ctr);
        char *keyname = NULL;
        TALLOC_CTX *ctx = talloc_tos();
@@ -382,7 +386,7 @@ static bool regdb_store_keys_internal(const char *key, REGSUBKEY_CTR *ctr)
        /* allocate some initial memory */
 
        if (!(buffer = (uint8 *)SMB_MALLOC(1024))) {
-               return False;
+               return false;
        }
        buflen = 1024;
        len = 0;
@@ -399,7 +403,7 @@ static bool regdb_store_keys_internal(const char *key, REGSUBKEY_CTR *ctr)
                        /* allocate some extra space */
                        if ((buffer = (uint8 *)SMB_REALLOC( buffer, len*2 )) == NULL) {
                                DEBUG(0,("regdb_store_keys: Failed to realloc memory of size [%d]\n", len*2));
-                               ret = False;
+                               ret = false;
                                goto done;
                        }
                        buflen = len*2;
@@ -413,7 +417,7 @@ static bool regdb_store_keys_internal(const char *key, REGSUBKEY_CTR *ctr)
        dbuf.dptr = buffer;
        dbuf.dsize = len;
        if ( tdb_store_bystring( tdb_reg->tdb, keyname, dbuf, TDB_REPLACE ) == -1) {
-               ret = False;
+               ret = false;
                goto done;
        }
 
@@ -618,7 +622,15 @@ int regdb_fetch_keys(const char *key, REGSUBKEY_CTR *ctr)
        }
        strupper_m(path);
 
+       if (tdb_read_lock_bystring_with_timeout(tdb_reg->tdb, path, 10) == -1) {
+               return 0;
+       }
+
        dbuf = tdb_fetch_bystring(tdb_reg->tdb, path);
+       ctr->seqnum = regdb_get_seqnum();
+
+       tdb_read_unlock_bystring(tdb_reg->tdb, path);
+
 
        buf = dbuf.dptr;
        buflen = dbuf.dsize;
@@ -746,7 +758,14 @@ int regdb_fetch_values( const char* key, REGVAL_CTR *values )
                return 0;
        }
 
+       if (tdb_read_lock_bystring_with_timeout(tdb_reg->tdb, keystr, 10) == -1) {
+               return 0;
+       }
+
        data = tdb_fetch_bystring(tdb_reg->tdb, keystr);
+       values->seqnum = regdb_get_seqnum();
+
+       tdb_read_unlock_bystring(tdb_reg->tdb, keystr);
 
        if (!data.dptr) {
                /* all keys have zero values by default */
@@ -801,7 +820,7 @@ bool regdb_store_values( const char *key, REGVAL_CTR *values )
            && (memcmp(old_data.dptr, data.dptr, data.dsize) == 0)) {
                SAFE_FREE(old_data.dptr);
                SAFE_FREE(data.dptr);
-               return True;
+               return true;
        }
 
        ret = tdb_trans_store_bystring(tdb_reg->tdb, keystr, data, TDB_REPLACE);
@@ -903,6 +922,16 @@ static WERROR regdb_set_secdesc(const char *key,
        return err;
 }
 
+bool regdb_subkeys_need_update(REGSUBKEY_CTR *subkeys)
+{
+       return (regdb_get_seqnum() != subkeys->seqnum);
+}
+
+bool regdb_values_need_update(REGVAL_CTR *values)
+{
+       return (regdb_get_seqnum() != values->seqnum);
+}
+
 /* 
  * Table of function pointers for default access
  */
@@ -914,5 +943,7 @@ REGISTRY_OPS regdb_ops = {
        regdb_store_values,
        NULL,
        regdb_get_secdesc,
-       regdb_set_secdesc
+       regdb_set_secdesc,
+       regdb_subkeys_need_update,
+       regdb_values_need_update
 };
diff --git a/source/registry/reg_backend_hkpt_params.c b/source/registry/reg_backend_hkpt_params.c
new file mode 100644 (file)
index 0000000..2ed5e78
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ *  Unix SMB/CIFS implementation.
+ *  Virtual Windows Registry Layer
+ *  Copyright (C) Gerald Carter     2002-2005
+ *  Copyright (C) Michael Adam      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/>.
+ */
+
+/*
+ * HKPT parameters registry backend.
+ *
+ * This replaces the former dynamic hkpt parameters overlay.
+ */
+
+#include "includes.h"
+
+#undef DBGC_CLASS
+#define DBGC_CLASS DBGC_REGISTRY
+
+extern REGISTRY_OPS regdb_ops;
+
+static int hkpt_params_fetch_values(const char *key, REGVAL_CTR *regvals)
+{
+       uint32 base_index;
+       uint32 buffer_size;
+       char *buffer = NULL;
+
+       /* This is ALMOST the same as perflib_009_params, but HKPT has
+          a "Counters" entry instead of a "Counter" key. <Grrrr> */
+
+       base_index = reg_perfcount_get_base_index();
+       buffer_size = reg_perfcount_get_counter_names(base_index, &buffer);
+       regval_ctr_addvalue(regvals, "Counters", REG_MULTI_SZ, buffer,
+                           buffer_size);
+
+       if(buffer_size > 0) {
+               SAFE_FREE(buffer);
+       }
+
+       buffer_size = reg_perfcount_get_counter_help(base_index, &buffer);
+       regval_ctr_addvalue(regvals, "Help", REG_MULTI_SZ, buffer, buffer_size);
+       if(buffer_size > 0) {
+               SAFE_FREE(buffer);
+       }
+
+       return regval_ctr_numvals( regvals );
+}
+
+static int hkpt_params_fetch_subkeys(const char *key,
+                                        REGSUBKEY_CTR *subkey_ctr)
+{
+       return regdb_ops.fetch_subkeys(key, subkey_ctr);
+}
+
+REGISTRY_OPS hkpt_params_reg_ops = {
+       .fetch_values = hkpt_params_fetch_values,
+       .fetch_subkeys = hkpt_params_fetch_subkeys,
+};
diff --git a/source/registry/reg_backend_netlogon_params.c b/source/registry/reg_backend_netlogon_params.c
new file mode 100644 (file)
index 0000000..71f8814
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ *  Unix SMB/CIFS implementation.
+ *  Virtual Windows Registry Layer
+ *  Copyright (C) Gerald Carter     2002-2005
+ *  Copyright (C) Michael Adam      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/>.
+ */
+
+/*
+ * Netlogon parameters registry backend.
+ *
+ * This replaces the former dynamic netlogon parameters overlay.
+ */
+
+#include "includes.h"
+
+#undef DBGC_CLASS
+#define DBGC_CLASS DBGC_REGISTRY
+
+extern REGISTRY_OPS regdb_ops;
+
+static int netlogon_params_fetch_values(const char *key, REGVAL_CTR *regvals)
+{
+       uint32 dwValue;
+
+       if (!pdb_get_account_policy(AP_REFUSE_MACHINE_PW_CHANGE, &dwValue)) {
+               dwValue = 0;
+       }
+
+       regval_ctr_addvalue(regvals, "RefusePasswordChange", REG_DWORD,
+                           (char*)&dwValue, sizeof(dwValue));
+
+       return regval_ctr_numvals(regvals);
+}
+
+static int netlogon_params_fetch_subkeys(const char *key,
+                                        REGSUBKEY_CTR *subkey_ctr)
+{
+       return regdb_ops.fetch_subkeys(key, subkey_ctr);
+}
+
+REGISTRY_OPS netlogon_params_reg_ops = {
+       .fetch_values = netlogon_params_fetch_values,
+       .fetch_subkeys = netlogon_params_fetch_subkeys,
+};
diff --git a/source/registry/reg_backend_perflib.c b/source/registry/reg_backend_perflib.c
new file mode 100644 (file)
index 0000000..999bca2
--- /dev/null
@@ -0,0 +1,106 @@
+/*
+ *  Unix SMB/CIFS implementation.
+ *  Virtual Windows Registry Layer
+ *  Copyright (C) Gerald Carter     2002-2005
+ *  Copyright (C) Michael Adam      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/>.
+ */
+
+/*
+ * perflib registry backend.
+ *
+ * This is a virtual overlay, dynamically presenting perflib values.
+ */
+
+#include "includes.h"
+
+#undef DBGC_CLASS
+#define DBGC_CLASS DBGC_REGISTRY
+
+extern REGISTRY_OPS regdb_ops;
+
+#define KEY_PERFLIB_NORM       "HKLM/SOFTWARE/MICROSOFT/WINDOWS NT/CURRENTVERSION/PERFLIB"
+#define KEY_PERFLIB_009_NORM   "HKLM/SOFTWARE/MICROSOFT/WINDOWS NT/CURRENTVERSION/PERFLIB/009"
+
+static int perflib_params( REGVAL_CTR *regvals )
+{
+       int base_index = -1;
+       int last_counter = -1;
+       int last_help = -1;
+       int version = 0x00010001;
+       
+       base_index = reg_perfcount_get_base_index();
+       regval_ctr_addvalue(regvals, "Base Index", REG_DWORD, (char *)&base_index, sizeof(base_index));
+       last_counter = reg_perfcount_get_last_counter(base_index);
+       regval_ctr_addvalue(regvals, "Last Counter", REG_DWORD, (char *)&last_counter, sizeof(last_counter));
+       last_help = reg_perfcount_get_last_help(last_counter);
+       regval_ctr_addvalue(regvals, "Last Help", REG_DWORD, (char *)&last_help, sizeof(last_help));
+       regval_ctr_addvalue(regvals, "Version", REG_DWORD, (char *)&version, sizeof(version));
+
+       return regval_ctr_numvals( regvals );
+}
+
+static int perflib_009_params( REGVAL_CTR *regvals )
+{
+       int base_index;
+       int buffer_size;
+       char *buffer = NULL;
+
+       base_index = reg_perfcount_get_base_index();
+       buffer_size = reg_perfcount_get_counter_names(base_index, &buffer);
+       regval_ctr_addvalue(regvals, "Counter", REG_MULTI_SZ, buffer, buffer_size);
+       if(buffer_size > 0)
+               SAFE_FREE(buffer);
+       buffer_size = reg_perfcount_get_counter_help(base_index, &buffer);
+       regval_ctr_addvalue(regvals, "Help", REG_MULTI_SZ, buffer, buffer_size);
+       if(buffer_size > 0)
+               SAFE_FREE(buffer);
+       
+       return regval_ctr_numvals( regvals );
+}
+
+static int perflib_fetch_values(const char *key, REGVAL_CTR *regvals)
+{
+       char *path = NULL;
+       TALLOC_CTX *ctx = talloc_tos();
+
+       path = talloc_strdup(ctx, key);
+       if (path == NULL) {
+               return -1;
+       }
+       path = normalize_reg_path(ctx, path);
+       if (path == NULL) {
+               return -1;
+       }
+
+       if (strncmp(path, KEY_PERFLIB_NORM, strlen(path)) == 0) {
+               return perflib_params(regvals);
+       } else if (strncmp(path, KEY_PERFLIB_009_NORM, strlen(path)) == 0) {
+               return perflib_009_params(regvals);
+       } else {
+               return 0;
+       }
+}
+
+static int perflib_fetch_subkeys(const char *key,
+                                        REGSUBKEY_CTR *subkey_ctr)
+{
+       return regdb_ops.fetch_subkeys(key, subkey_ctr);
+}
+
+REGISTRY_OPS perflib_reg_ops = {
+       .fetch_values = perflib_fetch_values,
+       .fetch_subkeys = perflib_fetch_subkeys,
+};
similarity index 99%
rename from source/registry/reg_printing.c
rename to source/registry/reg_backend_printing.c
index 2ca74f7c169c39dc9cb4b43ae653b29ade19b9d8..a4da103d404952606dc01caf11e251fa26d8121f 100644 (file)
@@ -1262,9 +1262,8 @@ static bool regprint_store_reg_values( const char *key, REGVAL_CTR *values )
  */
 
 REGISTRY_OPS printing_ops = {
-       regprint_fetch_reg_keys,
-       regprint_fetch_reg_values,
-       regprint_store_reg_keys,
-       regprint_store_reg_values,
-       NULL, NULL, NULL
+       .fetch_subkeys = regprint_fetch_reg_keys,
+       .fetch_values = regprint_fetch_reg_values,
+       .store_subkeys = regprint_store_reg_keys,
+       .store_values = regprint_store_reg_values,
 };
diff --git a/source/registry/reg_backend_prod_options.c b/source/registry/reg_backend_prod_options.c
new file mode 100644 (file)
index 0000000..7ac5c5b
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ *  Unix SMB/CIFS implementation.
+ *  Virtual Windows Registry Layer
+ *  Copyright (C) Gerald Carter     2002-2005
+ *  Copyright (C) Michael Adam      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/>.
+ */
+
+/*
+ * Product options registry backend.
+ *
+ * This replaces the former dynamic product options overlay.
+ */
+
+#include "includes.h"
+
+#undef DBGC_CLASS
+#define DBGC_CLASS DBGC_REGISTRY
+
+extern REGISTRY_OPS regdb_ops;
+
+static int prod_options_fetch_values(const char *key, REGVAL_CTR *regvals)
+{
+       const char *value_ascii = "";
+       fstring value;
+       int value_length;
+
+       switch (lp_server_role()) {
+               case ROLE_DOMAIN_PDC:
+               case ROLE_DOMAIN_BDC:
+                       value_ascii = "LanmanNT";
+                       break;
+               case ROLE_STANDALONE:
+                       value_ascii = "ServerNT";
+                       break;
+               case ROLE_DOMAIN_MEMBER:
+                       value_ascii = "WinNT";
+                       break;
+       }
+
+       value_length = push_ucs2(value, value, value_ascii, sizeof(value),
+                                STR_TERMINATE|STR_NOALIGN );
+       regval_ctr_addvalue(regvals, "ProductType", REG_SZ, value,
+                           value_length);
+
+       return regval_ctr_numvals( regvals );
+}
+
+static int prod_options_fetch_subkeys(const char *key,
+                                     REGSUBKEY_CTR *subkey_ctr)
+{
+       return regdb_ops.fetch_subkeys(key, subkey_ctr);
+}
+
+REGISTRY_OPS prod_options_reg_ops = {
+       .fetch_values = prod_options_fetch_values,
+       .fetch_subkeys = prod_options_fetch_subkeys,
+};
similarity index 96%
rename from source/registry/reg_shares.c
rename to source/registry/reg_backend_shares.c
index 178f23e21cc276d21fde8affc997e6a56a4ed622..ee9e5dc5a1848e675e34c1bcc85795567f3ad3d7 100644 (file)
@@ -155,11 +155,10 @@ static bool shares_store_value( const char *key, REGVAL_CTR *val )
  */
  
 REGISTRY_OPS shares_reg_ops = {
-       shares_subkey_info,
-       shares_value_info,
-       shares_store_subkey,
-       shares_store_value,
-       NULL, NULL, NULL
+       .fetch_subkeys = shares_subkey_info,
+       .fetch_values = shares_value_info,
+       .store_subkeys = shares_store_subkey,
+       .store_values = shares_store_value,
 };
 
 
similarity index 96%
rename from source/registry/reg_smbconf.c
rename to source/registry/reg_backend_smbconf.c
index 116cde936ed48c00d37f7b4c9825ae4750b88902..a6e478200f1afcd39d108fa3712f15a1beb77ebf 100644 (file)
@@ -265,11 +265,11 @@ static WERROR smbconf_set_secdesc(const char *key,
  */
 
 REGISTRY_OPS smbconf_reg_ops = {
-       smbconf_fetch_keys,
-       smbconf_fetch_values,
-       smbconf_store_keys,
-       smbconf_store_values,
-       smbconf_reg_access_check,
-       smbconf_get_secdesc,
-       smbconf_set_secdesc
+       .fetch_subkeys = smbconf_fetch_keys,
+       .fetch_values = smbconf_fetch_values,
+       .store_subkeys = smbconf_store_keys,
+       .store_values = smbconf_store_values,
+       .reg_access_check = smbconf_reg_access_check,
+       .get_secdesc = smbconf_get_secdesc,
+       .set_secdesc = smbconf_set_secdesc,
 };
diff --git a/source/registry/reg_backend_tcpip_params.c b/source/registry/reg_backend_tcpip_params.c
new file mode 100644 (file)
index 0000000..db7df5d
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ *  Unix SMB/CIFS implementation.
+ *  Virtual Windows Registry Layer
+ *  Copyright (C) Gerald Carter     2002-2005
+ *  Copyright (C) Michael Adam      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/>.
+ */
+
+/*
+ * TCP/IP parameters registry backend.
+ *
+ * This replaces the former dynamic tcpip parameters overlay.
+ */
+
+#include "includes.h"
+
+#undef DBGC_CLASS
+#define DBGC_CLASS DBGC_REGISTRY
+
+extern REGISTRY_OPS regdb_ops;
+
+static int tcpip_params_fetch_values(const char *key, REGVAL_CTR *regvals)
+{
+       fstring value;
+       int value_length;
+       char *hname;
+       char *mydomainname = NULL;
+
+       hname = myhostname();
+       value_length = push_ucs2(value, value, hname, sizeof(value),
+                                STR_TERMINATE|STR_NOALIGN);
+       regval_ctr_addvalue(regvals, "Hostname",REG_SZ, value, value_length);
+
+       mydomainname = get_mydnsdomname(talloc_tos());
+       if (!mydomainname) {
+               return -1;
+       }
+
+       value_length = push_ucs2(value, value, mydomainname, sizeof(value),
+                                STR_TERMINATE|STR_NOALIGN);
+       regval_ctr_addvalue(regvals, "Domain", REG_SZ, value, value_length);
+
+       return regval_ctr_numvals(regvals);
+}
+
+static int tcpip_params_fetch_subkeys(const char *key,
+                                        REGSUBKEY_CTR *subkey_ctr)
+{
+       return regdb_ops.fetch_subkeys(key, subkey_ctr);
+}
+
+REGISTRY_OPS tcpip_params_reg_ops = {
+       .fetch_values = tcpip_params_fetch_values,
+       .fetch_subkeys = tcpip_params_fetch_subkeys,
+};
index 289d4e50cec788bfbc7d758d328ea31c73459808..f9851c781012b92c3ede67272da398ba370727d1 100644 (file)
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_REGISTRY
 
-static SORTED_TREE *cache_tree;
+static SORTED_TREE *cache_tree = NULL;
 extern REGISTRY_OPS regdb_ops;         /* these are the default */
 static REGISTRY_HOOK default_hook = { KEY_TREE_ROOT, &regdb_ops };
 
 /**********************************************************************
- Initialize the cache tree
+ Initialize the cache tree if it has not been initialized yet.
  *********************************************************************/
 
 bool reghook_cache_init( void )
 {
-       cache_tree = pathtree_init( &default_hook, NULL );
+       if (cache_tree == NULL) {
+               cache_tree = pathtree_init(&default_hook, NULL);
+               if (cache_tree !=0) {
+                       DEBUG(10, ("reghook_cache_init: new tree with default "
+                                  "ops %p for key [%s]\n", (void *)&regdb_ops,
+                                  KEY_TREE_ROOT));
+               }
+       }
 
-       return ( cache_tree == NULL );
+       return (cache_tree != NULL);
 }
 
 /**********************************************************************
@@ -54,7 +61,7 @@ bool reghook_cache_add( REGISTRY_HOOK *hook )
                return false;
        }
 
-       key = talloc_asprintf(ctx, "//%s", hook->keyname);
+       key = talloc_asprintf(ctx, "\\%s", hook->keyname);
        if (!key) {
                return false;
        }
@@ -63,7 +70,8 @@ bool reghook_cache_add( REGISTRY_HOOK *hook )
                return false;
        }
 
-       DEBUG(10,("reghook_cache_add: Adding key [%s]\n", key));
+       DEBUG(10, ("reghook_cache_add: Adding ops %p for key [%s]\n",
+                  (void *)hook->ops, key));
 
        return pathtree_add( cache_tree, key, hook );
 }
@@ -100,6 +108,9 @@ REGISTRY_HOOK* reghook_cache_find( const char *keyname )
        DEBUG(10,("reghook_cache_find: Searching for keyname [%s]\n", key));
        
        hook = (REGISTRY_HOOK *)pathtree_find( cache_tree, key ) ;
+
+       DEBUG(10, ("reghook_cache_find: found ops %p for key [%s]\n",
+                  hook ? (void *)hook->ops : 0, key));
        
        SAFE_FREE( key );
        
similarity index 84%
rename from source/registry/reg_frontend_hilvl.c
rename to source/registry/reg_dispatcher.c
index a4b78b24c0e657a8fa62db599bf8e355ec1a2939..e6e76134570512f1efaa812bbe8de8ff6fb6b0a7 100644 (file)
@@ -1,25 +1,25 @@
-/* 
+/*
  *  Unix SMB/CIFS implementation.
  *  Virtual Windows Registry Layer
  *  Copyright (C) Gerald Carter                     2002-2005
- *  Copyright (C) Michael Adam 2006
+ *  Copyright (C) Michael Adam                      2006-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/>.
  */
 
-/* 
- * Implementation of registry frontend view functions. 
+/*
+ * Implementation of registry frontend view functions.
  * Functions moved from reg_frontend.c to minimize linker deps.
  */
 
@@ -44,12 +44,12 @@ static SEC_DESC* construct_registry_sd( TALLOC_CTX *ctx )
        size_t sd_size;
 
        /* basic access for Everyone */
-       
+
        init_sec_access(&mask, REG_KEY_READ );
        init_sec_ace(&ace[i++], &global_sid_World, SEC_ACE_TYPE_ACCESS_ALLOWED, mask, 0);
-       
+
        /* Full Access 'BUILTIN\Administrators' */
-       
+
        init_sec_access(&mask, REG_KEY_ALL );
        init_sec_ace(&ace[i++], &global_sid_Builtin_Administrators, SEC_ACE_TYPE_ACCESS_ALLOWED, mask, 0);
 
@@ -58,9 +58,8 @@ static SEC_DESC* construct_registry_sd( TALLOC_CTX *ctx )
        init_sec_access(&mask, REG_KEY_ALL );
        init_sec_ace(&ace[i++], &global_sid_System, SEC_ACE_TYPE_ACCESS_ALLOWED, mask, 0);
 
-       
        /* create the security descriptor */
-       
+
        if ( !(acl = make_sec_acl(ctx, NT4_ACL_REVISION, i, ace)) )
                return NULL;
 
@@ -73,29 +72,25 @@ static SEC_DESC* construct_registry_sd( TALLOC_CTX *ctx )
 /***********************************************************************
  High level wrapper function for storing registry subkeys
  ***********************************************************************/
+
 bool store_reg_keys( REGISTRY_KEY *key, REGSUBKEY_CTR *subkeys )
 {
        if ( key->hook && key->hook->ops && key->hook->ops->store_subkeys )
                return key->hook->ops->store_subkeys( key->name, subkeys );
-               
-       return False;
 
+       return false;
 }
 
 /***********************************************************************
  High level wrapper function for storing registry values
  ***********************************************************************/
+
 bool store_reg_values( REGISTRY_KEY *key, REGVAL_CTR *val )
 {
-       if ( check_dynamic_reg_values( key ) )
-               return False;
-
        if ( key->hook && key->hook->ops && key->hook->ops->store_values )
                return key->hook->ops->store_values( key->name, val );
 
-       return False;
+       return false;
 }
 
 /***********************************************************************
@@ -106,7 +101,7 @@ bool store_reg_values( REGISTRY_KEY *key, REGVAL_CTR *val )
 int fetch_reg_keys( REGISTRY_KEY *key, REGSUBKEY_CTR *subkey_ctr )
 {
        int result = -1;
-       
+
        if ( key->hook && key->hook->ops && key->hook->ops->fetch_subkeys )
                result = key->hook->ops->fetch_subkeys( key->name, subkey_ctr );
 
@@ -120,23 +115,18 @@ int fetch_reg_keys( REGISTRY_KEY *key, REGSUBKEY_CTR *subkey_ctr )
 int fetch_reg_values( REGISTRY_KEY *key, REGVAL_CTR *val )
 {
        int result = -1;
-       
+
+       DEBUG(10, ("fetch_reg_values called for key '%s' (ops %p)\n", key->name,
+                  (key->hook && key->hook->ops) ? (void *)key->hook->ops : NULL));
+
        if ( key->hook && key->hook->ops && key->hook->ops->fetch_values )
                result = key->hook->ops->fetch_values( key->name, val );
-       
-       /* if the backend lookup returned no data, try the dynamic overlay */
-       
-       if ( result == 0 ) {
-               result = fetch_dynamic_reg_values( key, val );
 
-               return ( result != -1 ) ? result : 0;
-       }
-       
        return result;
 }
 
 /***********************************************************************
- High level access check for passing the required access mask to the 
+ High level access check for passing the required access mask to the
  underlying registry backend
  ***********************************************************************/
 
@@ -161,21 +151,21 @@ bool regkey_access_check( REGISTRY_KEY *key, uint32 requested, uint32 *granted,
         */
 
        if (!(mem_ctx = talloc_init("regkey_access_check"))) {
-               return False;
+               return false;
        }
 
        err = regkey_get_secdesc(mem_ctx, key, &sec_desc);
 
        if (!W_ERROR_IS_OK(err)) {
                TALLOC_FREE(mem_ctx);
-               return False;
+               return false;
        }
 
        se_map_generic( &requested, &reg_generic_map );
 
        if (!se_access_check(sec_desc, token, requested, granted, &status)) {
                TALLOC_FREE(mem_ctx);
-               return False;
+               return false;
        }
 
        TALLOC_FREE(mem_ctx);
@@ -214,3 +204,32 @@ WERROR regkey_set_secdesc(REGISTRY_KEY *key,
 
        return WERR_ACCESS_DENIED;
 }
+
+/**
+ * Check whether the in-memory version of the subkyes of a
+ * registry key needs update from disk.
+ */
+bool reg_subkeys_need_update(REGISTRY_KEY *key, REGSUBKEY_CTR *subkeys)
+{
+       if (key->hook && key->hook->ops && key->hook->ops->subkeys_need_update)
+       {
+               return key->hook->ops->subkeys_need_update(subkeys);
+       }
+
+       return false;
+}
+
+/**
+ * Check whether the in-memory version of the values of a
+ * registry key needs update from disk.
+ */
+bool reg_values_need_update(REGISTRY_KEY *key, REGVAL_CTR *values)
+{
+       if (key->hook && key->hook->ops && key->hook->ops->values_need_update)
+       {
+               return key->hook->ops->values_need_update(values);
+       }
+
+       return false;
+}
+
diff --git a/source/registry/reg_dynamic.c b/source/registry/reg_dynamic.c
deleted file mode 100644 (file)
index e70bd17..0000000
+++ /dev/null
@@ -1,264 +0,0 @@
-/* 
- *  Unix SMB/CIFS implementation.
- *  Virtual Windows Registry Layer
- *  Copyright (C) Gerald Carter                     2002-2005
- *
- *  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/>.
- */
-
-/* Implementation of registry frontend view functions. */
-
-#include "includes.h"
-
-#undef DBGC_CLASS
-#define DBGC_CLASS DBGC_REGISTRY
-
-struct reg_dyn_values {
-       const char *path;
-       int (*fetch_values) ( REGVAL_CTR *val );
-};
-
-/***********************************************************************
-***********************************************************************/
-
-static int netlogon_params( REGVAL_CTR *regvals )
-{
-       uint32 dwValue;
-       
-       if ( !pdb_get_account_policy(AP_REFUSE_MACHINE_PW_CHANGE, &dwValue) )
-               dwValue = 0;
-               
-       regval_ctr_addvalue( regvals, "RefusePasswordChange", REG_DWORD,
-               (char*)&dwValue, sizeof(dwValue) );
-
-       return regval_ctr_numvals( regvals );
-}
-
-/***********************************************************************
-***********************************************************************/
-
-static int prod_options( REGVAL_CTR *regvals )
-{
-       const char              *value_ascii = "";
-       fstring                 value;
-       int                     value_length;
-       
-       switch (lp_server_role()) {
-               case ROLE_DOMAIN_PDC:
-               case ROLE_DOMAIN_BDC:
-                       value_ascii = "LanmanNT";
-                       break;
-               case ROLE_STANDALONE:
-                       value_ascii = "ServerNT";
-                       break;
-               case ROLE_DOMAIN_MEMBER:
-                       value_ascii = "WinNT";
-                       break;
-       }
-               
-       value_length = push_ucs2( value, value, value_ascii, sizeof(value), 
-               STR_TERMINATE|STR_NOALIGN );
-       regval_ctr_addvalue( regvals, "ProductType", REG_SZ, value, 
-               value_length );
-       
-       return regval_ctr_numvals( regvals );
-}
-
-/***********************************************************************
-***********************************************************************/
-
-static int tcpip_params( REGVAL_CTR *regvals )
-{
-       fstring                 value;
-       int                     value_length;
-       char                    *hname;
-       char *mydomainname = NULL;
-
-       hname = myhostname();
-       value_length = push_ucs2( value, value, hname, sizeof(value), STR_TERMINATE|STR_NOALIGN);               
-       regval_ctr_addvalue( regvals, "Hostname",REG_SZ, value, value_length );
-
-       mydomainname = get_mydnsdomname(talloc_tos());
-       if (!mydomainname) {
-               return -1;
-       }
-
-       value_length = push_ucs2( value, value, mydomainname, sizeof(value), STR_TERMINATE|STR_NOALIGN);                
-       regval_ctr_addvalue( regvals, "Domain", REG_SZ, value, value_length );
-
-       return regval_ctr_numvals( regvals );
-}
-
-/***********************************************************************
-***********************************************************************/
-
-static int perflib_params( REGVAL_CTR *regvals )
-{
-       int base_index = -1;
-       int last_counter = -1;
-       int last_help = -1;
-       int version = 0x00010001;
-       
-       base_index = reg_perfcount_get_base_index();
-       regval_ctr_addvalue(regvals, "Base Index", REG_DWORD, (char *)&base_index, sizeof(base_index));
-       last_counter = reg_perfcount_get_last_counter(base_index);
-       regval_ctr_addvalue(regvals, "Last Counter", REG_DWORD, (char *)&last_counter, sizeof(last_counter));
-       last_help = reg_perfcount_get_last_help(last_counter);
-       regval_ctr_addvalue(regvals, "Last Help", REG_DWORD, (char *)&last_help, sizeof(last_help));
-       regval_ctr_addvalue(regvals, "Version", REG_DWORD, (char *)&version, sizeof(version));
-
-       return regval_ctr_numvals( regvals );
-}
-
-/***********************************************************************
-***********************************************************************/
-
-static int perflib_009_params( REGVAL_CTR *regvals )
-{
-       int base_index;
-       int buffer_size;
-       char *buffer = NULL;
-
-       base_index = reg_perfcount_get_base_index();
-       buffer_size = reg_perfcount_get_counter_names(base_index, &buffer);
-       regval_ctr_addvalue(regvals, "Counter", REG_MULTI_SZ, buffer, buffer_size);
-       if(buffer_size > 0)
-               SAFE_FREE(buffer);
-       buffer_size = reg_perfcount_get_counter_help(base_index, &buffer);
-       regval_ctr_addvalue(regvals, "Help", REG_MULTI_SZ, buffer, buffer_size);
-       if(buffer_size > 0)
-               SAFE_FREE(buffer);
-       
-       return regval_ctr_numvals( regvals );
-}
-
-/***********************************************************************
-***********************************************************************/
-
-static int hkpt_params( REGVAL_CTR *regvals )
-{
-       uint32 base_index;
-       uint32 buffer_size;
-       char *buffer = NULL;
-
-       /* This is ALMOST the same as perflib_009_params, but HKPT has
-          a "Counters" entry instead of a "Counter" key. <Grrrr> */
-          
-       base_index = reg_perfcount_get_base_index();
-       buffer_size = reg_perfcount_get_counter_names(base_index, &buffer);
-       regval_ctr_addvalue(regvals, "Counters", REG_MULTI_SZ, buffer, buffer_size);
-       
-       if(buffer_size > 0)
-               SAFE_FREE(buffer);
-               
-       buffer_size = reg_perfcount_get_counter_help(base_index, &buffer);
-       regval_ctr_addvalue(regvals, "Help", REG_MULTI_SZ, buffer, buffer_size);
-       if(buffer_size > 0)
-               SAFE_FREE(buffer);
-       
-       return regval_ctr_numvals( regvals );
-}
-
-/***********************************************************************
-***********************************************************************/
-
-static int current_version( REGVAL_CTR *values )
-{
-       const char *sysroot_string = "c:\\Windows";
-       fstring sysversion;
-       fstring value;
-       uint32 value_length;
-       
-       value_length = push_ucs2( value, value, sysroot_string, sizeof(value), 
-               STR_TERMINATE|STR_NOALIGN );
-       regval_ctr_addvalue( values, "SystemRoot", REG_SZ, value, value_length );
-       
-       fstr_sprintf( sysversion, "%d.%d", lp_major_announce_version(), lp_minor_announce_version() );
-       value_length = push_ucs2( value, value, sysversion, sizeof(value), 
-               STR_TERMINATE|STR_NOALIGN );
-       regval_ctr_addvalue( values, "CurrentVersion", REG_SZ, value, value_length );
-       
-               
-       return regval_ctr_numvals( values );
-}
-
-
-/***********************************************************************
- Structure holding the registry paths and pointers to the value 
- enumeration functions
-***********************************************************************/
-
-static struct reg_dyn_values dynamic_values[] = {
-       { "HKLM/SYSTEM/CURRENTCONTROLSET/SERVICES/NETLOGON/PARAMETERS", &netlogon_params  },
-       { "HKLM/SYSTEM/CURRENTCONTROLSET/CONTROL/PRODUCTOPTIONS",       &prod_options     },
-       { "HKLM/SYSTEM/CURRENTCONTROLSET/SERVICES/TCPIP/PARAMETERS",    &tcpip_params     },
-       { "HKLM/SOFTWARE/MICROSOFT/WINDOWS NT/CURRENTVERSION/PERFLIB",  &perflib_params   }, 
-       { "HKLM/SOFTWARE/MICROSOFT/WINDOWS NT/CURRENTVERSION/PERFLIB/009", &perflib_009_params }, 
-       { "HKLM/SOFTWARE/MICROSOFT/WINDOWS NT/CURRENTVERSION",          &current_version }, 
-       { "HKPT", &hkpt_params },
-       { NULL, NULL }
-};
-
-/***********************************************************************
-***********************************************************************/
-
-int fetch_dynamic_reg_values( REGISTRY_KEY *key, REGVAL_CTR *val )
-{
-       int i;
-       char *path = NULL;
-       TALLOC_CTX *ctx = talloc_tos();
-
-       path = talloc_strdup(ctx, key->name);
-       if (!path) {
-               return -1;
-       }
-       path = normalize_reg_path(ctx, path);
-       if (!path) {
-               return -1;
-       }
-
-       for ( i=0; dynamic_values[i].path; i++ ) {
-               if ( strcmp( path, dynamic_values[i].path ) == 0 )
-                       return dynamic_values[i].fetch_values( val );
-       }
-
-       return -1;
-}
-
-/***********************************************************************
-***********************************************************************/
-
-bool check_dynamic_reg_values( REGISTRY_KEY *key )
-{
-       int i;
-       char *path = NULL;
-       TALLOC_CTX *ctx = talloc_tos();
-
-       path = talloc_strdup(ctx, key->name);
-       if (!path) {
-               return false;
-       }
-       path = normalize_reg_path(ctx, path);
-       if (!path) {
-               return false;
-       }
-
-       for ( i=0; dynamic_values[i].path; i++ ) {
-               /* can't write to dynamic keys */
-               if ( strcmp( path, dynamic_values[i].path ) == 0 )
-                       return true;
-       }
-
-       return false;
-}
diff --git a/source/registry/reg_frontend.c b/source/registry/reg_frontend.c
deleted file mode 100644 (file)
index 40d9192..0000000
+++ /dev/null
@@ -1,202 +0,0 @@
-/* 
- *  Unix SMB/CIFS implementation.
- *  Virtual Windows Registry Layer
- *  Copyright (C) Gerald Carter                     2002-2005
- *
- *  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/>.
- */
-
-/* Implementation of registry frontend view functions. */
-
-#include "includes.h"
-
-#undef DBGC_CLASS
-#define DBGC_CLASS DBGC_REGISTRY
-
-extern REGISTRY_OPS printing_ops;
-extern REGISTRY_OPS eventlog_ops;
-extern REGISTRY_OPS shares_reg_ops;
-extern REGISTRY_OPS smbconf_reg_ops;
-extern REGISTRY_OPS regdb_ops;         /* these are the default */
-
-/* array of REGISTRY_HOOK's which are read into a tree for easy access */
-/* #define REG_TDB_ONLY                1 */
-
-REGISTRY_HOOK reg_hooks[] = {
-#ifndef REG_TDB_ONLY 
-  { KEY_PRINTING,              &printing_ops },
-  { KEY_PRINTING_2K,           &printing_ops },
-  { KEY_PRINTING_PORTS,        &printing_ops },
-  { KEY_SHARES,                &shares_reg_ops },
-  { KEY_SMBCONF,               &smbconf_reg_ops },
-#endif
-  { NULL, NULL }
-};
-
-/***********************************************************************
- Open the registry database and initialize the REGISTRY_HOOK cache
- ***********************************************************************/
-bool init_registry( void )
-{
-       int i;
-       bool ret = false;
-       TALLOC_CTX *frame = talloc_stackframe();
-       
-       
-       if ( !regdb_init() ) {
-               DEBUG(0,("init_registry: failed to initialize the registry tdb!\n"));
-               goto fail;
-       }
-
-       /* build the cache tree of registry hooks */
-       
-       reghook_cache_init();
-       
-       for ( i=0; reg_hooks[i].keyname; i++ ) {
-               if ( !reghook_cache_add(&reg_hooks[i]) )
-                       goto fail;
-       }
-
-       if ( DEBUGLEVEL >= 20 )
-               reghook_dump_cache(20);
-
-       /* add any keys for other services */
-
-       svcctl_init_keys();
-       eventlog_init_keys();
-       perfcount_init_keys();
-
-       /* close and let each smbd open up as necessary */
-
-       regdb_close();
-
-       ret = true;
- fail:
-       TALLOC_FREE(frame);
-       return ret;
-}
-
-WERROR regkey_open_internal( TALLOC_CTX *ctx, REGISTRY_KEY **regkey,
-                            const char *path,
-                             const struct nt_user_token *token,
-                            uint32 access_desired )
-{
-       struct registry_key *key;
-       WERROR err;
-
-       err = reg_open_path(NULL, path, access_desired, token, &key);
-       if (!W_ERROR_IS_OK(err)) {
-               return err;
-       }
-
-       *regkey = talloc_move(ctx, &key->key);
-       TALLOC_FREE(key);
-       return WERR_OK;
-}
-
-/*
- * Utility function to create a registry key without opening the hive
- * before. Assumes the hive already exists.
- */
-
-WERROR reg_create_path(TALLOC_CTX *mem_ctx, const char *orig_path,
-                      uint32 desired_access,
-                      const struct nt_user_token *token,
-                      enum winreg_CreateAction *paction,
-                      struct registry_key **pkey)
-{
-       struct registry_key *hive;
-       char *path, *p;
-       WERROR err;
-
-       if (!(path = SMB_STRDUP(orig_path))) {
-               return WERR_NOMEM;
-       }
-
-       p = strchr(path, '\\');
-
-       if ((p == NULL) || (p[1] == '\0')) {
-               /*
-                * No key behind the hive, just return the hive
-                */
-
-               err = reg_openhive(mem_ctx, path, desired_access, token,
-                                  &hive);
-               if (!W_ERROR_IS_OK(err)) {
-                       SAFE_FREE(path);
-                       return err;
-               }
-               SAFE_FREE(path);
-               *pkey = hive;
-               *paction = REG_OPENED_EXISTING_KEY;
-               return WERR_OK;
-       }
-
-       *p = '\0';
-
-       err = reg_openhive(mem_ctx, path,
-                          (strchr(p+1, '\\') != NULL) ?
-                          SEC_RIGHTS_ENUM_SUBKEYS : SEC_RIGHTS_CREATE_SUBKEY,
-                          token, &hive);
-       if (!W_ERROR_IS_OK(err)) {
-               SAFE_FREE(path);
-               return err;
-       }
-
-       err = reg_createkey(mem_ctx, hive, p+1, desired_access, pkey, paction);
-       SAFE_FREE(path);
-       TALLOC_FREE(hive);
-       return err;
-}
-
-/*
- * Utility function to create a registry key without opening the hive
- * before. Will not delete a hive.
- */
-
-WERROR reg_delete_path(const struct nt_user_token *token,
-                      const char *orig_path)
-{
-       struct registry_key *hive;
-       char *path, *p;
-       WERROR err;
-
-       if (!(path = SMB_STRDUP(orig_path))) {
-               return WERR_NOMEM;
-       }
-
-       p = strchr(path, '\\');
-
-       if ((p == NULL) || (p[1] == '\0')) {
-               SAFE_FREE(path);
-               return WERR_INVALID_PARAM;
-       }
-
-       *p = '\0';
-
-       err = reg_openhive(NULL, path,
-                          (strchr(p+1, '\\') != NULL) ?
-                          SEC_RIGHTS_ENUM_SUBKEYS : SEC_RIGHTS_CREATE_SUBKEY,
-                          token, &hive);
-       if (!W_ERROR_IS_OK(err)) {
-               SAFE_FREE(path);
-               return err;
-       }
-
-       err = reg_deletekey(hive, p+1);
-       SAFE_FREE(path);
-       TALLOC_FREE(hive);
-       return err;
-}
diff --git a/source/registry/reg_init_full.c b/source/registry/reg_init_full.c
new file mode 100644 (file)
index 0000000..b6a644b
--- /dev/null
@@ -0,0 +1,103 @@
+/* 
+ *  Unix SMB/CIFS implementation.
+ *  Virtual Windows Registry Layer
+ *  Copyright (C) Gerald Carter                     2002-2005
+ *  Copyright (C) Michael Adam                      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/>.
+ */
+
+/* Initialize the registry with all available backends. */
+
+#include "includes.h"
+
+#undef DBGC_CLASS
+#define DBGC_CLASS DBGC_REGISTRY
+
+extern REGISTRY_OPS printing_ops;
+extern REGISTRY_OPS eventlog_ops;
+extern REGISTRY_OPS shares_reg_ops;
+extern REGISTRY_OPS smbconf_reg_ops;
+extern REGISTRY_OPS netlogon_params_reg_ops;
+extern REGISTRY_OPS prod_options_reg_ops;
+extern REGISTRY_OPS tcpip_params_reg_ops;
+extern REGISTRY_OPS hkpt_params_reg_ops;
+extern REGISTRY_OPS current_version_reg_ops;
+extern REGISTRY_OPS perflib_reg_ops;
+extern REGISTRY_OPS regdb_ops;         /* these are the default */
+
+/* array of REGISTRY_HOOK's which are read into a tree for easy access */
+/* #define REG_TDB_ONLY                1 */
+
+REGISTRY_HOOK reg_hooks[] = {
+#ifndef REG_TDB_ONLY 
+  { KEY_PRINTING,              &printing_ops },
+  { KEY_PRINTING_2K,           &printing_ops },
+  { KEY_PRINTING_PORTS,        &printing_ops },
+  { KEY_SHARES,                &shares_reg_ops },
+  { KEY_SMBCONF,               &smbconf_reg_ops },
+  { KEY_NETLOGON_PARAMS,       &netlogon_params_reg_ops },
+  { KEY_PROD_OPTIONS,          &prod_options_reg_ops },
+  { KEY_TCPIP_PARAMS,          &tcpip_params_reg_ops },
+  { KEY_HKPT,                  &hkpt_params_reg_ops },
+  { KEY_CURRENT_VERSION,       &current_version_reg_ops },
+  { KEY_PERFLIB,               &perflib_reg_ops },
+#endif
+  { NULL, NULL }
+};
+
+/***********************************************************************
+ Open the registry database and initialize the REGISTRY_HOOK cache
+ with all available backens.
+ ***********************************************************************/
+bool init_registry( void )
+{
+       int i;
+       bool ret = false;
+       TALLOC_CTX *frame = talloc_stackframe();
+       
+       
+       if ( !regdb_init() ) {
+               DEBUG(0,("init_registry: failed to initialize the registry tdb!\n"));
+               goto fail;
+       }
+
+       /* build the cache tree of registry hooks */
+       
+       reghook_cache_init();
+       
+       for ( i=0; reg_hooks[i].keyname; i++ ) {
+               if ( !reghook_cache_add(&reg_hooks[i]) )
+                       goto fail;
+       }
+
+       if ( DEBUGLEVEL >= 20 )
+               reghook_dump_cache(20);
+
+       /* add any keys for other services */
+
+       svcctl_init_keys();
+       eventlog_init_keys();
+       perfcount_init_keys();
+
+       /* close and let each smbd open up as necessary */
+
+       regdb_close();
+
+       ret = true;
+ fail:
+       TALLOC_FREE(frame);
+       return ret;
+}
similarity index 75%
rename from source/lib/util_reg_smbconf.c
rename to source/registry/reg_init_smbconf.c
index 154c67ab8fd52411a206c0106febfb44a2963c80..6452b0b15bcad8d6a68ceb62804e8c9b4e707696 100644 (file)
@@ -26,28 +26,40 @@ extern REGISTRY_OPS smbconf_reg_ops;
 
 /*
  * create a fake token just with enough rights to
- * locally access the registry.
+ * locally access the registry:
+ *
+ * - builtin administrators sid
+ * - disk operators privilege
  */
-NT_USER_TOKEN *registry_create_admin_token(TALLOC_CTX *mem_ctx)
+NTSTATUS registry_create_admin_token(TALLOC_CTX *mem_ctx,
+                                    NT_USER_TOKEN **ptoken)
 {
+       NTSTATUS status;
        NT_USER_TOKEN *token = NULL;
 
-       /* fake a user token: builtin administrators sid and the
-        * disk operators privilege is all we need to access the 
-        * registry... */
-       if (!(token = TALLOC_ZERO_P(mem_ctx, NT_USER_TOKEN))) {
+       if (ptoken == NULL) {
+               return NT_STATUS_INVALID_PARAMETER;
+       }
+
+       token = TALLOC_ZERO_P(mem_ctx, NT_USER_TOKEN);
+       if (token == NULL) {
                DEBUG(1, ("talloc failed\n"));
+               status = NT_STATUS_NO_MEMORY;
                goto done;
        }
        token->privileges = se_disk_operators;
-       if (!add_sid_to_array(token, &global_sid_Builtin_Administrators,
-                        &token->user_sids, &token->num_sids)) {
+       status = add_sid_to_array(token, &global_sid_Builtin_Administrators,
+                                 &token->user_sids, &token->num_sids);
+       if (!NT_STATUS_IS_OK(status)) {
                DEBUG(1, ("Error adding builtin administrators sid "
                          "to fake token.\n"));
                goto done;
        }
+
+       *ptoken = token;
+
 done:
-       return token;
+       return status;
 }
 
 /*
@@ -57,7 +69,7 @@ done:
  */
 bool registry_init_regdb(void)
 {
-       bool ret = False;
+       bool ret = false;
        int saved_errno = 0;
        static REGISTRY_HOOK smbconf_reg_hook = {KEY_SMBCONF, &smbconf_reg_ops};
 
@@ -78,7 +90,7 @@ bool registry_init_regdb(void)
                goto done;
        }
 
-       ret = True;
+       ret = true;
 
 done:
        return ret;
diff --git a/source/registry/reg_util_legacy.c b/source/registry/reg_util_legacy.c
new file mode 100644 (file)
index 0000000..3e68025
--- /dev/null
@@ -0,0 +1,47 @@
+/* 
+ *  Unix SMB/CIFS implementation.
+ *  Virtual Windows Registry Layer
+ *  Copyright (C) Gerald Carter                     2002-2005
+ *
+ *  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/>.
+ */
+
+/* Implementation of registry frontend view functions. */
+
+#include "includes.h"
+
+#undef DBGC_CLASS
+#define DBGC_CLASS DBGC_REGISTRY
+
+/**
+ * legacy open key function that should be replaced by uses of
+ * reg_open_path
+ */
+WERROR regkey_open_internal( TALLOC_CTX *ctx, REGISTRY_KEY **regkey,
+                            const char *path,
+                             const struct nt_user_token *token,
+                            uint32 access_desired )
+{
+       struct registry_key *key;
+       WERROR err;
+
+       err = reg_open_path(NULL, path, access_desired, token, &key);
+       if (!W_ERROR_IS_OK(err)) {
+               return err;
+       }
+
+       *regkey = talloc_move(ctx, &key->key);
+       TALLOC_FREE(key);
+       return WERR_OK;
+}
index 22700e6481727af5456bbf63df5a6986159f3464..3740ff0ee4a5d8e956fd891b6f71aa92144a2a7f 100644 (file)
@@ -1234,7 +1234,7 @@ static void regfio_mem_free( REGF_FILE *file )
 
        /* cleanup for a file opened for write */
 
-       if ( file->open_flags & (O_WRONLY|O_RDWR) ) {
+       if ((file->fd != -1) && (file->open_flags & (O_WRONLY|O_RDWR))) {
                prs_struct ps;
                REGF_SK_REC *sk;
 
@@ -1554,7 +1554,7 @@ static uint32 sk_record_data_size( SEC_DESC * sd )
 
        /* the record size is sizeof(hdr) + name + static members + data_size_field */
 
-       size = sizeof(uint32)*5 + sec_desc_size( sd ) + sizeof(uint32);
+       size = sizeof(uint32)*5 + ndr_size_security_descriptor(sd, 0) + sizeof(uint32);
 
        /* multiple of 8 */
        size_mod8 = size & 0xfffffff8;
@@ -1784,7 +1784,8 @@ static int hashrec_cmp( REGF_HASH_REC *h1, REGF_HASH_REC *h2 )
                        nk->sec_desc->ref_count = 0;
                        
                        /* size value must be self-inclusive */
-                       nk->sec_desc->size      = sec_desc_size(sec_desc) + sizeof(uint32);
+                       nk->sec_desc->size      = ndr_size_security_descriptor(sec_desc, 0)
+                               + sizeof(uint32);
 
                        DLIST_ADD_END( file->sec_desc_list, nk->sec_desc, REGF_SK_REC *);
 
diff --git a/source/rpc_client/cli_ds.c b/source/rpc_client/cli_ds.c
deleted file mode 100644 (file)
index 71516b8..0000000
+++ /dev/null
@@ -1,138 +0,0 @@
-/* 
-   Unix SMB/CIFS implementation.
-   RPC pipe client
-   Copyright (C) Gerald Carter                        2002,
-   Copyright (C) Jeremy Allison                                2005.
-   
-   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"
-
-/* implementations of client side DsXXX() functions */
-
-/********************************************************************
- Get information about the server and directory services
-********************************************************************/
-
-NTSTATUS rpccli_ds_getprimarydominfo(struct rpc_pipe_client *cli,
-                                    TALLOC_CTX *mem_ctx, 
-                                    uint16 level, DS_DOMINFO_CTR *ctr)
-{
-       prs_struct qbuf, rbuf;
-       DS_Q_GETPRIMDOMINFO q;
-       DS_R_GETPRIMDOMINFO r;
-       NTSTATUS result;
-
-       ZERO_STRUCT(q);
-       ZERO_STRUCT(r);
-
-       q.level = level;
-       
-       CLI_DO_RPC( cli, mem_ctx, PI_LSARPC_DS, DS_GETPRIMDOMINFO,
-               q, r,
-               qbuf, rbuf,
-               ds_io_q_getprimdominfo,
-               ds_io_r_getprimdominfo,
-               NT_STATUS_UNSUCCESSFUL);
-       
-       /* Return basic info - if we are requesting at info != 1 then
-          there could be trouble. */ 
-
-       result = r.status;
-
-       if ( r.ptr && ctr ) {
-               ctr->basic = TALLOC_P(mem_ctx, DSROLE_PRIMARY_DOMAIN_INFO_BASIC);
-               if (!ctr->basic)
-                       goto done;
-               memcpy(ctr->basic, r.info.basic, sizeof(DSROLE_PRIMARY_DOMAIN_INFO_BASIC));
-       }
-       
-done:
-
-       return result;
-}
-
-/********************************************************************
- Enumerate trusted domains in an AD forest
-********************************************************************/
-
-NTSTATUS rpccli_ds_enum_domain_trusts(struct rpc_pipe_client *cli,
-                                     TALLOC_CTX *mem_ctx, 
-                                     const char *server, uint32 flags, 
-                                     struct ds_domain_trust **trusts,
-                                     uint32 *num_domains)
-{
-       prs_struct qbuf, rbuf;
-       DS_Q_ENUM_DOM_TRUSTS q;
-       DS_R_ENUM_DOM_TRUSTS r;
-       NTSTATUS result;
-
-       ZERO_STRUCT(q);
-       ZERO_STRUCT(r);
-
-       init_q_ds_enum_domain_trusts( &q, server, flags );
-               
-       CLI_DO_RPC( cli, mem_ctx, PI_NETLOGON, DS_ENUM_DOM_TRUSTS,
-               q, r,
-               qbuf, rbuf,
-               ds_io_q_enum_domain_trusts,
-               ds_io_r_enum_domain_trusts,
-               NT_STATUS_UNSUCCESSFUL);
-       
-       result = r.status;
-       
-       if ( NT_STATUS_IS_OK(result) ) {
-               int i;
-       
-               *num_domains = r.num_domains;
-               if (r.num_domains) {
-                       *trusts = TALLOC_ARRAY(mem_ctx, struct ds_domain_trust, r.num_domains);
-
-                       if (*trusts == NULL) {
-                               return NT_STATUS_NO_MEMORY;
-                       }
-               } else {
-                       *trusts = NULL;
-               }
-
-               for ( i=0; i< *num_domains; i++ ) {
-                       (*trusts)[i].flags = r.domains.trusts[i].flags;
-                       (*trusts)[i].parent_index = r.domains.trusts[i].parent_index;
-                       (*trusts)[i].trust_type = r.domains.trusts[i].trust_type;
-                       (*trusts)[i].trust_attributes = r.domains.trusts[i].trust_attributes;
-                       (*trusts)[i].guid = r.domains.trusts[i].guid;
-
-                       if (r.domains.trusts[i].sid_ptr) {
-                               sid_copy(&(*trusts)[i].sid, &r.domains.trusts[i].sid.sid);
-                       } else {
-                               ZERO_STRUCT((*trusts)[i].sid);
-                       }
-
-                       if (r.domains.trusts[i].netbios_ptr) {
-                               (*trusts)[i].netbios_domain = unistr2_to_ascii_talloc( mem_ctx, &r.domains.trusts[i].netbios_domain );
-                       } else {
-                               (*trusts)[i].netbios_domain = NULL;
-                       }
-
-                       if (r.domains.trusts[i].dns_ptr) {
-                               (*trusts)[i].dns_domain = unistr2_to_ascii_talloc( mem_ctx, &r.domains.trusts[i].dns_domain );
-                       } else {
-                               (*trusts)[i].dns_domain = NULL;
-                       }
-               }
-       }
-       
-       return result;
-}
index 6abc67fc35eee4a461cdb1674d833a9702f15752..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)
 {
@@ -716,41 +718,6 @@ NTSTATUS rpccli_lsa_query_info_policy2(struct rpc_pipe_client *cli,
        return result;
 }
 
-NTSTATUS rpccli_lsa_set_info_policy(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
-                                   POLICY_HND *pol, uint16 info_class,
-                                   LSA_INFO_CTR ctr)
-{
-       prs_struct qbuf, rbuf;
-       LSA_Q_SET_INFO q;
-       LSA_R_SET_INFO r;
-       NTSTATUS result;
-
-       ZERO_STRUCT(q);
-       ZERO_STRUCT(r);
-
-       init_q_set(&q, pol, info_class, ctr);
-
-       CLI_DO_RPC(cli, mem_ctx, PI_LSARPC, LSA_SETINFOPOLICY,
-               q, r,
-               qbuf, rbuf,
-               lsa_io_q_set,
-               lsa_io_r_set,
-               NT_STATUS_UNSUCCESSFUL);
-
-       result = r.status;
-
-       if (!NT_STATUS_IS_OK(result)) {
-               goto done;
-       }
-
-       /* Return output parameters */
-
- done:
-
-       return result;
-}
-
-
 /**
  * Enumerate list of trusted domains
  *
@@ -1468,222 +1435,3 @@ Error was : %s.\n", remote_machine, cli_errstr(&cli) ));
 }
 
 #endif
-
-NTSTATUS rpccli_lsa_open_trusted_domain(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
-                                    POLICY_HND *pol, DOM_SID *dom_sid, uint32 access_mask,
-                                    POLICY_HND *trustdom_pol)
-{
-       prs_struct qbuf, rbuf;
-       LSA_Q_OPEN_TRUSTED_DOMAIN q;
-       LSA_R_OPEN_TRUSTED_DOMAIN r;
-       NTSTATUS result;
-
-       ZERO_STRUCT(q);
-       ZERO_STRUCT(r);
-
-       /* Initialise input parameters */
-
-       init_lsa_q_open_trusted_domain(&q, pol, dom_sid, access_mask);
-
-       /* Marshall data and send request */
-
-       CLI_DO_RPC( cli, mem_ctx, PI_LSARPC, LSA_OPENTRUSTDOM,
-               q, r,
-               qbuf, rbuf,
-               lsa_io_q_open_trusted_domain,
-               lsa_io_r_open_trusted_domain,
-               NT_STATUS_UNSUCCESSFUL);
-
-       /* Return output parameters */
-
-       result = r.status;
-
-       if (NT_STATUS_IS_OK(result)) {
-               *trustdom_pol = r.handle;
-       }
-
-       return result;
-}
-
-NTSTATUS rpccli_lsa_query_trusted_domain_info(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
-                                          POLICY_HND *pol,
-                                          uint16 info_class,
-                                          LSA_TRUSTED_DOMAIN_INFO **info)
-{
-       prs_struct qbuf, rbuf;
-       LSA_Q_QUERY_TRUSTED_DOMAIN_INFO q;
-       LSA_R_QUERY_TRUSTED_DOMAIN_INFO r;
-       NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
-
-       ZERO_STRUCT(q);
-       ZERO_STRUCT(r);
-
-       /* Marshall data and send request */
-
-       init_q_query_trusted_domain_info(&q, pol, info_class);
-
-       CLI_DO_RPC( cli, mem_ctx, PI_LSARPC, LSA_QUERYTRUSTDOMINFO,
-               q, r,
-               qbuf, rbuf,
-               lsa_io_q_query_trusted_domain_info,
-               lsa_io_r_query_trusted_domain_info,
-               NT_STATUS_UNSUCCESSFUL);
-
-       result = r.status;
-
-       if (!NT_STATUS_IS_OK(result)) {
-               goto done;
-       }
-
-       *info = r.info;
-
-done:
-       return result;
-}
-
-NTSTATUS rpccli_lsa_open_trusted_domain_by_name(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
-                                               POLICY_HND *pol, const char *name, uint32 access_mask,
-                                               POLICY_HND *trustdom_pol)
-{
-       prs_struct qbuf, rbuf;
-       LSA_Q_OPEN_TRUSTED_DOMAIN_BY_NAME q;
-       LSA_R_OPEN_TRUSTED_DOMAIN_BY_NAME r;
-       NTSTATUS result;
-
-       ZERO_STRUCT(q);
-       ZERO_STRUCT(r);
-
-       /* Initialise input parameters */
-
-       init_lsa_q_open_trusted_domain_by_name(&q, pol, name, access_mask);
-
-       /* Marshall data and send request */
-
-       CLI_DO_RPC( cli, mem_ctx, PI_LSARPC, LSA_OPENTRUSTDOMBYNAME,
-               q, r,
-               qbuf, rbuf,
-               lsa_io_q_open_trusted_domain_by_name,
-               lsa_io_r_open_trusted_domain_by_name,
-               NT_STATUS_UNSUCCESSFUL);
-
-       /* Return output parameters */
-
-       result = r.status;
-
-       if (NT_STATUS_IS_OK(result)) {
-               *trustdom_pol = r.handle;
-       }
-
-       return result;
-}
-
-
-NTSTATUS rpccli_lsa_query_trusted_domain_info_by_sid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
-                                                 POLICY_HND *pol,
-                                                 uint16 info_class, DOM_SID *dom_sid,
-                                                 LSA_TRUSTED_DOMAIN_INFO **info)
-{
-       prs_struct qbuf, rbuf;
-       LSA_Q_QUERY_TRUSTED_DOMAIN_INFO_BY_SID q;
-       LSA_R_QUERY_TRUSTED_DOMAIN_INFO r;
-       NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
-
-       ZERO_STRUCT(q);
-       ZERO_STRUCT(r);
-
-       /* Marshall data and send request */
-
-       init_q_query_trusted_domain_info_by_sid(&q, pol, info_class, dom_sid);
-
-       CLI_DO_RPC( cli, mem_ctx, PI_LSARPC, LSA_QUERYTRUSTDOMINFOBYSID,
-               q, r,
-               qbuf, rbuf,
-               lsa_io_q_query_trusted_domain_info_by_sid,
-               lsa_io_r_query_trusted_domain_info,
-               NT_STATUS_UNSUCCESSFUL);
-
-       result = r.status;
-
-       if (!NT_STATUS_IS_OK(result)) {
-               goto done;
-       }
-
-       *info = r.info;
-
-done:
-
-       return result;
-}
-
-NTSTATUS rpccli_lsa_query_trusted_domain_info_by_name(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
-                                                  POLICY_HND *pol,
-                                                  uint16 info_class, const char *domain_name,
-                                                  LSA_TRUSTED_DOMAIN_INFO **info)
-{
-       prs_struct qbuf, rbuf;
-       LSA_Q_QUERY_TRUSTED_DOMAIN_INFO_BY_NAME q;
-       LSA_R_QUERY_TRUSTED_DOMAIN_INFO r;
-       NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
-
-       ZERO_STRUCT(q);
-       ZERO_STRUCT(r);
-
-       /* Marshall data and send request */
-
-       init_q_query_trusted_domain_info_by_name(&q, pol, info_class, domain_name);
-
-       CLI_DO_RPC( cli, mem_ctx, PI_LSARPC, LSA_QUERYTRUSTDOMINFOBYNAME,
-               q, r,
-               qbuf, rbuf,
-               lsa_io_q_query_trusted_domain_info_by_name,
-               lsa_io_r_query_trusted_domain_info,
-               NT_STATUS_UNSUCCESSFUL);
-
-       result = r.status;
-
-       if (!NT_STATUS_IS_OK(result)) {
-               goto done;
-       }
-
-       *info = r.info;
-
-done:
-
-       return result;
-}
-
-NTSTATUS cli_lsa_query_domain_info_policy(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
-                                         POLICY_HND *pol,
-                                         uint16 info_class, LSA_DOM_INFO_UNION **info)
-{
-       prs_struct qbuf, rbuf;
-       LSA_Q_QUERY_DOM_INFO_POLICY q;
-       LSA_R_QUERY_DOM_INFO_POLICY r;
-       NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
-
-       ZERO_STRUCT(q);
-       ZERO_STRUCT(r);
-
-       /* Marshall data and send request */
-
-       init_q_query_dom_info(&q, pol, info_class);
-
-       CLI_DO_RPC( cli, mem_ctx, PI_LSARPC, LSA_QUERYDOMINFOPOL,
-               q, r,
-               qbuf, rbuf,
-               lsa_io_q_query_dom_info,
-               lsa_io_r_query_dom_info,
-               NT_STATUS_UNSUCCESSFUL);
-
-       result = r.status;
-
-       if (!NT_STATUS_IS_OK(result)) {
-               goto done;
-       }
-
-       *info = r.info;
-
-done:
-       return result;
-}
-
index 3cb5827e73d126bd75edd0c2343434fc952c61ec..54c6c7f23ecb3e28621182b06533bbbf5042ad78 100644 (file)
@@ -383,7 +383,7 @@ NTSTATUS rpccli_netlogon_logon_ctrl2(struct rpc_pipe_client *cli, TALLOC_CTX *me
 
 WERROR rpccli_netlogon_getanydcname(struct rpc_pipe_client *cli,
                                    TALLOC_CTX *mem_ctx, const char *mydcname,
-                                   const char *domainname, fstring newdcname)
+                                   const char *domainname, char **newdcname)
 {
        prs_struct qbuf, rbuf;
        NET_Q_GETANYDCNAME q;
@@ -410,8 +410,9 @@ WERROR rpccli_netlogon_getanydcname(struct rpc_pipe_client *cli,
 
        result = r.status;
 
-       if (W_ERROR_IS_OK(result)) {
-               rpcstr_pull_unistr2_fstring(newdcname, &r.uni_dcname);
+       if (W_ERROR_IS_OK(result) && newdcname) {
+               *newdcname = rpcstr_pull_unistr2_talloc(mem_ctx, &r.uni_dcname);
+               W_ERROR_HAVE_NO_MEMORY(*newdcname);
        }
 
        return result;
@@ -421,7 +422,7 @@ WERROR rpccli_netlogon_getanydcname(struct rpc_pipe_client *cli,
 
 WERROR rpccli_netlogon_getdcname(struct rpc_pipe_client *cli,
                                 TALLOC_CTX *mem_ctx, const char *mydcname,
-                                const char *domainname, fstring newdcname)
+                                const char *domainname, char **newdcname)
 {
        prs_struct qbuf, rbuf;
        NET_Q_GETDCNAME q;
@@ -448,8 +449,9 @@ WERROR rpccli_netlogon_getdcname(struct rpc_pipe_client *cli,
 
        result = r.status;
 
-       if (W_ERROR_IS_OK(result)) {
-               rpcstr_pull_unistr2_fstring(newdcname, &r.uni_dcname);
+       if (W_ERROR_IS_OK(result) && newdcname) {
+               *newdcname = rpcstr_pull_unistr2_talloc(mem_ctx, &r.uni_dcname);
+               W_ERROR_HAVE_NO_MEMORY(*newdcname);
        }
 
        return result;
@@ -591,109 +593,6 @@ WERROR rpccli_netlogon_dsr_getdcname(struct rpc_pipe_client *cli,
        return WERR_OK;
 }
 
-/* Dsr_GetDCNameEx */
-
-WERROR rpccli_netlogon_dsr_getdcnameex(struct rpc_pipe_client *cli,
-                                      TALLOC_CTX *mem_ctx,
-                                      const char *server_name,
-                                      const char *domain_name,
-                                      struct GUID *domain_guid,
-                                      const char *site_name,
-                                      uint32_t flags,
-                                      struct DS_DOMAIN_CONTROLLER_INFO **info_out)
-{
-       prs_struct qbuf, rbuf;
-       NET_Q_DSR_GETDCNAMEEX q;
-       NET_R_DSR_GETDCNAME r;
-       char *tmp_str;
-
-       ZERO_STRUCT(q);
-       ZERO_STRUCT(r);
-
-       /* Initialize input parameters */
-
-       tmp_str = talloc_asprintf(mem_ctx, "\\\\%s", server_name);
-       if (tmp_str == NULL) {
-               return WERR_NOMEM;
-       }
-
-       init_net_q_dsr_getdcnameex(&q, server_name, domain_name, domain_guid,
-                                  site_name, flags);
-
-       /* Marshall data and send request */
-
-       CLI_DO_RPC_WERR(cli, mem_ctx, PI_NETLOGON, NET_DSR_GETDCNAMEEX,
-                       q, r,
-                       qbuf, rbuf,
-                       net_io_q_dsr_getdcnameex,
-                       net_io_r_dsr_getdcname,
-                       WERR_GENERAL_FAILURE);
-
-       if (!W_ERROR_IS_OK(r.result)) {
-               return r.result;
-       }
-
-       r.result = pull_domain_controller_info_from_getdcname_reply(mem_ctx, info_out, &r);
-       if (!W_ERROR_IS_OK(r.result)) {
-               return r.result;
-       }
-
-       return WERR_OK;
-}
-
-/* Dsr_GetDCNameEx */
-
-WERROR rpccli_netlogon_dsr_getdcnameex2(struct rpc_pipe_client *cli,
-                                       TALLOC_CTX *mem_ctx,
-                                       const char *server_name,
-                                       const char *client_account,
-                                       uint32 mask,
-                                       const char *domain_name,
-                                       struct GUID *domain_guid,
-                                       const char *site_name,
-                                       uint32_t flags,
-                                       struct DS_DOMAIN_CONTROLLER_INFO **info_out)
-{
-       prs_struct qbuf, rbuf;
-       NET_Q_DSR_GETDCNAMEEX2 q;
-       NET_R_DSR_GETDCNAME r;
-       char *tmp_str;
-
-       ZERO_STRUCT(q);
-       ZERO_STRUCT(r);
-
-       /* Initialize input parameters */
-
-       tmp_str = talloc_asprintf(mem_ctx, "\\\\%s", server_name);
-       if (tmp_str == NULL) {
-               return WERR_NOMEM;
-       }
-
-       init_net_q_dsr_getdcnameex2(&q, server_name, domain_name, client_account,
-                                   mask, domain_guid, site_name, flags);
-
-       /* Marshall data and send request */
-
-       CLI_DO_RPC_WERR(cli, mem_ctx, PI_NETLOGON, NET_DSR_GETDCNAMEEX2,
-                       q, r,
-                       qbuf, rbuf,
-                       net_io_q_dsr_getdcnameex2,
-                       net_io_r_dsr_getdcname,
-                       WERR_GENERAL_FAILURE);
-
-       if (!W_ERROR_IS_OK(r.result)) {
-               return r.result;
-       }
-
-       r.result = pull_domain_controller_info_from_getdcname_reply(mem_ctx, info_out, &r);
-       if (!W_ERROR_IS_OK(r.result)) {
-               return r.result;
-       }
-
-       return WERR_OK;
-}
-
-
 /* Dsr_GetSiteName */
 
 WERROR rpccli_netlogon_dsr_getsitename(struct rpc_pipe_client *cli,
@@ -976,11 +875,12 @@ NTSTATUS rpccli_netlogon_sam_network_logon(struct rpc_pipe_client *cli,
        int validation_level = 3;
        const char *workstation_name_slash;
        const char *server_name_slash;
-       static uint8 zeros[16];
+       uint8 zeros[16];
        DOM_CRED clnt_creds;
        DOM_CRED ret_creds;
        int i;
-       
+
+       ZERO_STRUCT(zeros);
        ZERO_STRUCT(q);
        ZERO_STRUCT(r);
        ZERO_STRUCT(ret_creds);
@@ -1082,9 +982,10 @@ NTSTATUS rpccli_netlogon_sam_network_logon_ex(struct rpc_pipe_client *cli,
        int validation_level = 3;
        const char *workstation_name_slash;
        const char *server_name_slash;
-       static uint8 zeros[16];
+       uint8 zeros[16];
        int i;
-       
+
+       ZERO_STRUCT(zeros);
        ZERO_STRUCT(q);
        ZERO_STRUCT(r);
 
index f61ea95d042e02fe31cdc119c1b265ffc9cc505b..40d0ac5da9682f7e40538e1eb0b910e45955a2f7 100644 (file)
@@ -2263,7 +2263,7 @@ struct rpc_pipe_client *cli_rpc_pipe_open_noauth(struct cli_state *cli, int pipe
        *perr = rpc_pipe_bind(result, PIPE_AUTH_TYPE_NONE, PIPE_AUTH_LEVEL_NONE);
        if (!NT_STATUS_IS_OK(*perr)) {
                int lvl = 0;
-               if (pipe_idx == PI_LSARPC_DS) {
+               if (pipe_idx == PI_DSSETUP) {
                        /* non AD domains just don't have this pipe, avoid
                         * level 0 statement in that case - gd */
                        lvl = 3;
@@ -2364,8 +2364,8 @@ static struct rpc_pipe_client *cli_rpc_pipe_open_ntlmssp_internal(struct cli_sta
                goto err;
        }
 
-       DEBUG(10,("cli_rpc_pipe_open_ntlmssp_internal: opened pipe %s to machine %s and"
-               "bound NTLMSSP as user %s\\%s.\n",
+       DEBUG(10,("cli_rpc_pipe_open_ntlmssp_internal: opened pipe %s to "
+               "machine %s and bound NTLMSSP as user %s\\%s.\n",
                result->pipe_name, cli->desthost,
                domain, username ));
 
@@ -2466,7 +2466,6 @@ static bool get_schannel_session_key_common(struct rpc_pipe_client *netlogon_pip
        if (((*pneg_flags) & NETLOGON_NEG_SCHANNEL) == 0) {
                DEBUG(3, ("get_schannel_session_key: Server %s did not offer schannel\n",
                        cli->desthost));
-               cli_rpc_pipe_close(netlogon_pipe);
                *perr = NT_STATUS_INVALID_NETWORK_RESPONSE;
                return false;
        }
@@ -2597,7 +2596,7 @@ struct rpc_pipe_client *cli_rpc_pipe_open_ntlmssp_auth_schannel(struct cli_state
                                                const char *password,
                                                NTSTATUS *perr)
 {
-       uint32 neg_flags = NETLOGON_NEG_AUTH2_FLAGS|NETLOGON_NEG_SCHANNEL;
+       uint32 neg_flags = NETLOGON_NEG_SELECT_AUTH2_FLAGS|NETLOGON_NEG_SCHANNEL;
        struct rpc_pipe_client *netlogon_pipe = NULL;
        struct rpc_pipe_client *result = NULL;
 
@@ -2631,7 +2630,7 @@ struct rpc_pipe_client *cli_rpc_pipe_open_schannel(struct cli_state *cli,
                                                 const char *domain,
                                                NTSTATUS *perr)
 {
-       uint32 neg_flags = NETLOGON_NEG_AUTH2_FLAGS|NETLOGON_NEG_SCHANNEL;
+       uint32 neg_flags = NETLOGON_NEG_SELECT_AUTH2_FLAGS|NETLOGON_NEG_SCHANNEL;
        struct rpc_pipe_client *netlogon_pipe = NULL;
        struct rpc_pipe_client *result = NULL;
 
index bf8313816cbbb90b274cfb2996cefac191576cfc..fa1e5a645bf96b10097e1475ad928998120c09dc 100644 (file)
@@ -95,201 +95,6 @@ NTSTATUS rpccli_samr_connect4(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
        return result;
 }
 
-/* Close SAMR handle */
-
-NTSTATUS rpccli_samr_close(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
-                          POLICY_HND *connect_pol)
-{
-       prs_struct qbuf, rbuf;
-       SAMR_Q_CLOSE_HND q;
-       SAMR_R_CLOSE_HND r;
-       NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
-
-       DEBUG(10,("cli_samr_close\n"));
-
-       ZERO_STRUCT(q);
-       ZERO_STRUCT(r);
-
-       /* Marshall data and send request */
-
-       init_samr_q_close_hnd(&q, connect_pol);
-
-       CLI_DO_RPC(cli, mem_ctx, PI_SAMR, SAMR_CLOSE_HND,
-               q, r,
-               qbuf, rbuf,
-               samr_io_q_close_hnd,
-               samr_io_r_close_hnd,
-               NT_STATUS_UNSUCCESSFUL); 
-
-       /* Return output parameters */
-
-       if (NT_STATUS_IS_OK(result = r.status)) {
-#ifdef __INSURE__
-               SAFE_FREE(connect_pol->marker);
-#endif
-               *connect_pol = r.pol;
-       }
-
-       return result;
-}
-
-/* Open handle on a domain */
-
-NTSTATUS rpccli_samr_open_domain(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
-                                POLICY_HND *connect_pol, uint32 access_mask, 
-                                const DOM_SID *domain_sid,
-                                POLICY_HND *domain_pol)
-{
-       prs_struct qbuf, rbuf;
-       SAMR_Q_OPEN_DOMAIN q;
-       SAMR_R_OPEN_DOMAIN r;
-       NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
-
-       DEBUG(10,("cli_samr_open_domain with sid %s\n",
-                 sid_string_dbg(domain_sid) ));
-
-       ZERO_STRUCT(q);
-       ZERO_STRUCT(r);
-
-       /* Marshall data and send request */
-
-       init_samr_q_open_domain(&q, connect_pol, access_mask, domain_sid);
-
-       CLI_DO_RPC(cli, mem_ctx, PI_SAMR, SAMR_OPEN_DOMAIN,
-               q, r,
-               qbuf, rbuf,
-               samr_io_q_open_domain,
-               samr_io_r_open_domain,
-               NT_STATUS_UNSUCCESSFUL); 
-
-       /* Return output parameters */
-
-       if (NT_STATUS_IS_OK(result = r.status)) {
-               *domain_pol = r.domain_pol;
-#ifdef __INSURE__
-               domain_pol->marker = malloc(1);
-#endif
-       }
-
-       return result;
-}
-
-NTSTATUS rpccli_samr_open_user(struct rpc_pipe_client *cli,
-                              TALLOC_CTX *mem_ctx,
-                              POLICY_HND *domain_pol, uint32 access_mask, 
-                              uint32 user_rid, POLICY_HND *user_pol)
-{
-       prs_struct qbuf, rbuf;
-       SAMR_Q_OPEN_USER q;
-       SAMR_R_OPEN_USER r;
-       NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
-
-       DEBUG(10,("cli_samr_open_user with rid 0x%x\n", user_rid ));
-
-       ZERO_STRUCT(q);
-       ZERO_STRUCT(r);
-
-       /* Marshall data and send request */
-
-       init_samr_q_open_user(&q, domain_pol, access_mask, user_rid);
-
-       CLI_DO_RPC(cli, mem_ctx, PI_SAMR, SAMR_OPEN_USER,
-               q, r,
-               qbuf, rbuf,
-               samr_io_q_open_user,
-               samr_io_r_open_user,
-               NT_STATUS_UNSUCCESSFUL); 
-
-       /* Return output parameters */
-
-       if (NT_STATUS_IS_OK(result = r.status)) {
-               *user_pol = r.user_pol;
-#ifdef __INSURE__
-               user_pol->marker = malloc(1);
-#endif
-       }
-
-       return result;
-}
-
-/* Open handle on a group */
-
-NTSTATUS rpccli_samr_open_group(struct rpc_pipe_client *cli,
-                               TALLOC_CTX *mem_ctx, 
-                               POLICY_HND *domain_pol, uint32 access_mask, 
-                               uint32 group_rid, POLICY_HND *group_pol)
-{
-       prs_struct qbuf, rbuf;
-       SAMR_Q_OPEN_GROUP q;
-       SAMR_R_OPEN_GROUP r;
-       NTSTATUS result =  NT_STATUS_UNSUCCESSFUL;
-
-       DEBUG(10,("cli_samr_open_group with rid 0x%x\n", group_rid ));
-
-       ZERO_STRUCT(q);
-       ZERO_STRUCT(r);
-
-       /* Marshall data and send request */
-
-       init_samr_q_open_group(&q, domain_pol, access_mask, group_rid);
-
-       CLI_DO_RPC(cli, mem_ctx, PI_SAMR, SAMR_OPEN_GROUP,
-               q, r,
-               qbuf, rbuf,
-               samr_io_q_open_group,
-               samr_io_r_open_group,
-               NT_STATUS_UNSUCCESSFUL); 
-
-       /* Return output parameters */
-
-       if (NT_STATUS_IS_OK(result = r.status)) {
-               *group_pol = r.pol;
-#ifdef __INSURE__
-               group_pol->marker = malloc(1);
-#endif
-       }
-
-       return result;
-}
-
-/* Create domain group */
-
-NTSTATUS rpccli_samr_create_dom_group(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
-                                  POLICY_HND *domain_pol,
-                                  const char *group_name,
-                                  uint32 access_mask, POLICY_HND *group_pol)
-{
-       prs_struct qbuf, rbuf;
-       SAMR_Q_CREATE_DOM_GROUP q;
-       SAMR_R_CREATE_DOM_GROUP r;
-       NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
-
-       DEBUG(10,("cli_samr_create_dom_group\n"));
-
-       ZERO_STRUCT(q);
-       ZERO_STRUCT(r);
-
-       /* Marshall data and send request */
-
-       init_samr_q_create_dom_group(&q, domain_pol, group_name, access_mask);
-
-       CLI_DO_RPC(cli, mem_ctx, PI_SAMR, SAMR_CREATE_DOM_GROUP,
-               q, r,
-               qbuf, rbuf,
-               samr_io_q_create_dom_group,
-               samr_io_r_create_dom_group,
-               NT_STATUS_UNSUCCESSFUL); 
-
-       /* Return output parameters */
-
-       result = r.status;
-
-       if (NT_STATUS_IS_OK(result))
-               *group_pol = r.pol;
-
-       return result;
-}
-
 /* Add a domain group member */
 
 NTSTATUS rpccli_samr_add_groupmem(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
@@ -908,82 +713,6 @@ NTSTATUS rpccli_samr_query_aliasmem(struct rpc_pipe_client *cli,
        return result;
 }
 
-/* Open handle on an alias */
-
-NTSTATUS rpccli_samr_open_alias(struct rpc_pipe_client *cli,
-                               TALLOC_CTX *mem_ctx, 
-                               POLICY_HND *domain_pol, uint32 access_mask, 
-                               uint32 alias_rid, POLICY_HND *alias_pol)
-{
-       prs_struct qbuf, rbuf;
-       SAMR_Q_OPEN_ALIAS q;
-       SAMR_R_OPEN_ALIAS r;
-       NTSTATUS result;
-
-       DEBUG(10,("cli_samr_open_alias with rid 0x%x\n", alias_rid));
-
-       ZERO_STRUCT(q);
-       ZERO_STRUCT(r);
-
-       /* Marshall data and send request */
-
-       init_samr_q_open_alias(&q, domain_pol, access_mask, alias_rid);
-
-       CLI_DO_RPC(cli, mem_ctx, PI_SAMR, SAMR_OPEN_ALIAS,
-               q, r,
-               qbuf, rbuf,
-               samr_io_q_open_alias,
-               samr_io_r_open_alias,
-               NT_STATUS_UNSUCCESSFUL); 
-
-       /* Return output parameters */
-
-       if (NT_STATUS_IS_OK(result = r.status)) {
-               *alias_pol = r.pol;
-#ifdef __INSURE__
-               alias_pol->marker = malloc(1);
-#endif
-       }
-
-       return result;
-}
-
-/* Create an alias */
-
-NTSTATUS rpccli_samr_create_dom_alias(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, 
-                                  POLICY_HND *domain_pol, const char *name,
-                                  POLICY_HND *alias_pol)
-{
-       prs_struct qbuf, rbuf;
-       SAMR_Q_CREATE_DOM_ALIAS q;
-       SAMR_R_CREATE_DOM_ALIAS r;
-       NTSTATUS result;
-
-       DEBUG(10,("cli_samr_create_dom_alias named %s\n", name));
-
-       ZERO_STRUCT(q);
-       ZERO_STRUCT(r);
-
-       /* Marshall data and send request */
-
-       init_samr_q_create_dom_alias(&q, domain_pol, name);
-
-       CLI_DO_RPC(cli, mem_ctx, PI_SAMR, SAMR_CREATE_DOM_ALIAS,
-               q, r,
-               qbuf, rbuf,
-               samr_io_q_create_dom_alias,
-               samr_io_r_create_dom_alias,
-               NT_STATUS_UNSUCCESSFUL); 
-
-       /* Return output parameters */
-
-       if (NT_STATUS_IS_OK(result = r.status)) {
-               *alias_pol = r.alias_pol;
-       }
-
-       return result;
-}
-
 /* Add an alias member */
 
 NTSTATUS rpccli_samr_add_aliasmem(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, 
@@ -1639,51 +1368,6 @@ NTSTATUS rpccli_samr_lookup_names(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c
        return result;
 }
 
-/* Create a domain user */
-
-NTSTATUS rpccli_samr_create_dom_user(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, 
-                                  POLICY_HND *domain_pol, const char *acct_name,
-                                  uint32 acb_info, uint32 access_mask,
-                                  POLICY_HND *user_pol, uint32 *rid)
-{
-       prs_struct qbuf, rbuf;
-       SAMR_Q_CREATE_USER q;
-       SAMR_R_CREATE_USER r;
-       NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
-
-       DEBUG(10,("cli_samr_create_dom_user %s\n", acct_name));
-
-       ZERO_STRUCT(q);
-       ZERO_STRUCT(r);
-
-       /* Marshall data and send request */
-
-       init_samr_q_create_user(&q, domain_pol, acct_name, acb_info, access_mask);
-
-       CLI_DO_RPC(cli, mem_ctx, PI_SAMR, SAMR_CREATE_USER,
-               q, r,
-               qbuf, rbuf,
-               samr_io_q_create_user,
-               samr_io_r_create_user,
-               NT_STATUS_UNSUCCESSFUL); 
-
-       /* Return output parameters */
-
-       if (!NT_STATUS_IS_OK(result = r.status)) {
-               goto done;
-       }
-
-       if (user_pol)
-               *user_pol = r.user_pol;
-
-       if (rid)
-               *rid = r.user_rid;
-
- done:
-
-       return result;
-}
-
 /* Set userinfo */
 
 NTSTATUS rpccli_samr_set_userinfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, 
@@ -1778,105 +1462,6 @@ NTSTATUS rpccli_samr_set_userinfo2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_
        return result;
 }
 
-/* Delete domain group */
-
-NTSTATUS rpccli_samr_delete_dom_group(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, 
-                                  POLICY_HND *group_pol)
-{
-       prs_struct qbuf, rbuf;
-       SAMR_Q_DELETE_DOM_GROUP q;
-       SAMR_R_DELETE_DOM_GROUP r;
-       NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
-
-       DEBUG(10,("cli_samr_delete_dom_group\n"));
-
-       ZERO_STRUCT(q);
-       ZERO_STRUCT(r);
-
-       /* Marshall data and send request */
-
-       init_samr_q_delete_dom_group(&q, group_pol);
-
-       CLI_DO_RPC(cli, mem_ctx, PI_SAMR, SAMR_DELETE_DOM_GROUP,
-               q, r,
-               qbuf, rbuf,
-               samr_io_q_delete_dom_group,
-               samr_io_r_delete_dom_group,
-               NT_STATUS_UNSUCCESSFUL); 
-
-       /* Return output parameters */
-
-       result = r.status;
-
-       return result;
-}
-
-/* Delete domain alias */
-
-NTSTATUS rpccli_samr_delete_dom_alias(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, 
-                                  POLICY_HND *alias_pol)
-{
-       prs_struct qbuf, rbuf;
-       SAMR_Q_DELETE_DOM_ALIAS q;
-       SAMR_R_DELETE_DOM_ALIAS r;
-       NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
-
-       DEBUG(10,("cli_samr_delete_dom_alias\n"));
-
-       ZERO_STRUCT(q);
-       ZERO_STRUCT(r);
-
-       /* Marshall data and send request */
-
-       init_samr_q_delete_dom_alias(&q, alias_pol);
-
-       CLI_DO_RPC(cli, mem_ctx, PI_SAMR, SAMR_DELETE_DOM_ALIAS,
-               q, r,
-               qbuf, rbuf,
-               samr_io_q_delete_dom_alias,
-               samr_io_r_delete_dom_alias,
-               NT_STATUS_UNSUCCESSFUL); 
-
-       /* Return output parameters */
-
-       result = r.status;
-
-       return result;
-}
-
-/* Delete domain user */
-
-NTSTATUS rpccli_samr_delete_dom_user(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, 
-                                  POLICY_HND *user_pol)
-{
-       prs_struct qbuf, rbuf;
-       SAMR_Q_DELETE_DOM_USER q;
-       SAMR_R_DELETE_DOM_USER r;
-       NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
-
-       DEBUG(10,("cli_samr_delete_dom_user\n"));
-
-       ZERO_STRUCT(q);
-       ZERO_STRUCT(r);
-
-       /* Marshall data and send request */
-
-       init_samr_q_delete_dom_user(&q, user_pol);
-
-       CLI_DO_RPC(cli, mem_ctx, PI_SAMR, SAMR_DELETE_DOM_USER,
-               q, r,
-               qbuf, rbuf,
-               samr_io_q_delete_dom_user,
-               samr_io_r_delete_dom_user,
-               NT_STATUS_UNSUCCESSFUL); 
-
-       /* Return output parameters */
-
-       result = r.status;
-
-       return result;
-}
-
 /* Remove foreign SID */
 
 NTSTATUS rpccli_samr_remove_sid_foreign_domain(struct rpc_pipe_client *cli, 
@@ -1981,91 +1566,6 @@ NTSTATUS rpccli_samr_set_sec_obj(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct
        return result;
 }
 
-
-/* Get domain password info */
-
-NTSTATUS rpccli_samr_get_dom_pwinfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
-                                uint16 *min_pwd_length, uint32 *password_properties)
-{
-       prs_struct qbuf, rbuf;
-       SAMR_Q_GET_DOM_PWINFO q;
-       SAMR_R_GET_DOM_PWINFO r;
-       NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
-
-       DEBUG(10,("cli_samr_get_dom_pwinfo\n"));
-
-       ZERO_STRUCT(q);
-       ZERO_STRUCT(r);
-
-       /* Marshall data and send request */
-
-       init_samr_q_get_dom_pwinfo(&q, cli->cli->desthost);
-
-       CLI_DO_RPC(cli, mem_ctx, PI_SAMR, SAMR_GET_DOM_PWINFO,
-               q, r,
-               qbuf, rbuf,
-               samr_io_q_get_dom_pwinfo,
-               samr_io_r_get_dom_pwinfo,
-               NT_STATUS_UNSUCCESSFUL); 
-
-       /* Return output parameters */
-
-       result = r.status;
-
-       if (NT_STATUS_IS_OK(result)) {
-               if (min_pwd_length)
-                       *min_pwd_length = r.min_pwd_length;
-               if (password_properties)
-                       *password_properties = r.password_properties;
-       }
-
-       return result;
-}
-
-/* Get domain password info */
-
-NTSTATUS rpccli_samr_get_usrdom_pwinfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
-                                      POLICY_HND *pol, uint16 *min_pwd_length, 
-                                      uint32 *password_properties, uint32 *unknown1)
-{
-       prs_struct qbuf, rbuf;
-       SAMR_Q_GET_USRDOM_PWINFO q;
-       SAMR_R_GET_USRDOM_PWINFO r;
-       NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
-
-       DEBUG(10,("cli_samr_get_usrdom_pwinfo\n"));
-
-       ZERO_STRUCT(q);
-       ZERO_STRUCT(r);
-
-       /* Marshall data and send request */
-
-       init_samr_q_get_usrdom_pwinfo(&q, pol);
-
-       CLI_DO_RPC(cli, mem_ctx, PI_SAMR, SAMR_GET_USRDOM_PWINFO,
-                  q, r,
-                  qbuf, rbuf,
-                  samr_io_q_get_usrdom_pwinfo,
-                  samr_io_r_get_usrdom_pwinfo,
-                  NT_STATUS_UNSUCCESSFUL); 
-
-       /* Return output parameters */
-
-       result = r.status;
-
-       if (NT_STATUS_IS_OK(result)) {
-               if (min_pwd_length)
-                       *min_pwd_length = r.min_pwd_length;
-               if (password_properties)
-                       *password_properties = r.password_properties;
-               if (unknown1)
-                       *unknown1 = r.unknown_1;
-       }
-
-       return result;
-}
-
-
 /* Lookup Domain Name */
 
 NTSTATUS rpccli_samr_lookup_domain(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
index c30ad487dd20ad7294e109d74f812427a9148a0b..e98822d46ee670b6b810ce68e706da8a2a113860 100644 (file)
@@ -435,7 +435,7 @@ bool smb_io_relsecdesc(const char *desc, RPC_BUFFER *buffer, int depth, SEC_DESC
                }
                
                if (*secdesc != NULL) {
-                       buffer->string_at_end -= sec_desc_size(*secdesc);
+                       buffer->string_at_end -= ndr_size_security_descriptor(*secdesc, 0);
 
                        if(!prs_set_offset(ps, buffer->string_at_end))
                                return False;
diff --git a/source/rpc_parse/parse_ds.c b/source/rpc_parse/parse_ds.c
deleted file mode 100644 (file)
index 8f3ce36..0000000
+++ /dev/null
@@ -1,299 +0,0 @@
-/* 
- *  Unix SMB/CIFS implementation.
- *  RPC Pipe client / server routines
- *  Copyright (C) Gerald Carter                                2002-2003
- *  
- *  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"
-
-/************************************************************************
-************************************************************************/
-
-static bool ds_io_dominfobasic(const char *desc, DSROLE_PRIMARY_DOMAIN_INFO_BASIC **basic, prs_struct *ps, int depth)
-{
-       DSROLE_PRIMARY_DOMAIN_INFO_BASIC *p = *basic;
-       
-       if ( UNMARSHALLING(ps) ) {
-               p = *basic = PRS_ALLOC_MEM(ps, DSROLE_PRIMARY_DOMAIN_INFO_BASIC, 1);
-       }
-               
-       if ( !p )
-               return False;
-               
-       if ( !prs_uint16("machine_role", ps, depth, &p->machine_role) )
-               return False;
-       if ( !prs_align(ps) )
-               return False;
-
-       if ( !prs_uint32("flags", ps, depth, &p->flags) )
-               return False;
-
-       if ( !prs_uint32("netbios_ptr", ps, depth, &p->netbios_ptr) )
-               return False;
-       if ( !prs_uint32("dnsname_ptr", ps, depth, &p->dnsname_ptr) )
-               return False;
-       if ( !prs_uint32("forestname_ptr", ps, depth, &p->forestname_ptr) )
-               return False;
-               
-       if ( !smb_io_uuid("domain_guid", &p->domain_guid, ps, depth) )
-               return False;
-               
-       if ( !smb_io_unistr2( "netbios_domain", &p->netbios_domain, p->netbios_ptr, ps, depth) )
-               return False;
-       if ( !prs_align(ps) )
-               return False;
-       
-       if ( !smb_io_unistr2( "dns_domain", &p->dns_domain, p->dnsname_ptr, ps, depth) )
-               return False;
-       if ( !prs_align(ps) )
-               return False;
-       
-       if ( !smb_io_unistr2( "forest_domain", &p->forest_domain, p->forestname_ptr, ps, depth) )
-               return False;
-       if ( !prs_align(ps) )
-               return False;
-       
-               
-       return True;
-               
-}
-
-/************************************************************************
-************************************************************************/
-
-bool ds_io_q_getprimdominfo( const char *desc, DS_Q_GETPRIMDOMINFO *q_u, prs_struct *ps, int depth)
-{
-       prs_debug(ps, depth, desc, "ds_io_q_getprimdominfo");
-       depth++;
-
-       if(!prs_align(ps))
-               return False;
-
-       if ( !prs_uint16( "level", ps, depth, &q_u->level ) )
-               return False;
-               
-       return True;
-}
-
-/************************************************************************
-************************************************************************/
-
-bool ds_io_r_getprimdominfo( const char *desc, DS_R_GETPRIMDOMINFO *r_u, prs_struct *ps, int depth)
-{
-       prs_debug(ps, depth, desc, "ds_io_r_getprimdominfo");
-       depth++;
-
-       if(!prs_align(ps))
-               return False;
-
-       if ( !prs_uint32( "ptr", ps, depth, &r_u->ptr ) )
-               return False;
-               
-       if ( r_u->ptr )
-       {
-               if ( !prs_uint16( "level", ps, depth, &r_u->level ) )
-                       return False;
-       
-               if ( !prs_uint16( "unknown0", ps, depth, &r_u->unknown0 ) )
-                       return False;
-               
-               switch ( r_u->level )
-               {
-                       case DsRolePrimaryDomainInfoBasic:
-                               if ( !ds_io_dominfobasic( "dominfobasic", &r_u->info.basic, ps, depth) )
-                                       return False;
-                               break;
-                       default:
-                               return False;
-               }
-       }
-
-       if ( !prs_align(ps) )
-               return False;
-       
-       if ( !prs_ntstatus("status", ps, depth, &r_u->status ) )
-               return False;           
-               
-       return True;
-}
-
-/************************************************************************
- initialize a DS_ENUM_DOM_TRUSTS structure
-************************************************************************/
-
-bool init_q_ds_enum_domain_trusts( DS_Q_ENUM_DOM_TRUSTS *q, const char *server, uint32 flags )
-{
-       q->flags = flags;
-       
-       if ( server && *server )
-               q->server_ptr = 1;
-       else
-               q->server_ptr = 0;
-
-       init_unistr2( &q->server, server, UNI_STR_TERMINATE);
-               
-       return True;
-}
-
-/************************************************************************
-************************************************************************/
-
-static bool ds_io_domain_trusts( const char *desc, DS_DOMAIN_TRUSTS *trust, prs_struct *ps, int depth)
-{
-       prs_debug(ps, depth, desc, "ds_io_dom_trusts_ctr");
-       depth++;
-
-       if ( !prs_uint32( "netbios_ptr", ps, depth, &trust->netbios_ptr ) )
-               return False;
-       
-       if ( !prs_uint32( "dns_ptr", ps, depth, &trust->dns_ptr ) )
-               return False;
-       
-       if ( !prs_uint32( "flags", ps, depth, &trust->flags ) )
-               return False;
-       
-       if ( !prs_uint32( "parent_index", ps, depth, &trust->parent_index ) )
-               return False;
-       
-       if ( !prs_uint32( "trust_type", ps, depth, &trust->trust_type ) )
-               return False;
-       
-       if ( !prs_uint32( "trust_attributes", ps, depth, &trust->trust_attributes ) )
-               return False;
-       
-       if ( !prs_uint32( "sid_ptr", ps, depth, &trust->sid_ptr ) )
-               return False;
-       
-       if ( !smb_io_uuid("guid", &trust->guid, ps, depth) )
-               return False;
-       
-       return True;    
-}
-
-/************************************************************************
-************************************************************************/
-
-static bool ds_io_dom_trusts_ctr( const char *desc, DS_DOMAIN_TRUSTS_CTR *ctr, prs_struct *ps, int depth)
-{
-       int i;
-
-       prs_debug(ps, depth, desc, "ds_io_dom_trusts_ctr");
-       depth++;
-       
-       if ( !prs_uint32( "ptr", ps, depth, &ctr->ptr ) )
-               return False;
-       
-       if ( !prs_uint32( "max_count", ps, depth, &ctr->max_count ) )
-               return False;
-       
-       /* are we done? */
-       
-       if ( ctr->max_count == 0 )
-               return True;
-       
-       /* allocate the domain trusts array are parse it */
-       
-       ctr->trusts = TALLOC_ARRAY(ps->mem_ctx, DS_DOMAIN_TRUSTS, ctr->max_count);
-       
-       if ( !ctr->trusts )
-               return False;
-       
-       /* this stinks; the static portion o fthe structure is read here and then
-          we need another loop to read the UNISTR2's and SID's */
-          
-       for ( i=0; i<ctr->max_count;i++ ) {
-               if ( !ds_io_domain_trusts("domain_trusts", &ctr->trusts[i], ps, depth) )
-                       return False;
-       }
-
-       for ( i=0; i<ctr->max_count; i++ ) {
-       
-               if ( !smb_io_unistr2("netbios_domain", &ctr->trusts[i].netbios_domain, ctr->trusts[i].netbios_ptr, ps, depth) )
-                       return False;
-
-               if(!prs_align(ps))
-                       return False;
-               
-               if ( !smb_io_unistr2("dns_domain", &ctr->trusts[i].dns_domain, ctr->trusts[i].dns_ptr, ps, depth) )
-                       return False;
-
-               if(!prs_align(ps))
-                       return False;
-                       
-               if ( ctr->trusts[i].sid_ptr ) {
-                       if ( !smb_io_dom_sid2("sid", &ctr->trusts[i].sid, ps, depth ) )
-                               return False;           
-               }
-       }
-       
-       return True;
-}
-
-/************************************************************************
- initialize a DS_ENUM_DOM_TRUSTS request
-************************************************************************/
-
-bool ds_io_q_enum_domain_trusts( const char *desc, DS_Q_ENUM_DOM_TRUSTS *q_u, prs_struct *ps, int depth)
-{
-       prs_debug(ps, depth, desc, "ds_io_q_enum_domain_trusts");
-       depth++;
-
-       if ( !prs_align(ps) )
-               return False;
-       
-       if ( !prs_uint32( "server_ptr", ps, depth, &q_u->server_ptr ) )
-               return False;
-       
-       if ( !smb_io_unistr2("server", &q_u->server, q_u->server_ptr, ps, depth) )
-                       return False;
-       
-       if ( !prs_align(ps) )
-               return False;
-       
-       if ( !prs_uint32( "flags", ps, depth, &q_u->flags ) )
-               return False;
-       
-       return True;
-}
-
-/************************************************************************
-************************************************************************/
-
-bool ds_io_r_enum_domain_trusts( const char *desc, DS_R_ENUM_DOM_TRUSTS *r_u, prs_struct *ps, int depth)
-{
-       prs_debug(ps, depth, desc, "ds_io_r_enum_domain_trusts");
-       depth++;
-
-       if(!prs_align(ps))
-               return False;
-
-       if ( !prs_uint32( "num_domains", ps, depth, &r_u->num_domains ) )
-               return False;
-               
-       if ( r_u->num_domains ) {
-               if ( !ds_io_dom_trusts_ctr("domains", &r_u->domains, ps, depth) )
-                       return False;
-       }
-               
-       if(!prs_align(ps))
-               return False;
-                       
-       if ( !prs_ntstatus("status", ps, depth, &r_u->status ) )
-               return False;           
-               
-       return True;
-}
index 59fce4a9047e2c5b6f99ee9ee5ac34b98b9f4b3b..1bddfba28eebfed56c4696fff1956c55d899e599 100644 (file)
@@ -909,21 +909,6 @@ bool lsa_io_dom_query_12(const char *desc, DOM_QUERY_12 *info, prs_struct *ps, i
        
 }
 
-/*******************************************************************
- Inits an LSA_Q_QUERY_INFO structure.
-********************************************************************/
-
-void init_q_set(LSA_Q_SET_INFO *in, POLICY_HND *hnd, uint16 info_class, LSA_INFO_CTR ctr)
-{
-       DEBUG(5,("init_q_set\n"));
-
-       in->info_class = info_class;
-
-       in->pol = *hnd;
-
-       in->ctr = ctr;
-       in->ctr.info_class = info_class;
-}
 
 /*******************************************************************
 reads or writes a structure.
@@ -1064,49 +1049,6 @@ bool lsa_io_r_query(const char *desc, LSA_R_QUERY_INFO *out, prs_struct *ps, int
        return True;
 }
 
-/*******************************************************************
- Reads or writes an LSA_Q_SET_INFO structure.
-********************************************************************/
-
-bool lsa_io_q_set(const char *desc, LSA_Q_SET_INFO *in, prs_struct *ps, 
-                 int depth)
-{
-       prs_debug(ps, depth, desc, "lsa_io_q_set");
-       depth++;
-
-       if(!prs_align(ps))
-               return False;
-
-       if(!smb_io_pol_hnd("", &in->pol, ps, depth))
-               return False;
-
-       if(!prs_uint16("info_class", ps, depth, &in->info_class))
-               return False;
-
-       if(!lsa_io_query_info_ctr("", ps, depth, &in->ctr))
-               return False;
-
-       return True;
-}
-
-/*******************************************************************
- Reads or writes an LSA_R_SET_INFO structure.
-********************************************************************/
-
-bool lsa_io_r_set(const char *desc, LSA_R_SET_INFO *out, prs_struct *ps, int depth)
-{
-       prs_debug(ps, depth, desc, "lsa_io_r_set");
-       depth++;
-
-       if(!prs_align(ps))
-               return False;
-
-       if(!prs_ntstatus("status", ps, depth, &out->status))
-               return False;
-
-       return True;
-}
-
 /*******************************************************************
  Inits a LSA_SID_ENUM structure.
 ********************************************************************/
@@ -2139,53 +2081,6 @@ bool lsa_io_r_lookup_names4(const char *desc, LSA_R_LOOKUP_NAMES4 *out, prs_stru
        return True;
 }
 
-/*******************************************************************
- Reads or writes an LSA_Q_OPEN_SECRET structure.
-********************************************************************/
-
-bool lsa_io_q_open_secret(const char *desc, LSA_Q_OPEN_SECRET *in, prs_struct *ps, int depth)
-{
-       prs_debug(ps, depth, desc, "lsa_io_q_open_secret");
-       depth++;
-
-       if(!prs_align(ps))
-               return False;
-
-       if(!smb_io_pol_hnd("", &in->handle, ps, depth))
-               return False;
-
-       if(!prs_unistr4 ("secretname", ps, depth, &in->secretname))
-               return False;
-       if(!prs_align(ps))
-               return False;
-
-       if(!prs_uint32("access", ps, depth, &in->access))
-               return False;
-
-       return True;
-}
-
-/*******************************************************************
- Reads or writes an LSA_R_OPEN_SECRET structure.
-********************************************************************/
-
-bool lsa_io_r_open_secret(const char *desc, LSA_R_OPEN_SECRET *out, prs_struct *ps, int depth)
-{
-       prs_debug(ps, depth, desc, "lsa_io_r_open_secret");
-       depth++;
-
-       if(!prs_align(ps))
-               return False;
-   
-       if(!smb_io_pol_hnd("", &out->handle, ps, depth))
-               return False;
-
-       if(!prs_ntstatus("status", ps, depth, &out->status))
-               return False;
-
-       return True;
-}
-
 /*******************************************************************
  Inits an LSA_Q_ENUM_PRIVS structure.
 ********************************************************************/
@@ -3372,209 +3267,12 @@ bool lsa_io_r_remove_acct_rights(const char *desc, LSA_R_REMOVE_ACCT_RIGHTS *out
        return True;
 }
 
-/*******************************************************************
- Inits an LSA_Q_OPEN_TRUSTED_DOMAIN structure.
-********************************************************************/
-
-void init_lsa_q_open_trusted_domain(LSA_Q_OPEN_TRUSTED_DOMAIN *q, POLICY_HND *hnd, DOM_SID *sid, uint32 desired_access)
-{
-       memcpy(&q->pol, hnd, sizeof(q->pol));
-
-       init_dom_sid2(&q->sid, sid);
-       q->access_mask = desired_access;
-}
-
-/*******************************************************************
-********************************************************************/
-
-#if 0 /* jerry, I think this not correct - gd */
-bool lsa_io_q_open_trusted_domain(const char *desc, LSA_Q_OPEN_TRUSTED_DOMAIN *in, prs_struct *ps, int depth)
-{
-       prs_debug(ps, depth, desc, "lsa_io_q_open_trusted_domain");
-       depth++;
-
-       if(!prs_align(ps))
-               return False;
-
-       if (!smb_io_pol_hnd("", &in->handle, ps, depth))
-               return False;
-
-       if(!prs_uint32("count", ps, depth, &in->count))
-               return False;
-
-       if(!smb_io_dom_sid("sid", &in->sid, ps, depth))
-               return False;
-
-       return True;
-}
-#endif
-
-
-/*******************************************************************
- Inits an LSA_Q_OPEN_TRUSTED_DOMAIN_BY_NAME structure.
-********************************************************************/
-
-void init_lsa_q_open_trusted_domain_by_name(LSA_Q_OPEN_TRUSTED_DOMAIN_BY_NAME *q, 
-                                           POLICY_HND *hnd, 
-                                           const char *name, 
-                                           uint32 desired_access)
-{
-       memcpy(&q->pol, hnd, sizeof(q->pol));
-
-       init_lsa_string(&q->name, name);
-       q->access_mask = desired_access;
-}
-
-/*******************************************************************
-********************************************************************/
-
-
-/*******************************************************************
- Reads or writes an LSA_Q_OPEN_TRUSTED_DOMAIN_BY_NAME structure.
-********************************************************************/
-
-bool lsa_io_q_open_trusted_domain_by_name(const char *desc, LSA_Q_OPEN_TRUSTED_DOMAIN_BY_NAME *q_o, prs_struct *ps, int depth)
-{
-       prs_debug(ps, depth, desc, "lsa_io_q_open_trusted_domain_by_name");
-       depth++;
-
-       if(!prs_align(ps))
-               return False;
-       if(!smb_io_pol_hnd("pol", &q_o->pol, ps, depth))
-               return False;
-
-       if(!prs_align(ps))
-               return False;
-
-       if(!smb_io_lsa_string("name", &q_o->name, ps, depth))
-               return False;
-
-       if(!prs_align(ps))
-               return False;
-
-       if(!prs_uint32("access", ps, depth, &q_o->access_mask))
-               return False;
-
-       return True;
-}
-
-/*******************************************************************
- Reads or writes an LSA_R_OPEN_TRUSTED_DOMAIN_BY_NAME structure.
-********************************************************************/
-
-bool lsa_io_r_open_trusted_domain_by_name(const char *desc, LSA_R_OPEN_TRUSTED_DOMAIN_BY_NAME *out, prs_struct *ps, int depth)
-{
-       prs_debug(ps, depth, desc, "lsa_io_r_open_trusted_domain_by_name");
-       depth++;
-
-       if(!prs_align(ps))
-               return False;
-
-       if (!smb_io_pol_hnd("handle", &out->handle, ps, depth))
-               return False;
-
-       if(!prs_ntstatus("status", ps, depth, &out->status))
-               return False;
-
-       return True;
-}
-
-/*******************************************************************
-********************************************************************/
-
-bool lsa_io_q_open_trusted_domain(const char *desc, LSA_Q_OPEN_TRUSTED_DOMAIN *q_o, prs_struct *ps, int depth)
-{
-       prs_debug(ps, depth, desc, "lsa_io_q_open_trusted_domain");
-       depth++;
-
-       if(!prs_align(ps))
-               return False;
-       if(!smb_io_pol_hnd("pol", &q_o->pol, ps, depth))
-               return False;
-
-       if(!smb_io_dom_sid2("sid", &q_o->sid, ps, depth))
-               return False;
-
-       if(!prs_uint32("access", ps, depth, &q_o->access_mask))
-               return False;
-  
-       return True;
-}
-
-/*******************************************************************
- Reads or writes an LSA_R_OPEN_TRUSTED_DOMAIN structure.
-********************************************************************/
-
-bool lsa_io_r_open_trusted_domain(const char *desc, LSA_R_OPEN_TRUSTED_DOMAIN *out, prs_struct *ps, int depth)
-{
-       prs_debug(ps, depth, desc, "lsa_io_r_open_trusted_domain");
-       depth++;
-
-       if(!prs_align(ps))
-               return False;
-
-       if (!smb_io_pol_hnd("handle", &out->handle, ps, depth))
-               return False;
-
-       if(!prs_ntstatus("status", ps, depth, &out->status))
-               return False;
-
-       return True;
-}
-
-/*******************************************************************
-********************************************************************/
-
-bool lsa_io_q_create_trusted_domain(const char *desc, LSA_Q_CREATE_TRUSTED_DOMAIN *in, prs_struct *ps, int depth)
-{
-       prs_debug(ps, depth, desc, "lsa_io_q_create_trusted_domain");
-       depth++;
-
-       if(!prs_align(ps))
-               return False;
-
-       if(!smb_io_pol_hnd("", &in->handle, ps, depth))
-               return False;
-
-       if(!prs_unistr4 ("secretname", ps, depth, &in->secretname))
-               return False;
-       if(!prs_align(ps))
-               return False;
-
-       if(!prs_uint32("access", ps, depth, &in->access))
-               return False;
-
-       return True;
-}
-
-/*******************************************************************
-********************************************************************/
-
-bool lsa_io_r_create_trusted_domain(const char *desc, LSA_R_CREATE_TRUSTED_DOMAIN *out, prs_struct *ps, int depth)
-{
-       prs_debug(ps, depth, desc, "lsa_io_r_create_trusted_domain");
-       depth++;
-
-       if(!prs_align(ps))
-               return False;
-
-       if (!smb_io_pol_hnd("", &out->handle, ps, depth))
-               return False;
-
-       if(!prs_ntstatus("status", ps, depth, &out->status))
-               return False;
-
-       return True;
-}
-
 /*******************************************************************
 ********************************************************************/
 
-bool lsa_io_q_create_secret(const char *desc, LSA_Q_CREATE_SECRET *in, prs_struct *ps, int depth)
+bool lsa_io_q_delete_object(const char *desc, LSA_Q_DELETE_OBJECT *in, prs_struct *ps, int depth)
 {
-       prs_debug(ps, depth, desc, "lsa_io_q_create_secret");
+       prs_debug(ps, depth, desc, "lsa_io_q_delete_object");
        depth++;
 
        if(!prs_align(ps))
@@ -3583,594 +3281,17 @@ bool lsa_io_q_create_secret(const char *desc, LSA_Q_CREATE_SECRET *in, prs_struc
        if(!smb_io_pol_hnd("", &in->handle, ps, depth))
                return False;
 
-       if(!prs_unistr4 ("secretname", ps, depth, &in->secretname))
-               return False;
-       if(!prs_align(ps))
-               return False;
-
-       if(!prs_uint32("access", ps, depth, &in->access))
-               return False;
-
        return True;
 }
 
 /*******************************************************************
 ********************************************************************/
 
-bool lsa_io_r_create_secret(const char *desc, LSA_R_CREATE_SECRET *out, prs_struct *ps, int depth)
+bool lsa_io_r_delete_object(const char *desc, LSA_R_DELETE_OBJECT *out, prs_struct *ps, int depth)
 {
-       prs_debug(ps, depth, desc, "lsa_io_r_create_secret");
+       prs_debug(ps, depth, desc, "lsa_io_r_delete_object");
        depth++;
 
-       if(!prs_align(ps))
-               return False;
-
-       if (!smb_io_pol_hnd("", &out->handle, ps, depth))
-               return False;
-
-       if(!prs_ntstatus("status", ps, depth, &out->status))
-               return False;
-
-       return True;
-}
-
-
-
-/*******************************************************************
-********************************************************************/
-
-static bool lsa_io_data_blob( const char *desc, prs_struct *ps, int depth, LSA_DATA_BLOB *blob )
-{
-       prs_debug(ps, depth, desc, "lsa_io_data_blob");
-       depth++;
-
-       if ( !prs_uint32("size", ps, depth, &blob->size) )
-               return False;
-       if ( !prs_uint32("size", ps, depth, &blob->size) )
-               return False;
-
-       if ( !prs_io_unistr2_p(desc, ps, depth, &blob->data) )
-               return False;
-
-       return True;
-}
-
-/*******************************************************************
-********************************************************************/
-
-bool lsa_io_q_set_secret(const char *desc, LSA_Q_SET_SECRET *in, prs_struct *ps, int depth)
-{
-       prs_debug(ps, depth, desc, "lsa_io_q_set_secret");
-       depth++;
-
-       if ( !prs_align(ps) )
-               return False;
-
-       if ( !smb_io_pol_hnd("", &in->handle, ps, depth) )
-               return False;
-
-       if ( !prs_pointer( "old_value", ps, depth, (void*)&in->old_value, sizeof(LSA_DATA_BLOB), (PRS_POINTER_CAST)lsa_io_data_blob ))
-               return False;
-
-       if( !prs_align(ps) )
-               return False;
-       if ( !prs_pointer( "old_value", ps, depth, (void*)&in->old_value, sizeof(LSA_DATA_BLOB), (PRS_POINTER_CAST)lsa_io_data_blob ))
-               return False;
-
-
-       return True;
-}
-
-/*******************************************************************
-********************************************************************/
-
-bool lsa_io_r_set_secret(const char *desc, LSA_R_SET_SECRET *out, prs_struct *ps, int depth)
-{
-       prs_debug(ps, depth, desc, "lsa_io_r_set_secret");
-       depth++;
-
-       if(!prs_ntstatus("status", ps, depth, &out->status))
-               return False;
-
-       return True;
-}
-
-/*******************************************************************
-********************************************************************/
-
-bool lsa_io_q_delete_object(const char *desc, LSA_Q_DELETE_OBJECT *in, prs_struct *ps, int depth)
-{
-       prs_debug(ps, depth, desc, "lsa_io_q_delete_object");
-       depth++;
-
-       if(!prs_align(ps))
-               return False;
-
-       if(!smb_io_pol_hnd("", &in->handle, ps, depth))
-               return False;
-
-       return True;
-}
-
-/*******************************************************************
-********************************************************************/
-
-bool lsa_io_r_delete_object(const char *desc, LSA_R_DELETE_OBJECT *out, prs_struct *ps, int depth)
-{
-       prs_debug(ps, depth, desc, "lsa_io_r_delete_object");
-       depth++;
-
-       if(!prs_ntstatus("status", ps, depth, &out->status))
-               return False;
-
-       return True;
-}
-
-/*******************************************************************
- Inits an LSA_Q_QUERY_TRUSTED_DOMAIN_INFO structure.
-********************************************************************/
-
-void init_q_query_trusted_domain_info(LSA_Q_QUERY_TRUSTED_DOMAIN_INFO *q, 
-                                     POLICY_HND *hnd, uint16 info_class) 
-{
-       DEBUG(5, ("init_q_query_trusted_domain_info\n"));
-       
-       q->pol = *hnd;
-       q->info_class = info_class;
-}
-
-/*******************************************************************
- Inits an LSA_Q_QUERY_TRUSTED_DOMAIN_INFO_BY_NAME structure.
-********************************************************************/
-
-void init_q_query_trusted_domain_info_by_name(LSA_Q_QUERY_TRUSTED_DOMAIN_INFO_BY_NAME *q, 
-                                             POLICY_HND *hnd, uint16 info_class, 
-                                             const char *dom_name)
-{
-       DEBUG(5, ("init_q_query_trusted_domain_info_by_name\n"));
-       
-       q->pol = *hnd;
-       init_lsa_string(&q->domain_name, dom_name );
-       q->info_class = info_class;
-}
-
-/*******************************************************************
- Inits an LSA_Q_QUERY_TRUSTED_DOMAIN_INFO_BY_SID structure.
-********************************************************************/
-
-void init_q_query_trusted_domain_info_by_sid(LSA_Q_QUERY_TRUSTED_DOMAIN_INFO_BY_SID *q, 
-                                            POLICY_HND *hnd, uint16 info_class, 
-                                            DOM_SID *dom_sid)
-{
-       DEBUG(5, ("init_q_query_trusted_domain_info_by_sid\n"));
-       
-       q->pol = *hnd;
-       init_dom_sid2(&q->dom_sid, dom_sid);
-       q->info_class = info_class;
-}
-
-/*******************************************************************
- Reads or writes an LSA_Q_QUERY_TRUSTED_DOMAIN_INFO structure.
-********************************************************************/
-
-bool lsa_io_q_query_trusted_domain_info(const char *desc, 
-                                       LSA_Q_QUERY_TRUSTED_DOMAIN_INFO *q_q,
-                                       prs_struct *ps, int depth)
-{
-       prs_debug(ps, depth, desc, "lsa_io_q_query_trusted_domain_info");
-       depth++;
-
-       if(!prs_align(ps))
-               return False;
-
-       if(!smb_io_pol_hnd("pol", &q_q->pol, ps, depth))
-               return False;
-
-       if(!prs_uint16("info_class", ps, depth, &q_q->info_class))
-               return False;
-
-       return True;
-}
-
-
-/*******************************************************************
- Reads or writes an LSA_Q_QUERY_TRUSTED_DOMAIN_INFO_BY_SID structure.
-********************************************************************/
-
-bool lsa_io_q_query_trusted_domain_info_by_sid(const char *desc, 
-                                              LSA_Q_QUERY_TRUSTED_DOMAIN_INFO_BY_SID *q_q,
-                                              prs_struct *ps, int depth)
-{
-       prs_debug(ps, depth, desc, "lsa_io_q_query_trusted_domain_info_by_sid");
-       depth++;
-
-       if(!prs_align(ps))
-               return False;
-
-       if(!smb_io_pol_hnd("pol", &q_q->pol, ps, depth))
-               return False;
-
-       if(!prs_align(ps))
-               return False;
-
-       if(!smb_io_dom_sid2("dom_sid", &q_q->dom_sid, ps, depth))
-               return False;
-
-       if(!prs_uint16("info_class", ps, depth, &q_q->info_class))
-               return False;
-
-       return True;
-}
-
-/*******************************************************************
- Reads or writes an LSA_Q_QUERY_TRUSTED_DOMAIN_INFO_BY_NAME structure.
-********************************************************************/
-
-bool lsa_io_q_query_trusted_domain_info_by_name(const char *desc, 
-                                               LSA_Q_QUERY_TRUSTED_DOMAIN_INFO_BY_NAME *q_q,
-                                               prs_struct *ps, int depth)
-{
-       prs_debug(ps, depth, desc, "lsa_io_q_query_trusted_domain_info_by_name");
-       depth++;
-
-       if(!prs_align(ps))
-               return False;
-
-       if(!smb_io_pol_hnd("pol", &q_q->pol, ps, depth))
-               return False;
-
-       if(!prs_align(ps))
-               return False;
-
-       if(!smb_io_lsa_string("domain_name", &q_q->domain_name, ps, depth))
-               return False;
-
-       if(!prs_uint16("info_class", ps, depth, &q_q->info_class))
-               return False;
-
-       return True;
-}
-
-/*******************************************************************
-********************************************************************/
-
-static bool smb_io_lsa_data_buf_hdr(const char *desc, LSA_DATA_BUF_HDR *buf_hdr, 
-                                   prs_struct *ps, int depth)
-{
-       prs_debug(ps, depth, desc, "smb_io_lsa_data_buf_hdr");
-       depth++;
-
-       if(!prs_align(ps))
-               return False;
-
-       if(!prs_uint32("length", ps, depth, &buf_hdr->length))
-               return False;
-       
-       if(!prs_uint32("size", ps, depth, &buf_hdr->size))
-               return False;
-
-       if (!prs_uint32("data_ptr", ps, depth, &buf_hdr->data_ptr))
-               return False;
-
-       return True;
-}
-
-/*******************************************************************
-********************************************************************/
-
-static bool smb_io_lsa_data_buf(const char *desc, LSA_DATA_BUF *buf, 
-                               prs_struct *ps, int depth, int length, int size)
-{
-       prs_debug(ps, depth, desc, "smb_io_lsa_data_buf");
-       depth++;
-
-       if ( UNMARSHALLING(ps) && length ) {
-               if ( !(buf->data = PRS_ALLOC_MEM( ps, uint8, length )) )
-                       return False;
-       }
-
-       if (!prs_uint32("size", ps, depth, &buf->size))
-               return False;
-
-       if (!prs_uint32("offset", ps, depth, &buf->offset))
-               return False;
-
-       if (!prs_uint32("length", ps, depth, &buf->length))
-               return False;
-
-       if(!prs_uint8s(False, "data", ps, depth, buf->data, length))
-               return False;
-
-       return True;
-}
-
-/*******************************************************************
-********************************************************************/
-
-static bool lsa_io_trustdom_query_1(const char *desc, TRUSTED_DOMAIN_INFO_NAME *name, 
-                                   prs_struct *ps, int depth)
-{
-       if (!smb_io_lsa_string("netbios_name", &name->netbios_name, ps, depth))
-               return False;
-
-       return True;
-}
-
-/*******************************************************************
-********************************************************************/
-
-static bool lsa_io_trustdom_query_3(const char *desc, TRUSTED_DOMAIN_INFO_POSIX_OFFSET *posix, 
-                                   prs_struct *ps, int depth)
-{
-       if(!prs_uint32("posix_offset", ps, depth, &posix->posix_offset))
-               return False;
-
-       return True;
-}
-
-/*******************************************************************
-********************************************************************/
-
-static bool lsa_io_trustdom_query_4(const char *desc, TRUSTED_DOMAIN_INFO_PASSWORD *password, 
-                                   prs_struct *ps, int depth)
-{
-       if(!prs_align(ps))
-               return False;
-       
-       if(!prs_uint32("ptr_password", ps, depth, &password->ptr_password))
-               return False;
-
-       if(!prs_uint32("ptr_old_password", ps, depth, &password->ptr_old_password))
-               return False;
-
-       if (&password->ptr_password) {
-       
-               if (!smb_io_lsa_data_buf_hdr("password_hdr", &password->password_hdr, ps, depth))
-                       return False;
-
-               if (!smb_io_lsa_data_buf("password", &password->password, ps, depth, 
-                                       password->password_hdr.length, password->password_hdr.size))
-                       return False;
-       }
-
-       if (&password->ptr_old_password) {
-
-               if (!smb_io_lsa_data_buf_hdr("old_password_hdr", &password->old_password_hdr, ps, depth))
-                       return False;
-
-               if (!smb_io_lsa_data_buf("old_password", &password->old_password, ps, depth, 
-                                       password->old_password_hdr.length, password->old_password_hdr.size))
-                       return False;
-       }
-
-       return True;
-}
-
-/*******************************************************************
-********************************************************************/
-
-static bool lsa_io_trustdom_query_6(const char *desc, TRUSTED_DOMAIN_INFO_EX *info_ex, 
-                                   prs_struct *ps, int depth)
-{
-       uint32 dom_sid_ptr;
-       
-       if (!smb_io_unihdr("domain_name_hdr", &info_ex->domain_name.hdr, ps, depth))
-               return False;
-               
-       if (!smb_io_unihdr("netbios_name_hdr", &info_ex->netbios_name.hdr, ps, depth))
-               return False;
-
-       if (!prs_uint32("dom_sid_ptr", ps, depth, &dom_sid_ptr))
-               return False;
-
-       if (!prs_uint32("trust_direction", ps, depth, &info_ex->trust_direction))
-               return False;
-
-       if (!prs_uint32("trust_type", ps, depth, &info_ex->trust_type))
-               return False;
-
-       if (!prs_uint32("trust_attributes", ps, depth, &info_ex->trust_attributes))
-               return False;
-               
-       if (!smb_io_unistr2("domain_name_unistring", &info_ex->domain_name.unistring, info_ex->domain_name.hdr.buffer, ps, depth))
-               return False;
-               
-       if (!smb_io_unistr2("netbios_name_unistring", &info_ex->netbios_name.unistring, info_ex->netbios_name.hdr.buffer, ps, depth))
-               return False;
-
-       if (!smb_io_dom_sid2("sid", &info_ex->sid, ps, depth))
-               return False;
-
-       return True;
-}
-
-/*******************************************************************
-********************************************************************/
-
-static bool lsa_io_trustdom_query(const char *desc, prs_struct *ps, int depth, LSA_TRUSTED_DOMAIN_INFO *info)
-{
-       prs_debug(ps, depth, desc, "lsa_io_trustdom_query");
-       depth++;
-
-       if(!prs_uint16("info_class", ps, depth, &info->info_class))
-               return False;
-
-       if(!prs_align(ps))
-               return False;
-
-       switch (info->info_class) {
-       case 1:
-               if(!lsa_io_trustdom_query_1("name", &info->name, ps, depth))
-                       return False;
-               break;
-       case 3:
-               if(!lsa_io_trustdom_query_3("posix_offset", &info->posix_offset, ps, depth))
-                       return False;
-               break;
-       case 4:
-               if(!lsa_io_trustdom_query_4("password", &info->password, ps, depth))
-                       return False;
-               break;
-       case 6:
-               if(!lsa_io_trustdom_query_6("info_ex", &info->info_ex, ps, depth))
-                       return False;
-               break;
-       default:
-               DEBUG(0,("unsupported info-level: %d\n", info->info_class));
-               return False;
-       }
-
-       return True;
-}
-
-/*******************************************************************
- Reads or writes an LSA_R_QUERY_TRUSTED_DOMAIN_INFO structure.
-********************************************************************/
-
-bool lsa_io_r_query_trusted_domain_info(const char *desc, 
-                                       LSA_R_QUERY_TRUSTED_DOMAIN_INFO *r_q, 
-                                       prs_struct *ps, int depth)
-{
-       if (r_q == NULL)
-               return False;
-
-       prs_debug(ps, depth, desc, "lsa_io_r_query_trusted_domain_info");
-       depth++;
-
-       if (!prs_pointer("trustdom", ps, depth, (void*)&r_q->info, 
-                        sizeof(LSA_TRUSTED_DOMAIN_INFO), 
-                        (PRS_POINTER_CAST)lsa_io_trustdom_query) )
-               return False;
-
-       if(!prs_align(ps))
-               return False;
-
-       if(!prs_ntstatus("status", ps, depth, &r_q->status))
-               return False;
-
-       return True;
-}
-
-/*******************************************************************
- Inits an LSA_Q_QUERY_DOM_INFO_POLICY structure.
-********************************************************************/
-
-void init_q_query_dom_info(LSA_Q_QUERY_DOM_INFO_POLICY *in, POLICY_HND *hnd, uint16 info_class)
-{
-       DEBUG(5, ("init_q_query_dom_info\n"));
-
-       memcpy(&in->pol, hnd, sizeof(in->pol));
-
-       in->info_class = info_class;
-}
-
-/*******************************************************************
- Reads or writes an LSA_Q_QUERY_DOM_INFO_POLICY structure.
-********************************************************************/
-
-bool lsa_io_q_query_dom_info(const char *desc, LSA_Q_QUERY_DOM_INFO_POLICY *in, prs_struct *ps, int depth)
-{
-       prs_debug(ps, depth, desc, "lsa_io_q_query_dom_info");
-       depth++;
-
-       if(!prs_align(ps))
-               return False;
-       if(!smb_io_pol_hnd("pol", &in->pol, ps, depth))
-               return False;
-       
-       if(!prs_uint16("info_class", ps, depth, &in->info_class))
-               return False;
-
-       return True;
-}
-
-/*******************************************************************
- Reads or writes an LSA_R_QUERY_DOM_INFO_POLICY structure.
-********************************************************************/
-
-static bool lsa_io_dominfo_query_3(const char *desc, LSA_DOM_INFO_POLICY_KERBEROS *krb_policy, 
-                                  prs_struct *ps, int depth)
-{
-       if (!prs_align_uint64(ps))
-               return False;
-
-       if (!prs_align(ps))
-               return False;
-
-       if (!prs_uint32("enforce_restrictions", ps, depth, &krb_policy->enforce_restrictions))
-               return False;
-
-       if (!prs_align_uint64(ps))
-               return False;
-
-       if (!smb_io_nttime("service_tkt_lifetime", ps, depth, &krb_policy->service_tkt_lifetime))
-               return False;
-
-       if (!prs_align_uint64(ps))
-               return False;
-       
-       if (!smb_io_nttime("user_tkt_lifetime", ps, depth, &krb_policy->user_tkt_lifetime))
-               return False;
-
-       if (!prs_align_uint64(ps))
-               return False;
-       
-       if (!smb_io_nttime("user_tkt_renewaltime", ps, depth, &krb_policy->user_tkt_renewaltime))
-               return False;
-
-       if (!prs_align_uint64(ps))
-               return False;
-       
-       if (!smb_io_nttime("clock_skew", ps, depth, &krb_policy->clock_skew))
-               return False;
-
-       if (!prs_align_uint64(ps))
-               return False;
-       
-       if (!smb_io_nttime("unknown6", ps, depth, &krb_policy->unknown6))
-               return False;
-
-       return True;
-}
-
-static bool lsa_io_dom_info_query(const char *desc, prs_struct *ps, int depth, LSA_DOM_INFO_UNION *info)
-{
-       prs_debug(ps, depth, desc, "lsa_io_dom_info_query");
-       depth++;
-
-       if(!prs_align_uint16(ps))
-               return False;
-
-       if(!prs_uint16("info_class", ps, depth, &info->info_class))
-               return False;
-
-       switch (info->info_class) {
-       case 3: 
-               if (!lsa_io_dominfo_query_3("krb_policy", &info->krb_policy, ps, depth))
-                       return False;
-               break;
-       default:
-               DEBUG(0,("unsupported info-level: %d\n", info->info_class));
-               return False;
-               break;
-       }
-
-       return True;
-}
-
-
-bool lsa_io_r_query_dom_info(const char *desc, LSA_R_QUERY_DOM_INFO_POLICY *out,
-                            prs_struct *ps, int depth)
-{
-       prs_debug(ps, depth, desc, "lsa_io_r_query_dom_info");
-       depth++;
-
-       if (!prs_pointer("dominfo", ps, depth, (void*)&out->info, 
-                        sizeof(LSA_DOM_INFO_UNION), 
-                        (PRS_POINTER_CAST)lsa_io_dom_info_query) )
-               return False;
-       
        if(!prs_ntstatus("status", ps, depth, &out->status))
                return False;
 
index 65607a4ac896a31c9b9d5f77a306b2817aea89c5..d6a99b87312b67ed777ae3c90a5ce5e3e02d3d6a 100644 (file)
@@ -1656,8 +1656,8 @@ static void dump_acct_flags(uint32 acct_flags) {
        if (acct_flags & ACB_NO_AUTH_DATA_REQD) {
                DEBUGADD(lvl,("\taccount has ACB_NO_AUTH_DATA_REQD set\n"));
        }
-       if (acct_flags & ACB_PWEXPIRED) {
-               DEBUGADD(lvl,("\taccount has ACB_PWEXPIRED set\n"));
+       if (acct_flags & ACB_PW_EXPIRED) {
+               DEBUGADD(lvl,("\taccount has ACB_PW_EXPIRED set\n"));
        }
 }
 
@@ -1665,23 +1665,23 @@ static void dump_user_flgs(uint32 user_flags) {
 
        int lvl = 10;
        DEBUG(lvl,("dump_user_flgs\n"));
-       if (user_flags & LOGON_EXTRA_SIDS) {
-               DEBUGADD(lvl,("\taccount has LOGON_EXTRA_SIDS\n"));
+       if (user_flags & NETLOGON_EXTRA_SIDS) {
+               DEBUGADD(lvl,("\taccount has NETLOGON_EXTRA_SIDS\n"));
        }
-       if (user_flags & LOGON_RESOURCE_GROUPS) {
-               DEBUGADD(lvl,("\taccount has LOGON_RESOURCE_GROUPS\n"));
+       if (user_flags & NETLOGON_RESOURCE_GROUPS) {
+               DEBUGADD(lvl,("\taccount has NETLOGON_RESOURCE_GROUPS\n"));
        }
-       if (user_flags & LOGON_NTLMV2_ENABLED) {
-               DEBUGADD(lvl,("\taccount has LOGON_NTLMV2_ENABLED\n"));
+       if (user_flags & NETLOGON_NTLMV2_ENABLED) {
+               DEBUGADD(lvl,("\taccount has NETLOGON_NTLMV2_ENABLED\n"));
        }
-       if (user_flags & LOGON_CACHED_ACCOUNT) {
-               DEBUGADD(lvl,("\taccount has LOGON_CACHED_ACCOUNT\n"));
+       if (user_flags & NETLOGON_CACHED_ACCOUNT) {
+               DEBUGADD(lvl,("\taccount has NETLOGON_CACHED_ACCOUNT\n"));
        }
-       if (user_flags & LOGON_PROFILE_PATH_RETURNED) {
-               DEBUGADD(lvl,("\taccount has LOGON_PROFILE_PATH_RETURNED\n"));
+       if (user_flags & NETLOGON_PROFILE_PATH_RETURNED) {
+               DEBUGADD(lvl,("\taccount has NETLOGON_PROFILE_PATH_RETURNED\n"));
        }
-       if (user_flags & LOGON_SERVER_TRUST_ACCOUNT) {
-               DEBUGADD(lvl,("\taccount has LOGON_SERVER_TRUST_ACCOUNT\n"));
+       if (user_flags & NETLOGON_SERVER_TRUST_ACCOUNT) {
+               DEBUGADD(lvl,("\taccount has NETLOGON_SERVER_TRUST_ACCOUNT\n"));
        }
 
 
@@ -1859,8 +1859,8 @@ bool net_io_user_info3(const char *desc, NET_USER_INFO_3 *usr, prs_struct *ps,
 
                uint32 num_other_sids = usr->num_other_sids;
 
-               if (!(usr->user_flgs & LOGON_EXTRA_SIDS)) {
-                       DEBUG(10,("net_io_user_info3: user_flgs attribute does not have LOGON_EXTRA_SIDS\n"));
+               if (!(usr->user_flgs & NETLOGON_EXTRA_SIDS)) {
+                       DEBUG(10,("net_io_user_info3: user_flgs attribute does not have NETLOGON_EXTRA_SIDS\n"));
                        /* return False; */
                }
 
@@ -3439,67 +3439,6 @@ void init_net_q_dsr_getdcname(NET_Q_DSR_GETDCNAME *r_t, const char *server_unc,
        r_t->flags = flags;
 }
 
-/*******************************************************************
- Inits a NET_Q_DSR_GETDCNAMEEX structure.
-********************************************************************/
-
-void init_net_q_dsr_getdcnameex(NET_Q_DSR_GETDCNAMEEX *r_t, const char *server_unc,
-                               const char *domain_name,
-                               struct GUID *domain_guid,
-                               const char *site_name,
-                               uint32_t flags)
-{
-       DEBUG(5, ("init_net_q_dsr_getdcnameex\n"));
-
-       r_t->ptr_server_unc = (server_unc != NULL);
-       init_unistr2(&r_t->uni_server_unc, server_unc, UNI_STR_TERMINATE);
-
-       r_t->ptr_domain_name = (domain_name != NULL);
-       init_unistr2(&r_t->uni_domain_name, domain_name, UNI_STR_TERMINATE);
-
-       r_t->ptr_domain_guid = (domain_guid != NULL);
-       r_t->domain_guid = domain_guid;
-
-       r_t->ptr_site_name = (site_name != NULL);
-       init_unistr2(&r_t->uni_site_name, site_name, UNI_STR_TERMINATE);
-
-       r_t->flags = flags;
-}
-
-/*******************************************************************
- Inits a NET_Q_DSR_GETDCNAMEEX2 structure.
-********************************************************************/
-
-void init_net_q_dsr_getdcnameex2(NET_Q_DSR_GETDCNAMEEX2 *r_t, const char *server_unc,
-                                const char *domain_name,
-                                const char *client_account,
-                                uint32 mask,
-                                struct GUID *domain_guid,
-                                const char *site_name,
-                                uint32_t flags)
-{
-       DEBUG(5, ("init_net_q_dsr_getdcnameex2\n"));
-
-       r_t->ptr_server_unc = (server_unc != NULL);
-       init_unistr2(&r_t->uni_server_unc, server_unc, UNI_STR_TERMINATE);
-
-       r_t->ptr_client_account = (client_account != NULL);
-       init_unistr2(&r_t->uni_client_account, client_account, UNI_STR_TERMINATE);
-
-       r_t->mask = mask;
-
-       r_t->ptr_domain_name = (domain_name != NULL);
-       init_unistr2(&r_t->uni_domain_name, domain_name, UNI_STR_TERMINATE);
-
-       r_t->ptr_domain_guid = (domain_guid != NULL);
-       r_t->domain_guid = domain_guid;
-
-       r_t->ptr_site_name = (site_name != NULL);
-       init_unistr2(&r_t->uni_site_name, site_name, UNI_STR_TERMINATE);
-
-       r_t->flags = flags;
-}
-
 /*******************************************************************
  Reads or writes an NET_Q_DSR_GETDCNAME structure.
 ********************************************************************/
@@ -3571,154 +3510,6 @@ bool net_io_q_dsr_getdcname(const char *desc, NET_Q_DSR_GETDCNAME *r_t,
        return True;
 }
 
-/*******************************************************************
- Reads or writes an NET_Q_DSR_GETDCNAMEEX structure.
-********************************************************************/
-
-bool net_io_q_dsr_getdcnameex(const char *desc, NET_Q_DSR_GETDCNAMEEX *r_t,
-                             prs_struct *ps, int depth)
-{
-       if (r_t == NULL)
-               return False;
-
-       prs_debug(ps, depth, desc, "net_io_q_dsr_getdcnameex");
-       depth++;
-
-       if (!prs_uint32("ptr_server_unc", ps, depth, &r_t->ptr_server_unc))
-               return False;
-
-       if (!smb_io_unistr2("server_unc", &r_t->uni_server_unc,
-                           r_t->ptr_server_unc, ps, depth))
-               return False;
-
-       if (!prs_align(ps))
-               return False;
-
-       if (!prs_uint32("ptr_domain_name", ps, depth, &r_t->ptr_domain_name))
-               return False;
-
-       if (!smb_io_unistr2("domain_name", &r_t->uni_domain_name,
-                           r_t->ptr_domain_name, ps, depth))
-               return False;
-
-       if (!prs_align(ps))
-               return False;
-
-       if (!prs_uint32("ptr_domain_guid", ps, depth, &r_t->ptr_domain_guid))
-               return False;
-
-       if (UNMARSHALLING(ps) && (r_t->ptr_domain_guid)) {
-               r_t->domain_guid = PRS_ALLOC_MEM(ps, struct GUID, 1);
-               if (r_t->domain_guid == NULL)
-                       return False;
-       }
-
-       if ((r_t->ptr_domain_guid) &&
-           (!smb_io_uuid("domain_guid", r_t->domain_guid, ps, depth)))
-               return False;
-
-       if (!prs_align(ps))
-               return False;
-
-       if (!prs_uint32("ptr_site_name", ps, depth, &r_t->ptr_site_name))
-               return False;
-
-       if (!smb_io_unistr2("site_name", &r_t->uni_site_name,
-                           r_t->ptr_site_name, ps, depth))
-               return False;
-
-       if (!prs_align(ps))
-               return False;
-
-       if (!prs_uint32("flags", ps, depth, &r_t->flags))
-               return False;
-
-       return True;
-}
-
-/*******************************************************************
- Reads or writes an NET_Q_DSR_GETDCNAMEEX2 structure.
-********************************************************************/
-
-bool net_io_q_dsr_getdcnameex2(const char *desc, NET_Q_DSR_GETDCNAMEEX2 *r_t,
-                              prs_struct *ps, int depth)
-{
-       if (r_t == NULL)
-               return False;
-
-       prs_debug(ps, depth, desc, "net_io_q_dsr_getdcnameex2");
-       depth++;
-
-       if (!prs_uint32("ptr_server_unc", ps, depth, &r_t->ptr_server_unc))
-               return False;
-
-       if (!smb_io_unistr2("server_unc", &r_t->uni_server_unc,
-                           r_t->ptr_server_unc, ps, depth))
-               return False;
-
-       if (!prs_align(ps))
-               return False;
-
-       if (!prs_uint32("ptr_client_account", ps, depth, &r_t->ptr_client_account))
-               return False;
-
-       if (!smb_io_unistr2("client_account", &r_t->uni_client_account,
-                           r_t->ptr_client_account, ps, depth))
-               return False;
-
-       if (!prs_align(ps))
-               return False;
-
-       if (!prs_uint32("mask", ps, depth, &r_t->mask))
-               return False;
-
-       if (!prs_align(ps))
-               return False;
-
-       if (!prs_uint32("ptr_domain_name", ps, depth, &r_t->ptr_domain_name))
-               return False;
-
-       if (!smb_io_unistr2("domain_name", &r_t->uni_domain_name,
-                           r_t->ptr_domain_name, ps, depth))
-               return False;
-
-       if (!prs_align(ps))
-               return False;
-
-       if (!prs_uint32("ptr_domain_guid", ps, depth, &r_t->ptr_domain_guid))
-               return False;
-
-       if (UNMARSHALLING(ps) && (r_t->ptr_domain_guid)) {
-               r_t->domain_guid = PRS_ALLOC_MEM(ps, struct GUID, 1);
-               if (r_t->domain_guid == NULL)
-                       return False;
-       }
-
-       if ((r_t->ptr_domain_guid) &&
-           (!smb_io_uuid("domain_guid", r_t->domain_guid, ps, depth)))
-               return False;
-
-       if (!prs_align(ps))
-               return False;
-
-       if (!prs_uint32("ptr_site_name", ps, depth, &r_t->ptr_site_name))
-               return False;
-
-       if (!smb_io_unistr2("site_name", &r_t->uni_site_name,
-                           r_t->ptr_site_name, ps, depth))
-               return False;
-
-       if (!prs_align(ps))
-               return False;
-
-       if (!prs_uint32("flags", ps, depth, &r_t->flags))
-               return False;
-
-       return True;
-}
-
-
-
 /*******************************************************************
  Inits a NET_R_DSR_GETDCNAME structure.
 ********************************************************************/
index 4abf63e71d30043616610d91f3cc2db117ebcfae..638d71a73e3512c47e9b11f33c5864a6f7beef58 100644 (file)
@@ -85,7 +85,7 @@ void prs_dump_region(const char *name, int v, prs_struct *ps,
 
 void prs_debug(prs_struct *ps, int depth, const char *desc, const char *fn_name)
 {
-       DEBUG(5+depth, ("%s%06x %s %s\n", tab_depth(depth), ps->data_offset, fn_name, desc));
+       DEBUG(5+depth, ("%s%06x %s %s\n", tab_depth(5+depth,depth), ps->data_offset, fn_name, desc));
 }
 
 /**
@@ -621,7 +621,7 @@ bool prs_uint8(const char *name, prs_struct *ps, int depth, uint8 *data8)
        else
                SCVAL(q,0,*data8);
 
-       DEBUG(5,("%s%04x %s: %02x\n", tab_depth(depth), ps->data_offset, name, *data8));
+       DEBUG(5,("%s%04x %s: %02x\n", tab_depth(5,depth), ps->data_offset, name, *data8));
 
        ps->data_offset += 1;
 
@@ -686,7 +686,7 @@ bool prs_uint16(const char *name, prs_struct *ps, int depth, uint16 *data16)
                        SSVAL(q,0,*data16);
        }
 
-       DEBUG(5,("%s%04x %s: %04x\n", tab_depth(depth), ps->data_offset, name, *data16));
+       DEBUG(5,("%s%04x %s: %04x\n", tab_depth(5,depth), ps->data_offset, name, *data16));
 
        ps->data_offset += sizeof(uint16);
 
@@ -715,7 +715,7 @@ bool prs_uint32(const char *name, prs_struct *ps, int depth, uint32 *data32)
                        SIVAL(q,0,*data32);
        }
 
-       DEBUG(5,("%s%04x %s: %08x\n", tab_depth(depth), ps->data_offset, name, *data32));
+       DEBUG(5,("%s%04x %s: %08x\n", tab_depth(5,depth), ps->data_offset, name, *data32));
 
        ps->data_offset += sizeof(uint32);
 
@@ -744,7 +744,7 @@ bool prs_int32(const char *name, prs_struct *ps, int depth, int32 *data32)
                        SIVALS(q,0,*data32);
        }
 
-       DEBUG(5,("%s%04x %s: %08x\n", tab_depth(depth), ps->data_offset, name, *data32));
+       DEBUG(5,("%s%04x %s: %08x\n", tab_depth(5,depth), ps->data_offset, name, *data32));
 
        ps->data_offset += sizeof(int32);
 
@@ -773,7 +773,7 @@ bool prs_ntstatus(const char *name, prs_struct *ps, int depth, NTSTATUS *status)
                        SIVAL(q,0,NT_STATUS_V(*status));
        }
 
-       DEBUG(5,("%s%04x %s: %s\n", tab_depth(depth), ps->data_offset, name, 
+       DEBUG(5,("%s%04x %s: %s\n", tab_depth(5,depth), ps->data_offset, name, 
                 nt_errstr(*status)));
 
        ps->data_offset += sizeof(uint32);
@@ -803,7 +803,7 @@ bool prs_dcerpc_status(const char *name, prs_struct *ps, int depth, NTSTATUS *st
                        SIVAL(q,0,NT_STATUS_V(*status));
        }
 
-       DEBUG(5,("%s%04x %s: %s\n", tab_depth(depth), ps->data_offset, name, 
+       DEBUG(5,("%s%04x %s: %s\n", tab_depth(5,depth), ps->data_offset, name, 
                 dcerpc_errstr(NT_STATUS_V(*status))));
 
        ps->data_offset += sizeof(uint32);
@@ -834,7 +834,7 @@ bool prs_werror(const char *name, prs_struct *ps, int depth, WERROR *status)
                        SIVAL(q,0,W_ERROR_V(*status));
        }
 
-       DEBUG(5,("%s%04x %s: %s\n", tab_depth(depth), ps->data_offset, name, 
+       DEBUG(5,("%s%04x %s: %s\n", tab_depth(5,depth), ps->data_offset, name, 
                 dos_errstr(*status)));
 
        ps->data_offset += sizeof(uint32);
@@ -862,7 +862,7 @@ bool prs_uint8s(bool charmode, const char *name, prs_struct *ps, int depth, uint
                        SCVAL(q, i, data8s[i]);
        }
 
-       DEBUG(5,("%s%04x %s: ", tab_depth(depth), ps->data_offset ,name));
+       DEBUG(5,("%s%04x %s: ", tab_depth(5,depth), ps->data_offset ,name));
        if (charmode)
                print_asc(5, (unsigned char*)data8s, len);
        else {
@@ -905,7 +905,7 @@ bool prs_uint16s(bool charmode, const char *name, prs_struct *ps, int depth, uin
                }
        }
 
-       DEBUG(5,("%s%04x %s: ", tab_depth(depth), ps->data_offset, name));
+       DEBUG(5,("%s%04x %s: ", tab_depth(5,depth), ps->data_offset, name));
        if (charmode)
                print_asc(5, (unsigned char*)data16s, 2*len);
        else {
@@ -947,7 +947,7 @@ static void dbg_rw_punival(bool charmode, const char *name, int depth, prs_struc
                }
        }
 
-       DEBUG(5,("%s%04x %s: ", tab_depth(depth), ps->data_offset, name));
+       DEBUG(5,("%s%04x %s: ", tab_depth(5,depth), ps->data_offset, name));
        if (charmode)
                print_asc(5, (unsigned char*)out_buf, 2*len);
        else {
@@ -1002,7 +1002,7 @@ bool prs_uint32s(bool charmode, const char *name, prs_struct *ps, int depth, uin
                }
        }
 
-       DEBUG(5,("%s%04x %s: ", tab_depth(depth), ps->data_offset, name));
+       DEBUG(5,("%s%04x %s: ", tab_depth(5,depth), ps->data_offset, name));
        if (charmode)
                print_asc(5, (unsigned char*)data32s, 4*len);
        else {
@@ -1103,7 +1103,7 @@ bool prs_string2(bool charmode, const char *name, prs_struct *ps, int depth, STR
                } else {
                        str->buffer = NULL;
                        /* Return early to ensure Coverity isn't confused. */
-                       DEBUG(5,("%s%04x %s: \n", tab_depth(depth), ps->data_offset, name));
+                       DEBUG(5,("%s%04x %s: \n", tab_depth(5,depth), ps->data_offset, name));
                        return True;
                }
        }
@@ -1116,7 +1116,7 @@ bool prs_string2(bool charmode, const char *name, prs_struct *ps, int depth, STR
                        SCVAL(q, i, str->buffer[i]);
        }
 
-       DEBUG(5,("%s%04x %s: ", tab_depth(depth), ps->data_offset, name));
+       DEBUG(5,("%s%04x %s: ", tab_depth(5,depth), ps->data_offset, name));
        if (charmode)
                print_asc(5, (unsigned char*)str->buffer, str->str_str_len);
        else {
@@ -1252,7 +1252,7 @@ bool prs_unistr(const char *name, prs_struct *ps, int depth, UNISTR *str)
 
                len++;
 
-               DEBUG(5,("%s%04x %s: ", tab_depth(depth), ps->data_offset, name));
+               DEBUG(5,("%s%04x %s: ", tab_depth(5,depth), ps->data_offset, name));
                print_asc(5, (unsigned char*)start, 2*len);     
                DEBUG(5, ("\n"));
        }
@@ -1309,7 +1309,7 @@ bool prs_unistr(const char *name, prs_struct *ps, int depth, UNISTR *str)
                        str->buffer[len++] = '\0';
                }
 
-               DEBUG(5,("%s%04x %s: ", tab_depth(depth), ps->data_offset, name));
+               DEBUG(5,("%s%04x %s: ", tab_depth(5,depth), ps->data_offset, name));
                print_asc(5, (unsigned char*)str->buffer, 2*len);       
                DEBUG(5, ("\n"));
        }
@@ -1544,9 +1544,11 @@ static void schannel_digest(struct schannel_auth_struct *a,
                          uchar digest_final[16]) 
 {
        uchar whole_packet_digest[16];
-       static const uchar zeros[4] = { 0, };
+       uchar zeros[4];
        struct MD5Context ctx3;
-       
+
+       ZERO_STRUCT(zeros);
+
        /* verfiy the signature on the packet by MD5 over various bits */
        MD5Init(&ctx3);
        /* use our sequence number, which ensures the packet is not
@@ -1573,11 +1575,13 @@ static void schannel_get_sealing_key(struct schannel_auth_struct *a,
                                   RPC_AUTH_SCHANNEL_CHK *verf,
                                   uchar sealing_key[16]) 
 {
-       static const uchar zeros[4] = { 0, };
+       uchar zeros[4];
        uchar digest2[16];
        uchar sess_kf0[16];
        int i;
 
+       ZERO_STRUCT(zeros);
+
        for (i = 0; i < sizeof(sess_kf0); i++) {
                sess_kf0[i] = a->sess_key[i] ^ 0xf0;
        }
@@ -1600,10 +1604,12 @@ static void schannel_get_sealing_key(struct schannel_auth_struct *a,
 static void schannel_deal_with_seq_num(struct schannel_auth_struct *a,
                                     RPC_AUTH_SCHANNEL_CHK *verf)
 {
-       static const uchar zeros[4] = { 0, };
+       uchar zeros[4];
        uchar sequence_key[16];
        uchar digest1[16];
 
+       ZERO_STRUCT(zeros);
+
        hmac_md5(a->sess_key, zeros, sizeof(zeros), digest1);
        dump_data_pw("(sequence key) digest1:\n", digest1, sizeof(digest1));
 
index 614a80dd6fe29ef7a47ca98cdefc47bcc48862a1..9924a164a1b26ad5ab71d4001d8e860d671af9e3 100644 (file)
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_RPC_PARSE
 
-/*******************************************************************
-inits a SAMR_Q_CLOSE_HND structure.
-********************************************************************/
-
-void init_samr_q_close_hnd(SAMR_Q_CLOSE_HND * q_c, POLICY_HND *hnd)
-{
-       DEBUG(5, ("init_samr_q_close_hnd\n"));
-       
-       q_c->pol = *hnd;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_q_close_hnd(const char *desc, SAMR_Q_CLOSE_HND * q_u,
-                        prs_struct *ps, int depth)
-{
-       if (q_u == NULL)
-               return False;
-
-       prs_debug(ps, depth, desc, "samr_io_q_close_hnd");
-       depth++;
-
-       if(!prs_align(ps))
-               return False;
-
-       return smb_io_pol_hnd("pol", &q_u->pol, ps, depth);
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_r_close_hnd(const char *desc, SAMR_R_CLOSE_HND * r_u,
-                        prs_struct *ps, int depth)
-{
-       if (r_u == NULL)
-               return False;
-
-       prs_debug(ps, depth, desc, "samr_io_r_close_hnd");
-       depth++;
-
-       if(!prs_align(ps))
-               return False;
-
-       if(!smb_io_pol_hnd("pol", &r_u->pol, ps, depth))
-               return False;
-
-       if(!prs_ntstatus("status", ps, depth, &r_u->status))
-               return False;
-
-       return True;
-}
-
 /*******************************************************************
 inits a SAMR_Q_LOOKUP_DOMAIN structure.
 ********************************************************************/
@@ -240,74 +185,6 @@ bool samr_io_r_remove_sid_foreign_domain(const char *desc, SAMR_R_REMOVE_SID_FOR
 reads or writes a structure.
 ********************************************************************/
 
-void init_samr_q_open_domain(SAMR_Q_OPEN_DOMAIN * q_u,
-                            POLICY_HND *pol, uint32 flags,
-                            const DOM_SID *sid)
-{
-       DEBUG(5, ("samr_init_samr_q_open_domain\n"));
-
-       q_u->pol = *pol;
-       q_u->flags = flags;
-       init_dom_sid2(&q_u->dom_sid, sid);
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_q_open_domain(const char *desc, SAMR_Q_OPEN_DOMAIN * q_u,
-                          prs_struct *ps, int depth)
-{
-       if (q_u == NULL)
-               return False;
-
-       prs_debug(ps, depth, desc, "samr_io_q_open_domain");
-       depth++;
-
-       if(!prs_align(ps))
-               return False;
-
-       if(!smb_io_pol_hnd("pol", &q_u->pol, ps, depth))
-               return False;
-
-       if(!prs_uint32("flags", ps, depth, &q_u->flags))
-               return False;
-
-       if(!smb_io_dom_sid2("sid", &q_u->dom_sid, ps, depth))
-               return False;
-
-       return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_r_open_domain(const char *desc, SAMR_R_OPEN_DOMAIN * r_u,
-                          prs_struct *ps, int depth)
-{
-       if (r_u == NULL)
-               return False;
-
-       prs_debug(ps, depth, desc, "samr_io_r_open_domain");
-       depth++;
-
-       if(!prs_align(ps))
-               return False;
-
-       if(!smb_io_pol_hnd("domain_pol", &r_u->domain_pol, ps, depth))
-               return False;
-
-       if(!prs_ntstatus("status", ps, depth, &r_u->status))
-               return False;
-
-       return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
 void init_samr_q_get_usrdom_pwinfo(SAMR_Q_GET_USRDOM_PWINFO * q_u,
                                   POLICY_HND *user_pol)
 {
@@ -2171,73 +2048,6 @@ bool samr_io_r_query_dispinfo(const char *desc, SAMR_R_QUERY_DISPINFO * r_u,
        return True;
 }
 
-/*******************************************************************
-inits a SAMR_Q_OPEN_GROUP structure.
-********************************************************************/
-
-void init_samr_q_open_group(SAMR_Q_OPEN_GROUP * q_c,
-                           POLICY_HND *hnd,
-                           uint32 access_mask, uint32 rid)
-{
-       DEBUG(5, ("init_samr_q_open_group\n"));
-
-       q_c->domain_pol = *hnd;
-       q_c->access_mask = access_mask;
-       q_c->rid_group = rid;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_q_open_group(const char *desc, SAMR_Q_OPEN_GROUP * q_u,
-                         prs_struct *ps, int depth)
-{
-       if (q_u == NULL)
-               return False;
-
-       prs_debug(ps, depth, desc, "samr_io_q_open_group");
-       depth++;
-
-       if(!prs_align(ps))
-               return False;
-
-       if(!smb_io_pol_hnd("domain_pol", &q_u->domain_pol, ps, depth))
-               return False;
-
-       if(!prs_uint32("access_mask", ps, depth, &q_u->access_mask))
-               return False;
-       if(!prs_uint32("rid_group", ps, depth, &q_u->rid_group))
-               return False;
-
-       return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_r_open_group(const char *desc, SAMR_R_OPEN_GROUP * r_u,
-                         prs_struct *ps, int depth)
-{
-       if (r_u == NULL)
-               return False;
-
-       prs_debug(ps, depth, desc, "samr_io_r_open_group");
-       depth++;
-
-       if(!prs_align(ps))
-               return False;
-
-       if(!smb_io_pol_hnd("pol", &r_u->pol, ps, depth))
-               return False;
-
-       if(!prs_ntstatus("status", ps, depth, &r_u->status))
-               return False;
-
-       return True;
-}
-
 /*******************************************************************
 inits a GROUP_INFO1 structure.
 ********************************************************************/
@@ -2517,143 +2327,6 @@ static bool samr_group_info_ctr(const char *desc, GROUP_INFO_CTR **ctr,
        return True;
 }
 
-/*******************************************************************
-inits a SAMR_Q_CREATE_DOM_GROUP structure.
-********************************************************************/
-
-void init_samr_q_create_dom_group(SAMR_Q_CREATE_DOM_GROUP * q_e,
-                                 POLICY_HND *pol, const char *acct_desc,
-                                 uint32 access_mask)
-{
-       DEBUG(5, ("init_samr_q_create_dom_group\n"));
-
-       q_e->pol = *pol;
-
-       init_unistr2(&q_e->uni_acct_desc, acct_desc, UNI_FLAGS_NONE);
-       init_uni_hdr(&q_e->hdr_acct_desc, &q_e->uni_acct_desc);
-
-       q_e->access_mask = access_mask;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_q_create_dom_group(const char *desc, SAMR_Q_CREATE_DOM_GROUP * q_e,
-                               prs_struct *ps, int depth)
-{
-       if (q_e == NULL)
-               return False;
-
-       prs_debug(ps, depth, desc, "samr_io_q_create_dom_group");
-       depth++;
-
-       if(!prs_align(ps))
-               return False;
-
-       if(!smb_io_pol_hnd("pol", &q_e->pol, ps, depth))
-               return False;
-
-       if(!smb_io_unihdr("hdr_acct_desc", &q_e->hdr_acct_desc, ps, depth))
-               return False;
-       if(!smb_io_unistr2("uni_acct_desc", &q_e->uni_acct_desc,
-                      q_e->hdr_acct_desc.buffer, ps, depth))
-               return False;
-
-       if(!prs_align(ps))
-               return False;
-       if(!prs_uint32("access", ps, depth, &q_e->access_mask))
-               return False;
-
-       return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_r_create_dom_group(const char *desc, SAMR_R_CREATE_DOM_GROUP * r_u,
-                               prs_struct *ps, int depth)
-{
-       if (r_u == NULL)
-               return False;
-
-       prs_debug(ps, depth, desc, "samr_io_r_create_dom_group");
-       depth++;
-
-       if(!prs_align(ps))
-               return False;
-
-       if(!smb_io_pol_hnd("pol", &r_u->pol, ps, depth))
-               return False;
-
-       if(!prs_uint32("rid   ", ps, depth, &r_u->rid))
-               return False;
-       if(!prs_ntstatus("status", ps, depth, &r_u->status))
-               return False;
-
-       return True;
-}
-
-/*******************************************************************
-inits a SAMR_Q_DELETE_DOM_GROUP structure.
-********************************************************************/
-
-void init_samr_q_delete_dom_group(SAMR_Q_DELETE_DOM_GROUP * q_c,
-                                 POLICY_HND *hnd)
-{
-       DEBUG(5, ("init_samr_q_delete_dom_group\n"));
-
-       q_c->group_pol = *hnd;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_q_delete_dom_group(const char *desc, SAMR_Q_DELETE_DOM_GROUP * q_u,
-                               prs_struct *ps, int depth)
-{
-       if (q_u == NULL)
-               return False;
-
-       prs_debug(ps, depth, desc, "samr_io_q_delete_dom_group");
-       depth++;
-
-       if(!prs_align(ps))
-               return False;
-
-       if(!smb_io_pol_hnd("group_pol", &q_u->group_pol, ps, depth))
-               return False;
-
-       return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_r_delete_dom_group(const char *desc, SAMR_R_DELETE_DOM_GROUP * r_u,
-                               prs_struct *ps, int depth)
-{
-       if (r_u == NULL)
-               return False;
-
-       prs_debug(ps, depth, desc, "samr_io_r_delete_dom_group");
-       depth++;
-
-       if(!prs_align(ps))
-               return False;
-
-       if(!smb_io_pol_hnd("pol", &r_u->pol, ps, depth))
-               return False;
-
-       if(!prs_ntstatus("status", ps, depth, &r_u->status))
-               return False;
-
-       return True;
-}
-
 /*******************************************************************
 inits a SAMR_Q_DEL_GROUPMEM structure.
 ********************************************************************/
@@ -4092,72 +3765,6 @@ bool samr_io_r_query_useraliases(const char *desc, SAMR_R_QUERY_USERALIASES * r_
        return True;
 }
 
-/*******************************************************************
-inits a SAMR_Q_OPEN_ALIAS structure.
-********************************************************************/
-
-void init_samr_q_open_alias(SAMR_Q_OPEN_ALIAS * q_u, POLICY_HND *pol,
-                           uint32 access_mask, uint32 rid)
-{
-       DEBUG(5, ("init_samr_q_open_alias\n"));
-
-       q_u->dom_pol = *pol;
-       q_u->access_mask = access_mask;
-       q_u->rid_alias = rid;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_q_open_alias(const char *desc, SAMR_Q_OPEN_ALIAS * q_u,
-                         prs_struct *ps, int depth)
-{
-       if (q_u == NULL)
-               return False;
-
-       prs_debug(ps, depth, desc, "samr_io_q_open_alias");
-       depth++;
-
-       if(!prs_align(ps))
-               return False;
-
-       if(!smb_io_pol_hnd("domain_pol", &q_u->dom_pol, ps, depth))
-               return False;
-
-       if(!prs_uint32("access_mask", ps, depth, &q_u->access_mask))
-               return False;
-       if(!prs_uint32("rid_alias", ps, depth, &q_u->rid_alias))
-               return False;
-
-       return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_r_open_alias(const char *desc, SAMR_R_OPEN_ALIAS * r_u,
-                         prs_struct *ps, int depth)
-{
-       if (r_u == NULL)
-               return False;
-
-       prs_debug(ps, depth, desc, "samr_io_r_open_alias");
-       depth++;
-
-       if(!prs_align(ps))
-               return False;
-
-       if(!smb_io_pol_hnd("pol", &r_u->pol, ps, depth))
-               return False;
-
-       if(!prs_ntstatus("status", ps, depth, &r_u->status))
-               return False;
-
-       return True;
-}
-
 /*******************************************************************
 inits a SAMR_Q_LOOKUP_RIDS structure.
 ********************************************************************/
@@ -4356,141 +3963,6 @@ bool samr_io_r_lookup_rids(const char *desc, SAMR_R_LOOKUP_RIDS * r_u,
        return True;
 }
 
-/*******************************************************************
-inits a SAMR_Q_OPEN_ALIAS structure.
-********************************************************************/
-
-void init_samr_q_delete_alias(SAMR_Q_DELETE_DOM_ALIAS * q_u, POLICY_HND *hnd)
-{
-       DEBUG(5, ("init_samr_q_delete_alias\n"));
-
-       q_u->alias_pol = *hnd;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_q_delete_alias(const char *desc, SAMR_Q_DELETE_DOM_ALIAS * q_u,
-                           prs_struct *ps, int depth)
-{
-       if (q_u == NULL)
-               return False;
-
-       prs_debug(ps, depth, desc, "samr_io_q_delete_alias");
-       depth++;
-
-       if(!prs_align(ps))
-               return False;
-
-       if(!smb_io_pol_hnd("alias_pol", &q_u->alias_pol, ps, depth))
-               return False;
-
-       return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_r_delete_alias(const char *desc, SAMR_R_DELETE_DOM_ALIAS * r_u,
-                           prs_struct *ps, int depth)
-{
-       if (r_u == NULL)
-               return False;
-
-       prs_debug(ps, depth, desc, "samr_io_r_delete_alias");
-       depth++;
-
-       if(!prs_align(ps))
-               return False;
-
-       if(!smb_io_pol_hnd("pol", &r_u->pol, ps, depth))
-               return False;
-       if(!prs_ntstatus("status", ps, depth, &r_u->status))
-               return False;
-
-       return True;
-}
-
-/*******************************************************************
-inits a SAMR_Q_CREATE_DOM_ALIAS structure.
-********************************************************************/
-
-void init_samr_q_create_dom_alias(SAMR_Q_CREATE_DOM_ALIAS * q_u,
-                                 POLICY_HND *hnd, const char *acct_desc)
-{
-       DEBUG(5, ("init_samr_q_create_dom_alias\n"));
-
-       q_u->dom_pol = *hnd;
-
-       init_unistr2(&q_u->uni_acct_desc, acct_desc, UNI_FLAGS_NONE);
-       init_uni_hdr(&q_u->hdr_acct_desc, &q_u->uni_acct_desc);
-
-       q_u->access_mask = MAXIMUM_ALLOWED_ACCESS;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_q_create_dom_alias(const char *desc, SAMR_Q_CREATE_DOM_ALIAS * q_u,
-                               prs_struct *ps, int depth)
-{
-       if (q_u == NULL)
-               return False;
-
-       prs_debug(ps, depth, desc, "samr_io_q_create_dom_alias");
-       depth++;
-
-       if(!prs_align(ps))
-               return False;
-
-       if(!smb_io_pol_hnd("dom_pol", &q_u->dom_pol, ps, depth))
-               return False;
-
-       if(!smb_io_unihdr("hdr_acct_desc", &q_u->hdr_acct_desc, ps, depth))
-               return False;
-       if(!smb_io_unistr2("uni_acct_desc", &q_u->uni_acct_desc,
-                      q_u->hdr_acct_desc.buffer, ps, depth))
-               return False;
-
-       if(!prs_align(ps))
-               return False;
-       if(!prs_uint32("access_mask", ps, depth, &q_u->access_mask))
-               return False;
-
-       return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_r_create_dom_alias(const char *desc, SAMR_R_CREATE_DOM_ALIAS * r_u,
-                               prs_struct *ps, int depth)
-{
-       if (r_u == NULL)
-               return False;
-
-       prs_debug(ps, depth, desc, "samr_io_r_create_dom_alias");
-       depth++;
-
-       if(!prs_align(ps))
-               return False;
-
-       if(!smb_io_pol_hnd("alias_pol", &r_u->alias_pol, ps, depth))
-               return False;
-
-       if(!prs_uint32("rid", ps, depth, &r_u->rid))
-               return False;
-
-       if(!prs_ntstatus("status", ps, depth, &r_u->status))
-               return False;
-
-       return True;
-}
-
 /*******************************************************************
 inits a SAMR_Q_ADD_ALIASMEM structure.
 ********************************************************************/
@@ -4538,66 +4010,7 @@ bool samr_io_r_add_aliasmem(const char *desc, SAMR_R_ADD_ALIASMEM * r_u,
        if (r_u == NULL)
                return False;
 
-       prs_debug(ps, depth, desc, "samr_io_r_add_aliasmem");
-       depth++;
-
-       if(!prs_align(ps))
-               return False;
-
-       if(!prs_ntstatus("status", ps, depth, &r_u->status))
-               return False;
-
-       return True;
-}
-
-/*******************************************************************
-inits a SAMR_Q_DEL_ALIASMEM structure.
-********************************************************************/
-
-void init_samr_q_del_aliasmem(SAMR_Q_DEL_ALIASMEM * q_u, POLICY_HND *hnd,
-                             DOM_SID *sid)
-{
-       DEBUG(5, ("init_samr_q_del_aliasmem\n"));
-
-       q_u->alias_pol = *hnd;
-       init_dom_sid2(&q_u->sid, sid);
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_q_del_aliasmem(const char *desc, SAMR_Q_DEL_ALIASMEM * q_u,
-                           prs_struct *ps, int depth)
-{
-       if (q_u == NULL)
-               return False;
-
-       prs_debug(ps, depth, desc, "samr_io_q_del_aliasmem");
-       depth++;
-
-       if(!prs_align(ps))
-               return False;
-
-       if(!smb_io_pol_hnd("alias_pol", &q_u->alias_pol, ps, depth))
-               return False;
-       if(!smb_io_dom_sid2("sid      ", &q_u->sid, ps, depth))
-               return False;
-
-       return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_r_del_aliasmem(const char *desc, SAMR_R_DEL_ALIASMEM * r_u,
-                           prs_struct *ps, int depth)
-{
-       if (r_u == NULL)
-               return False;
-
-       prs_debug(ps, depth, desc, "samr_io_r_del_aliasmem");
+       prs_debug(ps, depth, desc, "samr_io_r_add_aliasmem");
        depth++;
 
        if(!prs_align(ps))
@@ -4610,28 +4023,29 @@ bool samr_io_r_del_aliasmem(const char *desc, SAMR_R_DEL_ALIASMEM * r_u,
 }
 
 /*******************************************************************
-inits a SAMR_Q_DELETE_DOM_ALIAS structure.
+inits a SAMR_Q_DEL_ALIASMEM structure.
 ********************************************************************/
 
-void init_samr_q_delete_dom_alias(SAMR_Q_DELETE_DOM_ALIAS * q_c,
-                                 POLICY_HND *hnd)
+void init_samr_q_del_aliasmem(SAMR_Q_DEL_ALIASMEM * q_u, POLICY_HND *hnd,
+                             DOM_SID *sid)
 {
-       DEBUG(5, ("init_samr_q_delete_dom_alias\n"));
+       DEBUG(5, ("init_samr_q_del_aliasmem\n"));
 
-       q_c->alias_pol = *hnd;
+       q_u->alias_pol = *hnd;
+       init_dom_sid2(&q_u->sid, sid);
 }
 
 /*******************************************************************
 reads or writes a structure.
 ********************************************************************/
 
-bool samr_io_q_delete_dom_alias(const char *desc, SAMR_Q_DELETE_DOM_ALIAS * q_u,
-                               prs_struct *ps, int depth)
+bool samr_io_q_del_aliasmem(const char *desc, SAMR_Q_DEL_ALIASMEM * q_u,
+                           prs_struct *ps, int depth)
 {
        if (q_u == NULL)
                return False;
 
-       prs_debug(ps, depth, desc, "samr_io_q_delete_dom_alias");
+       prs_debug(ps, depth, desc, "samr_io_q_del_aliasmem");
        depth++;
 
        if(!prs_align(ps))
@@ -4639,41 +4053,28 @@ bool samr_io_q_delete_dom_alias(const char *desc, SAMR_Q_DELETE_DOM_ALIAS * q_u,
 
        if(!smb_io_pol_hnd("alias_pol", &q_u->alias_pol, ps, depth))
                return False;
+       if(!smb_io_dom_sid2("sid      ", &q_u->sid, ps, depth))
+               return False;
 
        return True;
 }
 
-/*******************************************************************
-inits a SAMR_R_DELETE_DOM_ALIAS structure.
-********************************************************************/
-
-void init_samr_r_delete_dom_alias(SAMR_R_DELETE_DOM_ALIAS * r_u,
-                                 NTSTATUS status)
-{
-       DEBUG(5, ("init_samr_r_delete_dom_alias\n"));
-
-       r_u->status = status;
-}
-
 /*******************************************************************
 reads or writes a structure.
 ********************************************************************/
 
-bool samr_io_r_delete_dom_alias(const char *desc, SAMR_R_DELETE_DOM_ALIAS * r_u,
-                               prs_struct *ps, int depth)
+bool samr_io_r_del_aliasmem(const char *desc, SAMR_R_DEL_ALIASMEM * r_u,
+                           prs_struct *ps, int depth)
 {
        if (r_u == NULL)
                return False;
 
-       prs_debug(ps, depth, desc, "samr_io_r_delete_dom_alias");
+       prs_debug(ps, depth, desc, "samr_io_r_del_aliasmem");
        depth++;
 
        if(!prs_align(ps))
                return False;
 
-       if(!smb_io_pol_hnd("pol", &r_u->pol, ps, depth))
-               return False;
-
        if(!prs_ntstatus("status", ps, depth, &r_u->status))
                return False;
 
@@ -5039,215 +4440,6 @@ bool samr_io_r_lookup_names(const char *desc, SAMR_R_LOOKUP_NAMES * r_u,
        return True;
 }
 
-/*******************************************************************
-inits a SAMR_Q_DELETE_DOM_USER structure.
-********************************************************************/
-
-void init_samr_q_delete_dom_user(SAMR_Q_DELETE_DOM_USER * q_c,
-                                POLICY_HND *hnd)
-{
-       DEBUG(5, ("init_samr_q_delete_dom_user\n"));
-
-       q_c->user_pol = *hnd;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_q_delete_dom_user(const char *desc, SAMR_Q_DELETE_DOM_USER * q_u,
-                              prs_struct *ps, int depth)
-{
-       if (q_u == NULL)
-               return False;
-
-       prs_debug(ps, depth, desc, "samr_io_q_delete_dom_user");
-       depth++;
-
-       if(!prs_align(ps))
-               return False;
-
-       if(!smb_io_pol_hnd("user_pol", &q_u->user_pol, ps, depth))
-               return False;
-
-       return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_r_delete_dom_user(const char *desc, SAMR_R_DELETE_DOM_USER * r_u,
-                              prs_struct *ps, int depth)
-{
-       if (r_u == NULL)
-               return False;
-
-       prs_debug(ps, depth, desc, "samr_io_r_delete_dom_user");
-       depth++;
-
-       if(!prs_align(ps))
-               return False;
-
-       if(!smb_io_pol_hnd("pol", &r_u->pol, ps, depth))
-               return False;
-       if(!prs_ntstatus("status", ps, depth, &r_u->status))
-               return False;
-
-       return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-void init_samr_q_open_user(SAMR_Q_OPEN_USER * q_u,
-                          POLICY_HND *pol,
-                          uint32 access_mask, uint32 rid)
-{
-       DEBUG(5, ("samr_init_samr_q_open_user\n"));
-
-       q_u->domain_pol = *pol;
-       q_u->access_mask = access_mask;
-       q_u->user_rid = rid;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_q_open_user(const char *desc, SAMR_Q_OPEN_USER * q_u,
-                        prs_struct *ps, int depth)
-{
-       if (q_u == NULL)
-               return False;
-
-       prs_debug(ps, depth, desc, "samr_io_q_open_user");
-       depth++;
-
-       if(!prs_align(ps))
-               return False;
-
-       if(!smb_io_pol_hnd("domain_pol", &q_u->domain_pol, ps, depth))
-               return False;
-
-       if(!prs_uint32("access_mask", ps, depth, &q_u->access_mask))
-               return False;
-       if(!prs_uint32("user_rid ", ps, depth, &q_u->user_rid))
-               return False;
-
-       return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_r_open_user(const char *desc, SAMR_R_OPEN_USER * r_u,
-                        prs_struct *ps, int depth)
-{
-       if (r_u == NULL)
-               return False;
-
-       prs_debug(ps, depth, desc, "samr_io_r_open_user");
-       depth++;
-
-       if(!prs_align(ps))
-               return False;
-
-       if(!smb_io_pol_hnd("user_pol", &r_u->user_pol, ps, depth))
-               return False;
-
-       if(!prs_ntstatus("status", ps, depth, &r_u->status))
-               return False;
-
-       return True;
-}
-
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-void init_samr_q_create_user(SAMR_Q_CREATE_USER * q_u,
-                            POLICY_HND *pol,
-                            const char *name,
-                            uint32 acb_info, uint32 access_mask)
-{
-       DEBUG(5, ("samr_init_samr_q_create_user\n"));
-
-       q_u->domain_pol = *pol;
-
-       init_unistr2(&q_u->uni_name, name, UNI_FLAGS_NONE);
-       init_uni_hdr(&q_u->hdr_name, &q_u->uni_name);
-
-       q_u->acb_info = acb_info;
-       q_u->access_mask = access_mask;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_q_create_user(const char *desc, SAMR_Q_CREATE_USER * q_u,
-                          prs_struct *ps, int depth)
-{
-       if (q_u == NULL)
-               return False;
-
-       prs_debug(ps, depth, desc, "samr_io_q_create_user");
-       depth++;
-
-       if(!prs_align(ps))
-               return False;
-
-       if(!smb_io_pol_hnd("domain_pol", &q_u->domain_pol, ps, depth))
-               return False;
-
-       if(!smb_io_unihdr("hdr_name", &q_u->hdr_name, ps, depth))
-               return False;
-       if(!smb_io_unistr2("uni_name", &q_u->uni_name, q_u->hdr_name.buffer, ps, depth))
-               return False;
-
-       if(!prs_align(ps))
-               return False;
-       if(!prs_uint32("acb_info   ", ps, depth, &q_u->acb_info))
-               return False;
-       if(!prs_uint32("access_mask", ps, depth, &q_u->access_mask))
-               return False;
-
-       return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_r_create_user(const char *desc, SAMR_R_CREATE_USER * r_u,
-                          prs_struct *ps, int depth)
-{
-       if (r_u == NULL)
-               return False;
-
-       prs_debug(ps, depth, desc, "samr_io_r_create_user");
-       depth++;
-
-       if(!prs_align(ps))
-               return False;
-
-       if(!smb_io_pol_hnd("user_pol", &r_u->user_pol, ps, depth))
-               return False;
-
-       if(!prs_uint32("access_granted", ps, depth, &r_u->access_granted))
-               return False;
-       if(!prs_uint32("user_rid ", ps, depth, &r_u->user_rid))
-               return False;
-       if(!prs_ntstatus("status", ps, depth, &r_u->status))
-               return False;
-
-       return True;
-}
-
 /*******************************************************************
 inits a SAMR_Q_QUERY_USERINFO structure.
 ********************************************************************/
@@ -7338,77 +6530,6 @@ bool samr_io_r_connect_anon(const char *desc, SAMR_R_CONNECT_ANON * r_u,
        return True;
 }
 
-/*******************************************************************
-inits a SAMR_Q_GET_DOM_PWINFO structure.
-********************************************************************/
-
-void init_samr_q_get_dom_pwinfo(SAMR_Q_GET_DOM_PWINFO * q_u,
-                               char *srv_name)
-{
-       DEBUG(5, ("init_samr_q_get_dom_pwinfo\n"));
-
-       q_u->ptr = 1;
-       init_unistr2(&q_u->uni_srv_name, srv_name, UNI_FLAGS_NONE);
-       init_uni_hdr(&q_u->hdr_srv_name, &q_u->uni_srv_name);
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_q_get_dom_pwinfo(const char *desc, SAMR_Q_GET_DOM_PWINFO * q_u,
-                             prs_struct *ps, int depth)
-{
-       if (q_u == NULL)
-               return False;
-
-       prs_debug(ps, depth, desc, "samr_io_q_get_dom_pwinfo");
-       depth++;
-
-       if(!prs_align(ps))
-               return False;
-
-       if(!prs_uint32("ptr", ps, depth, &q_u->ptr))
-               return False;
-       if (q_u->ptr != 0) {
-               if(!smb_io_unihdr("", &q_u->hdr_srv_name, ps, depth))
-                       return False;
-               if(!smb_io_unistr2("", &q_u->uni_srv_name, q_u->hdr_srv_name.buffer, ps, depth))
-                       return False;
-       }
-
-       return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_r_get_dom_pwinfo(const char *desc, SAMR_R_GET_DOM_PWINFO * r_u,
-                             prs_struct *ps, int depth)
-{
-       if (r_u == NULL)
-               return False;
-
-       prs_debug(ps, depth, desc, "samr_io_r_get_dom_pwinfo");
-       depth++;
-
-       if(!prs_align(ps))
-               return False;
-
-       if(!prs_uint16("min_pwd_length", ps, depth, &r_u->min_pwd_length))
-               return False;
-       if(!prs_align(ps))
-               return False;
-       if(!prs_uint32("password_properties", ps, depth, &r_u->password_properties))
-               return False;
-
-       if(!prs_ntstatus("status", ps, depth, &r_u->status))
-               return False;
-
-       return True;
-}
-
 /*******************************************************************
 make a SAMR_ENC_PASSWD structure.
 ********************************************************************/
index 6198a78de0513bdf96a9cc2b4b27fd1568e8d0b3..6ea128d3a49cf61c9ecc902ea7d54d889cd4a5fd 100644 (file)
@@ -291,14 +291,14 @@ bool sec_io_desc(const char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth)
 
                if (psd->owner_sid != NULL) {
                        off_owner_sid = offset;
-                       offset += sid_size(psd->owner_sid);
+                       offset += ndr_size_dom_sid(psd->owner_sid, 0);
                } else {
                        off_owner_sid = 0;
                }
 
                if (psd->group_sid != NULL) {
                        off_grp_sid = offset;
-                       offset += sid_size(psd->group_sid);
+                       offset += ndr_size_dom_sid(psd->group_sid, 0);
                } else {
                        off_grp_sid = 0;
                }
@@ -426,7 +426,7 @@ bool sec_io_desc_buf(const char *desc, SEC_DESC_BUF **ppsdb, prs_struct *ps, int
        if(!prs_uint32    ("ptr  ", ps, depth, &ptr))
                return False;
 
-       len = sec_desc_size(psdb->sd);
+       len = ndr_size_security_descriptor(psdb->sd, 0);
        if(!prs_uint32_pre("len    ", ps, depth, &len, &off_len))
                return False;
 
index ea76c57045aacb057b9d2c6cade3958009b30ea8..3bf8ef27c1e8cce57a872b67789878cf94abadf6 100644 (file)
@@ -3098,7 +3098,7 @@ uint32 spoolss_size_printer_info_2(PRINTER_INFO_2 *info)
                
        size += 4;
        
-       size += sec_desc_size( info->secdesc );
+       size += ndr_size_security_descriptor( info->secdesc, 0 );
 
        size+=size_of_device_mode( info->devmode );
        
@@ -3185,7 +3185,7 @@ return the size required by a struct in the stream
 uint32 spoolss_size_printer_info_3(PRINTER_INFO_3 *info)
 {
        /* The 8 is for the self relative pointer - 8 byte aligned.. */
-       return 8 + (uint32)sec_desc_size( info->secdesc );
+       return 8 + (uint32)ndr_size_security_descriptor( info->secdesc, 0 );
 }
 
 /*******************************************************************
index e7a73183f5829df865ec645d111bfa7503de9e53..954aa806000ff92c4fc4837822c774ae4779716b 100644 (file)
@@ -507,7 +507,8 @@ static bool srv_io_share_info502_str(const char *desc, SH_INFO_502_STR *sh502, p
 
                if(UNMARSHALLING(ps)) {
 
-                       sh502->ptrs->sd_size = sh502->sd_size = sec_desc_size(sh502->sd);
+                       sh502->ptrs->sd_size = sh502->sd_size =
+                               ndr_size_security_descriptor(sh502->sd, 0);
 
                        prs_set_offset(ps, old_offset + sh502->reserved);
                }
@@ -1018,7 +1019,7 @@ static bool srv_io_srv_share_ctr(const char *desc, SRV_SHARE_INFO_CTR *ctr, prs_
 
        default:
                DEBUG(5,("%s no share info at switch_value %d\n",
-                        tab_depth(depth), ctr->switch_value));
+                        tab_depth(5,depth), ctr->switch_value));
                break;
        }
 
@@ -1267,7 +1268,7 @@ static bool srv_io_srv_share_info(const char *desc, prs_struct *ps, int depth, S
                                return False;
                default:
                        DEBUG(5,("%s no share info at switch_value %d\n",
-                                tab_depth(depth), r_n->switch_value));
+                                tab_depth(5,depth), r_n->switch_value));
                        break;
                }
        }
@@ -1460,7 +1461,7 @@ void init_srv_q_net_share_add(SRV_Q_NET_SHARE_ADD *q, const char *srvname,
 {
        switch(level) {
        case 502: {
-               size_t sd_size = sec_desc_size(sd);
+               size_t sd_size = ndr_size_security_descriptor(sd, 0);
                q->ptr_srv_name = 1;
                init_unistr2(&q->uni_srv_name, srvname, UNI_STR_TERMINATE);
                q->info.switch_value = q->info_level = level;
@@ -1796,7 +1797,7 @@ static bool srv_io_srv_sess_ctr(const char *desc, SRV_SESS_INFO_CTR **pp_ctr, pr
                        break;
                default:
                        DEBUG(5,("%s no session info at switch_value %d\n",
-                                tab_depth(depth), ctr->switch_value));
+                                tab_depth(5,depth), ctr->switch_value));
                        break;
                }
        }
@@ -2216,7 +2217,7 @@ static bool srv_io_srv_conn_ctr(const char *desc, SRV_CONN_INFO_CTR **pp_ctr, pr
                        break;
                default:
                        DEBUG(5,("%s no connection info at switch_value %d\n",
-                                tab_depth(depth), ctr->switch_value));
+                                tab_depth(5,depth), ctr->switch_value));
                        break;
                }
        }
@@ -2486,7 +2487,7 @@ static bool srv_io_srv_file_ctr(const char *desc, SRV_FILE_INFO_CTR *ctr, prs_st
                break;
        }
        default:
-               DEBUG(5,("%s no file info at switch_value %d\n", tab_depth(depth), ctr->level));
+               DEBUG(5,("%s no file info at switch_value %d\n", tab_depth(5,depth), ctr->level));
                break;
        }
                        
@@ -2839,7 +2840,7 @@ static bool srv_io_info_ctr(const char *desc, SRV_INFO_CTR *ctr, prs_struct *ps,
                        break;
                default:
                        DEBUG(5,("%s no server info at switch_value %d\n",
-                                        tab_depth(depth), ctr->switch_value));
+                                        tab_depth(5,depth), ctr->switch_value));
                        break;
                }
                if(!prs_align(ps))
index 8a1cdedb4fa3757b566d916bd4a1509ebc75e4b5..29538a304f63d4f4921fd3c4cec9a835cef8dc17 100644 (file)
@@ -34,7 +34,7 @@ void _dfs_GetManagerVersion(pipes_struct *p, struct dfs_GetManagerVersion *r)
        if (lp_host_msdfs()) {
                *r->out.version = DFS_MANAGER_VERSION_NT4;
        } else {
-               *r->out.version = 0;
+               *r->out.version = (enum dfs_ManagerVersion)0;
        }
 }
 
@@ -133,10 +133,10 @@ WERROR _dfs_Remove(pipes_struct *p, struct dfs_Remove *r)
                altpath = talloc_asprintf(ctx, "%s\\%s",
                        r->in.servername,
                        r->in.sharename);
-               strlower_m(altpath);
                if (!altpath) {
                        return WERR_NOMEM;
                }
+               strlower_m(altpath);
                DEBUG(5,("init_reply_dfs_remove: Request to remove %s -> %s\\%s.\n",
                        r->in.dfs_entry_path, r->in.servername, r->in.sharename));
        }
diff --git a/source/rpc_server/srv_dssetup_nt.c b/source/rpc_server/srv_dssetup_nt.c
new file mode 100644 (file)
index 0000000..ea535a3
--- /dev/null
@@ -0,0 +1,220 @@
+/*
+ *  Unix SMB/CIFS implementation.
+ *  RPC Pipe client / server routines
+ *  Copyright (C) Andrew Tridgell               1992-1997.
+ *  Copyright (C) Luke Kenneth Casson Leighton  1996-1997.
+ *  Copyright (C) Paul Ashton                        1997.
+ *  Copyright (C) Jeremy Allison                     2001.
+ *  Copyright (C) Gerald Carter                      2002.
+ *  Copyright (C) Guenther Deschner                  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/>.
+ */
+
+#include "includes.h"
+
+#undef DBGC_CLASS
+#define DBGC_CLASS DBGC_RPC_SRV
+
+/********************************************************************
+ Fill in a dssetup_DsRolePrimaryDomInfoBasic structure
+ ********************************************************************/
+
+static WERROR fill_dsrole_dominfo_basic(TALLOC_CTX *ctx,
+                                       struct dssetup_DsRolePrimaryDomInfoBasic **info)
+{
+       struct dssetup_DsRolePrimaryDomInfoBasic *basic = NULL;
+       fstring dnsdomain;
+
+       DEBUG(10,("fill_dsrole_dominfo_basic: enter\n"));
+
+       basic = TALLOC_ZERO_P(ctx, struct dssetup_DsRolePrimaryDomInfoBasic);
+       if (!basic) {
+               DEBUG(0,("fill_dsrole_dominfo_basic: out of memory\n"));
+               return WERR_NOMEM;
+       }
+
+       switch (lp_server_role()) {
+               case ROLE_STANDALONE:
+                       basic->role = DS_ROLE_STANDALONE_SERVER;
+                       basic->domain = get_global_sam_name();
+                       break;
+               case ROLE_DOMAIN_MEMBER:
+                       basic->role = DS_ROLE_MEMBER_SERVER;
+                       basic->domain = lp_workgroup();
+                       break;
+               case ROLE_DOMAIN_BDC:
+                       basic->role = DS_ROLE_BACKUP_DC;
+                       basic->domain = get_global_sam_name();
+                       break;
+               case ROLE_DOMAIN_PDC:
+                       basic->role = DS_ROLE_PRIMARY_DC;
+                       basic->domain = get_global_sam_name();
+                       break;
+       }
+
+       if (secrets_fetch_domain_guid(lp_workgroup(), &basic->domain_guid)) {
+               basic->flags |= DS_ROLE_PRIMARY_DOMAIN_GUID_PRESENT;
+       }
+
+       /* fill in some additional fields if we are a member of an AD domain */
+
+       if (lp_security() == SEC_ADS) {
+               fstrcpy(dnsdomain, lp_realm());
+               strlower_m(dnsdomain);
+               basic->dns_domain = dnsdomain;
+
+               /* FIXME!! We really should fill in the correct forest
+                  name.  Should get this information from winbindd.  */
+               basic->forest = dnsdomain;
+       } else {
+               /* security = domain should not fill in the dns or
+                  forest name */
+               basic->dns_domain = NULL;
+               basic->forest = NULL;
+       }
+
+       *info = basic;
+
+       return WERR_OK;
+}
+
+/********************************************************************
+ Implement the _dssetup_DsRoleGetPrimaryDomainInformation() call
+ ********************************************************************/
+
+WERROR _dssetup_DsRoleGetPrimaryDomainInformation(pipes_struct *p,
+                                                 struct dssetup_DsRoleGetPrimaryDomainInformation *r)
+{
+       WERROR werr = WERR_OK;
+
+       switch (r->in.level) {
+
+               case DS_ROLE_BASIC_INFORMATION: {
+                       struct dssetup_DsRolePrimaryDomInfoBasic *basic = NULL;
+                       werr = fill_dsrole_dominfo_basic(p->mem_ctx, &basic);
+                       if (W_ERROR_IS_OK(werr)) {
+                               r->out.info->basic = *basic;
+                       }
+                       break;
+               }
+               default:
+                       DEBUG(0,("_dssetup_DsRoleGetPrimaryDomainInformation: "
+                               "Unknown info level [%d]!\n", r->in.level));
+                       werr = WERR_UNKNOWN_LEVEL;
+       }
+
+       return werr;
+}
+
+/****************************************************************
+****************************************************************/
+
+WERROR _dssetup_DsRoleDnsNameToFlatName(pipes_struct *p,
+                                       struct dssetup_DsRoleDnsNameToFlatName *r)
+{
+       p->rng_fault_state = true;
+       return WERR_NOT_SUPPORTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+WERROR _dssetup_DsRoleDcAsDc(pipes_struct *p,
+                            struct dssetup_DsRoleDcAsDc *r)
+{
+       p->rng_fault_state = true;
+       return WERR_NOT_SUPPORTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+WERROR _dssetup_DsRoleDcAsReplica(pipes_struct *p,
+                                 struct dssetup_DsRoleDcAsReplica *r)
+{
+       p->rng_fault_state = true;
+       return WERR_NOT_SUPPORTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+WERROR _dssetup_DsRoleDemoteDc(pipes_struct *p,
+                              struct dssetup_DsRoleDemoteDc *r)
+{
+       p->rng_fault_state = true;
+       return WERR_NOT_SUPPORTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+WERROR _dssetup_DsRoleGetDcOperationProgress(pipes_struct *p,
+                                            struct dssetup_DsRoleGetDcOperationProgress *r)
+{
+       p->rng_fault_state = true;
+       return WERR_NOT_SUPPORTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+WERROR _dssetup_DsRoleGetDcOperationResults(pipes_struct *p,
+                                           struct dssetup_DsRoleGetDcOperationResults *r)
+{
+       p->rng_fault_state = true;
+       return WERR_NOT_SUPPORTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+WERROR _dssetup_DsRoleCancel(pipes_struct *p,
+                            struct dssetup_DsRoleCancel *r)
+{
+       p->rng_fault_state = true;
+       return WERR_NOT_SUPPORTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+WERROR _dssetup_DsRoleServerSaveStateForUpgrade(pipes_struct *p,
+                                               struct dssetup_DsRoleServerSaveStateForUpgrade *r)
+{
+       p->rng_fault_state = true;
+       return WERR_NOT_SUPPORTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+WERROR _dssetup_DsRoleUpgradeDownlevelServer(pipes_struct *p,
+                                            struct dssetup_DsRoleUpgradeDownlevelServer *r)
+{
+       p->rng_fault_state = true;
+       return WERR_NOT_SUPPORTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+WERROR _dssetup_DsRoleAbortDownlevelServerUpgrade(pipes_struct *p,
+                                                 struct dssetup_DsRoleAbortDownlevelServerUpgrade *r)
+{
+       p->rng_fault_state = true;
+       return WERR_NOT_SUPPORTED;
+}
+
index 4e996ee19bf48f688e48a91f7e97f84395990abc..269e2f318e52fcaa6b281c50c662f18aab44a863 100644 (file)
@@ -140,15 +140,14 @@ int elog_tdb_size( TDB_CONTEXT * tdb, int *MaxSize, int *Retention )
  return True if we made enough room to accommodate needed bytes
 ********************************************************************/
 
-bool make_way_for_eventlogs( TDB_CONTEXT * the_tdb, int32 needed,
-                            bool whack_by_date )
+static bool make_way_for_eventlogs( TDB_CONTEXT * the_tdb, int32 needed,
+                                   bool whack_by_date )
 {
        int start_record, i, new_start;
        int end_record;
        int nbytes, reclen, len, Retention, MaxSize;
        int tresv1, trecnum, timegen, timewr;
        TDB_DATA key, ret;
-       TALLOC_CTX *mem_ctx = NULL;
        time_t current_time, exp_time;
 
        /* discard some eventlogs */
@@ -156,10 +155,7 @@ bool make_way_for_eventlogs( TDB_CONTEXT * the_tdb, int32 needed,
        /* read eventlogs from oldest_entry -- there can't be any discontinuity in recnos,
           although records not necessarily guaranteed to have successive times */
        /* */
-       mem_ctx = talloc_init( "make_way_for_eventlogs" );      /* Homage to BPG */
 
-       if ( mem_ctx == NULL )
-               return False;   /* can't allocate memory indicates bigger problems */
        /* lock */
        tdb_lock_bystring_with_timeout( the_tdb, EVT_NEXT_RECORD, 1 );
        /* read */
index 3c9c835bad72545d4415377084d99c77cee59eb4..7af8219a3e0cc30b6a8e195802a7155b74a72625 100644 (file)
@@ -423,12 +423,12 @@ static bool sync_eventlog_params( EVENTLOG_INFO *info )
        char *path = NULL;
        uint32 uiMaxSize;
        uint32 uiRetention;
-       REGISTRY_KEY *keyinfo;
-       REGISTRY_VALUE *val;
-       REGVAL_CTR *values;
+       struct registry_key *key;
+       struct registry_value *value;
        WERROR wresult;
        char *elogname = info->logname;
        TALLOC_CTX *ctx = talloc_tos();
+       bool ret = false;
 
        DEBUG( 4, ( "sync_eventlog_params with %s\n", elogname ) );
 
@@ -451,36 +451,42 @@ static bool sync_eventlog_params( EVENTLOG_INFO *info )
                return false;
        }
 
-       wresult = regkey_open_internal( NULL, &keyinfo, path,
-                                       get_root_nt_token(  ), REG_KEY_READ );
+       wresult = reg_open_path(ctx, path, REG_KEY_READ, get_root_nt_token(),
+                               &key);
 
        if ( !W_ERROR_IS_OK( wresult ) ) {
                DEBUG( 4,
                       ( "sync_eventlog_params: Failed to open key [%s] (%s)\n",
                         path, dos_errstr( wresult ) ) );
-               return False;
+               return false;
        }
 
-       if ( !( values = TALLOC_ZERO_P( keyinfo, REGVAL_CTR ) ) ) {
-               TALLOC_FREE( keyinfo );
-               DEBUG( 0, ( "control_eventlog_hook: talloc() failed!\n" ) );
-
-               return False;
+       wresult = reg_queryvalue(key, key, "Retention", &value);
+       if (!W_ERROR_IS_OK(wresult)) {
+               DEBUG(4, ("Failed to query value \"Retention\": %s\n",
+                         dos_errstr(wresult)));
+               ret = false;
+               goto done;
        }
-       fetch_reg_values( keyinfo, values );
-
-       if ( ( val = regval_ctr_getvalue( values, "Retention" ) ) != NULL )
-               uiRetention = IVAL( regval_data_p( val ), 0 );
+       uiRetention = value->v.dword;
 
-       if ( ( val = regval_ctr_getvalue( values, "MaxSize" ) ) != NULL )
-               uiMaxSize = IVAL( regval_data_p( val ), 0 );
-
-       TALLOC_FREE( keyinfo );
+       wresult = reg_queryvalue(key, key, "MaxSize", &value);
+       if (!W_ERROR_IS_OK(wresult)) {
+               DEBUG(4, ("Failed to query value \"MaxSize\": %s\n",
+                         dos_errstr(wresult)));
+               ret = false;
+               goto done;
+       }
+       uiMaxSize = value->v.dword;
 
        tdb_store_int32( ELOG_TDB_CTX(info->etdb), EVT_MAXSIZE, uiMaxSize );
        tdb_store_int32( ELOG_TDB_CTX(info->etdb), EVT_RETENTION, uiRetention );
 
-       return True;
+       ret = true;
+
+done:
+       TALLOC_FREE(ctx);
+       return ret;
 }
 
 /********************************************************************
diff --git a/source/rpc_server/srv_lsa_ds.c b/source/rpc_server/srv_lsa_ds.c
deleted file mode 100644 (file)
index 55baa40..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- *  Unix SMB/CIFS implementation.
- *  RPC Pipe client / server routines
- *  Copyright (C) Gerald Carter                2003
- *
- *  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/>.
- */
-
-/* This is the interface for the registry functions. */
-
-#include "includes.h"
-
-#undef DBGC_CLASS
-#define DBGC_CLASS DBGC_RPC_SRV
-
-/*******************************************************************
- ********************************************************************/
-
-static bool api_dsrole_get_primary_dominfo(pipes_struct *p)
-{
-       DS_Q_GETPRIMDOMINFO q_u;
-       DS_R_GETPRIMDOMINFO r_u;
-       prs_struct *data = &p->in_data.data;
-       prs_struct *rdata = &p->out_data.rdata;
-
-       ZERO_STRUCT(q_u);
-       ZERO_STRUCT(r_u);
-
-       /* grab the request */
-       if ( !ds_io_q_getprimdominfo("", &q_u, data, 0) )
-               return False;
-
-       /* construct reply. */
-       r_u.status = _dsrole_get_primary_dominfo( p, &q_u, &r_u );
-
-       if ( !ds_io_r_getprimdominfo("", &r_u, rdata, 0) )
-               return False;
-
-       return True;
-}
-
-/*******************************************************************
- stub functions for unimplemented RPC
-*******************************************************************/
-
-static bool api_dsrole_stub( pipes_struct *p )
-{
-       DEBUG(0,("api_dsrole_stub:  Hmmm....didn't know this RPC existed...\n"));
-
-       return False;
-}
-
-
-/*******************************************************************
- array of \PIPE\lsass (new windows 2000 UUID)  operations
-********************************************************************/
-static struct api_struct api_lsa_ds_cmds[] = {
-       { "DS_NOP",                     DS_NOP,                 api_dsrole_stub },
-       { "DS_GETPRIMDOMINFO",          DS_GETPRIMDOMINFO,      api_dsrole_get_primary_dominfo  }
-
-};
-
-void lsa_ds_get_pipe_fns( struct api_struct **fns, int *n_fns )
-{
-       *fns = api_lsa_ds_cmds;
-       *n_fns = sizeof(api_lsa_ds_cmds) / sizeof(struct api_struct);
-}
-
-
-NTSTATUS rpc_lsa_ds_init(void)
-{
-       return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "lsa_ds", "lsa_ds", api_lsa_ds_cmds,
-               sizeof(api_lsa_ds_cmds) / sizeof(struct api_struct));
-}
diff --git a/source/rpc_server/srv_lsa_ds_nt.c b/source/rpc_server/srv_lsa_ds_nt.c
deleted file mode 100644 (file)
index 994b3cc..0000000
+++ /dev/null
@@ -1,130 +0,0 @@
-/* 
- *  Unix SMB/CIFS implementation.
- *  RPC Pipe client / server routines
- *  Copyright (C) Andrew Tridgell               1992-1997.
- *  Copyright (C) Luke Kenneth Casson Leighton  1996-1997.
- *  Copyright (C) Paul Ashton                        1997.
- *  Copyright (C) Jeremy Allison                     2001.
- *  Copyright (C) Gerald Carter                      2002.
- *
- *  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/>.
- */
-
-/* Implementation of registry functions. */
-
-#include "includes.h"
-
-#undef DBGC_CLASS
-#define DBGC_CLASS DBGC_RPC_SRV
-
-/********************************************************************
- Fill in a DS_DOMINFO_CTR structure
- ********************************************************************/
-
-static NTSTATUS fill_dsrole_dominfo_basic(TALLOC_CTX *ctx, DSROLE_PRIMARY_DOMAIN_INFO_BASIC **info) 
-{
-       DSROLE_PRIMARY_DOMAIN_INFO_BASIC *basic;
-       const char *netbios_domain = "";
-       fstring dnsdomain;
-
-       DEBUG(10,("fill_dsrole_dominfo_basic: enter\n"));
-
-       if ( !(basic = TALLOC_ZERO_P(ctx, DSROLE_PRIMARY_DOMAIN_INFO_BASIC)) ) {
-               DEBUG(0,("fill_dsrole_dominfo_basic: FATAL error!  talloc_xero() failed\n"));
-               return NT_STATUS_NO_MEMORY;
-       }
-
-       switch ( lp_server_role() ) {
-               case ROLE_STANDALONE:
-                       basic->machine_role = DSROLE_STANDALONE_SRV;
-                       basic->netbios_ptr = 1;
-                       netbios_domain = get_global_sam_name();
-                       break;
-               case ROLE_DOMAIN_MEMBER:
-                       basic->netbios_ptr = 1;
-                       netbios_domain = lp_workgroup();
-                       basic->machine_role = DSROLE_DOMAIN_MEMBER_SRV;
-                       break;
-               case ROLE_DOMAIN_BDC:
-                       basic->netbios_ptr = 1;
-                       netbios_domain = get_global_sam_name();
-                       basic->machine_role = DSROLE_BDC;
-                       break;
-               case ROLE_DOMAIN_PDC:
-                       basic->netbios_ptr = 1;
-                       netbios_domain = get_global_sam_name();
-                       basic->machine_role = DSROLE_PDC;
-                       break;
-       }
-
-       /* always set netbios name */
-
-       init_unistr2( &basic->netbios_domain, netbios_domain, UNI_STR_TERMINATE);
-
-       if ( secrets_fetch_domain_guid( lp_workgroup(), &basic->domain_guid ) )
-               basic->flags |= DSROLE_PRIMARY_DOMAIN_GUID_PRESENT;
-
-       /* fill in some additional fields if we are a member of an AD domain */
-
-       if ( lp_security() == SEC_ADS ) {
-               fstrcpy( dnsdomain, lp_realm() );
-               strlower_m( dnsdomain );
-               
-               basic->dnsname_ptr = 1;
-               init_unistr2( &basic->dns_domain, dnsdomain, UNI_STR_TERMINATE);
-
-               /* FIXME!! We really should fill in the correct forest
-                  name.  Should get this information from winbindd.  */
-               basic->forestname_ptr = 1;
-               init_unistr2( &basic->forest_domain, dnsdomain, UNI_STR_TERMINATE);
-       } else {
-               /* security = domain should not fill in the dns or
-                  forest name */
-               basic->dnsname_ptr = 0;
-               basic->forestname_ptr = 0;
-       }
-
-       *info = basic;
-
-       return NT_STATUS_OK;
-}
-
-/********************************************************************
- Implement the DsroleGetPrimaryDomainInfo() call
- ********************************************************************/
-
-NTSTATUS _dsrole_get_primary_dominfo(pipes_struct *p, DS_Q_GETPRIMDOMINFO *q_u, DS_R_GETPRIMDOMINFO *r_u)
-{
-       NTSTATUS result = NT_STATUS_OK;
-       uint32 level = q_u->level;
-
-       switch ( level ) {
-
-               case DsRolePrimaryDomainInfoBasic:
-                       r_u->level = DsRolePrimaryDomainInfoBasic;
-                       r_u->ptr = 1;
-                       result = fill_dsrole_dominfo_basic( p->mem_ctx, &r_u->info.basic );
-                       break;
-
-               default:
-                       DEBUG(0,("_dsrole_get_primary_dominfo: Unsupported info level [%d]!\n",
-                               level));
-                       result = NT_STATUS_INVALID_LEVEL;
-       }
-
-       return result;
-}
-
-
-
index a289196f5fe6c9630297757f61cfa69707c66685..20cafbd0af2f8679cef4a4408b69a24d59afa2d1 100644 (file)
@@ -463,7 +463,9 @@ static NTSTATUS lsa_get_generic_sd(TALLOC_CTX *mem_ctx, SEC_DESC **sd, size_t *s
        if((psa = make_sec_acl(mem_ctx, NT4_ACL_REVISION, 3, ace)) == NULL)
                return NT_STATUS_NO_MEMORY;
 
-       if((*sd = make_sec_desc(mem_ctx, SEC_DESC_REVISION, SEC_DESC_SELF_RELATIVE, &adm_sid, NULL, NULL, psa, sd_size)) == NULL)
+       if((*sd = make_sec_desc(mem_ctx, SECURITY_DESCRIPTOR_REVISION_1,
+                               SEC_DESC_SELF_RELATIVE, &adm_sid, NULL, NULL,
+                               psa, sd_size)) == NULL)
                return NT_STATUS_NO_MEMORY;
 
        return NT_STATUS_OK;
@@ -2581,7 +2583,7 @@ NTSTATUS _lsa_LSARUNREGISTERAUDITEVENT(pipes_struct *p, struct lsa_LSARUNREGISTE
        return NT_STATUS_NOT_IMPLEMENTED;
 }
 
-NTSTATUS _lsa_LSARQUERYFORESTTRUSTINFORMATION(pipes_struct *p, struct lsa_LSARQUERYFORESTTRUSTINFORMATION *r)
+NTSTATUS _lsa_lsaRQueryForestTrustInformation(pipes_struct *p, struct lsa_lsaRQueryForestTrustInformation *r)
 {
        p->rng_fault_state = True;
        return NT_STATUS_NOT_IMPLEMENTED;
index 6d9859a9ae0f2e168c4c752f91f7f242f4de1cb6..30ef02bee8c899d90082d5c36c7a3046faab64c8 100644 (file)
@@ -335,43 +335,6 @@ static bool api_net_sam_logon_ex(pipes_struct *p)
        return True;
 }
 
-
-/*************************************************************************
- api_ds_enum_dom_trusts:
- *************************************************************************/
-
-#if 0  /* JERRY */
-static bool api_ds_enum_dom_trusts(pipes_struct *p)
-{
-       DS_Q_ENUM_DOM_TRUSTS q_u;
-       DS_R_ENUM_DOM_TRUSTS r_u;
-
-       prs_struct *data = &p->in_data.data;
-       prs_struct *rdata = &p->out_data.rdata;
-
-       ZERO_STRUCT(q_u);
-       ZERO_STRUCT(r_u);
-
-       DEBUG(6,("api_ds_enum_dom_trusts\n"));
-
-       if ( !ds_io_q_enum_domain_trusts("", data, 0, &q_u) ) {
-               DEBUG(0,("api_ds_enum_domain_trusts: Failed to unmarshall DS_Q_ENUM_DOM_TRUSTS.\n"));
-               return False;
-       }
-
-       r_u.status = _ds_enum_dom_trusts(p, &q_u, &r_u);
-
-       if ( !ds_io_r_enum_domain_trusts("", rdata, 0, &r_u) ) {
-               DEBUG(0,("api_ds_enum_domain_trusts: Failed to marshall DS_R_ENUM_DOM_TRUSTS.\n"));
-               return False;
-       }
-
-       DEBUG(6,("api_ds_enum_dom_trusts\n"));
-
-       return True;
-}
-#endif /* JERRY */
-
 /*******************************************************************
  array of \PIPE\NETLOGON operations
  ********************************************************************/
@@ -387,9 +350,6 @@ static struct api_struct api_net_cmds [] =
       { "NET_TRUST_DOM_LIST", NET_TRUST_DOM_LIST, api_net_trust_dom_list },
       { "NET_LOGON_CTRL"    , NET_LOGON_CTRL    , api_net_logon_ctrl     },
       { "NET_SAMLOGON_EX"   , NET_SAMLOGON_EX   , api_net_sam_logon_ex   },
-#if 0  /* JERRY */
-      { "DS_ENUM_DOM_TRUSTS", DS_ENUM_DOM_TRUSTS, api_ds_enum_dom_trusts }
-#endif /* JERRY */
     };
 
 void netlog_get_pipe_fns( struct api_struct **fns, int *n_fns )
index 218ce734440482b4e277495b5c7d2e9c8618e9a9..3a7075ecd6d1918b1e53fa528805e93d5372aded 100644 (file)
@@ -42,14 +42,6 @@ static void init_net_r_req_chal(NET_R_REQ_CHAL *r_c,
        r_c->status = status;
 }
 
-/*************************************************************************
- error messages cropping up when using nltest.exe...
- *************************************************************************/
-
-#define ERROR_NO_SUCH_DOMAIN   0x54b
-#define ERROR_NO_LOGON_SERVERS 0x51f
-#define NO_ERROR               0x0
-
 /*************************************************************************
  net_reply_logon_ctrl:
  *************************************************************************/
@@ -97,7 +89,7 @@ NTSTATUS _net_logon_ctrl2(pipes_struct *p, NET_Q_LOGON_CTRL2 *q_u, NET_R_LOGON_C
 
        r_u->status = NT_STATUS_OK;
        
-       tc_status = ERROR_NO_SUCH_DOMAIN;
+       tc_status = W_ERROR_V(WERR_NO_SUCH_DOMAIN);
        fstrcpy( dc_name, "" );
        
        switch ( q_u->function_code ) {
@@ -108,13 +100,13 @@ NTSTATUS _net_logon_ctrl2(pipes_struct *p, NET_Q_LOGON_CTRL2 *q_u, NET_R_LOGON_C
                                break;
                                
                        if ( !get_dc_name( domain, NULL, dc_name2, &dc_ss ) ) {
-                               tc_status = ERROR_NO_LOGON_SERVERS;
+                               tc_status = W_ERROR_V(WERR_NO_LOGON_SERVERS);
                                break;
                        }
 
                        fstr_sprintf( dc_name, "\\\\%s", dc_name2 );
                                
-                       tc_status = NO_ERROR;
+                       tc_status = W_ERROR_V(WERR_OK);
                        
                        break;
                        
@@ -125,13 +117,13 @@ NTSTATUS _net_logon_ctrl2(pipes_struct *p, NET_Q_LOGON_CTRL2 *q_u, NET_R_LOGON_C
                                break;
                                
                        if ( !get_dc_name( domain, NULL, dc_name2, &dc_ss ) ) {
-                               tc_status = ERROR_NO_LOGON_SERVERS;
+                               tc_status = W_ERROR_V(WERR_NO_LOGON_SERVERS);
                                break;
                        }
 
                        fstr_sprintf( dc_name, "\\\\%s", dc_name2 );
                                
-                       tc_status = NO_ERROR;
+                       tc_status = W_ERROR_V(WERR_OK);
                        
                        break;
                        
@@ -1062,7 +1054,7 @@ static NTSTATUS _net_sam_logon_internal(pipes_struct *p,
                                    0, /* bad_pw_count */
                                    num_gids,    /* uint32 num_groups */
                                    gids    , /* DOM_GID *gids */
-                                   LOGON_EXTRA_SIDS, /* uint32 user_flgs (?) */
+                                   NETLOGON_EXTRA_SIDS, /* uint32 user_flgs (?) */
                                    pdb_get_acct_ctrl(sampw),
                                    server_info->user_session_key.length ? user_session_key : NULL,
                                    server_info->lm_session_key.length ? lm_session_key : NULL,
@@ -1130,7 +1122,7 @@ NTSTATUS _net_sam_logon_ex(pipes_struct *p, NET_Q_SAM_LOGON_EX *q_u, NET_R_SAM_L
  _ds_enum_dom_trusts
  *************************************************************************/
 #if 0  /* JERRY -- not correct */
-NTSTATUS _ds_enum_dom_trusts(pipes_struct *p, DS_Q_ENUM_DOM_TRUSTS *q_u,
+ NTSTATUS _ds_enum_dom_trusts(pipes_struct *p, DS_Q_ENUM_DOM_TRUSTS *q_u,
                             DS_R_ENUM_DOM_TRUSTS *r_u)
 {
        NTSTATUS status = NT_STATUS_OK;
@@ -1144,3 +1136,475 @@ NTSTATUS _ds_enum_dom_trusts(pipes_struct *p, DS_Q_ENUM_DOM_TRUSTS *q_u,
        return status;
 }
 #endif /* JERRY */
+
+
+/****************************************************************
+****************************************************************/
+
+WERROR _netr_LogonUasLogon(pipes_struct *p,
+                          struct netr_LogonUasLogon *r)
+{
+       p->rng_fault_state = true;
+       return WERR_NOT_SUPPORTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+WERROR _netr_LogonUasLogoff(pipes_struct *p,
+                           struct netr_LogonUasLogoff *r)
+{
+       p->rng_fault_state = true;
+       return WERR_NOT_SUPPORTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _netr_LogonSamLogon(pipes_struct *p,
+                            struct netr_LogonSamLogon *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _netr_LogonSamLogoff(pipes_struct *p,
+                             struct netr_LogonSamLogoff *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _netr_ServerReqChallenge(pipes_struct *p,
+                                 struct netr_ServerReqChallenge *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _netr_ServerAuthenticate(pipes_struct *p,
+                                 struct netr_ServerAuthenticate *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _netr_ServerPasswordSet(pipes_struct *p,
+                                struct netr_ServerPasswordSet *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _netr_DatabaseDeltas(pipes_struct *p,
+                             struct netr_DatabaseDeltas *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _netr_DatabaseSync(pipes_struct *p,
+                           struct netr_DatabaseSync *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _netr_AccountDeltas(pipes_struct *p,
+                            struct netr_AccountDeltas *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _netr_AccountSync(pipes_struct *p,
+                          struct netr_AccountSync *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+WERROR _netr_LogonControl(pipes_struct *p,
+                         struct netr_LogonControl *r)
+{
+       p->rng_fault_state = true;
+       return WERR_NOT_SUPPORTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+WERROR _netr_GetDcName(pipes_struct *p,
+                      struct netr_GetDcName *r)
+{
+       p->rng_fault_state = true;
+       return WERR_NOT_SUPPORTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+WERROR _netr_GetAnyDCName(pipes_struct *p,
+                         struct netr_GetAnyDCName *r)
+{
+       p->rng_fault_state = true;
+       return WERR_NOT_SUPPORTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+WERROR _netr_LogonControl2(pipes_struct *p,
+                          struct netr_LogonControl2 *r)
+{
+       p->rng_fault_state = true;
+       return WERR_NOT_SUPPORTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _netr_ServerAuthenticate2(pipes_struct *p,
+                                  struct netr_ServerAuthenticate2 *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _netr_DatabaseSync2(pipes_struct *p,
+                            struct netr_DatabaseSync2 *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _netr_DatabaseRedo(pipes_struct *p,
+                           struct netr_DatabaseRedo *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+WERROR _netr_LogonControl2Ex(pipes_struct *p,
+                            struct netr_LogonControl2Ex *r)
+{
+       p->rng_fault_state = true;
+       return WERR_NOT_SUPPORTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+WERROR _netr_NetrEnumerateTrustedDomains(pipes_struct *p,
+                                        struct netr_NetrEnumerateTrustedDomains *r)
+{
+       p->rng_fault_state = true;
+       return WERR_NOT_SUPPORTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+WERROR _netr_DsRGetDCName(pipes_struct *p,
+                         struct netr_DsRGetDCName *r)
+{
+       p->rng_fault_state = true;
+       return WERR_NOT_SUPPORTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+WERROR _netr_NETRLOGONDUMMYROUTINE1(pipes_struct *p,
+                                   struct netr_NETRLOGONDUMMYROUTINE1 *r)
+{
+       p->rng_fault_state = true;
+       return WERR_NOT_SUPPORTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+WERROR _netr_NETRLOGONSETSERVICEBITS(pipes_struct *p,
+                                    struct netr_NETRLOGONSETSERVICEBITS *r)
+{
+       p->rng_fault_state = true;
+       return WERR_NOT_SUPPORTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+WERROR _netr_LogonGetTrustRid(pipes_struct *p,
+                             struct netr_LogonGetTrustRid *r)
+{
+       p->rng_fault_state = true;
+       return WERR_NOT_SUPPORTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+WERROR _netr_NETRLOGONCOMPUTESERVERDIGEST(pipes_struct *p,
+                                         struct netr_NETRLOGONCOMPUTESERVERDIGEST *r)
+{
+       p->rng_fault_state = true;
+       return WERR_NOT_SUPPORTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+WERROR _netr_NETRLOGONCOMPUTECLIENTDIGEST(pipes_struct *p,
+                                         struct netr_NETRLOGONCOMPUTECLIENTDIGEST *r)
+{
+       p->rng_fault_state = true;
+       return WERR_NOT_SUPPORTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _netr_ServerAuthenticate3(pipes_struct *p,
+                                  struct netr_ServerAuthenticate3 *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+WERROR _netr_DsRGetDCNameEx(pipes_struct *p,
+                           struct netr_DsRGetDCNameEx *r)
+{
+       p->rng_fault_state = true;
+       return WERR_NOT_SUPPORTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+WERROR _netr_DsRGetSiteName(pipes_struct *p,
+                           struct netr_DsRGetSiteName *r)
+{
+       p->rng_fault_state = true;
+       return WERR_NOT_SUPPORTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _netr_LogonGetDomainInfo(pipes_struct *p,
+                                 struct netr_LogonGetDomainInfo *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _netr_ServerPasswordSet2(pipes_struct *p,
+                                 struct netr_ServerPasswordSet2 *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+WERROR _netr_ServerPasswordGet(pipes_struct *p,
+                              struct netr_ServerPasswordGet *r)
+{
+       p->rng_fault_state = true;
+       return WERR_NOT_SUPPORTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+WERROR _netr_NETRLOGONSENDTOSAM(pipes_struct *p,
+                               struct netr_NETRLOGONSENDTOSAM *r)
+{
+       p->rng_fault_state = true;
+       return WERR_NOT_SUPPORTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+WERROR _netr_DsRAddressToSitenamesW(pipes_struct *p,
+                                   struct netr_DsRAddressToSitenamesW *r)
+{
+       p->rng_fault_state = true;
+       return WERR_NOT_SUPPORTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+WERROR _netr_DsRGetDCNameEx2(pipes_struct *p,
+                            struct netr_DsRGetDCNameEx2 *r)
+{
+       p->rng_fault_state = true;
+       return WERR_NOT_SUPPORTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+WERROR _netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN(pipes_struct *p,
+                                                struct netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN *r)
+{
+       p->rng_fault_state = true;
+       return WERR_NOT_SUPPORTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+WERROR _netr_NetrEnumerateTrustedDomainsEx(pipes_struct *p,
+                                          struct netr_NetrEnumerateTrustedDomainsEx *r)
+{
+       p->rng_fault_state = true;
+       return WERR_NOT_SUPPORTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+WERROR _netr_DsRAddressToSitenamesExW(pipes_struct *p,
+                                     struct netr_DsRAddressToSitenamesExW *r)
+{
+       p->rng_fault_state = true;
+       return WERR_NOT_SUPPORTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+WERROR _netr_DsrGetDcSiteCoverageW(pipes_struct *p,
+                                  struct netr_DsrGetDcSiteCoverageW *r)
+{
+       p->rng_fault_state = true;
+       return WERR_NOT_SUPPORTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _netr_LogonSamLogonEx(pipes_struct *p,
+                              struct netr_LogonSamLogonEx *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+WERROR _netr_DsrEnumerateDomainTrusts(pipes_struct *p,
+                                     struct netr_DsrEnumerateDomainTrusts *r)
+{
+       p->rng_fault_state = true;
+       return WERR_NOT_SUPPORTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+WERROR _netr_DsrDeregisterDNSHostRecords(pipes_struct *p,
+                                        struct netr_DsrDeregisterDNSHostRecords *r)
+{
+       p->rng_fault_state = true;
+       return WERR_NOT_SUPPORTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _netr_ServerTrustPasswordsGet(pipes_struct *p,
+                                      struct netr_ServerTrustPasswordsGet *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+WERROR _netr_DsRGetForestTrustInformation(pipes_struct *p,
+                                         struct netr_DsRGetForestTrustInformation *r)
+{
+       p->rng_fault_state = true;
+       return WERR_NOT_SUPPORTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+WERROR _netr_GetForestTrustInformation(pipes_struct *p,
+                                      struct netr_GetForestTrustInformation *r)
+{
+       p->rng_fault_state = true;
+       return WERR_NOT_SUPPORTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _netr_LogonSamLogonWithFlags(pipes_struct *p,
+                                     struct netr_LogonSamLogonWithFlags *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+WERROR _netr_NETRSERVERGETTRUSTINFO(pipes_struct *p,
+                                   struct netr_NETRSERVERGETTRUSTINFO *r)
+{
+       p->rng_fault_state = true;
+       return WERR_NOT_SUPPORTED;
+}
+
index 5ede0c93f4ad396e266faa80725f91e10dcbfc94..8c7c43f686dd680fd6c7239caf9792b57fb5dcf4 100644 (file)
@@ -2363,11 +2363,11 @@ void get_pipe_fns( int idx, struct api_struct **fns, int *n_fns )
                case PI_LSARPC:
                        lsa_get_pipe_fns( &cmds, &n_cmds );
                        break;
-               case PI_LSARPC_DS:
-                       lsa_ds_get_pipe_fns( &cmds, &n_cmds );
+               case PI_DSSETUP:
+                       dssetup_get_pipe_fns( &cmds, &n_cmds );
                        break;
                case PI_SAMR:
-                       samr_get_pipe_fns( &cmds, &n_cmds );
+                       samr2_get_pipe_fns( &cmds, &n_cmds );
                        break;
                case PI_NETLOGON:
                        netlog_get_pipe_fns( &cmds, &n_cmds );
index a1deac083df45bd17fc9a1c44204a0f8b6ab700a..f2e6f79d8c90b777defc37eda80342d9d5aec9f4 100644 (file)
 #define DBGC_CLASS DBGC_RPC_SRV
 
 /*******************************************************************
- api_samr_close_hnd
  ********************************************************************/
 
-static bool api_samr_close_hnd(pipes_struct *p)
+static bool proxy_samr_call(pipes_struct *p, uint8 opnum)
 {
-       SAMR_Q_CLOSE_HND q_u;
-       SAMR_R_CLOSE_HND r_u;
-       prs_struct *data = &p->in_data.data;
-       prs_struct *rdata = &p->out_data.rdata;
+       struct api_struct *fns;
+       int n_fns;
 
-       ZERO_STRUCT(q_u);
-       ZERO_STRUCT(r_u);
+       samr_get_pipe_fns(&fns, &n_fns);
 
-       if(!samr_io_q_close_hnd("", &q_u, data, 0)) {
-               DEBUG(0,("api_samr_close_hnd: unable to unmarshall SAMR_Q_CLOSE_HND.\n"));
-               return False;
+       if (opnum >= n_fns) {
+               return false;
        }
 
-       r_u.status = _samr_close_hnd(p, &q_u, &r_u);
-
-       /* store the response in the SMB stream */
-       if(!samr_io_r_close_hnd("", &r_u, rdata, 0)) {
-               DEBUG(0,("api_samr_close_hnd: unable to marshall SAMR_R_CLOSE_HND.\n"));
-               return False;
+       if (fns[opnum].opnum != opnum) {
+               smb_panic("SAMR function table not sorted");
        }
 
-       return True;
+       return fns[opnum].fn(p);
 }
 
 /*******************************************************************
- api_samr_open_domain
+ api_samr_close_hnd
  ********************************************************************/
 
-static bool api_samr_open_domain(pipes_struct *p)
+static bool api_samr_close_hnd(pipes_struct *p)
 {
-       SAMR_Q_OPEN_DOMAIN q_u;
-       SAMR_R_OPEN_DOMAIN r_u;
-
-       prs_struct *data = &p->in_data.data;
-       prs_struct *rdata = &p->out_data.rdata;
-
-       ZERO_STRUCT(q_u);
-       ZERO_STRUCT(r_u);
-
-       if(!samr_io_q_open_domain("", &q_u, data, 0)) {
-               DEBUG(0,("api_samr_open_domain: unable to unmarshall SAMR_Q_OPEN_DOMAIN.\n"));
-               return False;
-       }
-
-       r_u.status = _samr_open_domain(p, &q_u, &r_u);
+       return proxy_samr_call(p, NDR_SAMR_CLOSE);
+}
 
-       /* store the response in the SMB stream */
-       if(!samr_io_r_open_domain("", &r_u, rdata, 0)) {
-               DEBUG(0,("api_samr_open_domain: unable to marshall SAMR_R_OPEN_DOMAIN.\n"));
-               return False;
-       }
+/*******************************************************************
+ api_samr_open_domain
+ ********************************************************************/
 
-       return True;
+static bool api_samr_open_domain(pipes_struct *p)
+{
+       return proxy_samr_call(p, NDR_SAMR_OPENDOMAIN);
 }
 
 /*******************************************************************
@@ -439,28 +417,7 @@ static bool api_samr_lookup_rids(pipes_struct *p)
 
 static bool api_samr_open_user(pipes_struct *p)
 {
-       SAMR_Q_OPEN_USER q_u;
-       SAMR_R_OPEN_USER r_u;
-       prs_struct *data = &p->in_data.data;
-       prs_struct *rdata = &p->out_data.rdata;
-
-       ZERO_STRUCT(q_u);
-       ZERO_STRUCT(r_u);
-
-       if(!samr_io_q_open_user("", &q_u, data, 0)) {
-               DEBUG(0,("api_samr_open_user: unable to unmarshall SAMR_Q_OPEN_USER.\n"));
-               return False;
-       }
-
-       r_u.status = _samr_open_user(p, &q_u, &r_u);
-
-       /* store the response in the SMB stream */
-       if(!samr_io_r_open_user("", &r_u, rdata, 0)) {
-               DEBUG(0,("api_samr_open_user: unable to marshall SAMR_R_OPEN_USER.\n"));
-               return False;
-       }
-
-       return True;
+       return proxy_samr_call(p, NDR_SAMR_OPENUSER);
 }
 
 /*******************************************************************
@@ -559,30 +516,7 @@ static bool api_samr_query_domain_info(pipes_struct *p)
 
 static bool api_samr_create_user(pipes_struct *p)
 {
-       prs_struct *data = &p->in_data.data;
-       prs_struct *rdata = &p->out_data.rdata;
-
-       SAMR_Q_CREATE_USER q_u;
-       SAMR_R_CREATE_USER r_u;
-
-       ZERO_STRUCT(q_u);
-       ZERO_STRUCT(r_u);
-
-       /* grab the samr create user */
-       if (!samr_io_q_create_user("", &q_u, data, 0)) {
-               DEBUG(0,("api_samr_create_user: Unable to unmarshall SAMR_Q_CREATE_USER.\n"));
-               return False;
-       }
-
-       r_u.status=_samr_create_user(p, &q_u, &r_u);
-
-       /* store the response in the SMB stream */
-       if(!samr_io_r_create_user("", &r_u, rdata, 0)) {
-               DEBUG(0,("api_samr_create_user: Unable to marshall SAMR_R_CREATE_USER.\n"));
-               return False;
-       }
-
-       return True;
+       return proxy_samr_call(p, NDR_SAMR_CREATEUSER2);
 }
 
 /*******************************************************************
@@ -804,29 +738,7 @@ static bool api_samr_enum_domains(pipes_struct *p)
 
 static bool api_samr_open_alias(pipes_struct *p)
 {
-       SAMR_Q_OPEN_ALIAS q_u;
-       SAMR_R_OPEN_ALIAS r_u;
-       prs_struct *data = &p->in_data.data;
-       prs_struct *rdata = &p->out_data.rdata;
-
-       ZERO_STRUCT(q_u);
-       ZERO_STRUCT(r_u);
-
-       /* grab the samr open policy */
-       if(!samr_io_q_open_alias("", &q_u, data, 0)) {
-               DEBUG(0,("api_samr_open_alias: Unable to unmarshall SAMR_Q_OPEN_ALIAS.\n"));
-               return False;
-       }
-
-       r_u.status=_samr_open_alias(p, &q_u, &r_u);
-
-       /* store the response in the SMB stream */
-       if(!samr_io_r_open_alias("", &r_u, rdata, 0)) {
-               DEBUG(0,("api_samr_open_alias: Unable to marshall SAMR_R_OPEN_ALIAS.\n"));
-               return False;
-       }
-       
-       return True;
+       return proxy_samr_call(p, NDR_SAMR_OPENALIAS);
 }
 
 /*******************************************************************
@@ -1110,28 +1022,7 @@ static bool api_samr_del_groupmem(pipes_struct *p)
 
 static bool api_samr_delete_dom_user(pipes_struct *p)
 {
-       SAMR_Q_DELETE_DOM_USER q_u;
-       SAMR_R_DELETE_DOM_USER r_u;
-
-       prs_struct *data = &p->in_data.data;
-       prs_struct *rdata = &p->out_data.rdata;
-
-       ZERO_STRUCT(q_u);
-       ZERO_STRUCT(r_u);
-
-       if (!samr_io_q_delete_dom_user("", &q_u, data, 0)) {
-               DEBUG(0,("api_samr_delete_dom_user: unable to unmarshall SAMR_Q_DELETE_DOM_USER.\n"));
-               return False;
-       }
-
-       r_u.status = _samr_delete_dom_user(p, &q_u, &r_u);
-
-       if (!samr_io_r_delete_dom_user("", &r_u, rdata, 0)) {
-               DEBUG(0,("api_samr_delete_dom_user: unable to marshall SAMR_R_DELETE_DOM_USER.\n"));
-               return False;
-       }
-
-       return True;
+       return proxy_samr_call(p, NDR_SAMR_DELETEUSER);
 }
 
 /*******************************************************************
@@ -1140,28 +1031,7 @@ static bool api_samr_delete_dom_user(pipes_struct *p)
 
 static bool api_samr_delete_dom_group(pipes_struct *p)
 {
-       SAMR_Q_DELETE_DOM_GROUP q_u;
-       SAMR_R_DELETE_DOM_GROUP r_u;
-
-       prs_struct *data = &p->in_data.data;
-       prs_struct *rdata = &p->out_data.rdata;
-
-       ZERO_STRUCT(q_u);
-       ZERO_STRUCT(r_u);
-
-       if (!samr_io_q_delete_dom_group("", &q_u, data, 0)) {
-               DEBUG(0,("api_samr_delete_dom_group: unable to unmarshall SAMR_Q_DELETE_DOM_GROUP.\n"));
-               return False;
-       }
-
-       r_u.status = _samr_delete_dom_group(p, &q_u, &r_u);
-
-       if (!samr_io_r_delete_dom_group("", &r_u, rdata, 0)) {
-               DEBUG(0,("api_samr_delete_dom_group: unable to marshall SAMR_R_DELETE_DOM_GROUP.\n"));
-               return False;
-       }
-
-       return True;
+       return proxy_samr_call(p, NDR_SAMR_DELETEDOMAINGROUP);
 }
 
 /*******************************************************************
@@ -1170,28 +1040,7 @@ static bool api_samr_delete_dom_group(pipes_struct *p)
 
 static bool api_samr_delete_dom_alias(pipes_struct *p)
 {
-       SAMR_Q_DELETE_DOM_ALIAS q_u;
-       SAMR_R_DELETE_DOM_ALIAS r_u;
-
-       prs_struct *data = &p->in_data.data;
-       prs_struct *rdata = &p->out_data.rdata;
-
-       ZERO_STRUCT(q_u);
-       ZERO_STRUCT(r_u);
-
-       if (!samr_io_q_delete_dom_alias("", &q_u, data, 0)) {
-               DEBUG(0,("api_samr_delete_dom_alias: unable to unmarshall SAMR_Q_DELETE_DOM_ALIAS.\n"));
-               return False;
-       }
-
-       r_u.status = _samr_delete_dom_alias(p, &q_u, &r_u);
-
-       if (!samr_io_r_delete_dom_alias("", &r_u, rdata, 0)) {
-               DEBUG(0,("api_samr_delete_dom_alias: unable to marshall SAMR_R_DELETE_DOM_ALIAS.\n"));
-               return False;
-       }
-
-       return True;
+       return proxy_samr_call(p, NDR_SAMR_DELETEDOMALIAS);
 }
 
 /*******************************************************************
@@ -1200,28 +1049,7 @@ static bool api_samr_delete_dom_alias(pipes_struct *p)
 
 static bool api_samr_create_dom_group(pipes_struct *p)
 {
-       SAMR_Q_CREATE_DOM_GROUP q_u;
-       SAMR_R_CREATE_DOM_GROUP r_u;
-
-       prs_struct *data = &p->in_data.data;
-       prs_struct *rdata = &p->out_data.rdata;
-
-       ZERO_STRUCT(q_u);
-       ZERO_STRUCT(r_u);
-
-       if (!samr_io_q_create_dom_group("", &q_u, data, 0)) {
-               DEBUG(0,("api_samr_create_dom_group: unable to unmarshall SAMR_Q_CREATE_DOM_GROUP.\n"));
-               return False;
-       }
-
-       r_u.status = _samr_create_dom_group(p, &q_u, &r_u);
-
-       if (!samr_io_r_create_dom_group("", &r_u, rdata, 0)) {
-               DEBUG(0,("api_samr_create_dom_group: unable to marshall SAMR_R_CREATE_DOM_GROUP.\n"));
-               return False;
-       }
-
-       return True;
+       return proxy_samr_call(p, NDR_SAMR_CREATEDOMAINGROUP);
 }
 
 /*******************************************************************
@@ -1230,28 +1058,7 @@ static bool api_samr_create_dom_group(pipes_struct *p)
 
 static bool api_samr_create_dom_alias(pipes_struct *p)
 {
-       SAMR_Q_CREATE_DOM_ALIAS q_u;
-       SAMR_R_CREATE_DOM_ALIAS r_u;
-
-       prs_struct *data = &p->in_data.data;
-       prs_struct *rdata = &p->out_data.rdata;
-
-       ZERO_STRUCT(q_u);
-       ZERO_STRUCT(r_u);
-
-       if (!samr_io_q_create_dom_alias("", &q_u, data, 0)) {
-               DEBUG(0,("api_samr_create_dom_alias: unable to unmarshall SAMR_Q_CREATE_DOM_ALIAS.\n"));
-               return False;
-       }
-
-       r_u.status = _samr_create_dom_alias(p, &q_u, &r_u);
-
-       if (!samr_io_r_create_dom_alias("", &r_u, rdata, 0)) {
-               DEBUG(0,("api_samr_create_dom_alias: unable to marshall SAMR_R_CREATE_DOM_ALIAS.\n"));
-               return False;
-       }
-
-       return True;
+       return proxy_samr_call(p, NDR_SAMR_CREATEDOMALIAS);
 }
 
 /*******************************************************************
@@ -1350,28 +1157,7 @@ static bool api_samr_set_aliasinfo(pipes_struct *p)
 
 static bool api_samr_get_dom_pwinfo(pipes_struct *p)
 {
-       SAMR_Q_GET_DOM_PWINFO q_u;
-       SAMR_R_GET_DOM_PWINFO r_u;
-
-       prs_struct *data = &p->in_data.data;
-       prs_struct *rdata = &p->out_data.rdata;
-
-       ZERO_STRUCT(q_u);
-       ZERO_STRUCT(r_u);
-
-       if (!samr_io_q_get_dom_pwinfo("", &q_u, data, 0)) {
-               DEBUG(0,("api_samr_get_dom_pwinfo: unable to unmarshall SAMR_Q_GET_DOM_PWINFO.\n"));
-               return False;
-       }
-
-       r_u.status = _samr_get_dom_pwinfo(p, &q_u, &r_u);
-
-       if (!samr_io_r_get_dom_pwinfo("", &r_u, rdata, 0)) {
-               DEBUG(0,("api_samr_get_dom_pwinfo: unable to marshall SAMR_R_GET_DOM_PWINFO.\n"));
-               return False;
-       }
-
-       return True;
+       return proxy_samr_call(p, NDR_SAMR_GETDOMPWINFO);
 }
 
 /*******************************************************************
@@ -1380,28 +1166,7 @@ static bool api_samr_get_dom_pwinfo(pipes_struct *p)
 
 static bool api_samr_open_group(pipes_struct *p)
 {
-       SAMR_Q_OPEN_GROUP q_u;
-       SAMR_R_OPEN_GROUP r_u;
-
-       prs_struct *data = &p->in_data.data;
-       prs_struct *rdata = &p->out_data.rdata;
-
-       ZERO_STRUCT(q_u);
-       ZERO_STRUCT(r_u);
-
-       if (!samr_io_q_open_group("", &q_u, data, 0)) {
-               DEBUG(0,("api_samr_open_group: unable to unmarshall SAMR_Q_OPEN_GROUP.\n"));
-               return False;
-       }
-
-       r_u.status = _samr_open_group(p, &q_u, &r_u);
-
-       if (!samr_io_r_open_group("", &r_u, rdata, 0)) {
-               DEBUG(0,("api_samr_open_group: unable to marshall SAMR_R_OPEN_GROUP.\n"));
-               return False;
-       }
-
-       return True;
+       return proxy_samr_call(p, NDR_SAMR_OPENGROUP);
 }
 
 /*******************************************************************
@@ -1557,14 +1322,14 @@ static struct api_struct api_samr_cmds [] =
       {"SAMR_CONNECT5"          , SAMR_CONNECT5         , api_samr_connect5         }
 };
 
-void samr_get_pipe_fns( struct api_struct **fns, int *n_fns )
+void samr2_get_pipe_fns( struct api_struct **fns, int *n_fns )
 {
        *fns = api_samr_cmds;
        *n_fns = sizeof(api_samr_cmds) / sizeof(struct api_struct);
 }
 
 
-NTSTATUS rpc_samr_init(void)
+NTSTATUS rpc_samr2_init(void)
 {
   return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "samr", "lsass", api_samr_cmds,
                                    sizeof(api_samr_cmds) / sizeof(struct api_struct));
index cc4b4f330f29f08fdca1e855753269206c7732af..3f2022c9ed0c54f75f3eebce549ea69139695a2a 100644 (file)
@@ -149,7 +149,9 @@ static NTSTATUS make_samr_object_sd( TALLOC_CTX *ctx, SEC_DESC **psd, size_t *sd
        if ((psa = make_sec_acl(ctx, NT4_ACL_REVISION, i, ace)) == NULL)
                return NT_STATUS_NO_MEMORY;
 
-       if ((*psd = make_sec_desc(ctx, SEC_DESC_REVISION, SEC_DESC_SELF_RELATIVE, NULL, NULL, NULL, psa, sd_size)) == NULL)
+       if ((*psd = make_sec_desc(ctx, SECURITY_DESCRIPTOR_REVISION_1,
+                                 SEC_DESC_SELF_RELATIVE, NULL, NULL, NULL,
+                                 psa, sd_size)) == NULL)
                return NT_STATUS_NO_MEMORY;
 
        return NT_STATUS_OK;
@@ -541,45 +543,42 @@ static uint32 count_sam_aliases(struct disp_info *info)
 }
 
 /*******************************************************************
- _samr_close_hnd
+ _samr_Close
  ********************************************************************/
 
-NTSTATUS _samr_close_hnd(pipes_struct *p, SAMR_Q_CLOSE_HND *q_u, SAMR_R_CLOSE_HND *r_u)
+NTSTATUS _samr_Close(pipes_struct *p, struct samr_Close *r)
 {
-       r_u->status = NT_STATUS_OK;
-
-       /* close the policy handle */
-       if (!close_policy_hnd(p, &q_u->pol))
-               return NT_STATUS_OBJECT_NAME_INVALID;
+       if (!close_policy_hnd(p, r->in.handle)) {
+               return NT_STATUS_INVALID_HANDLE;
+       }
 
-       DEBUG(5,("samr_reply_close_hnd: %d\n", __LINE__));
+       ZERO_STRUCTP(r->out.handle);
 
-       return r_u->status;
+       return NT_STATUS_OK;
 }
 
 /*******************************************************************
samr_reply_open_domain
_samr_OpenDomain
  ********************************************************************/
 
-NTSTATUS _samr_open_domain(pipes_struct *p, SAMR_Q_OPEN_DOMAIN *q_u, SAMR_R_OPEN_DOMAIN *r_u)
+NTSTATUS _samr_OpenDomain(pipes_struct *p,
+                         struct samr_OpenDomain *r)
 {
        struct    samr_info *info;
        SEC_DESC *psd = NULL;
        uint32    acc_granted;
-       uint32    des_access = q_u->flags;
+       uint32    des_access = r->in.access_mask;
        NTSTATUS  status;
        size_t    sd_size;
        SE_PRIV se_rights;
 
-       r_u->status = NT_STATUS_OK;
-
        /* find the connection policy handle. */
        
-       if ( !find_policy_by_hnd(p, &q_u->pol, (void**)(void *)&info) )
+       if ( !find_policy_by_hnd(p, r->in.connect_handle, (void**)(void *)&info) )
                return NT_STATUS_INVALID_HANDLE;
 
        status = access_check_samr_function( info->acc_granted, 
-               SA_RIGHT_SAM_OPEN_DOMAIN, "_samr_open_domain" );
+               SA_RIGHT_SAM_OPEN_DOMAIN, "_samr_OpenDomain" );
                
        if ( !NT_STATUS_IS_OK(status) )
                return status;
@@ -594,28 +593,28 @@ NTSTATUS _samr_open_domain(pipes_struct *p, SAMR_Q_OPEN_DOMAIN *q_u, SAMR_R_OPEN
 
        status = access_check_samr_object( psd, p->pipe_user.nt_user_token, 
                &se_rights, GENERIC_RIGHTS_DOMAIN_WRITE, des_access, 
-               &acc_granted, "_samr_open_domain" );
+               &acc_granted, "_samr_OpenDomain" );
                
        if ( !NT_STATUS_IS_OK(status) )
                return status;
 
-       if (!sid_check_is_domain(&q_u->dom_sid.sid) &&
-           !sid_check_is_builtin(&q_u->dom_sid.sid)) {
+       if (!sid_check_is_domain(r->in.sid) &&
+           !sid_check_is_builtin(r->in.sid)) {
                return NT_STATUS_NO_SUCH_DOMAIN;
        }
 
        /* associate the domain SID with the (unique) handle. */
-       if ((info = get_samr_info_by_sid(&q_u->dom_sid.sid))==NULL)
+       if ((info = get_samr_info_by_sid(r->in.sid))==NULL)
                return NT_STATUS_NO_MEMORY;
        info->acc_granted = acc_granted;
 
        /* get a (unique) handle.  open a policy on it. */
-       if (!create_policy_hnd(p, &r_u->domain_pol, free_samr_info, (void *)info))
+       if (!create_policy_hnd(p, r->out.domain_handle, free_samr_info, (void *)info))
                return NT_STATUS_OBJECT_NAME_NOT_FOUND;
 
-       DEBUG(5,("samr_open_domain: %d\n", __LINE__));
+       DEBUG(5,("_samr_OpenDomain: %d\n", __LINE__));
 
-       return r_u->status;
+       return NT_STATUS_OK;
 }
 
 /*******************************************************************
@@ -1767,33 +1766,32 @@ NTSTATUS _samr_lookup_rids(pipes_struct *p, SAMR_Q_LOOKUP_RIDS *q_u, SAMR_R_LOOK
 }
 
 /*******************************************************************
- _samr_open_user. Safe - gives out no passwd info.
- ********************************************************************/
+ _samr_OpenUser
+********************************************************************/
 
-NTSTATUS _samr_open_user(pipes_struct *p, SAMR_Q_OPEN_USER *q_u, SAMR_R_OPEN_USER *r_u)
+NTSTATUS _samr_OpenUser(pipes_struct *p,
+                       struct samr_OpenUser *r)
 {
        struct samu *sampass=NULL;
        DOM_SID sid;
-       POLICY_HND domain_pol = q_u->domain_pol;
-       POLICY_HND *user_pol = &r_u->user_pol;
+       POLICY_HND domain_pol = *r->in.domain_handle;
+       POLICY_HND *user_pol = r->out.user_handle;
        struct samr_info *info = NULL;
        SEC_DESC *psd = NULL;
        uint32    acc_granted;
-       uint32    des_access = q_u->access_mask;
+       uint32    des_access = r->in.access_mask;
        size_t    sd_size;
        bool ret;
        NTSTATUS nt_status;
        SE_PRIV se_rights;
 
-       r_u->status = NT_STATUS_OK;
-
        /* find the domain policy handle and get domain SID / access bits in the domain policy. */
        
        if ( !get_lsa_policy_samr_sid(p, &domain_pol, &sid, &acc_granted, NULL) )
                return NT_STATUS_INVALID_HANDLE;
        
        nt_status = access_check_samr_function( acc_granted, 
-               SA_RIGHT_DOMAIN_OPEN_ACCOUNT, "_samr_open_user" );
+               SA_RIGHT_DOMAIN_OPEN_ACCOUNT, "_samr_OpenUser" );
                
        if ( !NT_STATUS_IS_OK(nt_status) )
                return nt_status;
@@ -1804,7 +1802,7 @@ NTSTATUS _samr_open_user(pipes_struct *p, SAMR_Q_OPEN_USER *q_u, SAMR_R_OPEN_USE
 
        /* append the user's RID to it */
        
-       if (!sid_append_rid(&sid, q_u->user_rid))
+       if (!sid_append_rid(&sid, r->in.rid))
                return NT_STATUS_NO_SUCH_USER;
        
        /* check if access can be granted as requested by client. */
@@ -1817,7 +1815,7 @@ NTSTATUS _samr_open_user(pipes_struct *p, SAMR_Q_OPEN_USER *q_u, SAMR_R_OPEN_USE
        
        nt_status = access_check_samr_object(psd, p->pipe_user.nt_user_token, 
                &se_rights, GENERIC_RIGHTS_USER_WRITE, des_access, 
-               &acc_granted, "_samr_open_user");
+               &acc_granted, "_samr_OpenUser");
                
        if ( !NT_STATUS_IS_OK(nt_status) )
                return nt_status;
@@ -1842,7 +1840,7 @@ NTSTATUS _samr_open_user(pipes_struct *p, SAMR_Q_OPEN_USER *q_u, SAMR_R_OPEN_USE
        if (!create_policy_hnd(p, user_pol, free_samr_info, (void *)info))
                return NT_STATUS_OBJECT_NAME_NOT_FOUND;
 
-       return r_u->status;
+       return NT_STATUS_OK;
 }
 
 /*************************************************************************
@@ -2520,19 +2518,17 @@ static NTSTATUS can_create(TALLOC_CTX *mem_ctx, const char *new_name)
 }
 
 /*******************************************************************
- _samr_create_user
- Create an account, can be either a normal user or a machine.
- This funcion will need to be updated for bdc/domain trusts.
+ _samr_CreateUser2
  ********************************************************************/
 
-NTSTATUS _samr_create_user(pipes_struct *p, SAMR_Q_CREATE_USER *q_u,
-                          SAMR_R_CREATE_USER *r_u)
+NTSTATUS _samr_CreateUser2(pipes_struct *p,
+                          struct samr_CreateUser2 *r)
 {
-       char *account;
+       const char *account = NULL;
        DOM_SID sid;
-       POLICY_HND dom_pol = q_u->domain_pol;
-       uint16 acb_info = q_u->acb_info;
-       POLICY_HND *user_pol = &r_u->user_pol;
+       POLICY_HND dom_pol = *r->in.domain_handle;
+       uint32_t acb_info = r->in.acct_flags;
+       POLICY_HND *user_pol = r->out.user_handle;
        struct samr_info *info = NULL;
        NTSTATUS nt_status;
        uint32 acc_granted;
@@ -2551,7 +2547,7 @@ NTSTATUS _samr_create_user(pipes_struct *p, SAMR_Q_CREATE_USER *q_u,
 
        nt_status = access_check_samr_function(acc_granted,
                                               SA_RIGHT_DOMAIN_CREATE_USER,
-                                              "_samr_create_user");
+                                              "_samr_CreateUser2");
        if (!NT_STATUS_IS_OK(nt_status)) {
                return nt_status;
        }
@@ -2563,7 +2559,7 @@ NTSTATUS _samr_create_user(pipes_struct *p, SAMR_Q_CREATE_USER *q_u,
                return NT_STATUS_INVALID_PARAMETER;
        }
 
-       account = rpcstr_pull_unistr2_talloc(p->mem_ctx, &q_u->uni_name);
+       account = r->in.account_name->string;
        if (account == NULL) {
                return NT_STATUS_NO_MEMORY;
        }
@@ -2602,7 +2598,7 @@ NTSTATUS _samr_create_user(pipes_struct *p, SAMR_Q_CREATE_USER *q_u,
                }
        }
                
-       DEBUG(5, ("_samr_create_user: %s can add this account : %s\n",
+       DEBUG(5, ("_samr_CreateUser2: %s can add this account : %s\n",
                  uidtoname(p->pipe_user.ut.uid),
                  can_add_account ? "True":"False" ));
                
@@ -2612,7 +2608,7 @@ NTSTATUS _samr_create_user(pipes_struct *p, SAMR_Q_CREATE_USER *q_u,
                become_root();
 
        nt_status = pdb_create_user(p->mem_ctx, account, acb_info,
-                                   &r_u->user_rid);
+                                   r->out.rid);
 
        if ( can_add_account )
                unbecome_root();
@@ -2626,7 +2622,7 @@ NTSTATUS _samr_create_user(pipes_struct *p, SAMR_Q_CREATE_USER *q_u,
                        
        /* Get the user's SID */
 
-       sid_compose(&sid, get_global_sam_sid(), r_u->user_rid);
+       sid_compose(&sid, get_global_sam_sid(), *r->out.rid);
        
        make_samr_object_sd(p->mem_ctx, &psd, &sd_size, &usr_generic_mapping,
                            &sid, SAMR_USR_RIGHTS_WRITE_PW);
@@ -2634,7 +2630,7 @@ NTSTATUS _samr_create_user(pipes_struct *p, SAMR_Q_CREATE_USER *q_u,
        
        nt_status = access_check_samr_object(psd, p->pipe_user.nt_user_token, 
                &se_rights, GENERIC_RIGHTS_USER_WRITE, des_access, 
-               &acc_granted, "_samr_create_user");
+               &acc_granted, "_samr_CreateUser2");
                
        if ( !NT_STATUS_IS_OK(nt_status) ) {
                return nt_status;
@@ -2657,7 +2653,7 @@ NTSTATUS _samr_create_user(pipes_struct *p, SAMR_Q_CREATE_USER *q_u,
        /* After a "set" ensure we have no cached display info. */
        force_flush_samr_cache(info->disp_info);
 
-       r_u->access_granted = acc_granted;
+       *r->out.access_granted = acc_granted;
 
        return NT_STATUS_OK;
 }
@@ -2979,32 +2975,31 @@ NTSTATUS _samr_enum_domains(pipes_struct *p, SAMR_Q_ENUM_DOMAINS *q_u, SAMR_R_EN
 }
 
 /*******************************************************************
api_samr_open_alias
_samr_OpenAlias
  ********************************************************************/
 
-NTSTATUS _samr_open_alias(pipes_struct *p, SAMR_Q_OPEN_ALIAS *q_u, SAMR_R_OPEN_ALIAS *r_u)
+NTSTATUS _samr_OpenAlias(pipes_struct *p,
+                        struct samr_OpenAlias *r)
 {
        DOM_SID sid;
-       POLICY_HND domain_pol = q_u->dom_pol;
-       uint32 alias_rid = q_u->rid_alias;
-       POLICY_HND *alias_pol = &r_u->pol;
+       POLICY_HND domain_pol = *r->in.domain_handle;
+       uint32 alias_rid = r->in.rid;
+       POLICY_HND *alias_pol = r->out.alias_handle;
        struct    samr_info *info = NULL;
        SEC_DESC *psd = NULL;
        uint32    acc_granted;
-       uint32    des_access = q_u->access_mask;
+       uint32    des_access = r->in.access_mask;
        size_t    sd_size;
        NTSTATUS  status;
        SE_PRIV se_rights;
 
-       r_u->status = NT_STATUS_OK;
-
        /* find the domain policy and get the SID / access bits stored in the domain policy */
        
        if ( !get_lsa_policy_samr_sid(p, &domain_pol, &sid, &acc_granted, NULL) )
                return NT_STATUS_INVALID_HANDLE;
        
        status = access_check_samr_function(acc_granted, 
-               SA_RIGHT_DOMAIN_OPEN_ACCOUNT, "_samr_open_alias");
+               SA_RIGHT_DOMAIN_OPEN_ACCOUNT, "_samr_OpenAlias");
                
        if ( !NT_STATUS_IS_OK(status) ) 
                return status;
@@ -3024,7 +3019,7 @@ NTSTATUS _samr_open_alias(pipes_struct *p, SAMR_Q_OPEN_ALIAS *q_u, SAMR_R_OPEN_A
        
        status = access_check_samr_object(psd, p->pipe_user.nt_user_token, 
                &se_rights, GENERIC_RIGHTS_ALIAS_WRITE, des_access, 
-               &acc_granted, "_samr_open_alias");
+               &acc_granted, "_samr_OpenAlias");
                
        if ( !NT_STATUS_IS_OK(status) )
                return status;
@@ -3061,7 +3056,7 @@ NTSTATUS _samr_open_alias(pipes_struct *p, SAMR_Q_OPEN_ALIAS *q_u, SAMR_R_OPEN_A
        if (!create_policy_hnd(p, alias_pol, free_samr_info, (void *)info))
                return NT_STATUS_OBJECT_NAME_NOT_FOUND;
 
-       return r_u->status;
+       return NT_STATUS_OK;
 }
 
 /*******************************************************************
@@ -3325,7 +3320,8 @@ static NTSTATUS set_user_info_23(TALLOC_CTX *mem_ctx, SAM_USER_INFO_23 *id23,
                                return NT_STATUS_ACCESS_DENIED;
                        }
 
-                       if ((passwd = Get_Pwnam(pdb_get_username(pwd))) == NULL) {
+                       passwd = Get_Pwnam_alloc(pwd, pdb_get_username(pwd));
+                       if (passwd == NULL) {
                                DEBUG(1, ("chgpasswd: Username does not exist in system !?!\n"));
                        }
 
@@ -3333,6 +3329,7 @@ static NTSTATUS set_user_info_23(TALLOC_CTX *mem_ctx, SAM_USER_INFO_23 *id23,
                                TALLOC_FREE(pwd);
                                return NT_STATUS_ACCESS_DENIED;
                        }
+                       TALLOC_FREE(passwd);
                }
        }
 
@@ -3406,7 +3403,8 @@ static bool set_user_info_pw(uint8 *pass, struct samu *pwd)
                                return False;
                        }
 
-                       if ((passwd = Get_Pwnam(pdb_get_username(pwd))) == NULL) {
+                       passwd = Get_Pwnam_alloc(pwd, pdb_get_username(pwd));
+                       if (passwd == NULL) {
                                DEBUG(1, ("chgpasswd: Username does not exist in system !?!\n"));
                        }
 
@@ -3414,6 +3412,7 @@ static bool set_user_info_pw(uint8 *pass, struct samu *pwd)
                                TALLOC_FREE(pwd);
                                return False;
                        }
+                       TALLOC_FREE(passwd);
                }
        }
 
@@ -4167,11 +4166,13 @@ NTSTATUS _samr_del_groupmem(pipes_struct *p, SAMR_Q_DEL_GROUPMEM *q_u, SAMR_R_DE
 }
 
 /*********************************************************************
- _samr_delete_dom_user
+ _samr_DeleteUser
 *********************************************************************/
 
-NTSTATUS _samr_delete_dom_user(pipes_struct *p, SAMR_Q_DELETE_DOM_USER *q_u, SAMR_R_DELETE_DOM_USER *r_u )
+NTSTATUS _samr_DeleteUser(pipes_struct *p,
+                         struct samr_DeleteUser *r)
 {
+       NTSTATUS status;
        DOM_SID user_sid;
        struct samu *sam_pass=NULL;
        uint32 acc_granted;
@@ -4180,14 +4181,15 @@ NTSTATUS _samr_delete_dom_user(pipes_struct *p, SAMR_Q_DELETE_DOM_USER *q_u, SAM
        DISP_INFO *disp_info = NULL;
        bool ret;
 
-       DEBUG(5, ("_samr_delete_dom_user: %d\n", __LINE__));
+       DEBUG(5, ("_samr_DeleteUser: %d\n", __LINE__));
 
        /* Find the policy handle. Open a policy on it. */
-       if (!get_lsa_policy_samr_sid(p, &q_u->user_pol, &user_sid, &acc_granted, &disp_info)) 
+       if (!get_lsa_policy_samr_sid(p, r->in.user_handle, &user_sid, &acc_granted, &disp_info)) 
                return NT_STATUS_INVALID_HANDLE;
                
-       if (!NT_STATUS_IS_OK(r_u->status = access_check_samr_function(acc_granted, STD_RIGHT_DELETE_ACCESS, "_samr_delete_dom_user"))) {
-               return r_u->status;
+       status = access_check_samr_function(acc_granted, STD_RIGHT_DELETE_ACCESS, "_samr_DeleteUser");
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
        }
                
        if (!sid_check_is_in_our_domain(&user_sid))
@@ -4203,7 +4205,7 @@ NTSTATUS _samr_delete_dom_user(pipes_struct *p, SAMR_Q_DELETE_DOM_USER *q_u, SAM
        unbecome_root();
 
        if( !ret ) {
-               DEBUG(5,("_samr_delete_dom_user:User %s doesn't exist.\n", 
+               DEBUG(5,("_samr_DeleteUser: User %s doesn't exist.\n", 
                        sid_string_dbg(&user_sid)));
                TALLOC_FREE(sam_pass);
                return NT_STATUS_NO_SUCH_USER;
@@ -4223,25 +4225,25 @@ NTSTATUS _samr_delete_dom_user(pipes_struct *p, SAMR_Q_DELETE_DOM_USER *q_u, SAM
        if ( can_add_accounts )
                become_root();
 
-       r_u->status = pdb_delete_user(p->mem_ctx, sam_pass);
+       status = pdb_delete_user(p->mem_ctx, sam_pass);
 
        if ( can_add_accounts )
                unbecome_root();
                
        /******** END SeAddUsers BLOCK *********/
                
-       if ( !NT_STATUS_IS_OK(r_u->status) ) {
-               DEBUG(5,("_samr_delete_dom_user: Failed to delete entry for "
+       if ( !NT_STATUS_IS_OK(status) ) {
+               DEBUG(5,("_samr_DeleteUser: Failed to delete entry for "
                         "user %s: %s.\n", pdb_get_username(sam_pass),
-                        nt_errstr(r_u->status)));
+                        nt_errstr(status)));
                TALLOC_FREE(sam_pass);
-               return r_u->status;
+               return status;
        }
 
 
        TALLOC_FREE(sam_pass);
 
-       if (!close_policy_hnd(p, &q_u->user_pol))
+       if (!close_policy_hnd(p, r->in.user_handle))
                return NT_STATUS_OBJECT_NAME_INVALID;
 
        force_flush_samr_cache(disp_info);
@@ -4250,11 +4252,13 @@ NTSTATUS _samr_delete_dom_user(pipes_struct *p, SAMR_Q_DELETE_DOM_USER *q_u, SAM
 }
 
 /*********************************************************************
- _samr_delete_dom_group
+ _samr_DeleteDomainGroup
 *********************************************************************/
 
-NTSTATUS _samr_delete_dom_group(pipes_struct *p, SAMR_Q_DELETE_DOM_GROUP *q_u, SAMR_R_DELETE_DOM_GROUP *r_u)
+NTSTATUS _samr_DeleteDomainGroup(pipes_struct *p,
+                                struct samr_DeleteDomainGroup *r)
 {
+       NTSTATUS status;
        DOM_SID group_sid;
        uint32 group_rid;
        uint32 acc_granted;
@@ -4262,14 +4266,15 @@ NTSTATUS _samr_delete_dom_group(pipes_struct *p, SAMR_Q_DELETE_DOM_GROUP *q_u, S
        bool can_add_accounts;
        DISP_INFO *disp_info = NULL;
 
-       DEBUG(5, ("samr_delete_dom_group: %d\n", __LINE__));
+       DEBUG(5, ("samr_DeleteDomainGroup: %d\n", __LINE__));
 
        /* Find the policy handle. Open a policy on it. */
-       if (!get_lsa_policy_samr_sid(p, &q_u->group_pol, &group_sid, &acc_granted, &disp_info)) 
+       if (!get_lsa_policy_samr_sid(p, r->in.group_handle, &group_sid, &acc_granted, &disp_info)) 
                return NT_STATUS_INVALID_HANDLE;
-               
-       if (!NT_STATUS_IS_OK(r_u->status = access_check_samr_function(acc_granted, STD_RIGHT_DELETE_ACCESS, "_samr_delete_dom_group"))) {
-               return r_u->status;
+
+       status = access_check_samr_function(acc_granted, STD_RIGHT_DELETE_ACCESS, "_samr_DeleteDomainGroup");
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
        }
 
        DEBUG(10, ("sid is %s\n", sid_string_dbg(&group_sid)));
@@ -4287,22 +4292,22 @@ NTSTATUS _samr_delete_dom_group(pipes_struct *p, SAMR_Q_DELETE_DOM_GROUP *q_u, S
        if ( can_add_accounts )
                become_root();
 
-       r_u->status = pdb_delete_dom_group(p->mem_ctx, group_rid);
+       status = pdb_delete_dom_group(p->mem_ctx, group_rid);
 
        if ( can_add_accounts )
                unbecome_root();
                
        /******** END SeAddUsers BLOCK *********/
        
-       if ( !NT_STATUS_IS_OK(r_u->status) ) {
-               DEBUG(5,("_samr_delete_dom_group: Failed to delete mapping "
+       if ( !NT_STATUS_IS_OK(status) ) {
+               DEBUG(5,("_samr_DeleteDomainGroup: Failed to delete mapping "
                         "entry for group %s: %s\n",
                         sid_string_dbg(&group_sid),
-                        nt_errstr(r_u->status)));
-               return r_u->status;
+                        nt_errstr(status)));
+               return status;
        }
        
-       if (!close_policy_hnd(p, &q_u->group_pol))
+       if (!close_policy_hnd(p, r->in.group_handle))
                return NT_STATUS_OBJECT_NAME_INVALID;
 
        force_flush_samr_cache(disp_info);
@@ -4311,10 +4316,11 @@ NTSTATUS _samr_delete_dom_group(pipes_struct *p, SAMR_Q_DELETE_DOM_GROUP *q_u, S
 }
 
 /*********************************************************************
- _samr_delete_dom_alias
+ _samr_DeleteDomAlias
 *********************************************************************/
 
-NTSTATUS _samr_delete_dom_alias(pipes_struct *p, SAMR_Q_DELETE_DOM_ALIAS *q_u, SAMR_R_DELETE_DOM_ALIAS *r_u)
+NTSTATUS _samr_DeleteDomAlias(pipes_struct *p,
+                             struct samr_DeleteDomAlias *r)
 {
        DOM_SID alias_sid;
        uint32 acc_granted;
@@ -4323,18 +4329,19 @@ NTSTATUS _samr_delete_dom_alias(pipes_struct *p, SAMR_Q_DELETE_DOM_ALIAS *q_u, S
        NTSTATUS status;
        DISP_INFO *disp_info = NULL;
 
-       DEBUG(5, ("_samr_delete_dom_alias: %d\n", __LINE__));
+       DEBUG(5, ("_samr_DeleteDomAlias: %d\n", __LINE__));
 
        /* Find the policy handle. Open a policy on it. */
-       if (!get_lsa_policy_samr_sid(p, &q_u->alias_pol, &alias_sid, &acc_granted, &disp_info)) 
+       if (!get_lsa_policy_samr_sid(p, r->in.alias_handle, &alias_sid, &acc_granted, &disp_info)) 
                return NT_STATUS_INVALID_HANDLE;
        
        /* copy the handle to the outgoing reply */
 
-       memcpy( &r_u->pol, &q_u->alias_pol, sizeof(r_u->pol) );
+       memcpy(r->out.alias_handle, r->in.alias_handle, sizeof(r->out.alias_handle));
 
-       if (!NT_STATUS_IS_OK(r_u->status = access_check_samr_function(acc_granted, STD_RIGHT_DELETE_ACCESS, "_samr_delete_dom_alias"))) {
-               return r_u->status;
+       status = access_check_samr_function(acc_granted, STD_RIGHT_DELETE_ACCESS, "_samr_DeleteDomAlias");
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
        }
 
        DEBUG(10, ("sid is %s\n", sid_string_dbg(&alias_sid)));
@@ -4369,7 +4376,7 @@ NTSTATUS _samr_delete_dom_alias(pipes_struct *p, SAMR_Q_DELETE_DOM_ALIAS *q_u, S
        if ( !NT_STATUS_IS_OK(status))
                return status;
 
-       if (!close_policy_hnd(p, &q_u->alias_pol))
+       if (!close_policy_hnd(p, r->in.alias_handle))
                return NT_STATUS_OBJECT_NAME_INVALID;
 
        force_flush_samr_cache(disp_info);
@@ -4378,11 +4385,14 @@ NTSTATUS _samr_delete_dom_alias(pipes_struct *p, SAMR_Q_DELETE_DOM_ALIAS *q_u, S
 }
 
 /*********************************************************************
- _samr_create_dom_group
+ _samr_CreateDomainGroup
 *********************************************************************/
 
-NTSTATUS _samr_create_dom_group(pipes_struct *p, SAMR_Q_CREATE_DOM_GROUP *q_u, SAMR_R_CREATE_DOM_GROUP *r_u)
+NTSTATUS _samr_CreateDomainGroup(pipes_struct *p,
+                                struct samr_CreateDomainGroup *r)
+
 {
+       NTSTATUS status;
        DOM_SID dom_sid;
        DOM_SID info_sid;
        const char *name;
@@ -4393,24 +4403,25 @@ NTSTATUS _samr_create_dom_group(pipes_struct *p, SAMR_Q_CREATE_DOM_GROUP *q_u, S
        DISP_INFO *disp_info = NULL;
 
        /* Find the policy handle. Open a policy on it. */
-       if (!get_lsa_policy_samr_sid(p, &q_u->pol, &dom_sid, &acc_granted, &disp_info)) 
+       if (!get_lsa_policy_samr_sid(p, r->in.domain_handle, &dom_sid, &acc_granted, &disp_info)) 
                return NT_STATUS_INVALID_HANDLE;
        
-       if (!NT_STATUS_IS_OK(r_u->status = access_check_samr_function(acc_granted, SA_RIGHT_DOMAIN_CREATE_GROUP, "_samr_create_dom_group"))) {
-               return r_u->status;
+       status = access_check_samr_function(acc_granted, SA_RIGHT_DOMAIN_CREATE_GROUP, "_samr_CreateDomainGroup");
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
        }
                
        if (!sid_equal(&dom_sid, get_global_sam_sid()))
                return NT_STATUS_ACCESS_DENIED;
 
-       name = rpcstr_pull_unistr2_talloc(p->mem_ctx, &q_u->uni_acct_desc);
+       name = r->in.name->string;
        if (name == NULL) {
                return NT_STATUS_NO_MEMORY;
        }
 
-       r_u->status = can_create(p->mem_ctx, name);
-       if (!NT_STATUS_IS_OK(r_u->status)) {
-               return r_u->status;
+       status = can_create(p->mem_ctx, name);
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
        }
 
        se_priv_copy( &se_rights, &se_add_users );
@@ -4423,7 +4434,7 @@ NTSTATUS _samr_create_dom_group(pipes_struct *p, SAMR_Q_CREATE_DOM_GROUP *q_u, S
        
        /* check that we successfully create the UNIX group */
        
-       r_u->status = pdb_create_dom_group(p->mem_ctx, name, &r_u->rid);
+       status = pdb_create_dom_group(p->mem_ctx, name, r->out.rid);
 
        if ( can_add_accounts )
                unbecome_root();
@@ -4432,10 +4443,10 @@ NTSTATUS _samr_create_dom_group(pipes_struct *p, SAMR_Q_CREATE_DOM_GROUP *q_u, S
        
        /* check if we should bail out here */
        
-       if ( !NT_STATUS_IS_OK(r_u->status) )
-               return r_u->status;
+       if ( !NT_STATUS_IS_OK(status) )
+               return status;
 
-       sid_compose(&info_sid, get_global_sam_sid(), r_u->rid);
+       sid_compose(&info_sid, get_global_sam_sid(), *r->out.rid);
        
        if ((info = get_samr_info_by_sid(&info_sid)) == NULL)
                return NT_STATUS_NO_MEMORY;
@@ -4445,7 +4456,7 @@ NTSTATUS _samr_create_dom_group(pipes_struct *p, SAMR_Q_CREATE_DOM_GROUP *q_u, S
        info->acc_granted = GENERIC_RIGHTS_GROUP_ALL_ACCESS;
 
        /* get a (unique) handle.  open a policy on it. */
-       if (!create_policy_hnd(p, &r_u->pol, free_samr_info, (void *)info))
+       if (!create_policy_hnd(p, r->out.group_handle, free_samr_info, (void *)info))
                return NT_STATUS_OBJECT_NAME_NOT_FOUND;
 
        force_flush_samr_cache(disp_info);
@@ -4454,14 +4465,15 @@ NTSTATUS _samr_create_dom_group(pipes_struct *p, SAMR_Q_CREATE_DOM_GROUP *q_u, S
 }
 
 /*********************************************************************
- _samr_create_dom_alias
+ _samr_CreateDomAlias
 *********************************************************************/
 
-NTSTATUS _samr_create_dom_alias(pipes_struct *p, SAMR_Q_CREATE_DOM_ALIAS *q_u, SAMR_R_CREATE_DOM_ALIAS *r_u)
+NTSTATUS _samr_CreateDomAlias(pipes_struct *p,
+                             struct samr_CreateDomAlias *r)
 {
        DOM_SID dom_sid;
        DOM_SID info_sid;
-       fstring name;
+       const char *name = NULL;
        struct samr_info *info;
        uint32 acc_granted;
        gid_t gid;
@@ -4471,17 +4483,18 @@ NTSTATUS _samr_create_dom_alias(pipes_struct *p, SAMR_Q_CREATE_DOM_ALIAS *q_u, S
        DISP_INFO *disp_info = NULL;
 
        /* Find the policy handle. Open a policy on it. */
-       if (!get_lsa_policy_samr_sid(p, &q_u->dom_pol, &dom_sid, &acc_granted, &disp_info)) 
+       if (!get_lsa_policy_samr_sid(p, r->in.domain_handle, &dom_sid, &acc_granted, &disp_info)) 
                return NT_STATUS_INVALID_HANDLE;
                
-       if (!NT_STATUS_IS_OK(r_u->status = access_check_samr_function(acc_granted, SA_RIGHT_DOMAIN_CREATE_ALIAS, "_samr_create_alias"))) {
-               return r_u->status;
+       result = access_check_samr_function(acc_granted, SA_RIGHT_DOMAIN_CREATE_ALIAS, "_samr_CreateDomAlias");
+       if (!NT_STATUS_IS_OK(result)) {
+               return result;
        }
                
        if (!sid_equal(&dom_sid, get_global_sam_sid()))
                return NT_STATUS_ACCESS_DENIED;
 
-       unistr2_to_ascii(name, &q_u->uni_acct_desc, sizeof(name));
+       name = r->in.alias_name->string;
 
        se_priv_copy( &se_rights, &se_add_users );
        can_add_accounts = user_has_privileges( p->pipe_user.nt_user_token, &se_rights );
@@ -4497,7 +4510,7 @@ NTSTATUS _samr_create_dom_alias(pipes_struct *p, SAMR_Q_CREATE_DOM_ALIAS *q_u, S
                become_root();
 
        /* Have passdb create the alias */
-       result = pdb_create_alias(name, &r_u->rid);
+       result = pdb_create_alias(name, r->out.rid);
 
        if ( can_add_accounts )
                unbecome_root();
@@ -4511,7 +4524,7 @@ NTSTATUS _samr_create_dom_alias(pipes_struct *p, SAMR_Q_CREATE_DOM_ALIAS *q_u, S
        }
 
        sid_copy(&info_sid, get_global_sam_sid());
-       sid_append_rid(&info_sid, r_u->rid);
+       sid_append_rid(&info_sid, *r->out.rid);
 
        if (!sid_to_gid(&info_sid, &gid)) {
                DEBUG(10, ("Could not find alias just created\n"));
@@ -4533,7 +4546,7 @@ NTSTATUS _samr_create_dom_alias(pipes_struct *p, SAMR_Q_CREATE_DOM_ALIAS *q_u, S
        info->acc_granted = GENERIC_RIGHTS_ALIAS_ALL_ACCESS;
 
        /* get a (unique) handle.  open a policy on it. */
-       if (!create_policy_hnd(p, &r_u->alias_pol, free_samr_info, (void *)info))
+       if (!create_policy_hnd(p, r->out.alias_handle, free_samr_info, (void *)info))
                return NT_STATUS_OBJECT_NAME_NOT_FOUND;
 
        force_flush_samr_cache(disp_info);
@@ -4806,32 +4819,35 @@ NTSTATUS _samr_set_aliasinfo(pipes_struct *p, SAMR_Q_SET_ALIASINFO *q_u, SAMR_R_
        return status;
 }
 
-/*********************************************************************
- _samr_get_dom_pwinfo
-*********************************************************************/
+/****************************************************************
+ _samr_GetDomPwInfo
+****************************************************************/
 
-NTSTATUS _samr_get_dom_pwinfo(pipes_struct *p, SAMR_Q_GET_DOM_PWINFO *q_u, SAMR_R_GET_DOM_PWINFO *r_u)
+NTSTATUS _samr_GetDomPwInfo(pipes_struct *p,
+                           struct samr_GetDomPwInfo *r)
 {
        /* Perform access check.  Since this rpc does not require a
           policy handle it will not be caught by the access checks on
           SAMR_CONNECT or SAMR_CONNECT_ANON. */
 
        if (!pipe_access_check(p)) {
-               DEBUG(3, ("access denied to samr_get_dom_pwinfo\n"));
-               r_u->status = NT_STATUS_ACCESS_DENIED;
-               return r_u->status;
+               DEBUG(3, ("access denied to _samr_GetDomPwInfo\n"));
+               return NT_STATUS_ACCESS_DENIED;
        }
 
        /* Actually, returning zeros here works quite well :-). */
+       ZERO_STRUCTP(r->out.info);
 
        return NT_STATUS_OK;
 }
 
 /*********************************************************************
- _samr_open_group
+ _samr_OpenGroup
 *********************************************************************/
 
-NTSTATUS _samr_open_group(pipes_struct *p, SAMR_Q_OPEN_GROUP *q_u, SAMR_R_OPEN_GROUP *r_u)
+NTSTATUS _samr_OpenGroup(pipes_struct *p,
+                        struct samr_OpenGroup *r)
+
 {
        DOM_SID sid;
        DOM_SID info_sid;
@@ -4839,18 +4855,18 @@ NTSTATUS _samr_open_group(pipes_struct *p, SAMR_Q_OPEN_GROUP *q_u, SAMR_R_OPEN_G
        struct samr_info *info;
        SEC_DESC         *psd = NULL;
        uint32            acc_granted;
-       uint32            des_access = q_u->access_mask;
+       uint32            des_access = r->in.access_mask;
        size_t            sd_size;
        NTSTATUS          status;
        fstring sid_string;
        bool ret;
        SE_PRIV se_rights;
 
-       if (!get_lsa_policy_samr_sid(p, &q_u->domain_pol, &sid, &acc_granted, NULL)) 
+       if (!get_lsa_policy_samr_sid(p, r->in.domain_handle, &sid, &acc_granted, NULL)) 
                return NT_STATUS_INVALID_HANDLE;
        
        status = access_check_samr_function(acc_granted, 
-               SA_RIGHT_DOMAIN_OPEN_ACCOUNT, "_samr_open_group");
+               SA_RIGHT_DOMAIN_OPEN_ACCOUNT, "_samr_OpenGroup");
                
        if ( !NT_STATUS_IS_OK(status) )
                return status;
@@ -4863,7 +4879,7 @@ NTSTATUS _samr_open_group(pipes_struct *p, SAMR_Q_OPEN_GROUP *q_u, SAMR_R_OPEN_G
 
        status = access_check_samr_object(psd, p->pipe_user.nt_user_token, 
                &se_rights, GENERIC_RIGHTS_GROUP_WRITE, des_access, 
-               &acc_granted, "_samr_open_group");
+               &acc_granted, "_samr_OpenGroup");
                
        if ( !NT_STATUS_IS_OK(status) ) 
                return status;
@@ -4874,7 +4890,7 @@ NTSTATUS _samr_open_group(pipes_struct *p, SAMR_Q_OPEN_GROUP *q_u, SAMR_R_OPEN_G
                return NT_STATUS_ACCESS_DENIED;
 
        sid_copy(&info_sid, get_global_sam_sid());
-       sid_append_rid(&info_sid, q_u->rid_group);
+       sid_append_rid(&info_sid, r->in.rid);
        sid_to_fstring(sid_string, &info_sid);
 
        if ((info = get_samr_info_by_sid(&info_sid)) == NULL)
@@ -4882,7 +4898,7 @@ NTSTATUS _samr_open_group(pipes_struct *p, SAMR_Q_OPEN_GROUP *q_u, SAMR_R_OPEN_G
                
        info->acc_granted = acc_granted;
 
-       DEBUG(10, ("_samr_open_group:Opening SID: %s\n", sid_string));
+       DEBUG(10, ("_samr_OpenGroup:Opening SID: %s\n", sid_string));
 
        /* check if that group really exists */
        become_root();
@@ -4892,7 +4908,7 @@ NTSTATUS _samr_open_group(pipes_struct *p, SAMR_Q_OPEN_GROUP *q_u, SAMR_R_OPEN_G
                return NT_STATUS_NO_SUCH_GROUP;
 
        /* get a (unique) handle.  open a policy on it. */
-       if (!create_policy_hnd(p, &r_u->pol, free_samr_info, (void *)info))
+       if (!create_policy_hnd(p, r->out.group_handle, free_samr_info, (void *)info))
                return NT_STATUS_OBJECT_NAME_NOT_FOUND;
 
        return NT_STATUS_OK;
@@ -5053,3 +5069,563 @@ NTSTATUS _samr_set_dom_info(pipes_struct *p, SAMR_Q_SET_DOMAIN_INFO *q_u, SAMR_R
 
        return r_u->status;
 }
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _samr_Connect(pipes_struct *p,
+                      struct samr_Connect *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _samr_SetSecurity(pipes_struct *p,
+                          struct samr_SetSecurity *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _samr_QuerySecurity(pipes_struct *p,
+                            struct samr_QuerySecurity *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _samr_Shutdown(pipes_struct *p,
+                       struct samr_Shutdown *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _samr_LookupDomain(pipes_struct *p,
+                           struct samr_LookupDomain *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _samr_EnumDomains(pipes_struct *p,
+                          struct samr_EnumDomains *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _samr_QueryDomainInfo(pipes_struct *p,
+                              struct samr_QueryDomainInfo *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _samr_SetDomainInfo(pipes_struct *p,
+                            struct samr_SetDomainInfo *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _samr_EnumDomainGroups(pipes_struct *p,
+                               struct samr_EnumDomainGroups *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _samr_CreateUser(pipes_struct *p,
+                         struct samr_CreateUser *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _samr_EnumDomainUsers(pipes_struct *p,
+                              struct samr_EnumDomainUsers *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _samr_EnumDomainAliases(pipes_struct *p,
+                                struct samr_EnumDomainAliases *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _samr_GetAliasMembership(pipes_struct *p,
+                                 struct samr_GetAliasMembership *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _samr_LookupNames(pipes_struct *p,
+                          struct samr_LookupNames *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _samr_LookupRids(pipes_struct *p,
+                         struct samr_LookupRids *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _samr_QueryGroupInfo(pipes_struct *p,
+                             struct samr_QueryGroupInfo *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _samr_SetGroupInfo(pipes_struct *p,
+                           struct samr_SetGroupInfo *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _samr_AddGroupMember(pipes_struct *p,
+                             struct samr_AddGroupMember *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _samr_DeleteGroupMember(pipes_struct *p,
+                                struct samr_DeleteGroupMember *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _samr_QueryGroupMember(pipes_struct *p,
+                               struct samr_QueryGroupMember *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _samr_SetMemberAttributesOfGroup(pipes_struct *p,
+                                         struct samr_SetMemberAttributesOfGroup *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _samr_QueryAliasInfo(pipes_struct *p,
+                             struct samr_QueryAliasInfo *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _samr_SetAliasInfo(pipes_struct *p,
+                           struct samr_SetAliasInfo *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _samr_AddAliasMember(pipes_struct *p,
+                             struct samr_AddAliasMember *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _samr_DeleteAliasMember(pipes_struct *p,
+                                struct samr_DeleteAliasMember *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _samr_GetMembersInAlias(pipes_struct *p,
+                                struct samr_GetMembersInAlias *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _samr_QueryUserInfo(pipes_struct *p,
+                            struct samr_QueryUserInfo *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _samr_SetUserInfo(pipes_struct *p,
+                          struct samr_SetUserInfo *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _samr_ChangePasswordUser(pipes_struct *p,
+                                 struct samr_ChangePasswordUser *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _samr_GetGroupsForUser(pipes_struct *p,
+                               struct samr_GetGroupsForUser *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _samr_QueryDisplayInfo(pipes_struct *p,
+                               struct samr_QueryDisplayInfo *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _samr_GetDisplayEnumerationIndex(pipes_struct *p,
+                                         struct samr_GetDisplayEnumerationIndex *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _samr_TestPrivateFunctionsDomain(pipes_struct *p,
+                                         struct samr_TestPrivateFunctionsDomain *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _samr_TestPrivateFunctionsUser(pipes_struct *p,
+                                       struct samr_TestPrivateFunctionsUser *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _samr_GetUserPwInfo(pipes_struct *p,
+                            struct samr_GetUserPwInfo *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _samr_RemoveMemberFromForeignDomain(pipes_struct *p,
+                                            struct samr_RemoveMemberFromForeignDomain *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _samr_QueryDomainInfo2(pipes_struct *p,
+                               struct samr_QueryDomainInfo2 *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _samr_QueryUserInfo2(pipes_struct *p,
+                             struct samr_QueryUserInfo2 *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _samr_QueryDisplayInfo2(pipes_struct *p,
+                                struct samr_QueryDisplayInfo2 *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _samr_GetDisplayEnumerationIndex2(pipes_struct *p,
+                                          struct samr_GetDisplayEnumerationIndex2 *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _samr_QueryDisplayInfo3(pipes_struct *p,
+                                struct samr_QueryDisplayInfo3 *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _samr_AddMultipleMembersToAlias(pipes_struct *p,
+                                        struct samr_AddMultipleMembersToAlias *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _samr_RemoveMultipleMembersFromAlias(pipes_struct *p,
+                                             struct samr_RemoveMultipleMembersFromAlias *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _samr_OemChangePasswordUser2(pipes_struct *p,
+                                     struct samr_OemChangePasswordUser2 *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _samr_ChangePasswordUser2(pipes_struct *p,
+                                  struct samr_ChangePasswordUser2 *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _samr_Connect2(pipes_struct *p,
+                       struct samr_Connect2 *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _samr_SetUserInfo2(pipes_struct *p,
+                           struct samr_SetUserInfo2 *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _samr_SetBootKeyInformation(pipes_struct *p,
+                                    struct samr_SetBootKeyInformation *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _samr_GetBootKeyInformation(pipes_struct *p,
+                                    struct samr_GetBootKeyInformation *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _samr_Connect3(pipes_struct *p,
+                       struct samr_Connect3 *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _samr_Connect4(pipes_struct *p,
+                       struct samr_Connect4 *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _samr_ChangePasswordUser3(pipes_struct *p,
+                                  struct samr_ChangePasswordUser3 *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _samr_Connect5(pipes_struct *p,
+                       struct samr_Connect5 *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _samr_RidToSid(pipes_struct *p,
+                       struct samr_RidToSid *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _samr_SetDsrmPassword(pipes_struct *p,
+                              struct samr_SetDsrmPassword *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS _samr_ValidatePassword(pipes_struct *p,
+                               struct samr_ValidatePassword *r)
+{
+       p->rng_fault_state = true;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
index bde7936343360c5717a0ec63fcc7ba9bc1da4465..c8f732153c1231f44df221668eff339f2545b93b 100644 (file)
@@ -44,16 +44,16 @@ void copy_id20_to_sam_passwd(struct samu *to, SAM_USER_INFO_20 *from)
        char *new_string;
        DATA_BLOB mung;
 
-       if (from == NULL || to == NULL) 
+       if (from == NULL || to == NULL)
                return;
-       
+
        if (from->hdr_munged_dial.buffer) {
                old_string = pdb_get_munged_dial(to);
                mung.length = from->hdr_munged_dial.uni_str_len;
                mung.data = (uint8 *) from->uni_munged_dial.buffer;
                mung.free = NULL;
                new_string = (mung.length == 0) ?
-                       NULL : base64_encode_data_blob(mung);
+                       NULL : base64_encode_data_blob(talloc_tos(), mung);
                DEBUG(10,("INFO_20 UNI_MUNGED_DIAL: %s -> %s\n",old_string, new_string));
                if (STRING_CHANGED_NC(old_string,new_string))
                        pdb_set_munged_dial(to   , new_string, PDB_CHANGED);
@@ -196,7 +196,7 @@ void copy_id21_to_sam_passwd(struct samu *to, SAM_USER_INFO_21 *from)
                mung.data = (uint8 *) from->uni_munged_dial.buffer;
                mung.free = NULL;
                newstr = (mung.length == 0) ?
-                       NULL : base64_encode_data_blob(mung);
+                       NULL : base64_encode_data_blob(talloc_tos(), mung);
                DEBUG(10,("INFO_21 UNI_MUNGED_DIAL: %s -> %s\n",old_string, newstr));
                if (STRING_CHANGED_NC(old_string,newstr))
                        pdb_set_munged_dial(to   , newstr, PDB_CHANGED);
@@ -421,7 +421,7 @@ void copy_id23_to_sam_passwd(struct samu *to, SAM_USER_INFO_23 *from)
                mung.data = (uint8 *) from->uni_munged_dial.buffer;
                mung.free = NULL;
                newstr = (mung.length == 0) ?
-                       NULL : base64_encode_data_blob(mung);
+                       NULL : base64_encode_data_blob(talloc_tos(), mung);
                DEBUG(10,("INFO_23 UNI_MUNGED_DIAL: %s -> %s\n",old_string, newstr));
                if (STRING_CHANGED_NC(old_string, newstr))
                        pdb_set_munged_dial(to   , newstr, PDB_CHANGED);
@@ -633,7 +633,7 @@ void copy_id25_to_sam_passwd(struct samu *to, SAM_USER_INFO_25 *from)
                mung.data = (uint8 *) from->uni_munged_dial.buffer;
                mung.free = NULL;
                newstr = (mung.length == 0) ?
-                       NULL : base64_encode_data_blob(mung);
+                       NULL : base64_encode_data_blob(talloc_tos(), mung);
                DEBUG(10,("INFO_25 UNI_MUNGED_DIAL: %s -> %s\n",old_string, newstr));
                if (STRING_CHANGED_NC(old_string,newstr))
                        pdb_set_munged_dial(to   , newstr, PDB_CHANGED);
index 125ccb4752add9440c68443644748a4c5d690c6a..1b877ee5b4ad6c0948d2011790a0e6db918f3ab4 100644 (file)
@@ -167,7 +167,7 @@ static void enum_file_fn( const struct share_mode_entry *e,
        ZERO_STRUCT( fsp );
        fsp.file_id = e->id;
 
-       if ( (brl = brl_get_locks(NULL,&fsp)) != NULL ) {
+       if ( (brl = brl_get_locks(talloc_tos(), &fsp)) != NULL ) {
                num_locks = brl->num_locks;
                TALLOC_FREE(brl);
        }
@@ -870,13 +870,11 @@ static void init_srv_sess_info_0(pipes_struct *p, SRV_SESS_INFO_0 *ss0, uint32 *
 /*******************************************************************
 ********************************************************************/
 
-/* global needed to make use of the share_mode_forall() callback */
-static struct sess_file_count s_file_cnt;
-
 static void sess_file_fn( const struct share_mode_entry *e, 
-                          const char *sharepath, const char *fname, void *state )
+                          const char *sharepath, const char *fname,
+                         void *data )
 {
-       struct sess_file_count *sess = &s_file_cnt;
+       struct sess_file_count *sess = (struct sess_file_count *)data;
  
        if ( procid_equal(&e->pid, &sess->pid) && (sess->uid == e->uid) ) {
                sess->count++;
@@ -890,11 +888,13 @@ static void sess_file_fn( const struct share_mode_entry *e,
 
 static int net_count_files( uid_t uid, struct server_id pid )
 {
+       struct sess_file_count s_file_cnt;
+
        s_file_cnt.count = 0;
        s_file_cnt.uid = uid;
        s_file_cnt.pid = pid;
        
-       share_mode_forall( sess_file_fn, NULL );
+       share_mode_forall( sess_file_fn, &s_file_cnt );
        
        return s_file_cnt.count;
 }
@@ -2089,7 +2089,6 @@ WERROR _srv_net_file_query_secdesc(pipes_struct *p, SRV_Q_NET_FILE_QUERY_SECDESC
        char *filename_in = NULL;
        char *filename = NULL;
        char *qualname = NULL;
-       files_struct *fsp = NULL;
        SMB_STRUCT_STAT st;
        NTSTATUS nt_status;
        struct current_user user;
@@ -2149,25 +2148,7 @@ WERROR _srv_net_file_query_secdesc(pipes_struct *p, SRV_Q_NET_FILE_QUERY_SECDESC
                goto error_exit;
        }
 
-       nt_status = open_file_stat(conn, NULL, filename, &st, &fsp);
-       /* Perhaps it is a directory */
-       if (NT_STATUS_EQUAL(nt_status, NT_STATUS_FILE_IS_A_DIRECTORY)) {
-               nt_status = open_directory(conn, NULL, filename, &st,
-                                          READ_CONTROL_ACCESS,
-                                          FILE_SHARE_READ|FILE_SHARE_WRITE,
-                                          FILE_OPEN,
-                                          0,
-                                          FILE_ATTRIBUTE_DIRECTORY,
-                                          NULL, &fsp);
-       }
-
-       if (!NT_STATUS_IS_OK(nt_status)) {
-               DEBUG(3,("_srv_net_file_query_secdesc: Unable to open file %s\n", filename));
-               r_u->status = ntstatus_to_werror(nt_status);
-               goto error_exit;
-       }
-
-       nt_status = SMB_VFS_GET_NT_ACL(fsp, fsp->fsp_name,
+       nt_status = SMB_VFS_GET_NT_ACL(conn, filename,
                                       (OWNER_SECURITY_INFORMATION
                                        |GROUP_SECURITY_INFORMATION
                                        |DACL_SECURITY_INFORMATION), &psd);
@@ -2178,7 +2159,7 @@ WERROR _srv_net_file_query_secdesc(pipes_struct *p, SRV_Q_NET_FILE_QUERY_SECDESC
                goto error_exit;
        }
 
-       sd_size = sec_desc_size(psd);
+       sd_size = ndr_size_security_descriptor(psd, 0);
 
        r_u->ptr_response = 1;
        r_u->size_response = sd_size;
@@ -2186,19 +2167,14 @@ WERROR _srv_net_file_query_secdesc(pipes_struct *p, SRV_Q_NET_FILE_QUERY_SECDESC
        r_u->size_secdesc = sd_size;
        r_u->sec_desc = psd;
 
-       psd->dacl->revision = (uint16) NT4_ACL_REVISION;
+       psd->dacl->revision = NT4_ACL_REVISION;
 
-       close_file(fsp, NORMAL_CLOSE);
        unbecome_user();
        close_cnum(conn, user.vuid);
        return r_u->status;
 
 error_exit:
 
-       if(fsp) {
-               close_file(fsp, NORMAL_CLOSE);
-       }
-
        if (became_user)
                unbecome_user();
 
index 7d81033264a6861f3587137910676cddf8d8d778..ac45d8bf752ca3d443f307105648eba68328d8e2 100644 (file)
@@ -162,7 +162,9 @@ static SEC_DESC* construct_scm_sd( TALLOC_CTX *ctx )
        if ( !(acl = make_sec_acl(ctx, NT4_ACL_REVISION, i, ace)) )
                return NULL;
 
-       if ( !(sd = make_sec_desc(ctx, SEC_DESC_REVISION, SEC_DESC_SELF_RELATIVE, NULL, NULL, NULL, acl, &sd_size)) )
+       if ( !(sd = make_sec_desc(ctx, SECURITY_DESCRIPTOR_REVISION_1,
+                                 SEC_DESC_SELF_RELATIVE, NULL, NULL, NULL,
+                                 acl, &sd_size)) )
                return NULL;
 
        return sd;
@@ -346,8 +348,8 @@ WERROR _svcctl_get_display_name(pipes_struct *p, SVCCTL_Q_GET_DISPLAY_NAME *q_u,
                
        rpcstr_pull(service, q_u->servicename.buffer, sizeof(service), q_u->servicename.uni_str_len*2, 0);
        
-       display_name = svcctl_lookup_dispname( service, p->pipe_user.nt_user_token );
-       init_svcctl_r_get_display_name( r_u, display_name );
+       display_name = svcctl_lookup_dispname(p->mem_ctx, service, p->pipe_user.nt_user_token );
+       init_svcctl_r_get_display_name( r_u, display_name ? display_name : "");
 
        return WERR_OK;
 }
@@ -394,8 +396,8 @@ static int enumerate_status( TALLOC_CTX *ctx, ENUM_SERVICES_STATUS **status, NT_
        for ( i=0; i<num_services; i++ ) {
                init_unistr( &st[i].servicename, svcctl_ops[i].name );
                
-               display_name = svcctl_lookup_dispname( svcctl_ops[i].name, token );
-               init_unistr( &st[i].displayname, display_name );
+               display_name = svcctl_lookup_dispname(ctx, svcctl_ops[i].name, token );
+               init_unistr( &st[i].displayname, display_name ? display_name : "");
                
                svcctl_ops[i].ops->service_status( svcctl_ops[i].name, &st[i].status );
        }
@@ -688,16 +690,16 @@ WERROR _svcctl_query_service_config2( pipes_struct *p, SVCCTL_Q_QUERY_SERVICE_CO
 {
        SERVICE_INFO *info = find_service_info_by_hnd( p, &q_u->handle );
        uint32 buffer_size;
-       
+
        /* perform access checks */
 
        if ( !info || (info->type != SVC_HANDLE_IS_SERVICE) )
-               return WERR_BADFID;     
-       
+               return WERR_BADFID;
+
        if ( !(info->access_granted & SC_RIGHT_SVC_QUERY_CONFIG) )
                return WERR_ACCESS_DENIED;
-       /* we have to set the outgoing buffer size to the same as the 
+
+       /* we have to set the outgoing buffer size to the same as the
           incoming buffer size (even in the case of failure */
 
        rpcbuf_init( &r_u->buffer, q_u->buffer_size, p->mem_ctx );
@@ -708,12 +710,12 @@ WERROR _svcctl_query_service_config2( pipes_struct *p, SVCCTL_Q_QUERY_SERVICE_CO
                {
                        SERVICE_DESCRIPTION desc_buf;
                        const char *description;
-                       
-                       description = svcctl_lookup_description( info->name, p->pipe_user.nt_user_token );
-                       
+
+                       description = svcctl_lookup_description(p->mem_ctx, info->name, p->pipe_user.nt_user_token );
+
                        ZERO_STRUCTP( &desc_buf );
 
-                       init_service_description_buffer( &desc_buf, description );
+                       init_service_description_buffer( &desc_buf, description ? description : "");
                        svcctl_io_service_description( "", &desc_buf, &r_u->buffer, 0 );
                        buffer_size = svcctl_sizeof_service_description( &desc_buf );
 
@@ -737,7 +739,7 @@ WERROR _svcctl_query_service_config2( pipes_struct *p, SVCCTL_Q_QUERY_SERVICE_CO
        default:
                return WERR_UNKNOWN_LEVEL;
        }
-       
+
        buffer_size += buffer_size % 4;
        r_u->needed = (buffer_size > q_u->buffer_size) ? buffer_size : q_u->buffer_size;
 
@@ -811,7 +813,7 @@ WERROR _svcctl_query_service_sec( pipes_struct *p, SVCCTL_Q_QUERY_SERVICE_SEC *q
        if ( !(sec_desc = svcctl_get_secdesc( p->mem_ctx, info->name, get_root_nt_token() )) )
                 return WERR_NOMEM;
 
-       r_u->needed = sec_desc_size( sec_desc );
+       r_u->needed = ndr_size_security_descriptor( sec_desc, 0 );
 
        if ( r_u->needed > q_u->buffer_size ) {
                ZERO_STRUCTP( &r_u->buffer );
index 873224085c1d9ada8babdb0131e87f0598f04fe5..92c178042f0e46eceaf1afbbb5b34b0271d7844a 100644 (file)
@@ -234,7 +234,7 @@ WERROR _winreg_QueryValue(pipes_struct *p, struct winreg_QueryValue *r)
        if ( !regkey )
                return WERR_BADFID;
 
-       *r->out.value_length = *r->out.type = 0;
+       *r->out.value_length = *r->out.type = REG_NONE;
        
        DEBUG(7,("_reg_info: policy key name = [%s]\n", regkey->key->name));
        DEBUG(7,("_reg_info: policy key type = [%08x]\n", regkey->key->type));
@@ -370,9 +370,7 @@ WERROR _winreg_GetVersion(pipes_struct *p, struct winreg_GetVersion *r)
        if ( !regkey )
                return WERR_BADFID;
        
-       *r->out.version = 0x00000005;   /* Windows 2000 registry API version */
-       
-       return WERR_OK;
+       return reg_getversion(r->out.version);
 }
 
 
@@ -934,7 +932,9 @@ static WERROR make_default_reg_sd( TALLOC_CTX *ctx, SEC_DESC **psd )
         if ((psa = make_sec_acl(ctx, NT4_ACL_REVISION, 2, ace)) == NULL)
                 return WERR_NOMEM;
 
-        if ((*psd = make_sec_desc(ctx, SEC_DESC_REVISION, SEC_DESC_SELF_RELATIVE, &owner_sid, NULL, NULL, psa, &sd_size)) == NULL)
+        if ((*psd = make_sec_desc(ctx, SECURITY_DESCRIPTOR_REVISION_1,
+                                 SEC_DESC_SELF_RELATIVE, &owner_sid, NULL,
+                                 NULL, psa, &sd_size)) == NULL)
                 return WERR_NOMEM;
 
        return WERR_OK;
@@ -1113,7 +1113,7 @@ WERROR _winreg_GetKeySecurity(pipes_struct *p, struct winreg_GetKeySecurity *r)
        if ( !(key->key->access_granted & STD_RIGHT_READ_CONTROL_ACCESS) )
                return WERR_ACCESS_DENIED;
 
-       err = regkey_get_secdesc(p->mem_ctx, key->key, &secdesc);
+       err = reg_getkeysecurity(p->mem_ctx, key, &secdesc);
        if (!W_ERROR_IS_OK(err)) {
                return err;
        }
@@ -1159,7 +1159,7 @@ WERROR _winreg_SetKeySecurity(pipes_struct *p, struct winreg_SetKeySecurity *r)
                return err;
        }
 
-       return regkey_set_secdesc(key->key, secdesc);
+       return reg_setkeysecurity(key, secdesc);
 }
 
 /*******************************************************************
index 1e43b5ae994d56b839b0e2c3bf388dba39bb47ea..e0103e6b586fcc2d296d4a50f3343214c1a107d6 100644 (file)
@@ -22,6 +22,7 @@
 /* This is the implementation of the wks interface. */
 
 #include "includes.h"
+#include "libnet/libnet.h"
 
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_RPC_SRV
@@ -32,7 +33,7 @@
 
 static void create_wks_info_100(struct wkssvc_NetWkstaInfo100 *info100)
 {
-       info100->platform_id     = 0x000001f4;  /* unknown */
+       info100->platform_id     = PLATFORM_ID_NT;      /* unknown */
        info100->version_major   = lp_major_announce_version();
        info100->version_minor   = lp_minor_announce_version();
 
@@ -284,7 +285,70 @@ WERROR _wkssvc_NetrGetJoinableOus(pipes_struct *p, struct wkssvc_NetrGetJoinable
 
 WERROR _wkssvc_NetrJoinDomain2(pipes_struct *p, struct wkssvc_NetrJoinDomain2 *r)
 {
-       /* FIXME: Add implementation code here */
+#if 0
+       struct libnet_JoinCtx *j = NULL;
+       char *cleartext_pwd = NULL;
+       char *admin_domain = NULL;
+       char *admin_account = NULL;
+       WERROR werr;
+       NTSTATUS status;
+       struct nt_user_token *token = p->pipe_user.nt_user_token;
+       struct DS_DOMAIN_CONTROLLER_INFO *info = NULL;
+
+       if (!r->in.domain_name) {
+               return WERR_INVALID_PARAM;
+       }
+
+       if (!user_has_privileges(token, &se_machine_account) &&
+           !nt_token_check_domain_rid(token, DOMAIN_GROUP_RID_ADMINS) &&
+           !nt_token_check_domain_rid(token, BUILTIN_ALIAS_RID_ADMINS)) {
+               return WERR_ACCESS_DENIED;
+       }
+
+       werr = decode_wkssvc_join_password_buffer(p->mem_ctx,
+                                                 r->in.encrypted_password,
+                                                 &p->session_key,
+                                                 &cleartext_pwd);
+       if (!W_ERROR_IS_OK(werr)) {
+               return werr;
+       }
+
+       split_domain_user(p->mem_ctx,
+                         r->in.admin_account,
+                         &admin_domain,
+                         &admin_account);
+
+       status = dsgetdcname(p->mem_ctx,
+                            r->in.domain_name,
+                            NULL,
+                            NULL,
+                            DS_DIRECTORY_SERVICE_REQUIRED |
+                            DS_WRITABLE_REQUIRED |
+                            DS_RETURN_DNS_NAME,
+                            &info);
+       if (!NT_STATUS_IS_OK(status)) {
+               return ntstatus_to_werror(status);
+       }
+
+       werr = libnet_init_JoinCtx(p->mem_ctx, &j);
+       if (!W_ERROR_IS_OK(werr)) {
+               return werr;
+       }
+
+       j->in.dc_name           = info->domain_controller_name;
+       j->in.domain_name       = r->in.domain_name;
+       j->in.account_ou        = r->in.account_ou;
+       j->in.join_flags        = r->in.join_flags;
+       j->in.admin_account     = admin_account;
+       j->in.admin_password    = cleartext_pwd;
+       j->in.modify_config     = true;
+
+       become_root();
+       werr = libnet_Join(p->mem_ctx, j);
+       unbecome_root();
+
+       return werr;
+#endif
        p->rng_fault_state = True;
        return WERR_NOT_SUPPORTED;
 }
diff --git a/source/rpcclient/cmd_ds.c b/source/rpcclient/cmd_ds.c
deleted file mode 100644 (file)
index 1f36dc3..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-/* 
-   Unix SMB/CIFS implementation.
-   RPC pipe client
-
-   Copyright (C) Gerald Carter 2002
-
-   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 "rpcclient.h"
-
-/* Look up domain related information on a remote host */
-
-static NTSTATUS cmd_ds_dsrole_getprimarydominfo(struct rpc_pipe_client *cli, 
-                                    TALLOC_CTX *mem_ctx, int argc, 
-                                    const char **argv) 
-{
-       NTSTATUS result;
-       DS_DOMINFO_CTR  ctr;
-       
-       result = rpccli_ds_getprimarydominfo( cli, mem_ctx, DsRolePrimaryDomainInfoBasic, &ctr );
-       if ( NT_STATUS_IS_OK(result) )
-       {
-               printf ("Machine Role = [%d]\n", ctr.basic->machine_role);
-               
-               if ( ctr.basic->flags & DSROLE_PRIMARY_DS_RUNNING )     {
-                       printf( "Directory Service is running.\n");
-                       printf( "Domain is in %s mode.\n", (ctr.basic->flags & DSROLE_PRIMARY_DS_MIXED_MODE) ? "mixed" : "native" );
-               }
-               else
-                       printf( "Directory Service not running on server\n");
-       }
-       
-       return result;
-}
-
-static NTSTATUS cmd_ds_enum_domain_trusts(struct rpc_pipe_client *cli,
-                                    TALLOC_CTX *mem_ctx, int argc, 
-                                    const char **argv) 
-{
-       NTSTATUS                result;
-       uint32                  flags = DS_DOMAIN_IN_FOREST;
-       struct ds_domain_trust   *trusts = NULL;
-       unsigned int                    num_domains = 0;
-       int i;
-       
-       if (argc > 1) {
-               flags = atoi(argv[1]);
-       }
-
-       result = rpccli_ds_enum_domain_trusts( cli, mem_ctx, cli->cli->desthost, flags, 
-               &trusts, &num_domains );
-       
-       printf( "%d domains returned\n", num_domains );
-
-       for (i=0; i<num_domains; i++ ) 
-               printf("%s (%s)\n", trusts[i].dns_domain, trusts[i].netbios_domain);
-       
-       return result;
-}
-
-/* List of commands exported by this module */
-
-struct cmd_set ds_commands[] = {
-
-       { "LSARPC-DS" },
-
-       { "dsroledominfo",   RPC_RTYPE_NTSTATUS, cmd_ds_dsrole_getprimarydominfo, NULL, PI_LSARPC_DS, NULL, "Get Primary Domain Information", "" },
-       { "dsenumdomtrusts", RPC_RTYPE_NTSTATUS, cmd_ds_enum_domain_trusts,       NULL, PI_NETLOGON,  NULL, "Enumerate all trusted domains in an AD forest", "" },
-
-{ NULL }
-};
diff --git a/source/rpcclient/cmd_dssetup.c b/source/rpcclient/cmd_dssetup.c
new file mode 100644 (file)
index 0000000..6ec58e9
--- /dev/null
@@ -0,0 +1,69 @@
+/* 
+   Unix SMB/CIFS implementation.
+   RPC pipe client
+
+   Copyright (C) Gerald Carter 2002
+   Copyright (C) Guenther Deschner 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/>.
+*/
+
+#include "includes.h"
+#include "rpcclient.h"
+
+/* Look up domain related information on a remote host */
+
+static WERROR cmd_ds_dsrole_getprimarydominfo(struct rpc_pipe_client *cli,
+                                             TALLOC_CTX *mem_ctx, int argc,
+                                             const char **argv)
+{
+       NTSTATUS status;
+       WERROR werr;
+       union dssetup_DsRoleInfo info;
+
+       status = rpccli_dssetup_DsRoleGetPrimaryDomainInformation(cli, mem_ctx,
+                                                                 DS_ROLE_BASIC_INFORMATION,
+                                                                 &info,
+                                                                 &werr);
+       if (!NT_STATUS_IS_OK(status)) {
+               return ntstatus_to_werror(status);
+       }
+
+       if (!W_ERROR_IS_OK(werr)) {
+               return werr;
+       }
+
+       printf ("Machine Role = [%d]\n", info.basic.role);
+
+       if (info.basic.flags & DS_ROLE_PRIMARY_DS_RUNNING) {
+               printf("Directory Service is running.\n");
+               printf("Domain is in %s mode.\n",
+                       (info.basic.flags & DS_ROLE_PRIMARY_DS_MIXED_MODE) ? "mixed" : "native" );
+       } else {
+               printf("Directory Service not running on server\n");
+       }
+
+       return werr;
+}
+
+/* List of commands exported by this module */
+
+struct cmd_set ds_commands[] = {
+
+       { "LSARPC-DS" },
+
+       { "dsroledominfo",   RPC_RTYPE_WERROR, NULL, cmd_ds_dsrole_getprimarydominfo, PI_DSSETUP, NULL, "Get Primary Domain Information", "" },
+
+{ NULL }
+};
index d54f67264a95b8fe3485bb658fb01d4de2dce328..05269d771128ca3ecde403fa5bc634b48f1f78fb 100644 (file)
@@ -893,25 +893,15 @@ static NTSTATUS cmd_lsa_query_secobj(struct rpc_pipe_client *cli,
        return result;
 }
 
-static void display_trust_dom_info_1(TRUSTED_DOMAIN_INFO_NAME *n)
-{
-       printf("NetBIOS Name:\t%s\n", unistr2_static(&n->netbios_name.unistring));
-}
-
-static void display_trust_dom_info_3(TRUSTED_DOMAIN_INFO_POSIX_OFFSET *p)
-{
-       printf("Posix Offset:\t%08x (%d)\n", p->posix_offset, p->posix_offset);
-}
-
-static void display_trust_dom_info_4(TRUSTED_DOMAIN_INFO_PASSWORD *p, const char *password)
+static void display_trust_dom_info_4(struct lsa_TrustDomainInfoPassword *p, const char *password)
 {
        char *pwd, *pwd_old;
        
-       DATA_BLOB data     = data_blob(NULL, p->password.length);
-       DATA_BLOB data_old = data_blob(NULL, p->old_password.length);
+       DATA_BLOB data     = data_blob(NULL, p->password->length);
+       DATA_BLOB data_old = data_blob(NULL, p->old_password->length);
 
-       memcpy(data.data, p->password.data, p->password.length);
-       memcpy(data_old.data, p->old_password.data, p->old_password.length);
+       memcpy(data.data, p->password->data, p->password->length);
+       memcpy(data_old.data, p->old_password->data, p->old_password->length);
        
        pwd     = decrypt_trustdom_secret(password, &data);
        pwd_old = decrypt_trustdom_secret(password, &data_old);
@@ -926,35 +916,25 @@ static void display_trust_dom_info_4(TRUSTED_DOMAIN_INFO_PASSWORD *p, const char
        data_blob_free(&data_old);
 }
 
-static void display_trust_dom_info_6(TRUSTED_DOMAIN_INFO_EX *i)
-{
-       printf("Domain Name:\t\t%s\n", unistr2_static(&i->domain_name.unistring));
-       printf("NetBIOS Name:\t\t%s\n", unistr2_static(&i->netbios_name.unistring));
-       printf("SID:\t\t\t%s\n", sid_string_tos(&i->sid.sid));
-       printf("Trust Direction:\t0x%08x\n", i->trust_direction);
-       printf("Trust Type:\t\t0x%08x\n", i->trust_type);
-       printf("Trust Attributes:\t0x%08x\n", i->trust_attributes);
-}
-
-
-static void display_trust_dom_info(LSA_TRUSTED_DOMAIN_INFO *info, uint32 info_class, const char *pass)
+static void display_trust_dom_info(TALLOC_CTX *mem_ctx,
+                                  union lsa_TrustedDomainInfo *info,
+                                  enum lsa_TrustDomInfoEnum info_class,
+                                  const char *pass)
 {
        switch (info_class) {
-       case 1:
-               display_trust_dom_info_1(&info->name);
-               break;
-       case 3:
-               display_trust_dom_info_3(&info->posix_offset);
-               break;
-       case 4:
-               display_trust_dom_info_4(&info->password, pass);
-               break;
-       case 6:
-               display_trust_dom_info_6(&info->info_ex);
-               break;
-       default:
-               printf("unsupported info-class: %d\n", info_class);
-               break;
+               case LSA_TRUSTED_DOMAIN_INFO_PASSWORD:
+                       display_trust_dom_info_4(&info->password, pass);
+                       break;
+               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;
+               }
        }
 }
 
@@ -966,9 +946,8 @@ static NTSTATUS cmd_lsa_query_trustdominfobysid(struct rpc_pipe_client *cli,
        NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
        DOM_SID dom_sid;
        uint32 access_mask = SEC_RIGHTS_MAXIMUM_ALLOWED;
-       LSA_TRUSTED_DOMAIN_INFO *info;
-
-       uint32 info_class = 1; 
+       union lsa_TrustedDomainInfo info;
+       enum lsa_TrustDomInfoEnum info_class = 1;
 
        if (argc > 3 || argc < 2) {
                printf("Usage: %s [sid] [info_class]\n", argv[0]);
@@ -986,13 +965,15 @@ static NTSTATUS cmd_lsa_query_trustdominfobysid(struct rpc_pipe_client *cli,
        if (!NT_STATUS_IS_OK(result))
                goto done;
 
-       result = rpccli_lsa_query_trusted_domain_info_by_sid(cli, mem_ctx, &pol,
-                                                         info_class, &dom_sid, &info);
-
+       result = rpccli_lsa_QueryTrustedDomainInfoBySid(cli, mem_ctx,
+                                                       &pol,
+                                                       &dom_sid,
+                                                       info_class,
+                                                       &info);
        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)
@@ -1001,6 +982,11 @@ static NTSTATUS cmd_lsa_query_trustdominfobysid(struct rpc_pipe_client *cli,
        return result;
 }
 
+static void init_lsa_String(struct lsa_String *name, const char *s)
+{
+       name->string = s;
+}
+
 static NTSTATUS cmd_lsa_query_trustdominfobyname(struct rpc_pipe_client *cli,
                                                 TALLOC_CTX *mem_ctx, int argc,
                                                 const char **argv) 
@@ -1008,8 +994,9 @@ static NTSTATUS cmd_lsa_query_trustdominfobyname(struct rpc_pipe_client *cli,
        POLICY_HND pol;
        NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
        uint32 access_mask = SEC_RIGHTS_MAXIMUM_ALLOWED;
-       LSA_TRUSTED_DOMAIN_INFO *info;
-       uint32 info_class = 1; 
+       union lsa_TrustedDomainInfo info;
+       enum lsa_TrustDomInfoEnum info_class = 1;
+       struct lsa_String trusted_domain;
 
        if (argc > 3 || argc < 2) {
                printf("Usage: %s [name] [info_class]\n", argv[0]);
@@ -1024,13 +1011,17 @@ static NTSTATUS cmd_lsa_query_trustdominfobyname(struct rpc_pipe_client *cli,
        if (!NT_STATUS_IS_OK(result))
                goto done;
 
-       result = rpccli_lsa_query_trusted_domain_info_by_name(cli, mem_ctx, &pol, 
-                                                          info_class, argv[1], &info);
+       init_lsa_String(&trusted_domain, argv[1]);
 
+       result = rpccli_lsa_QueryTrustedDomainInfoByName(cli, mem_ctx,
+                                                        &pol,
+                                                        trusted_domain,
+                                                        info_class,
+                                                        &info);
        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)
@@ -1046,9 +1037,9 @@ static NTSTATUS cmd_lsa_query_trustdominfo(struct rpc_pipe_client *cli,
        POLICY_HND pol, trustdom_pol;
        NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
        uint32 access_mask = SEC_RIGHTS_MAXIMUM_ALLOWED;
-       LSA_TRUSTED_DOMAIN_INFO *info;
+       union lsa_TrustedDomainInfo info;
        DOM_SID dom_sid;
-       uint32 info_class = 1; 
+       enum lsa_TrustDomInfoEnum info_class = 1;
 
        if (argc > 3 || argc < 2) {
                printf("Usage: %s [sid] [info_class]\n", argv[0]);
@@ -1066,20 +1057,25 @@ static NTSTATUS cmd_lsa_query_trustdominfo(struct rpc_pipe_client *cli,
 
        if (!NT_STATUS_IS_OK(result))
                goto done;
-       
-       result = rpccli_lsa_open_trusted_domain(cli, mem_ctx, &pol,
-                                            &dom_sid, access_mask, &trustdom_pol);
+
+       result = rpccli_lsa_OpenTrustedDomain(cli, mem_ctx,
+                                             &pol,
+                                             &dom_sid,
+                                             access_mask,
+                                             &trustdom_pol);
 
        if (!NT_STATUS_IS_OK(result))
                goto done;
 
-       result = rpccli_lsa_query_trusted_domain_info(cli, mem_ctx, &trustdom_pol, 
-                                                  info_class, &info);
+       result = rpccli_lsa_QueryTrustedDomainInfo(cli, mem_ctx,
+                                                  &trustdom_pol,
+                                                  info_class,
+                                                  &info);
 
        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 e997bb5090536444c31fd908c3cc8a5a47629f48..aad538a0ee749ea0f813f0befe3063a96e64410b 100644 (file)
@@ -48,7 +48,7 @@ static WERROR cmd_netlogon_getanydcname(struct rpc_pipe_client *cli,
                                        TALLOC_CTX *mem_ctx, int argc, 
                                        const char **argv)
 {
-       fstring dcname;
+       char *dcname = NULL;
        WERROR result = WERR_GENERAL_FAILURE;
        int old_timeout;
 
@@ -60,7 +60,7 @@ static WERROR cmd_netlogon_getanydcname(struct rpc_pipe_client *cli,
        /* Make sure to wait for our DC's reply */
        old_timeout = cli_set_timeout(cli->cli, MAX(cli->cli->timeout,30000)); /* 30 seconds. */
 
-       result = rpccli_netlogon_getanydcname(cli, mem_ctx, cli->cli->desthost, argv[1], dcname);
+       result = rpccli_netlogon_getanydcname(cli, mem_ctx, cli->cli->desthost, argv[1], &dcname);
 
        cli_set_timeout(cli->cli, old_timeout);
 
@@ -79,7 +79,7 @@ static WERROR cmd_netlogon_getdcname(struct rpc_pipe_client *cli,
                                     TALLOC_CTX *mem_ctx, int argc, 
                                     const char **argv)
 {
-       fstring dcname;
+       char *dcname = NULL;
        WERROR result = WERR_GENERAL_FAILURE;
        int old_timeout;
 
@@ -91,7 +91,7 @@ static WERROR cmd_netlogon_getdcname(struct rpc_pipe_client *cli,
        /* Make sure to wait for our DC's reply */
        old_timeout = cli_set_timeout(cli->cli, MAX(cli->cli->timeout,30000)); /* 30 seconds. */
 
-       result = rpccli_netlogon_getdcname(cli, mem_ctx, cli->cli->desthost, argv[1], dcname);
+       result = rpccli_netlogon_getdcname(cli, mem_ctx, cli->cli->desthost, argv[1], &dcname);
 
        cli_set_timeout(cli->cli, old_timeout);
 
@@ -165,12 +165,13 @@ static WERROR cmd_netlogon_dsr_getdcnameex(struct rpc_pipe_client *cli,
                                           const char **argv)
 {
        WERROR result;
-       uint32 flags = DS_RETURN_DNS_NAME;
+       NTSTATUS status;
+       uint32_t flags = DS_RETURN_DNS_NAME;
        const char *server_name = cli->cli->desthost;
        const char *domain_name;
        const char *site_name = NULL;
        struct GUID domain_guid = GUID_zero();
-       struct DS_DOMAIN_CONTROLLER_INFO *info = NULL;
+       struct netr_DsRGetDCNameInfo *info = NULL;
 
        if (argc < 2) {
                fprintf(stderr, "Usage: %s [domain_name] [domain_guid] "
@@ -178,8 +179,7 @@ static WERROR cmd_netlogon_dsr_getdcnameex(struct rpc_pipe_client *cli,
                return WERR_OK;
        }
 
-       if (argc >= 2)
-               domain_name = argv[1];
+       domain_name = argv[1];
 
        if (argc >= 3) {
                if (!NT_STATUS_IS_OK(GUID_from_string(argv[2], &domain_guid))) {
@@ -187,26 +187,34 @@ static WERROR cmd_netlogon_dsr_getdcnameex(struct rpc_pipe_client *cli,
                }
        }
 
-       if (argc >= 4)
+       if (argc >= 4) {
                site_name = argv[3];
+       }
 
-       if (argc >= 5)
+       if (argc >= 5) {
                sscanf(argv[4], "%x", &flags);
+       }
 
        debug_dsdcinfo_flags(1,flags);
 
-       result = rpccli_netlogon_dsr_getdcnameex(cli, mem_ctx, server_name, domain_name, 
-                                                &domain_guid, site_name, flags,
-                                                &info);
+       status = rpccli_netr_DsRGetDCNameEx(cli, mem_ctx,
+                                           server_name,
+                                           domain_name,
+                                           &domain_guid,
+                                           site_name,
+                                           flags,
+                                           &info,
+                                           &result);
+       if (!NT_STATUS_IS_OK(status)) {
+               return ntstatus_to_werror(status);
+       }
 
-       if (W_ERROR_IS_OK(result)) {
-               d_printf("DsGetDcNameEx gave\n");
-               display_ds_domain_controller_info(mem_ctx, info);
-               return WERR_OK;
+       if (!W_ERROR_IS_OK(result)) {
+               return result;
        }
 
-       printf("rpccli_netlogon_dsr_getdcnameex returned %s\n",
-              dos_errstr(result));
+       d_printf("DsRGetDCNameEx gave %s\n",
+               NDR_PRINT_STRUCT_STRING(mem_ctx, netr_DsRGetDCNameInfo, info));
 
        return result;
 }
@@ -216,14 +224,15 @@ static WERROR cmd_netlogon_dsr_getdcnameex2(struct rpc_pipe_client *cli,
                                            const char **argv)
 {
        WERROR result;
-       uint32 flags = DS_RETURN_DNS_NAME;
+       NTSTATUS status;
+       uint32_t flags = DS_RETURN_DNS_NAME;
        const char *server_name = cli->cli->desthost;
        const char *domain_name = NULL;
        const char *client_account = NULL;
-       uint32 mask = 0;
+       uint32_t mask = 0;
        const char *site_name = NULL;
        struct GUID domain_guid = GUID_zero();
-       struct DS_DOMAIN_CONTROLLER_INFO *info = NULL;
+       struct netr_DsRGetDCNameInfo *info = NULL;
 
        if (argc < 2) {
                fprintf(stderr, "Usage: %s [client_account] [acb_mask] "
@@ -232,14 +241,17 @@ static WERROR cmd_netlogon_dsr_getdcnameex2(struct rpc_pipe_client *cli,
                return WERR_OK;
        }
 
-       if (argc >= 2)
+       if (argc >= 2) {
                client_account = argv[1];
+       }
 
-       if (argc >= 3)
+       if (argc >= 3) {
                mask = atoi(argv[2]);
+       }
 
-       if (argc >= 4)
+       if (argc >= 4) {
                domain_name = argv[3];
+       }
 
        if (argc >= 5) {
                if (!NT_STATUS_IS_OK(GUID_from_string(argv[4], &domain_guid))) {
@@ -247,28 +259,36 @@ static WERROR cmd_netlogon_dsr_getdcnameex2(struct rpc_pipe_client *cli,
                }
        }
 
-       if (argc >= 6)
+       if (argc >= 6) {
                site_name = argv[5];
+       }
 
-       if (argc >= 7)
+       if (argc >= 7) {
                sscanf(argv[6], "%x", &flags);
+       }
 
        debug_dsdcinfo_flags(1,flags);
 
-       result = rpccli_netlogon_dsr_getdcnameex2(cli, mem_ctx, server_name, 
-                                                 client_account, mask,
-                                                 domain_name, &domain_guid,
-                                                 site_name, flags,
-                                                 &info);
+       status = rpccli_netr_DsRGetDCNameEx2(cli, mem_ctx,
+                                            server_name,
+                                            client_account,
+                                            mask,
+                                            domain_name,
+                                            &domain_guid,
+                                            site_name,
+                                            flags,
+                                            &info,
+                                            &result);
+       if (!NT_STATUS_IS_OK(status)) {
+               return ntstatus_to_werror(status);
+       }
 
-       if (W_ERROR_IS_OK(result)) {
-               d_printf("DsGetDcNameEx2 gave\n");
-               display_ds_domain_controller_info(mem_ctx, info);
-               return WERR_OK;
+       if (!W_ERROR_IS_OK(result)) {
+               return result;
        }
 
-       printf("rpccli_netlogon_dsr_getdcnameex2 returned %s\n",
-              dos_errstr(result));
+       d_printf("DsRGetDCNameEx2 gave %s\n",
+               NDR_PRINT_STRUCT_STRING(mem_ctx, netr_DsRGetDCNameInfo, info));
 
        return result;
 }
@@ -539,6 +559,255 @@ static NTSTATUS cmd_netlogon_change_trust_pw(struct rpc_pipe_client *cli,
         return result;
 }
 
+static WERROR cmd_netlogon_gettrustrid(struct rpc_pipe_client *cli,
+                                      TALLOC_CTX *mem_ctx, int argc,
+                                      const char **argv)
+{
+       NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
+       WERROR werr = WERR_GENERAL_FAILURE;
+       const char *server_name = cli->cli->desthost;
+       const char *domain_name = lp_workgroup();
+       uint32_t rid = 0;
+
+       if (argc < 1 || argc > 3) {
+               fprintf(stderr, "Usage: %s <server_name> <domain_name>\n",
+                       argv[0]);
+               return WERR_OK;
+       }
+
+       if (argc >= 2) {
+               server_name = argv[1];
+       }
+
+       if (argc >= 3) {
+               domain_name = argv[2];
+       }
+
+       status = rpccli_netr_LogonGetTrustRid(cli, mem_ctx,
+                                             server_name,
+                                             domain_name,
+                                             &rid,
+                                             &werr);
+       if (!NT_STATUS_IS_OK(status)) {
+               goto done;
+       }
+
+       if (W_ERROR_IS_OK(werr)) {
+               printf("Rid: %d\n", rid);
+       }
+ done:
+       return werr;
+}
+
+static WERROR cmd_netlogon_dsr_enumtrustdom(struct rpc_pipe_client *cli,
+                                           TALLOC_CTX *mem_ctx, int argc,
+                                           const char **argv)
+{
+       NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
+       WERROR werr = WERR_GENERAL_FAILURE;
+       const char *server_name = cli->cli->desthost;
+       uint32_t trust_flags = NETR_TRUST_FLAG_IN_FOREST;
+       struct netr_DomainTrustList trusts;
+
+       if (argc < 1 || argc > 3) {
+               fprintf(stderr, "Usage: %s <server_name> <trust_flags>\n",
+                       argv[0]);
+               return WERR_OK;
+       }
+
+       if (argc >= 2) {
+               server_name = argv[1];
+       }
+
+       if (argc >= 3) {
+               sscanf(argv[2], "%x", &trust_flags);
+       }
+
+       status = rpccli_netr_DsrEnumerateDomainTrusts(cli, mem_ctx,
+                                                     server_name,
+                                                     trust_flags,
+                                                     &trusts,
+                                                     &werr);
+       if (!NT_STATUS_IS_OK(status)) {
+               goto done;
+       }
+
+       if (W_ERROR_IS_OK(werr)) {
+               int i;
+
+               printf("%d domains returned\n", trusts.count);
+
+               for (i=0; i<trusts.count; i++ ) {
+                       printf("%s (%s)\n",
+                               trusts.array[i].dns_name,
+                               trusts.array[i].netbios_name);
+               }
+       }
+ done:
+       return werr;
+}
+
+static WERROR cmd_netlogon_deregisterdnsrecords(struct rpc_pipe_client *cli,
+                                               TALLOC_CTX *mem_ctx, int argc,
+                                               const char **argv)
+{
+       NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
+       WERROR werr = WERR_GENERAL_FAILURE;
+       const char *server_name = cli->cli->desthost;
+       const char *domain = lp_workgroup();
+       const char *dns_host = NULL;
+
+       if (argc < 1 || argc > 4) {
+               fprintf(stderr, "Usage: %s <server_name> <domain_name> "
+                       "<dns_host>\n", argv[0]);
+               return WERR_OK;
+       }
+
+       if (argc >= 2) {
+               server_name = argv[1];
+       }
+
+       if (argc >= 3) {
+               domain = argv[2];
+       }
+
+       if (argc >= 4) {
+               dns_host = argv[3];
+       }
+
+       status = rpccli_netr_DsrDeregisterDNSHostRecords(cli, mem_ctx,
+                                                        server_name,
+                                                        domain,
+                                                        NULL,
+                                                        NULL,
+                                                        dns_host,
+                                                        &werr);
+       if (!NT_STATUS_IS_OK(status)) {
+               goto done;
+       }
+
+       if (W_ERROR_IS_OK(werr)) {
+               printf("success\n");
+       }
+ done:
+       return werr;
+}
+
+static WERROR cmd_netlogon_dsr_getforesttrustinfo(struct rpc_pipe_client *cli,
+                                                 TALLOC_CTX *mem_ctx, int argc,
+                                                 const char **argv)
+{
+       NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
+       WERROR werr = WERR_GENERAL_FAILURE;
+       const char *server_name = cli->cli->desthost;
+       const char *trusted_domain_name = NULL;
+       struct lsa_ForestTrustInformation *info = NULL;
+       uint32_t flags = 0;
+
+       if (argc < 1 || argc > 4) {
+               fprintf(stderr, "Usage: %s <server_name> <trusted_domain_name> "
+                       "<flags>\n", argv[0]);
+               return WERR_OK;
+       }
+
+       if (argc >= 2) {
+               server_name = argv[1];
+       }
+
+       if (argc >= 3) {
+               trusted_domain_name = argv[2];
+       }
+
+       if (argc >= 4) {
+               sscanf(argv[3], "%x", &flags);
+       }
+
+       status = rpccli_netr_DsRGetForestTrustInformation(cli, mem_ctx,
+                                                        server_name,
+                                                        trusted_domain_name,
+                                                        flags,
+                                                        &info,
+                                                        &werr);
+       if (!NT_STATUS_IS_OK(status)) {
+               goto done;
+       }
+
+       if (W_ERROR_IS_OK(werr)) {
+               printf("success\n");
+       }
+ done:
+       return werr;
+}
+
+static WERROR cmd_netlogon_enumtrusteddomains(struct rpc_pipe_client *cli,
+                                             TALLOC_CTX *mem_ctx, int argc,
+                                             const char **argv)
+{
+       NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
+       WERROR werr = WERR_GENERAL_FAILURE;
+       const char *server_name = cli->cli->desthost;
+       struct netr_Blob blob;
+
+
+       if (argc < 1 || argc > 3) {
+               fprintf(stderr, "Usage: %s <server_name>\n", argv[0]);
+               return WERR_OK;
+       }
+
+       if (argc >= 2) {
+               server_name = argv[1];
+       }
+
+       status = rpccli_netr_NetrEnumerateTrustedDomains(cli, mem_ctx,
+                                                        server_name,
+                                                        &blob,
+                                                        &werr);
+       if (!NT_STATUS_IS_OK(status)) {
+               goto done;
+       }
+
+       if (W_ERROR_IS_OK(werr)) {
+               printf("success\n");
+               dump_data(1, blob.data, blob.length);
+       }
+ done:
+       return werr;
+}
+
+static WERROR cmd_netlogon_enumtrusteddomainsex(struct rpc_pipe_client *cli,
+                                               TALLOC_CTX *mem_ctx, int argc,
+                                               const char **argv)
+{
+       NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
+       WERROR werr = WERR_GENERAL_FAILURE;
+       const char *server_name = cli->cli->desthost;
+       struct netr_DomainTrustList list;
+
+       if (argc < 1 || argc > 3) {
+               fprintf(stderr, "Usage: %s <server_name>\n", argv[0]);
+               return WERR_OK;
+       }
+
+       if (argc >= 2) {
+               server_name = argv[1];
+       }
+
+       status = rpccli_netr_NetrEnumerateTrustedDomainsEx(cli, mem_ctx,
+                                                          server_name,
+                                                          &list,
+                                                          &werr);
+       if (!NT_STATUS_IS_OK(status)) {
+               goto done;
+       }
+
+       if (W_ERROR_IS_OK(werr)) {
+               printf("success\n");
+       }
+ done:
+       return werr;
+}
+
+
 
 /* List of commands exported by this module */
 
@@ -553,11 +822,18 @@ struct cmd_set netlogon_commands[] = {
        { "dsr_getdcnameex", RPC_RTYPE_WERROR, NULL, cmd_netlogon_dsr_getdcnameex, PI_NETLOGON, NULL, "Get trusted DC name",     "" },
        { "dsr_getdcnameex2", RPC_RTYPE_WERROR, NULL, cmd_netlogon_dsr_getdcnameex2, PI_NETLOGON, NULL, "Get trusted DC name",     "" },
        { "dsr_getsitename", RPC_RTYPE_WERROR, NULL, cmd_netlogon_dsr_getsitename, PI_NETLOGON, NULL, "Get sitename",     "" },
+       { "dsr_getforesttrustinfo", RPC_RTYPE_WERROR, NULL, cmd_netlogon_dsr_getforesttrustinfo, PI_NETLOGON, NULL, "Get Forest Trust Info",     "" },
        { "logonctrl",  RPC_RTYPE_NTSTATUS, cmd_netlogon_logon_ctrl,  NULL, PI_NETLOGON, NULL, "Logon Control",       "" },
        { "samsync",    RPC_RTYPE_NTSTATUS, cmd_netlogon_sam_sync,    NULL, PI_NETLOGON, NULL, "Sam Synchronisation", "" },
        { "samdeltas",  RPC_RTYPE_NTSTATUS, cmd_netlogon_sam_deltas,  NULL, PI_NETLOGON, NULL, "Query Sam Deltas",    "" },
        { "samlogon",   RPC_RTYPE_NTSTATUS, cmd_netlogon_sam_logon,   NULL, PI_NETLOGON, NULL, "Sam Logon",           "" },
        { "change_trust_pw",   RPC_RTYPE_NTSTATUS, cmd_netlogon_change_trust_pw,   NULL, PI_NETLOGON, NULL, "Change Trust Account Password",           "" },
+       { "gettrustrid", RPC_RTYPE_WERROR, NULL, cmd_netlogon_gettrustrid, PI_NETLOGON, NULL, "Get trust rid",     "" },
+       { "dsr_enumtrustdom", RPC_RTYPE_WERROR, NULL, cmd_netlogon_dsr_enumtrustdom, PI_NETLOGON, NULL, "Enumerate trusted domains",     "" },
+       { "dsenumdomtrusts",  RPC_RTYPE_WERROR, NULL, cmd_netlogon_dsr_enumtrustdom, PI_NETLOGON, NULL, "Enumerate all trusted domains in an AD forest",     "" },
+       { "deregisterdnsrecords", RPC_RTYPE_WERROR, NULL, cmd_netlogon_deregisterdnsrecords, PI_NETLOGON, NULL, "Deregister DNS records",     "" },
+       { "netrenumtrusteddomains", RPC_RTYPE_WERROR, NULL, cmd_netlogon_enumtrusteddomains, PI_NETLOGON, NULL, "Enumerate trusted domains",     "" },
+       { "netrenumtrusteddomainsex", RPC_RTYPE_WERROR, NULL, cmd_netlogon_enumtrusteddomainsex, PI_NETLOGON, NULL, "Enumerate trusted domains",     "" },
 
        { NULL }
 };
index dae6c42bf221a5709de040d8068a0be231f4684e..976bc86d9b10cd5448ec5fa223abbf0f930aef5c 100644 (file)
 
 extern DOM_SID domain_sid;
 
+static void init_lsa_String(struct lsa_String *name, const char *s)
+{
+       name->string = s;
+}
+
 /****************************************************************************
  display sam_user_info_7 structure
  ****************************************************************************/
@@ -122,7 +127,7 @@ static void display_sam_user_info_21(SAM_USER_INFO_21 *usr)
 }
 
 
-static void display_password_properties(uint32 password_properties) 
+static void display_password_properties(uint32_t password_properties)
 {
        printf("password_properties: 0x%08x\n", password_properties);
                
@@ -135,8 +140,8 @@ static void display_password_properties(uint32 password_properties)
        if (password_properties & DOMAIN_PASSWORD_NO_CLEAR_CHANGE)
                printf("\tDOMAIN_PASSWORD_NO_CLEAR_CHANGE\n");
                        
-       if (password_properties & DOMAIN_LOCKOUT_ADMINS)
-               printf("\tDOMAIN_LOCKOUT_ADMINS\n");
+       if (password_properties & DOMAIN_PASSWORD_LOCKOUT_ADMINS)
+               printf("\tDOMAIN_PASSWORD_LOCKOUT_ADMINS\n");
                        
        if (password_properties & DOMAIN_PASSWORD_STORE_CLEARTEXT)
                printf("\tDOMAIN_PASSWORD_STORE_CLEARTEXT\n");
@@ -374,16 +379,19 @@ static NTSTATUS cmd_samr_query_user(struct rpc_pipe_client *cli,
        if (!NT_STATUS_IS_OK(result))
                goto done;
 
-       result = rpccli_samr_open_domain(cli, mem_ctx, &connect_pol,
-                                     MAXIMUM_ALLOWED_ACCESS,
-                                     &domain_sid, &domain_pol);
-
+       result = rpccli_samr_OpenDomain(cli, mem_ctx,
+                                       &connect_pol,
+                                       MAXIMUM_ALLOWED_ACCESS,
+                                       &domain_sid,
+                                       &domain_pol);
        if (!NT_STATUS_IS_OK(result))
                goto done;
 
-       result = rpccli_samr_open_user(cli, mem_ctx, &domain_pol,
-                                   access_mask,
-                                   user_rid, &user_pol);
+       result = rpccli_samr_OpenUser(cli, mem_ctx,
+                                     &domain_pol,
+                                     access_mask,
+                                     user_rid,
+                                     &user_pol);
 
        if (NT_STATUS_EQUAL(result, NT_STATUS_NO_SUCH_USER) &&
            (user_rid == 0)) {
@@ -398,10 +406,11 @@ static NTSTATUS cmd_samr_query_user(struct rpc_pipe_client *cli,
                                                  &types);
 
                if (NT_STATUS_IS_OK(result)) {
-                       result = rpccli_samr_open_user(cli, mem_ctx,
-                                                      &domain_pol,
-                                                      access_mask,
-                                                      rids[0], &user_pol);
+                       result = rpccli_samr_OpenUser(cli, mem_ctx,
+                                                     &domain_pol,
+                                                     access_mask,
+                                                     rids[0],
+                                                     &user_pol);
                }
        }
 
@@ -435,9 +444,9 @@ static NTSTATUS cmd_samr_query_user(struct rpc_pipe_client *cli,
                break;
        }
 
-       rpccli_samr_close(cli, mem_ctx, &user_pol);
-       rpccli_samr_close(cli, mem_ctx, &domain_pol);
-       rpccli_samr_close(cli, mem_ctx, &connect_pol);
+       rpccli_samr_Close(cli, mem_ctx, &user_pol);
+       rpccli_samr_Close(cli, mem_ctx, &domain_pol);
+       rpccli_samr_Close(cli, mem_ctx, &connect_pol);
 
 done:
        return result;
@@ -567,16 +576,20 @@ static NTSTATUS cmd_samr_query_group(struct rpc_pipe_client *cli,
        if (!NT_STATUS_IS_OK(result))
                goto done;
 
-       result = rpccli_samr_open_domain(cli, mem_ctx, &connect_pol,
-                                     MAXIMUM_ALLOWED_ACCESS,
-                                     &domain_sid, &domain_pol);
+       result = rpccli_samr_OpenDomain(cli, mem_ctx,
+                                       &connect_pol,
+                                       MAXIMUM_ALLOWED_ACCESS,
+                                       &domain_sid,
+                                       &domain_pol);
 
        if (!NT_STATUS_IS_OK(result))
                goto done;
 
-       result = rpccli_samr_open_group(cli, mem_ctx, &domain_pol,
-                                    access_mask,
-                                    group_rid, &group_pol);
+       result = rpccli_samr_OpenGroup(cli, mem_ctx,
+                                      &domain_pol,
+                                      access_mask,
+                                      group_rid,
+                                      &group_pol);
 
        if (!NT_STATUS_IS_OK(result))
                goto done;
@@ -589,9 +602,9 @@ static NTSTATUS cmd_samr_query_group(struct rpc_pipe_client *cli,
 
        display_group_info_ctr(group_ctr);
 
-       rpccli_samr_close(cli, mem_ctx, &group_pol);
-       rpccli_samr_close(cli, mem_ctx, &domain_pol);
-       rpccli_samr_close(cli, mem_ctx, &connect_pol);
+       rpccli_samr_Close(cli, mem_ctx, &group_pol);
+       rpccli_samr_Close(cli, mem_ctx, &domain_pol);
+       rpccli_samr_Close(cli, mem_ctx, &connect_pol);
 done:
        return result;
 }
@@ -632,16 +645,19 @@ static NTSTATUS cmd_samr_query_usergroups(struct rpc_pipe_client *cli,
        if (!NT_STATUS_IS_OK(result))
                goto done;
 
-       result = rpccli_samr_open_domain(cli, mem_ctx, &connect_pol,
-                                     MAXIMUM_ALLOWED_ACCESS,
-                                     &domain_sid, &domain_pol);
+       result = rpccli_samr_OpenDomain(cli, mem_ctx,
+                                       &connect_pol,
+                                       MAXIMUM_ALLOWED_ACCESS,
+                                       &domain_sid, &domain_pol);
 
        if (!NT_STATUS_IS_OK(result))
                goto done;
 
-       result = rpccli_samr_open_user(cli, mem_ctx, &domain_pol,
-                                   access_mask,
-                                   user_rid, &user_pol);
+       result = rpccli_samr_OpenUser(cli, mem_ctx,
+                                     &domain_pol,
+                                     access_mask,
+                                     user_rid,
+                                     &user_pol);
 
        if (!NT_STATUS_IS_OK(result))
                goto done;
@@ -657,9 +673,9 @@ static NTSTATUS cmd_samr_query_usergroups(struct rpc_pipe_client *cli,
                       user_gids[i].g_rid, user_gids[i].attr);
        }
 
-       rpccli_samr_close(cli, mem_ctx, &user_pol);
-       rpccli_samr_close(cli, mem_ctx, &domain_pol);
-       rpccli_samr_close(cli, mem_ctx, &connect_pol);
+       rpccli_samr_Close(cli, mem_ctx, &user_pol);
+       rpccli_samr_Close(cli, mem_ctx, &domain_pol);
+       rpccli_samr_Close(cli, mem_ctx, &connect_pol);
  done:
        return result;
 }
@@ -694,8 +710,9 @@ static NTSTATUS cmd_samr_query_useraliases(struct rpc_pipe_client *cli,
                        printf("%s is not a legal SID\n", argv[i]);
                        return NT_STATUS_INVALID_PARAMETER;
                }
-               if (!add_sid_to_array(mem_ctx, &tmp_sid, &sids, &num_sids)) {
-                       return NT_STATUS_NO_MEMORY;
+               result = add_sid_to_array(mem_ctx, &tmp_sid, &sids, &num_sids);
+               if (!NT_STATUS_IS_OK(result)) {
+                       return result;
                }
        }
 
@@ -722,14 +739,16 @@ static NTSTATUS cmd_samr_query_useraliases(struct rpc_pipe_client *cli,
                goto done;
 
        if (StrCaseCmp(argv[1], "domain")==0)
-               result = rpccli_samr_open_domain(cli, mem_ctx, &connect_pol,
-                                             access_mask,
-                                             &domain_sid, &domain_pol);
+               result = rpccli_samr_OpenDomain(cli, mem_ctx,
+                                               &connect_pol,
+                                               access_mask,
+                                               &domain_sid, &domain_pol);
        else if (StrCaseCmp(argv[1], "builtin")==0)
-               result = rpccli_samr_open_domain(cli, mem_ctx, &connect_pol,
-                                             access_mask,
-                                             &global_sid_Builtin,
-                                             &domain_pol);
+               result = rpccli_samr_OpenDomain(cli, mem_ctx,
+                                               &connect_pol,
+                                               access_mask,
+                                               CONST_DISCARD(struct dom_sid2 *, &global_sid_Builtin),
+                                               &domain_pol);
        else {
                printf("Usage: %s builtin|domain sid1 sid2 ...\n", argv[0]);
                return NT_STATUS_INVALID_PARAMETER;
@@ -749,8 +768,8 @@ static NTSTATUS cmd_samr_query_useraliases(struct rpc_pipe_client *cli,
                printf("\tgroup rid:[0x%x]\n", alias_rids[i]);
        }
 
-       rpccli_samr_close(cli, mem_ctx, &domain_pol);
-       rpccli_samr_close(cli, mem_ctx, &connect_pol);
+       rpccli_samr_Close(cli, mem_ctx, &domain_pol);
+       rpccli_samr_Close(cli, mem_ctx, &connect_pol);
  done:
        return result;
 }
@@ -788,16 +807,20 @@ static NTSTATUS cmd_samr_query_groupmem(struct rpc_pipe_client *cli,
        if (!NT_STATUS_IS_OK(result))
                goto done;
 
-       result = rpccli_samr_open_domain(cli, mem_ctx, &connect_pol,
-                                     MAXIMUM_ALLOWED_ACCESS,
-                                     &domain_sid, &domain_pol);
+       result = rpccli_samr_OpenDomain(cli, mem_ctx,
+                                       &connect_pol,
+                                       MAXIMUM_ALLOWED_ACCESS,
+                                       &domain_sid,
+                                       &domain_pol);
 
        if (!NT_STATUS_IS_OK(result))
                goto done;
 
-       result = rpccli_samr_open_group(cli, mem_ctx, &domain_pol,
-                                    access_mask,
-                                    group_rid, &group_pol);
+       result = rpccli_samr_OpenGroup(cli, mem_ctx,
+                                      &domain_pol,
+                                      access_mask,
+                                      group_rid,
+                                      &group_pol);
 
        if (!NT_STATUS_IS_OK(result))
                goto done;
@@ -819,9 +842,9 @@ static NTSTATUS cmd_samr_query_groupmem(struct rpc_pipe_client *cli,
                       group_attrs[i]);
        }
 
-       rpccli_samr_close(cli, mem_ctx, &group_pol);
-       rpccli_samr_close(cli, mem_ctx, &domain_pol);
-       rpccli_samr_close(cli, mem_ctx, &connect_pol);
+       rpccli_samr_Close(cli, mem_ctx, &group_pol);
+       rpccli_samr_Close(cli, mem_ctx, &domain_pol);
+       rpccli_samr_Close(cli, mem_ctx, &connect_pol);
  done:
        return result;
 }
@@ -864,9 +887,11 @@ static NTSTATUS cmd_samr_enum_dom_users(struct rpc_pipe_client *cli,
 
        /* Get domain policy handle */
 
-       result = rpccli_samr_open_domain(cli, mem_ctx, &connect_pol,
-                                     access_mask,
-                                     &domain_sid, &domain_pol);
+       result = rpccli_samr_OpenDomain(cli, mem_ctx,
+                                       &connect_pol,
+                                       access_mask,
+                                       &domain_sid,
+                                       &domain_pol);
 
        if (!NT_STATUS_IS_OK(result))
                goto done;
@@ -895,10 +920,10 @@ static NTSTATUS cmd_samr_enum_dom_users(struct rpc_pipe_client *cli,
 
  done:
        if (got_domain_pol)
-               rpccli_samr_close(cli, mem_ctx, &domain_pol);
+               rpccli_samr_Close(cli, mem_ctx, &domain_pol);
 
        if (got_connect_pol)
-               rpccli_samr_close(cli, mem_ctx, &connect_pol);
+               rpccli_samr_Close(cli, mem_ctx, &connect_pol);
 
        return result;
 }
@@ -936,9 +961,11 @@ static NTSTATUS cmd_samr_enum_dom_groups(struct rpc_pipe_client *cli,
 
        /* Get domain policy handle */
 
-       result = rpccli_samr_open_domain(cli, mem_ctx, &connect_pol,
-                                     access_mask,
-                                     &domain_sid, &domain_pol);
+       result = rpccli_samr_OpenDomain(cli, mem_ctx,
+                                       &connect_pol,
+                                       access_mask,
+                                       &domain_sid,
+                                       &domain_pol);
 
        if (!NT_STATUS_IS_OK(result))
                goto done;
@@ -968,10 +995,10 @@ static NTSTATUS cmd_samr_enum_dom_groups(struct rpc_pipe_client *cli,
 
  done:
        if (got_domain_pol)
-               rpccli_samr_close(cli, mem_ctx, &domain_pol);
+               rpccli_samr_Close(cli, mem_ctx, &domain_pol);
 
        if (got_connect_pol)
-               rpccli_samr_close(cli, mem_ctx, &connect_pol);
+               rpccli_samr_Close(cli, mem_ctx, &connect_pol);
 
        return result;
 }
@@ -1010,13 +1037,17 @@ static NTSTATUS cmd_samr_enum_als_groups(struct rpc_pipe_client *cli,
        /* Get domain policy handle */
 
        if (StrCaseCmp(argv[1], "domain")==0)
-               result = rpccli_samr_open_domain(cli, mem_ctx, &connect_pol,
-                                             access_mask,
-                                             &domain_sid, &domain_pol);
+               result = rpccli_samr_OpenDomain(cli, mem_ctx,
+                                               &connect_pol,
+                                               access_mask,
+                                               &domain_sid,
+                                               &domain_pol);
        else if (StrCaseCmp(argv[1], "builtin")==0)
-               result = rpccli_samr_open_domain(cli, mem_ctx, &connect_pol,
-                                             access_mask,
-                                             &global_sid_Builtin, &domain_pol);
+               result = rpccli_samr_OpenDomain(cli, mem_ctx,
+                                               &connect_pol,
+                                               access_mask,
+                                               CONST_DISCARD(struct dom_sid2 *, &global_sid_Builtin),
+                                               &domain_pol);
        else
                return NT_STATUS_OK;
 
@@ -1047,10 +1078,10 @@ static NTSTATUS cmd_samr_enum_als_groups(struct rpc_pipe_client *cli,
 
  done:
        if (got_domain_pol)
-               rpccli_samr_close(cli, mem_ctx, &domain_pol);
+               rpccli_samr_Close(cli, mem_ctx, &domain_pol);
        
        if (got_connect_pol)
-               rpccli_samr_close(cli, mem_ctx, &connect_pol);
+               rpccli_samr_Close(cli, mem_ctx, &connect_pol);
        
        return result;
 }
@@ -1088,13 +1119,17 @@ static NTSTATUS cmd_samr_query_aliasmem(struct rpc_pipe_client *cli,
        /* Open handle on domain */
        
        if (StrCaseCmp(argv[1], "domain")==0)
-               result = rpccli_samr_open_domain(cli, mem_ctx, &connect_pol,
-                                             MAXIMUM_ALLOWED_ACCESS,
-                                             &domain_sid, &domain_pol);
+               result = rpccli_samr_OpenDomain(cli, mem_ctx,
+                                               &connect_pol,
+                                               MAXIMUM_ALLOWED_ACCESS,
+                                               &domain_sid,
+                                               &domain_pol);
        else if (StrCaseCmp(argv[1], "builtin")==0)
-               result = rpccli_samr_open_domain(cli, mem_ctx, &connect_pol,
-                                             MAXIMUM_ALLOWED_ACCESS,
-                                             &global_sid_Builtin, &domain_pol);
+               result = rpccli_samr_OpenDomain(cli, mem_ctx,
+                                               &connect_pol,
+                                               MAXIMUM_ALLOWED_ACCESS,
+                                               CONST_DISCARD(struct dom_sid2 *, &global_sid_Builtin),
+                                               &domain_pol);
        else
                return NT_STATUS_OK;
 
@@ -1103,9 +1138,11 @@ static NTSTATUS cmd_samr_query_aliasmem(struct rpc_pipe_client *cli,
 
        /* Open handle on alias */
 
-       result = rpccli_samr_open_alias(cli, mem_ctx, &domain_pol,
-                                    access_mask,
-                                    alias_rid, &alias_pol);
+       result = rpccli_samr_OpenAlias(cli, mem_ctx,
+                                      &domain_pol,
+                                      access_mask,
+                                      alias_rid,
+                                      &alias_pol);
        if (!NT_STATUS_IS_OK(result))
                goto done;
 
@@ -1122,9 +1159,9 @@ static NTSTATUS cmd_samr_query_aliasmem(struct rpc_pipe_client *cli,
                printf("\tsid:[%s]\n", sid_str);
        }
 
-       rpccli_samr_close(cli, mem_ctx, &alias_pol);
-       rpccli_samr_close(cli, mem_ctx, &domain_pol);
-       rpccli_samr_close(cli, mem_ctx, &connect_pol);
+       rpccli_samr_Close(cli, mem_ctx, &alias_pol);
+       rpccli_samr_Close(cli, mem_ctx, &domain_pol);
+       rpccli_samr_Close(cli, mem_ctx, &connect_pol);
  done:
        return result;
 }
@@ -1158,13 +1195,17 @@ static NTSTATUS cmd_samr_delete_alias(struct rpc_pipe_client *cli,
        /* Open handle on domain */
        
        if (StrCaseCmp(argv[1], "domain")==0)
-               result = rpccli_samr_open_domain(cli, mem_ctx, &connect_pol,
-                                             MAXIMUM_ALLOWED_ACCESS,
-                                             &domain_sid, &domain_pol);
+               result = rpccli_samr_OpenDomain(cli, mem_ctx,
+                                               &connect_pol,
+                                               MAXIMUM_ALLOWED_ACCESS,
+                                               &domain_sid,
+                                               &domain_pol);
        else if (StrCaseCmp(argv[1], "builtin")==0)
-               result = rpccli_samr_open_domain(cli, mem_ctx, &connect_pol,
-                                             MAXIMUM_ALLOWED_ACCESS,
-                                             &global_sid_Builtin, &domain_pol);
+               result = rpccli_samr_OpenDomain(cli, mem_ctx,
+                                               &connect_pol,
+                                               MAXIMUM_ALLOWED_ACCESS,
+                                               CONST_DISCARD(struct dom_sid2 *, &global_sid_Builtin),
+                                               &domain_pol);
        else
                return NT_STATUS_INVALID_PARAMETER;
 
@@ -1173,9 +1214,11 @@ static NTSTATUS cmd_samr_delete_alias(struct rpc_pipe_client *cli,
 
        /* Open handle on alias */
 
-       result = rpccli_samr_open_alias(cli, mem_ctx, &domain_pol,
-                                    access_mask,
-                                    alias_rid, &alias_pol);
+       result = rpccli_samr_OpenAlias(cli, mem_ctx,
+                                      &domain_pol,
+                                      access_mask,
+                                      alias_rid,
+                                      &alias_pol);
        if (!NT_STATUS_IS_OK(result) && (alias_rid == 0)) {
                /* Probably this was a user name, try lookupnames */
                uint32 num_rids;
@@ -1187,20 +1230,22 @@ static NTSTATUS cmd_samr_delete_alias(struct rpc_pipe_client *cli,
                                                  &types);
 
                if (NT_STATUS_IS_OK(result)) {
-                       result = rpccli_samr_open_alias(cli, mem_ctx,
+                       result = rpccli_samr_OpenAlias(cli, mem_ctx,
                                                       &domain_pol,
                                                       access_mask,
-                                                      rids[0], &alias_pol);
+                                                      rids[0],
+                                                      &alias_pol);
                }
        }
 
-       result = rpccli_samr_delete_dom_alias(cli, mem_ctx, &alias_pol);
+       result = rpccli_samr_DeleteDomAlias(cli, mem_ctx,
+                                           &alias_pol);
 
        if (!NT_STATUS_IS_OK(result))
                goto done;
 
-       rpccli_samr_close(cli, mem_ctx, &domain_pol);
-       rpccli_samr_close(cli, mem_ctx, &connect_pol);
+       rpccli_samr_Close(cli, mem_ctx, &domain_pol);
+       rpccli_samr_Close(cli, mem_ctx, &connect_pol);
  done:
        return result;
 }
@@ -1259,9 +1304,11 @@ static NTSTATUS cmd_samr_query_dispinfo(struct rpc_pipe_client *cli,
 
        /* Get domain policy handle */
 
-       result = rpccli_samr_open_domain(cli, mem_ctx, &connect_pol,
-                                     access_mask, 
-                                     &domain_sid, &domain_pol);
+       result = rpccli_samr_OpenDomain(cli, mem_ctx,
+                                       &connect_pol,
+                                       access_mask,
+                                       &domain_sid,
+                                       &domain_pol);
 
        if (!NT_STATUS_IS_OK(result))
                goto done;
@@ -1335,8 +1382,8 @@ static NTSTATUS cmd_samr_query_dispinfo(struct rpc_pipe_client *cli,
                }
        } while ( NT_STATUS_EQUAL(result, STATUS_MORE_ENTRIES));
 
-       rpccli_samr_close(cli, mem_ctx, &domain_pol);
-       rpccli_samr_close(cli, mem_ctx, &connect_pol);
+       rpccli_samr_Close(cli, mem_ctx, &domain_pol);
+       rpccli_samr_Close(cli, mem_ctx, &connect_pol);
  done:
        return result;
 }
@@ -1374,9 +1421,11 @@ static NTSTATUS cmd_samr_query_dominfo(struct rpc_pipe_client *cli,
 
        /* Get domain policy handle */
 
-       result = rpccli_samr_open_domain(cli, mem_ctx, &connect_pol,
-                                     access_mask,
-                                     &domain_sid, &domain_pol);
+       result = rpccli_samr_OpenDomain(cli, mem_ctx,
+                                       &connect_pol,
+                                       access_mask,
+                                       &domain_sid,
+                                       &domain_pol);
 
        if (!NT_STATUS_IS_OK(result))
                goto done;
@@ -1433,9 +1482,9 @@ static NTSTATUS cmd_samr_query_dominfo(struct rpc_pipe_client *cli,
        }
 
  done:
-       rpccli_samr_close(cli, mem_ctx, &domain_pol);
-       rpccli_samr_close(cli, mem_ctx, &connect_pol);
+
+       rpccli_samr_Close(cli, mem_ctx, &domain_pol);
+       rpccli_samr_Close(cli, mem_ctx, &connect_pol);
        return result;
 }
 
@@ -1447,18 +1496,19 @@ static NTSTATUS cmd_samr_create_dom_user(struct rpc_pipe_client *cli,
 {
        POLICY_HND connect_pol, domain_pol, user_pol;
        NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
-       const char *acct_name;
+       struct lsa_String acct_name;
        uint32 acb_info;
-       uint32 user_rid;
+       uint32 acct_flags, user_rid;
        uint32 access_mask = MAXIMUM_ALLOWED_ACCESS;
+       uint32_t access_granted = 0;
 
        if ((argc < 2) || (argc > 3)) {
                printf("Usage: %s username [access mask]\n", argv[0]);
                return NT_STATUS_OK;
        }
 
-       acct_name = argv[1];
-       
+       init_lsa_String(&acct_name, argv[1]);
+
        if (argc > 2)
                 sscanf(argv[2], "%x", &access_mask);
 
@@ -1472,9 +1522,11 @@ static NTSTATUS cmd_samr_create_dom_user(struct rpc_pipe_client *cli,
 
        /* Get domain policy handle */
 
-       result = rpccli_samr_open_domain(cli, mem_ctx, &connect_pol,
-                                     access_mask,
-                                     &domain_sid, &domain_pol);
+       result = rpccli_samr_OpenDomain(cli, mem_ctx,
+                                       &connect_pol,
+                                       access_mask,
+                                       &domain_sid,
+                                       &domain_pol);
 
        if (!NT_STATUS_IS_OK(result))
                goto done;
@@ -1482,22 +1534,31 @@ static NTSTATUS cmd_samr_create_dom_user(struct rpc_pipe_client *cli,
        /* Create domain user */
 
        acb_info = ACB_NORMAL;
-       access_mask = 0xe005000b;
+       acct_flags = SEC_GENERIC_READ | SEC_GENERIC_WRITE | SEC_GENERIC_EXECUTE |
+                    SEC_STD_WRITE_DAC | SEC_STD_DELETE |
+                    SAMR_USER_ACCESS_SET_PASSWORD |
+                    SAMR_USER_ACCESS_GET_ATTRIBUTES |
+                    SAMR_USER_ACCESS_SET_ATTRIBUTES;
 
-       result = rpccli_samr_create_dom_user(cli, mem_ctx, &domain_pol,
-                                         acct_name, acb_info, access_mask,
-                                         &user_pol, &user_rid);
+       result = rpccli_samr_CreateUser2(cli, mem_ctx,
+                                        &domain_pol,
+                                        &acct_name,
+                                        acb_info,
+                                        acct_flags,
+                                        &user_pol,
+                                        &access_granted,
+                                        &user_rid);
 
        if (!NT_STATUS_IS_OK(result))
                goto done;
 
-       result = rpccli_samr_close(cli, mem_ctx, &user_pol);
+       result = rpccli_samr_Close(cli, mem_ctx, &user_pol);
        if (!NT_STATUS_IS_OK(result)) goto done;
 
-       result = rpccli_samr_close(cli, mem_ctx, &domain_pol);
+       result = rpccli_samr_Close(cli, mem_ctx, &domain_pol);
        if (!NT_STATUS_IS_OK(result)) goto done;
 
-       result = rpccli_samr_close(cli, mem_ctx, &connect_pol);
+       result = rpccli_samr_Close(cli, mem_ctx, &connect_pol);
        if (!NT_STATUS_IS_OK(result)) goto done;
 
  done:
@@ -1512,16 +1573,17 @@ static NTSTATUS cmd_samr_create_dom_group(struct rpc_pipe_client *cli,
 {
        POLICY_HND connect_pol, domain_pol, group_pol;
        NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
-       const char *grp_name;
+       struct lsa_String grp_name;
        uint32 access_mask = MAXIMUM_ALLOWED_ACCESS;
+       uint32_t rid = 0;
 
        if ((argc < 2) || (argc > 3)) {
                printf("Usage: %s groupname [access mask]\n", argv[0]);
                return NT_STATUS_OK;
        }
 
-       grp_name = argv[1];
-       
+       init_lsa_String(&grp_name, argv[1]);
+
        if (argc > 2)
                 sscanf(argv[2], "%x", &access_mask);
 
@@ -1535,29 +1597,33 @@ static NTSTATUS cmd_samr_create_dom_group(struct rpc_pipe_client *cli,
 
        /* Get domain policy handle */
 
-       result = rpccli_samr_open_domain(cli, mem_ctx, &connect_pol,
-                                     access_mask,
-                                     &domain_sid, &domain_pol);
+       result = rpccli_samr_OpenDomain(cli, mem_ctx,
+                                       &connect_pol,
+                                       access_mask,
+                                       &domain_sid,
+                                       &domain_pol);
 
        if (!NT_STATUS_IS_OK(result))
                goto done;
 
        /* Create domain user */
-
-       result = rpccli_samr_create_dom_group(cli, mem_ctx, &domain_pol,
-                                          grp_name, MAXIMUM_ALLOWED_ACCESS,
-                                          &group_pol);
+       result = rpccli_samr_CreateDomainGroup(cli, mem_ctx,
+                                              &domain_pol,
+                                              &grp_name,
+                                              MAXIMUM_ALLOWED_ACCESS,
+                                              &group_pol,
+                                              &rid);
 
        if (!NT_STATUS_IS_OK(result))
                goto done;
 
-       result = rpccli_samr_close(cli, mem_ctx, &group_pol);
+       result = rpccli_samr_Close(cli, mem_ctx, &group_pol);
        if (!NT_STATUS_IS_OK(result)) goto done;
 
-       result = rpccli_samr_close(cli, mem_ctx, &domain_pol);
+       result = rpccli_samr_Close(cli, mem_ctx, &domain_pol);
        if (!NT_STATUS_IS_OK(result)) goto done;
 
-       result = rpccli_samr_close(cli, mem_ctx, &connect_pol);
+       result = rpccli_samr_Close(cli, mem_ctx, &connect_pol);
        if (!NT_STATUS_IS_OK(result)) goto done;
 
  done:
@@ -1572,16 +1638,17 @@ static NTSTATUS cmd_samr_create_dom_alias(struct rpc_pipe_client *cli,
 {
        POLICY_HND connect_pol, domain_pol, alias_pol;
        NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
-       const char *alias_name;
+       struct lsa_String alias_name;
        uint32 access_mask = MAXIMUM_ALLOWED_ACCESS;
+       uint32_t rid = 0;
 
        if ((argc < 2) || (argc > 3)) {
                printf("Usage: %s aliasname [access mask]\n", argv[0]);
                return NT_STATUS_OK;
        }
 
-       alias_name = argv[1];
-       
+       init_lsa_String(&alias_name, argv[1]);
+
        if (argc > 2)
                 sscanf(argv[2], "%x", &access_mask);
 
@@ -1595,28 +1662,34 @@ static NTSTATUS cmd_samr_create_dom_alias(struct rpc_pipe_client *cli,
 
        /* Get domain policy handle */
 
-       result = rpccli_samr_open_domain(cli, mem_ctx, &connect_pol,
-                                        access_mask,
-                                        &domain_sid, &domain_pol);
+       result = rpccli_samr_OpenDomain(cli, mem_ctx,
+                                       &connect_pol,
+                                       access_mask,
+                                       &domain_sid,
+                                       &domain_pol);
 
        if (!NT_STATUS_IS_OK(result))
                goto done;
 
        /* Create domain user */
 
-       result = rpccli_samr_create_dom_alias(cli, mem_ctx, &domain_pol,
-                                             alias_name, &alias_pol);
+       result = rpccli_samr_CreateDomAlias(cli, mem_ctx,
+                                           &domain_pol,
+                                           &alias_name,
+                                           MAXIMUM_ALLOWED_ACCESS,
+                                           &alias_pol,
+                                           &rid);
 
        if (!NT_STATUS_IS_OK(result))
                goto done;
 
-       result = rpccli_samr_close(cli, mem_ctx, &alias_pol);
+       result = rpccli_samr_Close(cli, mem_ctx, &alias_pol);
        if (!NT_STATUS_IS_OK(result)) goto done;
 
-       result = rpccli_samr_close(cli, mem_ctx, &domain_pol);
+       result = rpccli_samr_Close(cli, mem_ctx, &domain_pol);
        if (!NT_STATUS_IS_OK(result)) goto done;
 
-       result = rpccli_samr_close(cli, mem_ctx, &connect_pol);
+       result = rpccli_samr_Close(cli, mem_ctx, &connect_pol);
        if (!NT_STATUS_IS_OK(result)) goto done;
 
  done:
@@ -1652,13 +1725,17 @@ static NTSTATUS cmd_samr_lookup_names(struct rpc_pipe_client *cli,
                goto done;
 
        if (StrCaseCmp(argv[1], "domain")==0)
-               result = rpccli_samr_open_domain(cli, mem_ctx, &connect_pol,
-                                             MAXIMUM_ALLOWED_ACCESS,
-                                             &domain_sid, &domain_pol);
+               result = rpccli_samr_OpenDomain(cli, mem_ctx,
+                                               &connect_pol,
+                                               MAXIMUM_ALLOWED_ACCESS,
+                                               &domain_sid,
+                                               &domain_pol);
        else if (StrCaseCmp(argv[1], "builtin")==0)
-               result = rpccli_samr_open_domain(cli, mem_ctx, &connect_pol,
-                                             MAXIMUM_ALLOWED_ACCESS,
-                                             &global_sid_Builtin, &domain_pol);
+               result = rpccli_samr_OpenDomain(cli, mem_ctx,
+                                               &connect_pol,
+                                               MAXIMUM_ALLOWED_ACCESS,
+                                               CONST_DISCARD(struct dom_sid2 *, &global_sid_Builtin),
+                                               &domain_pol);
        else
                return NT_STATUS_OK;
 
@@ -1670,8 +1747,8 @@ static NTSTATUS cmd_samr_lookup_names(struct rpc_pipe_client *cli,
        num_names = argc - 2;
 
        if ((names = TALLOC_ARRAY(mem_ctx, const char *, num_names)) == NULL) {
-               rpccli_samr_close(cli, mem_ctx, &domain_pol);
-               rpccli_samr_close(cli, mem_ctx, &connect_pol);
+               rpccli_samr_Close(cli, mem_ctx, &domain_pol);
+               rpccli_samr_Close(cli, mem_ctx, &connect_pol);
                result = NT_STATUS_NO_MEMORY;
                goto done;
        }
@@ -1692,8 +1769,8 @@ static NTSTATUS cmd_samr_lookup_names(struct rpc_pipe_client *cli,
                printf("name %s: 0x%x (%d)\n", names[i], rids[i], 
                       name_types[i]);
 
-       rpccli_samr_close(cli, mem_ctx, &domain_pol);
-       rpccli_samr_close(cli, mem_ctx, &connect_pol);
+       rpccli_samr_Close(cli, mem_ctx, &domain_pol);
+       rpccli_samr_Close(cli, mem_ctx, &connect_pol);
  done:
        return result;
 }
@@ -1724,13 +1801,17 @@ static NTSTATUS cmd_samr_lookup_rids(struct rpc_pipe_client *cli,
                goto done;
 
        if (StrCaseCmp(argv[1], "domain")==0)
-               result = rpccli_samr_open_domain(cli, mem_ctx, &connect_pol,
-                                             MAXIMUM_ALLOWED_ACCESS,
-                                             &domain_sid, &domain_pol);
+               result = rpccli_samr_OpenDomain(cli, mem_ctx,
+                                               &connect_pol,
+                                               MAXIMUM_ALLOWED_ACCESS,
+                                               &domain_sid,
+                                               &domain_pol);
        else if (StrCaseCmp(argv[1], "builtin")==0)
-               result = rpccli_samr_open_domain(cli, mem_ctx, &connect_pol,
-                                             MAXIMUM_ALLOWED_ACCESS,
-                                             &global_sid_Builtin, &domain_pol);
+               result = rpccli_samr_OpenDomain(cli, mem_ctx,
+                                               &connect_pol,
+                                               MAXIMUM_ALLOWED_ACCESS,
+                                               CONST_DISCARD(struct dom_sid2 *, &global_sid_Builtin),
+                                               &domain_pol);
        else
                return NT_STATUS_OK;
 
@@ -1742,8 +1823,8 @@ static NTSTATUS cmd_samr_lookup_rids(struct rpc_pipe_client *cli,
        num_rids = argc - 2;
 
        if ((rids = TALLOC_ARRAY(mem_ctx, uint32, num_rids)) == NULL) {
-               rpccli_samr_close(cli, mem_ctx, &domain_pol);
-               rpccli_samr_close(cli, mem_ctx, &connect_pol);
+               rpccli_samr_Close(cli, mem_ctx, &domain_pol);
+               rpccli_samr_Close(cli, mem_ctx, &connect_pol);
                result = NT_STATUS_NO_MEMORY;
                goto done;
        }
@@ -1763,8 +1844,8 @@ static NTSTATUS cmd_samr_lookup_rids(struct rpc_pipe_client *cli,
        for (i = 0; i < num_names; i++)
                printf("rid 0x%x: %s (%d)\n", rids[i], names[i], name_types[i]);
 
-       rpccli_samr_close(cli, mem_ctx, &domain_pol);
-       rpccli_samr_close(cli, mem_ctx, &connect_pol);
+       rpccli_samr_Close(cli, mem_ctx, &domain_pol);
+       rpccli_samr_Close(cli, mem_ctx, &connect_pol);
  done:
        return result;
 }
@@ -1795,9 +1876,11 @@ static NTSTATUS cmd_samr_delete_dom_group(struct rpc_pipe_client *cli,
        if (!NT_STATUS_IS_OK(result))
                goto done;
 
-       result = rpccli_samr_open_domain(cli, mem_ctx, &connect_pol,
-                                     MAXIMUM_ALLOWED_ACCESS,
-                                     &domain_sid, &domain_pol);
+       result = rpccli_samr_OpenDomain(cli, mem_ctx,
+                                       &connect_pol,
+                                       MAXIMUM_ALLOWED_ACCESS,
+                                       &domain_sid,
+                                       &domain_pol);
 
        if (!NT_STATUS_IS_OK(result))
                goto done;
@@ -1816,26 +1899,29 @@ static NTSTATUS cmd_samr_delete_dom_group(struct rpc_pipe_client *cli,
                if (!NT_STATUS_IS_OK(result))
                        goto done;
 
-               result = rpccli_samr_open_group(cli, mem_ctx, &domain_pol,
-                                               access_mask,
-                                               group_rids[0], &group_pol);
+               result = rpccli_samr_OpenGroup(cli, mem_ctx,
+                                              &domain_pol,
+                                              access_mask,
+                                              group_rids[0],
+                                              &group_pol);
 
                if (!NT_STATUS_IS_OK(result))
                        goto done;
        }
 
-       /* Delete user */
+       /* Delete group */
 
-       result = rpccli_samr_delete_dom_group(cli, mem_ctx, &group_pol);
+       result = rpccli_samr_DeleteDomainGroup(cli, mem_ctx,
+                                              &group_pol);
 
        if (!NT_STATUS_IS_OK(result))
                goto done;
 
        /* Display results */
 
-       rpccli_samr_close(cli, mem_ctx, &group_pol);
-       rpccli_samr_close(cli, mem_ctx, &domain_pol);
-       rpccli_samr_close(cli, mem_ctx, &connect_pol);
+       rpccli_samr_Close(cli, mem_ctx, &group_pol);
+       rpccli_samr_Close(cli, mem_ctx, &domain_pol);
+       rpccli_samr_Close(cli, mem_ctx, &connect_pol);
 
  done:
        return result;
@@ -1867,9 +1953,11 @@ static NTSTATUS cmd_samr_delete_dom_user(struct rpc_pipe_client *cli,
        if (!NT_STATUS_IS_OK(result))
                goto done;
 
-       result = rpccli_samr_open_domain(cli, mem_ctx, &connect_pol,
-                                     MAXIMUM_ALLOWED_ACCESS,
-                                     &domain_sid, &domain_pol);
+       result = rpccli_samr_OpenDomain(cli, mem_ctx,
+                                       &connect_pol,
+                                       MAXIMUM_ALLOWED_ACCESS,
+                                       &domain_sid,
+                                       &domain_pol);
 
        if (!NT_STATUS_IS_OK(result))
                goto done;
@@ -1888,9 +1976,11 @@ static NTSTATUS cmd_samr_delete_dom_user(struct rpc_pipe_client *cli,
                if (!NT_STATUS_IS_OK(result))
                        goto done;
 
-               result = rpccli_samr_open_user(cli, mem_ctx, &domain_pol,
-                                           access_mask,
-                                           user_rids[0], &user_pol);
+               result = rpccli_samr_OpenUser(cli, mem_ctx,
+                                             &domain_pol,
+                                             access_mask,
+                                             user_rids[0],
+                                             &user_pol);
 
                if (!NT_STATUS_IS_OK(result))
                        goto done;
@@ -1898,16 +1988,17 @@ static NTSTATUS cmd_samr_delete_dom_user(struct rpc_pipe_client *cli,
 
        /* Delete user */
 
-       result = rpccli_samr_delete_dom_user(cli, mem_ctx, &user_pol);
+       result = rpccli_samr_DeleteUser(cli, mem_ctx,
+                                       &user_pol);
 
        if (!NT_STATUS_IS_OK(result))
                goto done;
 
        /* Display results */
 
-       rpccli_samr_close(cli, mem_ctx, &user_pol);
-       rpccli_samr_close(cli, mem_ctx, &domain_pol);
-       rpccli_samr_close(cli, mem_ctx, &connect_pol);
+       rpccli_samr_Close(cli, mem_ctx, &user_pol);
+       rpccli_samr_Close(cli, mem_ctx, &domain_pol);
+       rpccli_samr_Close(cli, mem_ctx, &connect_pol);
 
  done:
        return result;
@@ -1958,17 +2049,21 @@ static NTSTATUS cmd_samr_query_sec_obj(struct rpc_pipe_client *cli,
                goto done;
 
        if (domain || user_rid)
-               result = rpccli_samr_open_domain(cli, mem_ctx, &connect_pol,
-                                             MAXIMUM_ALLOWED_ACCESS,
-                                             &domain_sid, &domain_pol);
+               result = rpccli_samr_OpenDomain(cli, mem_ctx,
+                                               &connect_pol,
+                                               MAXIMUM_ALLOWED_ACCESS,
+                                               &domain_sid,
+                                               &domain_pol);
 
        if (!NT_STATUS_IS_OK(result))
                goto done;
 
        if (user_rid)
-               result = rpccli_samr_open_user(cli, mem_ctx, &domain_pol,
-                                           MAXIMUM_ALLOWED_ACCESS,
-                                           user_rid, &user_pol);
+               result = rpccli_samr_OpenUser(cli, mem_ctx,
+                                             &domain_pol,
+                                             MAXIMUM_ALLOWED_ACCESS,
+                                             user_rid,
+                                             &user_pol);
 
        if (!NT_STATUS_IS_OK(result))
                goto done;
@@ -1993,9 +2088,9 @@ static NTSTATUS cmd_samr_query_sec_obj(struct rpc_pipe_client *cli,
 
        display_sec_desc(sec_desc_buf->sd);
 
-       rpccli_samr_close(cli, mem_ctx, &user_pol);
-       rpccli_samr_close(cli, mem_ctx, &domain_pol);
-       rpccli_samr_close(cli, mem_ctx, &connect_pol);
+       rpccli_samr_Close(cli, mem_ctx, &user_pol);
+       rpccli_samr_Close(cli, mem_ctx, &domain_pol);
+       rpccli_samr_Close(cli, mem_ctx, &connect_pol);
 done:
        talloc_destroy(ctx);
        return result;
@@ -2007,14 +2102,14 @@ static NTSTATUS cmd_samr_get_usrdom_pwinfo(struct rpc_pipe_client *cli,
 {
        NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
        POLICY_HND connect_pol, domain_pol, user_pol;
-       uint16 min_pwd_length;
-       uint32 password_properties, unknown1, rid;
+       struct samr_PwInfo info;
+       uint32_t rid;
 
        if (argc != 2) {
                printf("Usage: %s rid\n", argv[0]);
                return NT_STATUS_OK;
        }
-       
+
        sscanf(argv[1], "%i", &rid);
 
        result = try_samr_connects(cli, mem_ctx, MAXIMUM_ALLOWED_ACCESS, 
@@ -2024,58 +2119,62 @@ static NTSTATUS cmd_samr_get_usrdom_pwinfo(struct rpc_pipe_client *cli,
                goto done;
        }
 
-       result = rpccli_samr_open_domain(cli, mem_ctx, &connect_pol,
-                                        MAXIMUM_ALLOWED_ACCESS, &domain_sid, &domain_pol);
+       result = rpccli_samr_OpenDomain(cli, mem_ctx,
+                                       &connect_pol,
+                                       MAXIMUM_ALLOWED_ACCESS,
+                                       &domain_sid,
+                                       &domain_pol);
 
        if (!NT_STATUS_IS_OK(result)) {
                goto done;
        }
 
-       result = rpccli_samr_open_user(cli, mem_ctx, &domain_pol,
-                                      MAXIMUM_ALLOWED_ACCESS,
-                                      rid, &user_pol);
+       result = rpccli_samr_OpenUser(cli, mem_ctx,
+                                     &domain_pol,
+                                     MAXIMUM_ALLOWED_ACCESS,
+                                     rid,
+                                     &user_pol);
 
        if (!NT_STATUS_IS_OK(result)) {
                goto done;
        }
 
-       result = rpccli_samr_get_usrdom_pwinfo(cli, mem_ctx, &user_pol,
-                                              &min_pwd_length, &password_properties, 
-                                              &unknown1) ;
-
+       result = rpccli_samr_GetUserPwInfo(cli, mem_ctx, &user_pol, &info);
        if (NT_STATUS_IS_OK(result)) {
-               printf("min_pwd_length: %d\n", min_pwd_length);
-               printf("unknown1: %d\n", unknown1);
-               display_password_properties(password_properties);
+               printf("min_password_length: %d\n", info.min_password_length);
+               printf("%s\n",
+                       NDR_PRINT_STRUCT_STRING(mem_ctx,
+                               samr_PasswordProperties, &info.password_properties));
        }
 
  done:
-       rpccli_samr_close(cli, mem_ctx, &user_pol);
-       rpccli_samr_close(cli, mem_ctx, &domain_pol);
-       rpccli_samr_close(cli, mem_ctx, &connect_pol);
+       rpccli_samr_Close(cli, mem_ctx, &user_pol);
+       rpccli_samr_Close(cli, mem_ctx, &domain_pol);
+       rpccli_samr_Close(cli, mem_ctx, &connect_pol);
 
        return result;
 }
 
-
-static NTSTATUS cmd_samr_get_dom_pwinfo(struct rpc_pipe_client *cli, 
+static NTSTATUS cmd_samr_get_dom_pwinfo(struct rpc_pipe_client *cli,
                                        TALLOC_CTX *mem_ctx,
-                                       int argc, const char **argv) 
+                                       int argc, const char **argv)
 {
        NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
-       uint16 min_pwd_length;
-       uint32 password_properties;
+       struct lsa_String domain_name;
+       struct samr_PwInfo info;
 
-       if (argc != 1) {
-               printf("Usage: %s\n", argv[0]);
+       if (argc < 1 || argc > 3) {
+               printf("Usage: %s <domain>\n", argv[0]);
                return NT_STATUS_OK;
        }
 
-       result = rpccli_samr_get_dom_pwinfo(cli, mem_ctx, &min_pwd_length, &password_properties) ;
-       
+       init_lsa_String(&domain_name, argv[1]);
+
+       result = rpccli_samr_GetDomPwInfo(cli, mem_ctx, &domain_name, &info);
+
        if (NT_STATUS_IS_OK(result)) {
-               printf("min_pwd_length: %d\n", min_pwd_length);
-               display_password_properties(password_properties);
+               printf("min_password_length: %d\n", info.min_password_length);
+               display_password_properties(info.password_properties);
        }
 
        return result;
@@ -2105,8 +2204,11 @@ static NTSTATUS cmd_samr_lookup_domain(struct rpc_pipe_client *cli,
        if (!NT_STATUS_IS_OK(result))
                goto done;
 
-       result = rpccli_samr_open_domain(cli, mem_ctx, &connect_pol,
-                                     access_mask, &domain_sid, &domain_pol);
+       result = rpccli_samr_OpenDomain(cli, mem_ctx,
+                                       &connect_pol,
+                                       access_mask,
+                                       &domain_sid,
+                                       &domain_pol);
 
        if (!NT_STATUS_IS_OK(result))
                goto done;
@@ -2114,14 +2216,14 @@ static NTSTATUS cmd_samr_lookup_domain(struct rpc_pipe_client *cli,
        result = rpccli_samr_lookup_domain(
                cli, mem_ctx, &connect_pol, domain_name, &sid);
 
-       sid_to_fstring(sid_string,&sid);
-       if (NT_STATUS_IS_OK(result)) 
+       if (NT_STATUS_IS_OK(result)) {
+               sid_to_fstring(sid_string,&sid);
                printf("SAMR_LOOKUP_DOMAIN: Domain Name: %s Domain SID: %s\n",
                       domain_name,sid_string);
+       }
 
-       rpccli_samr_close(cli, mem_ctx, &domain_pol);
-       rpccli_samr_close(cli, mem_ctx, &connect_pol);
+       rpccli_samr_Close(cli, mem_ctx, &domain_pol);
+       rpccli_samr_Close(cli, mem_ctx, &connect_pol);
 done:
        return result;
 }
@@ -2156,9 +2258,11 @@ static NTSTATUS cmd_samr_chgpasswd2(struct rpc_pipe_client *cli,
 
        /* Get domain policy handle */
 
-       result = rpccli_samr_open_domain(cli, mem_ctx, &connect_pol,
-                                     access_mask,
-                                     &domain_sid, &domain_pol);
+       result = rpccli_samr_OpenDomain(cli, mem_ctx,
+                                       &connect_pol,
+                                       access_mask,
+                                       &domain_sid,
+                                       &domain_pol);
 
        if (!NT_STATUS_IS_OK(result))
                goto done;
@@ -2169,10 +2273,10 @@ static NTSTATUS cmd_samr_chgpasswd2(struct rpc_pipe_client *cli,
        if (!NT_STATUS_IS_OK(result))
                goto done;
 
-       result = rpccli_samr_close(cli, mem_ctx, &domain_pol);
+       result = rpccli_samr_Close(cli, mem_ctx, &domain_pol);
        if (!NT_STATUS_IS_OK(result)) goto done;
 
-       result = rpccli_samr_close(cli, mem_ctx, &connect_pol);
+       result = rpccli_samr_Close(cli, mem_ctx, &connect_pol);
        if (!NT_STATUS_IS_OK(result)) goto done;
 
  done:
@@ -2212,9 +2316,11 @@ static NTSTATUS cmd_samr_chgpasswd3(struct rpc_pipe_client *cli,
 
        /* Get domain policy handle */
 
-       result = rpccli_samr_open_domain(cli, mem_ctx, &connect_pol,
-                                     access_mask,
-                                     &domain_sid, &domain_pol);
+       result = rpccli_samr_OpenDomain(cli, mem_ctx,
+                                       &connect_pol,
+                                       access_mask,
+                                       &domain_sid,
+                                       &domain_pol);
 
        if (!NT_STATUS_IS_OK(result))
                goto done;
@@ -2227,17 +2333,17 @@ static NTSTATUS cmd_samr_chgpasswd3(struct rpc_pipe_client *cli,
                display_sam_unk_info_1(&info);
 
                switch (reject.reject_reason) {
-                       case REJECT_REASON_TOO_SHORT:
-                               d_printf("REJECT_REASON_TOO_SHORT\n");
+                       case SAMR_REJECT_TOO_SHORT:
+                               d_printf("SAMR_REJECT_TOO_SHORT\n");
                                break;
-                       case REJECT_REASON_IN_HISTORY:
-                               d_printf("REJECT_REASON_IN_HISTORY\n");
+                       case SAMR_REJECT_IN_HISTORY:
+                               d_printf("SAMR_REJECT_IN_HISTORY\n");
                                break;
-                       case REJECT_REASON_NOT_COMPLEX:
-                               d_printf("REJECT_REASON_NOT_COMPLEX\n");
+                       case SAMR_REJECT_COMPLEXITY:
+                               d_printf("SAMR_REJECT_COMPLEXITY\n");
                                break;
-                       case REJECT_REASON_OTHER:
-                               d_printf("REJECT_REASON_OTHER\n");
+                       case SAMR_REJECT_OTHER:
+                               d_printf("SAMR_REJECT_OTHER\n");
                                break;
                        default:
                                d_printf("unknown reject reason: %d\n", reject.reject_reason);
@@ -2248,10 +2354,10 @@ static NTSTATUS cmd_samr_chgpasswd3(struct rpc_pipe_client *cli,
        if (!NT_STATUS_IS_OK(result))
                goto done;
 
-       result = rpccli_samr_close(cli, mem_ctx, &domain_pol);
+       result = rpccli_samr_Close(cli, mem_ctx, &domain_pol);
        if (!NT_STATUS_IS_OK(result)) goto done;
 
-       result = rpccli_samr_close(cli, mem_ctx, &connect_pol);
+       result = rpccli_samr_Close(cli, mem_ctx, &connect_pol);
        if (!NT_STATUS_IS_OK(result)) goto done;
 
  done:
index a7969bddd1eeb82341a31facd253863b11a80c47..b5282d2e9b568e18e0dac8a54c9fa8d6c6e987a8 100644 (file)
@@ -1222,9 +1222,10 @@ void set_drv_info_3_env (DRIVER_INFO_3 *info, const char *arch)
 static char* get_driver_3_param (char* str, const char* delim, UNISTR* dest)
 {
        char    *ptr;
+       char *saveptr;
 
        /* get the next token */
-       ptr = strtok(str, delim);
+       ptr = strtok_r(str, delim, &saveptr);
 
        /* a string of 'NULL' is used to represent an empty
           parameter because two consecutive delimiters
@@ -1251,7 +1252,8 @@ static bool init_drv_info_3_members ( TALLOC_CTX *mem_ctx, DRIVER_INFO_3 *info,
 {
        char    *str, *str2;
        uint32  len, i;
-       
+       char *saveptr = NULL;
+
        /* fill in the UNISTR fields */
        str = get_driver_3_param (args, ":", &info->name);
        str = get_driver_3_param (NULL, ":", &info->driverpath);
@@ -1266,13 +1268,13 @@ static bool init_drv_info_3_members ( TALLOC_CTX *mem_ctx, DRIVER_INFO_3 *info,
        str = str2;                     
 
        /* begin to strip out each filename */
-       str = strtok(str, ",");         
+       str = strtok_r(str, ",", &saveptr);
        len = 0;
        while (str != NULL)
        {
                /* keep a cumlative count of the str lengths */
                len += strlen(str)+1;
-               str = strtok(NULL, ",");
+               str = strtok_r(NULL, ",", &saveptr);
        }
 
        /* allocate the space; add one extra slot for a terminating NULL.
index d136cd0d458373deb29b769441ec59bb61f41414..68f408cf4815126fcdbe5c323417085505935fc9 100644 (file)
@@ -124,11 +124,48 @@ static WERROR cmd_wkssvc_messagebuffersend(struct rpc_pipe_client *cli,
        return werr;
 }
 
+static WERROR cmd_wkssvc_enumeratecomputernames(struct rpc_pipe_client *cli,
+                                               TALLOC_CTX *mem_ctx,
+                                               int argc,
+                                               const char **argv)
+{
+       const char *server_name;
+       enum wkssvc_ComputerNameType name_type = NetAllComputerNames;
+       NTSTATUS status;
+       struct wkssvc_ComputerNamesCtr *ctr = NULL;
+       WERROR werr;
+
+       server_name = cli->cli->desthost;
+
+       if (argc >= 2) {
+               name_type = atoi(argv[1]);
+       }
+
+       status = rpccli_wkssvc_NetrEnumerateComputerNames(cli, mem_ctx,
+                                                         server_name,
+                                                         name_type, 0,
+                                                         &ctr,
+                                                         &werr);
+       if (!NT_STATUS_IS_OK(status)) {
+               return ntstatus_to_werror(status);
+       }
+
+       if (W_ERROR_IS_OK(werr)) {
+               int i=0;
+               for (i = 0; i < ctr->count; i++) {
+                       printf("name: %d %s\n", i, ctr->computer_name->string);
+               }
+       }
+
+       return werr;
+}
+
 struct cmd_set wkssvc_commands[] = {
 
        { "WKSSVC" },
        { "wkssvc_wkstagetinfo", RPC_RTYPE_WERROR, NULL, cmd_wkssvc_wkstagetinfo, PI_WKSSVC, NULL, "Query WKSSVC Workstation Information", "" },
        { "wkssvc_getjoininformation", RPC_RTYPE_WERROR, NULL, cmd_wkssvc_getjoininformation, PI_WKSSVC, NULL, "Query WKSSVC Join Information", "" },
        { "wkssvc_messagebuffersend", RPC_RTYPE_WERROR, NULL, cmd_wkssvc_messagebuffersend, PI_WKSSVC, NULL, "Send WKSSVC message", "" },
+       { "wkssvc_enumeratecomputernames", RPC_RTYPE_WERROR, NULL, cmd_wkssvc_enumeratecomputernames, PI_WKSSVC, NULL, "Enumerate WKSSVC computer names", "" },
        { NULL }
 };
index 6f6e1e64743df91940690a943b7a94a175682aef..7b499918b068b40f5664b06fd64b6f77567441b9 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;
@@ -605,7 +605,7 @@ static NTSTATUS do_cmd(struct cli_state *cli,
                }
 
                if (cmd_entry->pipe_idx == PI_NETLOGON) {
-                       uint32 neg_flags = NETLOGON_NEG_AUTH2_FLAGS;
+                       uint32 neg_flags = NETLOGON_NEG_SELECT_AUTH2_FLAGS;
                        uint32 sec_channel_type;
                        uchar trust_password[16];
        
@@ -850,6 +850,18 @@ out_free:
                goto done;
        }
 
+       if (get_cmdline_auth_info_smb_encrypt()) {
+               nt_status = cli_cm_force_encryption(cli,
+                                       get_cmdline_auth_info_username(),
+                                       get_cmdline_auth_info_password(),
+                                       lp_workgroup(),
+                                       "IPC$");
+               if (!NT_STATUS_IS_OK(nt_status)) {
+                       result = 1;
+                       goto done;
+               }
+       }
+
 #if 0  /* COMMENT OUT FOR TESTING */
        memset(cmdline_auth_info.password,'X',sizeof(cmdline_auth_info.password));
 #endif
diff --git a/source/script/fix_bool.pl b/source/script/fix_bool.pl
new file mode 100755 (executable)
index 0000000..c09645d
--- /dev/null
@@ -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);
+
+
index ff266321ff1f339e613ab240148fc476e6b4e2f5..e9839fe49894ed13c7af2650ce0db393f93b90a5 100644 (file)
@@ -151,7 +151,7 @@ END {
     gotstart = 1;
   }
 
-  if( $0 ~ /^NODE_STATUS_STRUCT|^SMB_STRUCT_DIR|^ELOG_TDB|^codepoint_t|^_PUBLIC_/ ) {
+  if( $0 ~ /^NODE_STATUS_STRUCT|^SMB_STRUCT_DIR|^ELOG_TDB|^codepoint_t|^_PUBLIC_|^wbcErr/ ) {
     gotstart = 1;
   }
 
index 2250a81245147331ad11fbfa9c2a5c88816e17e7..c6232cf30179a781f56ffb06fea713611bd66cfe 100755 (executable)
@@ -62,7 +62,6 @@ export PATH SOCKET_WRAPPER_DIR DOMAIN
 export PRIVATEDIR LIBDIR PIDDIR LOCKDIR LOGDIR SERVERCONFFILE
 export SRCDIR SCRIPTDIR BINDIR
 export USERNAME PASSWORD
-export SMBTORTURE4
 export WORKGROUP SERVER SERVER_IP
 export NSS_WRAPPER_PASSWD NSS_WRAPPER_GROUP
 export WINBINDD_SOCKET_DIR WINBINDD_PRIV_PIPE_DIR
@@ -70,6 +69,20 @@ export WINBINDD_SOCKET_DIR WINBINDD_PRIV_PIPE_DIR
 PATH=bin:$PATH
 export PATH
 
+if test x"$LD_LIBRARY_PATH" != x""; then
+       LD_LIBRARY_PATH="$BINDIR:$LD_LIBRARY_PATH"
+else
+       LD_LIBRARY_PATH="$BINDIR"
+fi
+echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH"
+export LD_LIBRARY_PATH
+
+SAMBA4BINDIR=`dirname $SMBTORTURE4`
+SAMBA4SHAREDDIR="$SAMBA4BINDIR/shared"
+
+export SAMBA4SHAREDDIR
+export SMBTORTURE4
+
 ##
 ## verify that we were built with --enable-socket-wrapper
 ##
@@ -173,6 +186,7 @@ cat >$SERVERCONFFILE<<EOF
        map hidden = yes
        map system = yes
        create mask = 755
+       vfs objects = $BINDIR/xattr_tdb.so $BINDIR/streams_xattr.so
 [hideunread]
        copy = tmp
        hide unreadable = yes
index 6117106c8a3c445aa7f9c5760f6b2f990db32a5d..fd8f98ccabb5e608d54e0a47889ebfb8cd7ec183 100755 (executable)
@@ -21,6 +21,6 @@ testit "replacetort" $VALGRIND $BINDIR/replacetort || \
     failed=`expr $failed + 1`
 
 testit "tdbtorture" $VALGRIND $BINDIR/tdbtorture || \
-    failed=`expr $failed +1`
+    failed=`expr $failed + 1`
 
 testok $0 $failed
diff --git a/source/script/tests/test_ntlm_auth_s3.sh b/source/script/tests/test_ntlm_auth_s3.sh
new file mode 100755 (executable)
index 0000000..6c97f2e
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+incdir=`dirname $0`
+. $incdir/test_functions.sh
+
+failed=0
+
+(/usr/bin/env python --version > /dev/null 2>&1)
+
+if test $? -ne 0;
+then
+       echo "Python binary not found in path. Skipping ntlm_auth tests."
+       exit 0
+fi
+
+testit "ntlm_auth" $VALGRIND $SRCDIR/torture/test_ntlm_auth.py $BINDIR/ntlm_auth --configfile=$CONFFILE || failed=`expr $failed + 1`
+# This should work even with NTLMv2
+testit "ntlm_auth" $VALGRIND $SRCDIR/torture/test_ntlm_auth.py $BINDIR/ntlm_auth --configfile=$CONFFILE --client-domain=fOo --server-domain=fOo || failed=`expr $failed + 1`
+
+
+testok $0 $failed
index 9f672897acbab9d7cfd29f733ff9f788c1e93cee..91863b7a6bf68f85130b7aad9b645f6ebdc2c9cf 100755 (executable)
@@ -47,10 +47,10 @@ 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"
+skipped="$skipped RAW-SFILEINFO"
 
 echo "WARNING: Skipping tests $skipped"
 
index 3a8f3bd5b6c9bde49dff0c5dfd01f8c4c7e2e1e2..c10aed0ee650ee56eaffcc81fa39f805e8577c74 100755 (executable)
@@ -2,7 +2,7 @@
 
 # this runs the file serving tests that are expected to pass with samba3
 
-if [ $# != 2 ]; then
+if [ $# -lt 2 ]; then
 cat <<EOF
 Usage: test_smbclient_s3.sh SERVER SERVER_IP
 EOF
@@ -12,6 +12,8 @@ fi
 SERVER="$1"
 SERVER_IP="$2"
 SMBCLIENT="$VALGRIND ${SMBCLIENT:-$BINDIR/smbclient} $CONFIGURATION"
+shift 2
+ADDARGS="$*"
 
 incdir=`dirname $0`
 . $incdir/test_functions.sh
@@ -24,7 +26,7 @@ test_noninteractive_no_prompt()
     prompt="smb"
 
     echo du | \
-       $SMBCLIENT $CONFIGURATION "$@" -U$USERNAME%$PASSWORD //$SERVER/tmp 2>&1 | \
+       $SMBCLIENT $CONFIGURATION "$@" -U$USERNAME%$PASSWORD //$SERVER/tmp -I SERVER_IP $ADDARGS 2>&1 | \
     grep $prompt
 
     if [ $? = 0 ] ; then
@@ -48,8 +50,8 @@ quit
 EOF
 
     CLI_FORCE_INTERACTIVE=yes \
-    $SMBCLIENT $CONFIGURATION "$@" -U$USERNAME%$PASSWORD //$SERVER/tmp \
-       < $tmpfile 2>/dev/null | \
+    $SMBCLIENT $CONFIGURATION "$@" -U$USERNAME%$PASSWORD //$SERVER/tmp -I $SERVER_IP \
+       $ADDARGS < $tmpfile 2>/dev/null | \
     grep $prompt
 
     if [ $? = 0 ] ; then
@@ -64,7 +66,7 @@ EOF
 }
 
 testit "smbclient -L $SERVER_IP" $SMBCLIENT $CONFIGURATION -L $SERVER_IP -N -p 139 || failed=`expr $failed + 1`
-testit "smbclient -L $SERVER" $SMBCLIENT $CONFIGURATION -L $SERVER -N -p 139 || failed=`expr $failed + 1`
+testit "smbclient -L $SERVER -I $SERVER_IP" $SMBCLIENT $CONFIGURATION -L $SERVER -I $SERVER_IP -N -p 139 || failed=`expr $failed + 1`
 
 testit "noninteractive smbclient does not prompt" \
     test_noninteractive_no_prompt || \
index f662eacd3ecf97f5674a80e66fb7cefb611178a0..acb641b9fbac8d56dc4c256009841b6c0b1537f8 100755 (executable)
@@ -42,7 +42,7 @@ for t in $tests; do
     fi
     start=""
     name="$t"
-    testit "$name" $VALGRIND $BINDIR/smbtorture $ADDARGS $unc -U"$username"%"$password" $t || failed=`expr $failed + 1`
+    testit "$name" $VALGRIND $BINDIR/smbtorture $unc -U"$username"%"$password" $ADDARGS $t || failed=`expr $failed + 1`
 done
 
 testok $0 $failed
index 6a8faa1f87ec7ece128cef4acf160ac9c224611d..01eed6ead68907a54c525ffdc9ab4eeb0fd2f900 100755 (executable)
@@ -35,6 +35,8 @@ tests="$tests:--name-to-sid=$username"
 #Didn't pass yet# tests="$tests:--user-info=$username"
 tests="$tests:--user-groups=$username"
 
+failed=0
+
 OLDIFS=$IFS
 NEWIFS=$':'
 IFS=$NEWIFS
index 12789aa9263cdf1efd56bb8ec18b953b64d0e93c..369cf3ebe3147b68ba803a0c592cfbca08771de4 100755 (executable)
@@ -1,9 +1,15 @@
-
 $SCRIPTDIR/test_local_s3.sh || failed=`expr $failed + $?`
 $SCRIPTDIR/test_smbtorture_s3.sh //$SERVER_IP/tmp $USERNAME $PASSWORD "" || failed=`expr $failed + $?`
+echo "Testing encrypted"
+$SCRIPTDIR/test_smbtorture_s3.sh //$SERVER_IP/tmp $USERNAME $PASSWORD "" "-e" || failed=`expr $failed + $?`
 $SCRIPTDIR/test_smbclient_s3.sh $SERVER $SERVER_IP || failed=`expr $failed + $?`
+echo "Testing encrypted"
+$SCRIPTDIR/test_smbclient_s3.sh $SERVER $SERVER_IP "-e" || failed=`expr $failed + $?`
 $SCRIPTDIR/test_wbinfo_s3.sh $WORKGROUP $SERVER $USERNAME $PASSWORD || failed=`expr $failed + $?`
+$SCRIPTDIR/test_ntlm_auth_s3.sh || failed=`expr $failed + $?`
 
+eval "$LIB_PATH_VAR="\$SAMBA4SHAREDDIR:\$$LIB_PATH_VAR"; export $LIB_PATH_VAR"
+eval echo "$LIB_PATH_VAR=\$$LIB_PATH_VAR"
 SMBTORTURE4VERSION=`$SMBTORTURE4 --version`
 if [ -n "$SMBTORTURE4" -a -n "$SMBTORTURE4VERSION" ];then
        echo "Running Tests with Samba4's smbtorture"
index 430c58f50da6f6791740bb9e9b81ee438f28f2fc..d4e144d5ff8ca5d8ce1b36320cb8dfd2da34fee1 100644 (file)
@@ -112,7 +112,9 @@ static SEC_DESC* construct_service_sd( TALLOC_CTX *ctx )
        if ( !(acl = make_sec_acl(ctx, NT4_ACL_REVISION, i, ace)) )
                return NULL;
 
-       if ( !(sd = make_sec_desc(ctx, SEC_DESC_REVISION, SEC_DESC_SELF_RELATIVE, NULL, NULL, NULL, acl, &sd_size)) )
+       if ( !(sd = make_sec_desc(ctx, SECURITY_DESCRIPTOR_REVISION_1,
+                                 SEC_DESC_SELF_RELATIVE, NULL, NULL, NULL,
+                                 acl, &sd_size)) )
                return NULL;
 
        return sd;
@@ -125,22 +127,22 @@ static SEC_DESC* construct_service_sd( TALLOC_CTX *ctx )
 
 static char *get_common_service_dispname( const char *servicename )
 {
-       static fstring dispname;
        int i;
 
        for ( i=0; common_unix_svcs[i].servicename; i++ ) {
                if (strequal(servicename, common_unix_svcs[i].servicename)) {
-                       fstr_sprintf( dispname, "%s (%s)",
+                       char *dispname;
+                       if (asprintf(&dispname,
+                               "%s (%s)",
                                common_unix_svcs[i].dispname,
-                               common_unix_svcs[i].servicename );
-
+                               common_unix_svcs[i].servicename) < 0) {
+                               return NULL;
+                       }
                        return dispname;
                }
        }
 
-       fstrcpy( dispname, servicename );
-
-       return dispname;
+       return SMB_STRDUP(servicename );
 }
 
 /********************************************************************
@@ -292,6 +294,7 @@ static void fill_service_values( const char *name, REGVAL_CTR *values )
 
        if ( builtin_svcs[i].servicename == NULL ) {
                char *pstr = NULL;
+               char *dispname = NULL;
                struct rcinit_file_information *init_info = NULL;
 
                if (asprintf(&pstr, "%s/%s/%s",get_dyn_LIBDIR(),
@@ -303,7 +306,9 @@ static void fill_service_values( const char *name, REGVAL_CTR *values )
                }
 
                /* lookup common unix display names */
-               init_unistr2( &dname, get_common_service_dispname( name ), UNI_STR_TERMINATE );
+               dispname = get_common_service_dispname(name);
+               init_unistr2( &dname, dispname ? dispname : "", UNI_STR_TERMINATE );
+               SAFE_FREE(dispname);
 
                /* get info from init file itself */
                if ( read_init_file( name, &init_info ) ) {
@@ -521,7 +526,7 @@ SEC_DESC *svcctl_get_secdesc( TALLOC_CTX *ctx, const char *name, NT_USER_TOKEN *
        SAFE_FREE(path);
 
        if ( !(values = TALLOC_ZERO_P( key, REGVAL_CTR )) ) {
-               DEBUG(0,("add_new_svc_name: talloc() failed!\n"));
+               DEBUG(0,("svcctl_get_secdesc: talloc() failed!\n"));
                TALLOC_FREE( key );
                return NULL;
        }
@@ -577,7 +582,7 @@ bool svcctl_set_secdesc( TALLOC_CTX *ctx, const char *name, SEC_DESC *sec_desc,
        SAFE_FREE(path);
 
        if ( !(values = TALLOC_ZERO_P( key, REGVAL_CTR )) ) {
-               DEBUG(0,("add_new_svc_name: talloc() failed!\n"));
+               DEBUG(0,("svcctl_set_secdesc: talloc() failed!\n"));
                TALLOC_FREE( key );
                return False;
        }
@@ -602,9 +607,9 @@ bool svcctl_set_secdesc( TALLOC_CTX *ctx, const char *name, SEC_DESC *sec_desc,
 /********************************************************************
 ********************************************************************/
 
-char *svcctl_lookup_dispname( const char *name, NT_USER_TOKEN *token )
+const char *svcctl_lookup_dispname(TALLOC_CTX *ctx, const char *name, NT_USER_TOKEN *token )
 {
-       static fstring display_name;
+       char *display_name = NULL;
        REGISTRY_KEY *key = NULL;
        REGVAL_CTR *values;
        REGISTRY_VALUE *val;
@@ -637,7 +642,7 @@ char *svcctl_lookup_dispname( const char *name, NT_USER_TOKEN *token )
        if ( !(val = regval_ctr_getvalue( values, "DisplayName" )) )
                goto fail;
 
-       rpcstr_pull( display_name, regval_data_p(val), sizeof(display_name), regval_size(val), 0 );
+       rpcstr_pull_talloc(ctx, &display_name, regval_data_p(val), regval_size(val), 0 );
 
        TALLOC_FREE( key );
 
@@ -646,16 +651,15 @@ char *svcctl_lookup_dispname( const char *name, NT_USER_TOKEN *token )
 fail:
        /* default to returning the service name */
        TALLOC_FREE( key );
-       fstrcpy( display_name, name );
-       return display_name;
+       return talloc_strdup(ctx, name);
 }
 
 /********************************************************************
 ********************************************************************/
 
-char *svcctl_lookup_description( const char *name, NT_USER_TOKEN *token )
+const char *svcctl_lookup_description(TALLOC_CTX *ctx, const char *name, NT_USER_TOKEN *token )
 {
-       static fstring description;
+       char *description = NULL;
        REGISTRY_KEY *key = NULL;
        REGVAL_CTR *values;
        REGISTRY_VALUE *val;
@@ -670,7 +674,7 @@ char *svcctl_lookup_description( const char *name, NT_USER_TOKEN *token )
        wresult = regkey_open_internal( NULL, &key, path, token,
                                        REG_KEY_READ );
        if ( !W_ERROR_IS_OK(wresult) ) {
-               DEBUG(0,("svcctl_lookup_dispname: key lookup failed! [%s] (%s)\n", 
+               DEBUG(0,("svcctl_lookup_description: key lookup failed! [%s] (%s)\n", 
                        path, dos_errstr(wresult)));
                SAFE_FREE(path);
                return NULL;
@@ -678,19 +682,19 @@ char *svcctl_lookup_description( const char *name, NT_USER_TOKEN *token )
        SAFE_FREE(path);
 
        if ( !(values = TALLOC_ZERO_P( key, REGVAL_CTR )) ) {
-               DEBUG(0,("svcctl_lookup_dispname: talloc() failed!\n"));
+               DEBUG(0,("svcctl_lookup_description: talloc() failed!\n"));
                TALLOC_FREE( key );
                return NULL;
        }
 
        fetch_reg_values( key, values );
 
-       if ( !(val = regval_ctr_getvalue( values, "Description" )) )
-               fstrcpy( description, "Unix Service");
-       else
-               rpcstr_pull( description, regval_data_p(val), sizeof(description), regval_size(val), 0 );
-
-       TALLOC_FREE( key );
+       if ( !(val = regval_ctr_getvalue( values, "Description" )) ) {
+               TALLOC_FREE( key );
+               return "Unix Service";
+       }
+       rpcstr_pull_talloc(ctx, &description, regval_data_p(val), regval_size(val), 0 );
+       TALLOC_FREE(key);
 
        return description;
 }
index 994b10d6a813bb3468c73c032a0e040b7eaa114c..86fdfe31b7162928bf66a6de1cb776bc86e915fa 100644 (file)
@@ -202,7 +202,8 @@ bool schedule_aio_read_and_X(connection_struct *conn,
        size_t bufsize;
        size_t min_aio_read_size = lp_aio_read_size(SNUM(conn));
 
-       if (!min_aio_read_size || (smb_maxcnt < min_aio_read_size)) {
+       if ((!min_aio_read_size || (smb_maxcnt < min_aio_read_size))
+           && !SMB_VFS_AIO_FORCE(fsp)) {
                /* Too small a read for aio request. */
                DEBUG(10,("schedule_aio_read_and_X: read size (%u) too small "
                          "for minimum aio_read of %u\n",
@@ -236,7 +237,7 @@ bool schedule_aio_read_and_X(connection_struct *conn,
        }
 
        construct_reply_common((char *)req->inbuf, aio_ex->outbuf);
-       set_message(aio_ex->outbuf, 12, 0, True);
+       srv_set_message(aio_ex->outbuf, 12, 0, True);
        SCVAL(aio_ex->outbuf,smb_vwv0,0xFF); /* Never a chained reply. */
 
        a = &aio_ex->acb;
@@ -284,7 +285,8 @@ bool schedule_aio_write_and_X(connection_struct *conn,
        bool write_through = BITSETW(req->inbuf+smb_vwv7,0);
        size_t min_aio_write_size = lp_aio_write_size(SNUM(conn));
 
-       if (!min_aio_write_size || (numtowrite < min_aio_write_size)) {
+       if ((!min_aio_write_size || (numtowrite < min_aio_write_size))
+           && !SMB_VFS_AIO_FORCE(fsp)) {
                /* Too small a write for aio request. */
                DEBUG(10,("schedule_aio_write_and_X: write size (%u) too "
                          "small for minimum aio_write of %u\n",
@@ -356,8 +358,9 @@ bool schedule_aio_write_and_X(connection_struct *conn,
                SSVAL(aio_ex->outbuf,smb_vwv2,numtowrite);
                 SSVAL(aio_ex->outbuf,smb_vwv4,(numtowrite>>16)&1);
                show_msg(aio_ex->outbuf);
-               if (!send_smb(smbd_server_fd(),aio_ex->outbuf)) {
-                       exit_server_cleanly("handle_aio_write: send_smb "
+               if (!srv_send_smb(smbd_server_fd(),aio_ex->outbuf,
+                               IS_CONN_ENCRYPTED(fsp->conn))) {
+                       exit_server_cleanly("handle_aio_write: srv_send_smb "
                                            "failed.");
                }
                DEBUG(10,("schedule_aio_write_and_X: scheduled aio_write "
@@ -407,10 +410,11 @@ static int handle_aio_read_complete(struct aio_extra *aio_ex)
                           "Error = %s\n",
                           aio_ex->fsp->fsp_name, strerror(errno) ));
 
-               outsize = (UNIXERROR(ERRDOS,ERRnoaccess));
                ret = errno;
+               ERROR_NT(map_nt_error_from_unix(ret));
+               outsize = srv_set_message(outbuf,0,0,true);
        } else {
-               outsize = set_message(outbuf,12,nread,False);
+               outsize = srv_set_message(outbuf,12,nread,False);
                SSVAL(outbuf,smb_vwv2,0xFFFF); /* Remaining - must be * -1. */
                SSVAL(outbuf,smb_vwv5,nread);
                SSVAL(outbuf,smb_vwv6,smb_offset(data,outbuf));
@@ -425,8 +429,9 @@ static int handle_aio_read_complete(struct aio_extra *aio_ex)
        }
        smb_setlen(outbuf,outsize - 4);
        show_msg(outbuf);
-       if (!send_smb(smbd_server_fd(),outbuf)) {
-               exit_server_cleanly("handle_aio_read_complete: send_smb "
+       if (!srv_send_smb(smbd_server_fd(),outbuf,
+                       IS_CONN_ENCRYPTED(aio_ex->fsp->conn))) {
+               exit_server_cleanly("handle_aio_read_complete: srv_send_smb "
                                    "failed.");
        }
 
@@ -492,8 +497,9 @@ static int handle_aio_write_complete(struct aio_extra *aio_ex)
                        return 0;
                }
 
-               UNIXERROR(ERRHRD,ERRdiskfull);
                ret = errno;
+               ERROR_BOTH(map_nt_error_from_unix(ret), ERRHRD, ERRdiskfull);
+               srv_set_message(outbuf,0,0,true);
         } else {
                bool write_through = BITSETW(aio_ex->inbuf+smb_vwv7,0);
                NTSTATUS status;
@@ -509,16 +515,18 @@ static int handle_aio_write_complete(struct aio_extra *aio_ex)
                         fsp->fnum, (int)numtowrite, (int)nwritten));
                status = sync_file(fsp->conn,fsp, write_through);
                if (!NT_STATUS_IS_OK(status)) {
-                       UNIXERROR(ERRHRD,ERRdiskfull);
                        ret = errno;
+                       ERROR_BOTH(map_nt_error_from_unix(ret),
+                                  ERRHRD, ERRdiskfull);
+                       srv_set_message(outbuf,0,0,true);
                        DEBUG(5,("handle_aio_write: sync_file for %s returned %s\n",
                                fsp->fsp_name, nt_errstr(status) ));
                }
        }
 
        show_msg(outbuf);
-       if (!send_smb(smbd_server_fd(),outbuf)) {
-               exit_server_cleanly("handle_aio_write: send_smb failed.");
+       if (!srv_send_smb(smbd_server_fd(),outbuf,IS_CONN_ENCRYPTED(fsp->conn))) {
+               exit_server_cleanly("handle_aio_write: srv_send_smb failed.");
        }
 
        DEBUG(10,("handle_aio_write_complete: scheduled aio_write completed "
@@ -739,7 +747,7 @@ void cancel_aio_by_fsp(files_struct *fsp)
                        /* Don't delete the aio_extra record as we may have
                           completed and don't yet know it. Just do the
                           aio_cancel call and return. */
-                       SMB_VFS_AIO_CANCEL(fsp,fsp->fh->fd, &aio_ex->acb);
+                       SMB_VFS_AIO_CANCEL(fsp, &aio_ex->acb);
                        aio_ex->fsp = NULL; /* fsp will be closed when we
                                             * return. */
                }
index 0078bb7d13dd11226af0c513c6800539df01dede..479361a8c1020117f29c2d251dab1029c3f6e02d 100644 (file)
@@ -41,6 +41,7 @@ typedef struct _blocking_lock_record {
        enum brl_type lock_type;
        char *inbuf;
        int length;
+       bool encrypted;
 } blocking_lock_record;
 
 /* dlink list we store pending lock records on. */
@@ -149,7 +150,7 @@ static bool recalc_brl_timeout(void)
 ****************************************************************************/
 
 bool push_blocking_lock_request( struct byte_range_lock *br_lck,
-               const char *inbuf, int length,
+               const struct smb_request *req,
                files_struct *fsp,
                int lock_timeout,
                int lock_num,
@@ -161,6 +162,7 @@ bool push_blocking_lock_request( struct byte_range_lock *br_lck,
                uint32 blocking_pid)
 {
        static bool set_lock_msg;
+       size_t length = smb_len(req->inbuf)+4;
        blocking_lock_record *blr;
        NTSTATUS status;
 
@@ -188,7 +190,7 @@ bool push_blocking_lock_request( struct byte_range_lock *br_lck,
                return False;
        }
 
-       blr->com_type = CVAL(inbuf,smb_com);
+       blr->com_type = CVAL(req->inbuf,smb_com);
        blr->fsp = fsp;
        if (lock_timeout == -1) {
                blr->expire_time.tv_sec = 0;
@@ -204,8 +206,9 @@ bool push_blocking_lock_request( struct byte_range_lock *br_lck,
        blr->lock_type = lock_type;
        blr->offset = offset;
        blr->count = count;
-       memcpy(blr->inbuf, inbuf, length);
+       memcpy(blr->inbuf, req->inbuf, length);
        blr->length = length;
+       blr->encrypted = req->encrypted;
 
        /* Add a pending lock record for this. */
        status = brl_lock(smbd_messaging_context(), br_lck,
@@ -235,14 +238,14 @@ bool push_blocking_lock_request( struct byte_range_lock *br_lck,
                set_lock_msg = True;
        }
 
-       DEBUG(3,("push_blocking_lock_request: lock request length=%d blocked with "
+       DEBUG(3,("push_blocking_lock_request: lock request length=%u blocked with "
                "expiry time (%u sec. %u usec) (+%d msec) for fnum = %d, name = %s\n",
-               length, (unsigned int)blr->expire_time.tv_sec,
+               (unsigned int)length, (unsigned int)blr->expire_time.tv_sec,
                (unsigned int)blr->expire_time.tv_usec, lock_timeout,
                blr->fsp->fnum, blr->fsp->fsp_name ));
 
        /* Push the MID of this packet on the signing queue. */
-       srv_defer_sign_response(SVAL(inbuf,smb_mid));
+       srv_defer_sign_response(SVAL(req->inbuf,smb_mid));
 
        return True;
 }
@@ -259,7 +262,7 @@ static void reply_lockingX_success(blocking_lock_record *blr)
                smb_panic("Could not allocate smb_request");
        }
 
-       init_smb_request(req, (uint8 *)blr->inbuf, 0);
+       init_smb_request(req, (uint8 *)blr->inbuf, 0, blr->encrypted);
        reply_outbuf(req, 2, 0);
 
        /*
@@ -272,8 +275,10 @@ static void reply_lockingX_success(blocking_lock_record *blr)
 
        chain_reply(req);
 
-       if (!send_smb(smbd_server_fd(),(char *)req->outbuf)) {
-               exit_server_cleanly("send_blocking_reply: send_smb failed.");
+       if (!srv_send_smb(smbd_server_fd(),
+                       (char *)req->outbuf,
+                       IS_CONN_ENCRYPTED(blr->fsp->conn))) {
+               exit_server_cleanly("send_blocking_reply: srv_send_smb failed.");
        }
 }
 
@@ -298,19 +303,21 @@ static void generic_blocking_lock_error(blocking_lock_record *blr, NTSTATUS stat
                /* Store the last lock error. */
                files_struct *fsp = blr->fsp;
 
-               fsp->last_lock_failure.context.smbpid = blr->lock_pid;
-               fsp->last_lock_failure.context.tid = fsp->conn->cnum;
-               fsp->last_lock_failure.context.pid = procid_self();
-               fsp->last_lock_failure.start = blr->offset;
-               fsp->last_lock_failure.size = blr->count;
-               fsp->last_lock_failure.fnum = fsp->fnum;
-               fsp->last_lock_failure.lock_type = READ_LOCK; /* Don't care. */
-               fsp->last_lock_failure.lock_flav = blr->lock_flav;
+               if (fsp) {
+                       fsp->last_lock_failure.context.smbpid = blr->lock_pid;
+                       fsp->last_lock_failure.context.tid = fsp->conn->cnum;
+                       fsp->last_lock_failure.context.pid = procid_self();
+                       fsp->last_lock_failure.start = blr->offset;
+                       fsp->last_lock_failure.size = blr->count;
+                       fsp->last_lock_failure.fnum = fsp->fnum;
+                       fsp->last_lock_failure.lock_type = READ_LOCK; /* Don't care. */
+                       fsp->last_lock_failure.lock_flav = blr->lock_flav;
+               }
        }
 
        ERROR_NT(status);
-       if (!send_smb(smbd_server_fd(),outbuf)) {
-               exit_server_cleanly("generic_blocking_lock_error: send_smb failed.");
+       if (!srv_send_smb(smbd_server_fd(),outbuf, blr->encrypted)) {
+               exit_server_cleanly("generic_blocking_lock_error: srv_send_smb failed.");
        }
 }
 
@@ -388,8 +395,10 @@ static void blocking_lock_reply_error(blocking_lock_record *blr, NTSTATUS status
                         */
                        SCVAL(outbuf,smb_com,SMBtrans2);
                        ERROR_NT(status);
-                       if (!send_smb(smbd_server_fd(),outbuf)) {
-                               exit_server_cleanly("blocking_lock_reply_error: send_smb failed.");
+                       if (!srv_send_smb(smbd_server_fd(),
+                                       outbuf,
+                                       IS_CONN_ENCRYPTED(blr->fsp->conn))) {
+                               exit_server_cleanly("blocking_lock_reply_error: srv_send_smb failed.");
                        }
                        break;
                }
@@ -531,12 +540,12 @@ static bool process_trans2(blocking_lock_record *blr)
                return True;
        }
 
-       init_smb_request(req, (uint8 *)blr->inbuf, 0);
+       init_smb_request(req, (uint8 *)blr->inbuf, 0, blr->encrypted);
 
        SCVAL(req->inbuf, smb_com, SMBtrans2);
        SSVAL(params,0,0);
        /* Fake up max_data_bytes here - we know it fits. */
-       send_trans2_replies(req, params, 2, NULL, 0, 0xffff);
+       send_trans2_replies(blr->fsp->conn, req, params, 2, NULL, 0, 0xffff);
        return True;
 }
 
@@ -597,6 +606,9 @@ file %s fnum = %d\n", blr->com_type, fsp->fsp_name, fsp->fnum ));
                                        locktype,
                                        NT_STATUS_RANGE_NOT_LOCKED);
                        }
+                       /* We're closing the file fsp here, so ensure
+                        * we don't have a dangling pointer. */
+                       blr->fsp = NULL;
                }
        }
 }
@@ -613,7 +625,7 @@ void remove_pending_lock_requests_by_mid(int mid)
                next = blr->next;
                if(SVAL(blr->inbuf,smb_mid) == mid) {
                        files_struct *fsp = blr->fsp;
-                       struct byte_range_lock *br_lck = brl_get_locks(NULL, fsp);
+                       struct byte_range_lock *br_lck = brl_get_locks(talloc_tos(), fsp);
 
                        if (br_lck) {
                                DEBUG(10,("remove_pending_lock_requests_by_mid - removing request type %d for \
@@ -703,7 +715,7 @@ static void process_blocking_lock_queue(void)
                        fsp->fnum, fsp->fsp_name ));
 
                if(!change_to_user(conn,vuid)) {
-                       struct byte_range_lock *br_lck = brl_get_locks(NULL, fsp);
+                       struct byte_range_lock *br_lck = brl_get_locks(talloc_tos(), fsp);
 
                        /*
                         * Remove the entry and return an error to the client.
@@ -729,7 +741,7 @@ static void process_blocking_lock_queue(void)
                }
 
                if(!set_current_service(conn,SVAL(blr->inbuf,smb_flg),True)) {
-                       struct byte_range_lock *br_lck = brl_get_locks(NULL, fsp);
+                       struct byte_range_lock *br_lck = brl_get_locks(talloc_tos(), fsp);
 
                        /*
                         * Remove the entry and return an error to the client.
@@ -761,7 +773,7 @@ static void process_blocking_lock_queue(void)
                 */
 
                if(blocking_lock_record_process(blr)) {
-                       struct byte_range_lock *br_lck = brl_get_locks(NULL, fsp);
+                       struct byte_range_lock *br_lck = brl_get_locks(talloc_tos(), fsp);
 
                        if (br_lck) {
                                brl_lock_cancel(br_lck,
@@ -788,7 +800,7 @@ static void process_blocking_lock_queue(void)
                 */
 
                if (!timeval_is_zero(&blr->expire_time) && timeval_compare(&blr->expire_time, &tv_curr) <= 0) {
-                       struct byte_range_lock *br_lck = brl_get_locks(NULL, fsp);
+                       struct byte_range_lock *br_lck = brl_get_locks(talloc_tos(), fsp);
 
                        /*
                         * Lock expired - throw away all previously
index 5ccf3ed9dace5ae7872741e67eddd091a8264775..668c8e20957ac9f991c19cffa7c63d382d7b4d36 100644 (file)
@@ -159,19 +159,19 @@ static int dochild(int master, const char *slavedev, const struct passwd *pass,
                DEBUG(3, ("More weirdness, could not open %s\n", slavedev));
                return (False);
        }
-#if defined(I_PUSH) && defined(I_FIND)
+#if defined(TIOCSCTTY)
+       if (ioctl(slave, TIOCSCTTY, 0) < 0)
+       {
+               DEBUG(3, ("Error in ioctl call for slave pty\n"));
+               /* return(False); */
+       }
+#elif defined(I_PUSH) && defined(I_FIND)
        if (ioctl(slave, I_FIND, "ptem") == 0) {
                ioctl(slave, I_PUSH, "ptem");
        }
        if (ioctl(slave, I_FIND, "ldterm") == 0) {
                ioctl(slave, I_PUSH, "ldterm");
        }
-#elif defined(TIOCSCTTY)
-       if (ioctl(slave, TIOCSCTTY, 0) < 0)
-       {
-               DEBUG(3, ("Error in ioctl call for slave pty\n"));
-               /* return(False); */
-       }
 #endif
 
        /* Close master. */
@@ -1092,7 +1092,7 @@ NTSTATUS change_oem_password(struct samu *hnd, char *old_passwd, char *new_passw
        if (!pdb_get_pass_can_change(hnd)) {
                DEBUG(1, ("user %s does not have permissions to change password\n", username));
                if (samr_reject_reason) {
-                       *samr_reject_reason = REJECT_REASON_OTHER;
+                       *samr_reject_reason = SAMR_REJECT_OTHER;
                }
                return NT_STATUS_ACCOUNT_RESTRICTION;
        }
@@ -1106,7 +1106,7 @@ NTSTATUS change_oem_password(struct samu *hnd, char *old_passwd, char *new_passw
                                  "denied by Refuse Machine Password Change policy\n",
                                  username));
                        if (samr_reject_reason) {
-                               *samr_reject_reason = REJECT_REASON_OTHER;
+                               *samr_reject_reason = SAMR_REJECT_OTHER;
                        }
                        return NT_STATUS_ACCOUNT_RESTRICTION;
                }
@@ -1119,7 +1119,7 @@ NTSTATUS change_oem_password(struct samu *hnd, char *old_passwd, char *new_passw
                          "wait until %s\n", username,
                          http_timestring(can_change_time)));
                if (samr_reject_reason) {
-                       *samr_reject_reason = REJECT_REASON_OTHER;
+                       *samr_reject_reason = SAMR_REJECT_OTHER;
                }
                return NT_STATUS_ACCOUNT_RESTRICTION;
        }
@@ -1129,7 +1129,7 @@ NTSTATUS change_oem_password(struct samu *hnd, char *old_passwd, char *new_passw
                          username));
                DEBUGADD(1, (" account policy min password len = %d\n", min_len));
                if (samr_reject_reason) {
-                       *samr_reject_reason = REJECT_REASON_TOO_SHORT;
+                       *samr_reject_reason = SAMR_REJECT_TOO_SHORT;
                }
                return NT_STATUS_PASSWORD_RESTRICTION;
 /*             return NT_STATUS_PWD_TOO_SHORT; */
@@ -1137,12 +1137,12 @@ NTSTATUS change_oem_password(struct samu *hnd, char *old_passwd, char *new_passw
 
        if (check_passwd_history(hnd,new_passwd)) {
                if (samr_reject_reason) {
-                       *samr_reject_reason = REJECT_REASON_IN_HISTORY;
+                       *samr_reject_reason = SAMR_REJECT_IN_HISTORY;
                }
                return NT_STATUS_PASSWORD_RESTRICTION;
        }
 
-       pass = Get_Pwnam(username);
+       pass = Get_Pwnam_alloc(talloc_tos(), username);
        if (!pass) {
                DEBUG(1, ("change_oem_password: Username %s does not exist in system !?!\n", username));
                return NT_STATUS_ACCESS_DENIED;
@@ -1158,8 +1158,9 @@ NTSTATUS change_oem_password(struct samu *hnd, char *old_passwd, char *new_passw
                if (check_ret != 0) {
                        DEBUG(1, ("change_oem_password: check password script said new password is not good enough!\n"));
                        if (samr_reject_reason) {
-                               *samr_reject_reason = REJECT_REASON_NOT_COMPLEX;
+                               *samr_reject_reason = SAMR_REJECT_COMPLEXITY;
                        }
+                       TALLOC_FREE(pass);
                        return NT_STATUS_PASSWORD_RESTRICTION;
                }
        }
@@ -1178,9 +1179,12 @@ NTSTATUS change_oem_password(struct samu *hnd, char *old_passwd, char *new_passw
        
        if(lp_unix_password_sync() &&
                !chgpasswd(username, pass, old_passwd, new_passwd, as_root)) {
+               TALLOC_FREE(pass);
                return NT_STATUS_ACCESS_DENIED;
        }
 
+       TALLOC_FREE(pass);
+
        if (!pdb_set_plaintext_passwd (hnd, new_passwd)) {
                return NT_STATUS_ACCESS_DENIED;
        }
index eb610f7d1a88b3d46f0fc4a63cc3913180ac2576..4bd23a35fc804a43756acbf93e3b865b09705aab 100644 (file)
@@ -27,7 +27,7 @@ extern struct current_user current_user;
  Run a file if it is a magic script.
 ****************************************************************************/
 
-static void check_magic(files_struct *fsp,connection_struct *conn)
+static void check_magic(struct files_struct *fsp)
 {
        int ret;
        const char *magic_output = NULL;
@@ -35,6 +35,7 @@ static void check_magic(files_struct *fsp,connection_struct *conn)
        int tmp_fd, outfd;
        TALLOC_CTX *ctx = NULL;
        const char *p;
+       struct connection_struct *conn = fsp->conn;
 
        if (!*lp_magicscript(SNUM(conn))) {
                return;
@@ -154,6 +155,75 @@ static void notify_deferred_opens(struct share_mode_lock *lck)
        }
 }
 
+/****************************************************************************
+ Delete all streams
+****************************************************************************/
+
+static NTSTATUS delete_all_streams(connection_struct *conn, const char *fname)
+{
+       struct stream_struct *stream_info;
+       int i;
+       unsigned int num_streams;
+       TALLOC_CTX *frame = talloc_stackframe();
+       NTSTATUS status;
+
+       status = SMB_VFS_STREAMINFO(conn, NULL, fname, talloc_tos(),
+                                   &num_streams, &stream_info);
+
+       if (NT_STATUS_EQUAL(status, NT_STATUS_NOT_IMPLEMENTED)) {
+               DEBUG(10, ("no streams around\n"));
+               TALLOC_FREE(frame);
+               return NT_STATUS_OK;
+       }
+
+       if (!NT_STATUS_IS_OK(status)) {
+               DEBUG(10, ("SMB_VFS_STREAMINFO failed: %s\n",
+                          nt_errstr(status)));
+               goto fail;
+       }
+
+       DEBUG(10, ("delete_all_streams found %d streams\n",
+                  num_streams));
+
+       if (num_streams == 0) {
+               TALLOC_FREE(frame);
+               return NT_STATUS_OK;
+       }
+
+       for (i=0; i<num_streams; i++) {
+               int res;
+               char *streamname;
+
+               if (strequal(stream_info[i].name, "::$DATA")) {
+                       continue;
+               }
+
+               streamname = talloc_asprintf(talloc_tos(), "%s%s", fname,
+                                            stream_info[i].name);
+
+               if (streamname == NULL) {
+                       DEBUG(0, ("talloc_aprintf failed\n"));
+                       status = NT_STATUS_NO_MEMORY;
+                       goto fail;
+               }
+
+               res = SMB_VFS_UNLINK(conn, streamname);
+
+               TALLOC_FREE(streamname);
+
+               if (res == -1) {
+                       status = map_nt_error_from_unix(errno);
+                       DEBUG(10, ("Could not delete stream %s: %s\n",
+                                  streamname, strerror(errno)));
+                       break;
+               }
+       }
+
+ fail:
+       TALLOC_FREE(frame);
+       return status;
+}
+
 /****************************************************************************
  Deal with removing a share mode on last close.
 ****************************************************************************/
@@ -162,7 +232,8 @@ static NTSTATUS close_remove_share_mode(files_struct *fsp,
                                        enum file_close_type close_type)
 {
        connection_struct *conn = fsp->conn;
-       bool delete_file = False;
+       bool delete_file = false;
+       bool changed_user = false;
        struct share_mode_lock *lck;
        SMB_STRUCT_STAT sbuf;
        NTSTATUS status = NT_STATUS_OK;
@@ -175,7 +246,7 @@ static NTSTATUS close_remove_share_mode(files_struct *fsp,
         * This prevents race conditions with the file being created. JRA.
         */
 
-       lck = get_share_mode_lock(NULL, fsp->file_id, NULL, NULL);
+       lck = get_share_mode_lock(talloc_tos(), fsp->file_id, NULL, NULL);
 
        if (lck == NULL) {
                DEBUG(0, ("close_remove_share_mode: Could not get share mode "
@@ -245,18 +316,27 @@ static NTSTATUS close_remove_share_mode(files_struct *fsp,
        DEBUG(5,("close_remove_share_mode: file %s. Delete on close was set "
                 "- deleting file.\n", fsp->fsp_name));
 
-       /* Become the user who requested the delete. */
+       if (!unix_token_equal(lck->delete_token, &current_user.ut)) {
+               /* Become the user who requested the delete. */
 
-       if (!push_sec_ctx()) {
-               smb_panic("close_remove_share_mode: file %s. failed to push "
-                         "sec_ctx.\n");
-       }
+               DEBUG(5,("close_remove_share_mode: file %s. "
+                       "Change user to uid %u\n",
+                       fsp->fsp_name,
+                       (unsigned int)lck->delete_token->uid));
 
-       set_sec_ctx(lck->delete_token->uid,
-                   lck->delete_token->gid,
-                   lck->delete_token->ngroups,
-                   lck->delete_token->groups,
-                   NULL);
+               if (!push_sec_ctx()) {
+                       smb_panic("close_remove_share_mode: file %s. failed to push "
+                                 "sec_ctx.\n");
+               }
+
+               set_sec_ctx(lck->delete_token->uid,
+                           lck->delete_token->gid,
+                           lck->delete_token->ngroups,
+                           lck->delete_token->groups,
+                           NULL);
+
+               changed_user = true;
+       }
 
        /* We can only delete the file if the name we have is still valid and
           hasn't been renamed. */
@@ -294,6 +374,19 @@ static NTSTATUS close_remove_share_mode(files_struct *fsp,
                goto done;
        }
 
+       if ((conn->fs_capabilities & FILE_NAMED_STREAMS)
+           && !is_ntfs_stream_name(fsp->fsp_name)) {
+
+               status = delete_all_streams(conn, fsp->fsp_name);
+
+               if (!NT_STATUS_IS_OK(status)) {
+                       DEBUG(5, ("delete_all_streams failed: %s\n",
+                                 nt_errstr(status)));
+                       goto done;
+               }
+       }
+
+
        if (SMB_VFS_UNLINK(conn,fsp->fsp_name) != 0) {
                /*
                 * This call can potentially fail as another smbd may
@@ -325,9 +418,11 @@ static NTSTATUS close_remove_share_mode(files_struct *fsp,
 
  done:
 
-       /* unbecome user. */
-       pop_sec_ctx();
-       
+       if (changed_user) {
+               /* unbecome user. */
+               pop_sec_ctx();
+       }
+
        TALLOC_FREE(lck);
        return status;
 }
@@ -389,11 +484,11 @@ static NTSTATUS close_normal_file(files_struct *fsp, enum file_close_type close_
 
        locking_close_file(smbd_messaging_context(), fsp);
 
-       status = fd_close(conn, fsp);
+       status = fd_close(fsp);
 
        /* check for magic scripts */
        if (close_type == NORMAL_CLOSE) {
-               check_magic(fsp,conn);
+               check_magic(fsp);
        }
 
        /*
@@ -440,7 +535,7 @@ static NTSTATUS close_directory(files_struct *fsp, enum file_close_type close_ty
         * reference to a directory also.
         */
 
-       lck = get_share_mode_lock(NULL, fsp->file_id, NULL, NULL);
+       lck = get_share_mode_lock(talloc_tos(), fsp->file_id, NULL, NULL);
 
        if (lck == NULL) {
                DEBUG(0, ("close_directory: Could not get share mode lock for %s\n", fsp->fsp_name));
@@ -557,12 +652,37 @@ static NTSTATUS close_stat(files_struct *fsp)
   
 NTSTATUS close_file(files_struct *fsp, enum file_close_type close_type)
 {
+       NTSTATUS status;
+       struct files_struct *base_fsp = fsp->base_fsp;
+
        if(fsp->is_directory) {
-               return close_directory(fsp, close_type);
+               status = close_directory(fsp, close_type);
        } else if (fsp->is_stat) {
-               return close_stat(fsp);
+               status = close_stat(fsp);
        } else if (fsp->fake_file_handle != NULL) {
-               return close_fake_file(fsp);
+               status = close_fake_file(fsp);
+       } else {
+               status = close_normal_file(fsp, close_type);
+       }
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if ((base_fsp != NULL) && (close_type != SHUTDOWN_CLOSE)) {
+
+               /*
+                * fsp was a stream, the base fsp can't be a stream as well
+                *
+                * For SHUTDOWN_CLOSE this is not possible here, because
+                * SHUTDOWN_CLOSE only happens from files.c which walks the
+                * complete list of files. If we mess with more than one fsp
+                * those loops will become confused.
+                */
+
+               SMB_ASSERT(base_fsp->base_fsp == NULL);
+               close_file(base_fsp, close_type);
        }
-       return close_normal_file(fsp, close_type);
+
+       return status;
 }
index 95e45a699003594ae642918b983c065c7ff7aff4..d7063c99894bcfd948d5c48d3162feea5b0c35a5 100644 (file)
@@ -117,6 +117,15 @@ int count_current_connections( const char *sharename, bool clear  )
        return cs.curr_connections;
 }
 
+/****************************************************************************
+ Count the number of connections open across all shares.
+****************************************************************************/
+
+int count_all_current_connections(void)
+{
+        return count_current_connections(NULL, True /* clear stale entries */);
+}
+
 /****************************************************************************
  Claim an entry in the connections database.
 ****************************************************************************/
@@ -132,7 +141,7 @@ bool claim_connection(connection_struct *conn, const char *name,
 
        DEBUG(5,("claiming [%s]\n", name));
 
-       if (!(rec = connections_fetch_entry(NULL, conn, name))) {
+       if (!(rec = connections_fetch_entry(talloc_tos(), conn, name))) {
                DEBUG(0, ("connections_fetch_entry failed\n"));
                return False;
        }
index 05679ee0ee045f685983e7f156e348becd31da0e..ca6f8bfd8dc22a2690afaf177f6a6c559fda2aaa 100644 (file)
@@ -142,8 +142,7 @@ static void dptr_idle(struct dptr_struct *dptr)
 {
        if (dptr->dir_hnd) {
                DEBUG(4,("Idling dptr dnum %d\n",dptr->dnum));
-               CloseDir(dptr->dir_hnd);
-               dptr->dir_hnd = NULL;
+               TALLOC_FREE(dptr->dir_hnd);
        }
 }
 
@@ -192,7 +191,9 @@ static struct dptr_struct *dptr_get(int key, bool forclose)
                                if (dirhandles_open >= MAX_OPEN_DIRECTORIES)
                                        dptr_idleoldest();
                                DEBUG(4,("dptr_get: Reopening dptr key %d\n",key));
-                               if (!(dptr->dir_hnd = OpenDir(dptr->conn, dptr->path, dptr->wcard, dptr->attr))) {
+                               if (!(dptr->dir_hnd = OpenDir(
+                                             NULL, dptr->conn, dptr->path,
+                                             dptr->wcard, dptr->attr))) {
                                        DEBUG(4,("dptr_get: Failed to open %s (%s)\n",dptr->path,
                                                strerror(errno)));
                                        return False;
@@ -263,9 +264,7 @@ static void dptr_close_internal(struct dptr_struct *dptr)
 
        bitmap_clear(dptr_bmap, dptr->dnum - 1);
 
-       if (dptr->dir_hnd) {
-               CloseDir(dptr->dir_hnd);
-       }
+       TALLOC_FREE(dptr->dir_hnd);
 
        /* Lanman 2 specific code */
        SAFE_FREE(dptr->wcard);
@@ -411,7 +410,7 @@ NTSTATUS dptr_create(connection_struct *conn, const char *path, bool old_handle,
                return status;
        }
 
-       dir_hnd = OpenDir(conn, path, wcard, attr);
+       dir_hnd = OpenDir(NULL, conn, path, wcard, attr);
        if (!dir_hnd) {
                return map_nt_error_from_unix(errno);
        }
@@ -425,7 +424,7 @@ NTSTATUS dptr_create(connection_struct *conn, const char *path, bool old_handle,
        dptr = SMB_MALLOC_P(struct dptr_struct);
        if(!dptr) {
                DEBUG(0,("malloc fail in dptr_create.\n"));
-               CloseDir(dir_hnd);
+               TALLOC_FREE(dir_hnd);
                return NT_STATUS_NO_MEMORY;
        }
 
@@ -455,7 +454,7 @@ NTSTATUS dptr_create(connection_struct *conn, const char *path, bool old_handle,
                        if(dptr->dnum == -1 || dptr->dnum > 254) {
                                DEBUG(0,("dptr_create: returned %d: Error - all old dirptrs in use ?\n", dptr->dnum));
                                SAFE_FREE(dptr);
-                               CloseDir(dir_hnd);
+                               TALLOC_FREE(dir_hnd);
                                return NT_STATUS_TOO_MANY_OPENED_FILES;
                        }
                }
@@ -485,7 +484,7 @@ NTSTATUS dptr_create(connection_struct *conn, const char *path, bool old_handle,
                        if(dptr->dnum == -1 || dptr->dnum < 255) {
                                DEBUG(0,("dptr_create: returned %d: Error - all new dirptrs in use ?\n", dptr->dnum));
                                SAFE_FREE(dptr);
-                               CloseDir(dir_hnd);
+                               TALLOC_FREE(dir_hnd);
                                return NT_STATUS_TOO_MANY_OPENED_FILES;
                        }
                }
@@ -504,7 +503,7 @@ NTSTATUS dptr_create(connection_struct *conn, const char *path, bool old_handle,
        if (!dptr->wcard) {
                bitmap_clear(dptr_bmap, dptr->dnum - 1);
                SAFE_FREE(dptr);
-               CloseDir(dir_hnd);
+               TALLOC_FREE(dir_hnd);
                return NT_STATUS_NO_MEMORY;
        }
        if (lp_posix_pathnames() || (wcard[0] == '.' && wcard[1] == 0)) {
@@ -533,7 +532,8 @@ NTSTATUS dptr_create(connection_struct *conn, const char *path, bool old_handle,
 int dptr_CloseDir(struct dptr_struct *dptr)
 {
        DLIST_REMOVE(dirptrs, dptr);
-       return CloseDir(dptr->dir_hnd);
+       TALLOC_FREE(dptr->dir_hnd);
+       return 0;
 }
 
 void dptr_SeekDir(struct dptr_struct *dptr, long offset)
@@ -646,10 +646,13 @@ const char *dptr_ReadDirName(TALLOC_CTX *ctx,
 
                TALLOC_FREE(pathreal);
 
-               /* In case sensitive mode we don't search - we know if it doesn't exist 
-                  with a stat we will fail. */
+               /* Stat failed. We know this is authoratiative if we are
+                * providing case sensitive semantics or the underlying
+                * filesystem is case sensitive.
+                */
 
-               if (dptr->conn->case_sensitive) {
+               if (dptr->conn->case_sensitive ||
+                   !(dptr->conn->fs_capabilities & FILE_CASE_SENSITIVE_SEARCH)) {
                        /* We need to set the underlying dir_hnd offset to -1 also as
                           this function is usually called with the output from TellDir. */
                        dptr->dir_hnd->offset = *poffset = END_OF_DIRECTORY_OFFSET;
@@ -924,12 +927,7 @@ static bool user_can_read_file(connection_struct *conn, char *name, SMB_STRUCT_S
                return True;
        }
 
-       /* If we can't stat it does not show it */
-       if (!VALID_STAT(*pst) && (SMB_VFS_STAT(conn, name, pst) != 0)) {
-               DEBUG(10,("user_can_read_file: SMB_VFS_STAT failed for file %s with error %s\n",
-                       name, strerror(errno) ));
-               return False;
-       }
+       SMB_ASSERT(VALID_STAT(*pst));
 
        /* Pseudo-open the file (note - no fd's created). */
 
@@ -950,7 +948,7 @@ static bool user_can_read_file(connection_struct *conn, char *name, SMB_STRUCT_S
        }
 
        /* Get NT ACL -allocated in main loop talloc context. No free needed here. */
-       status = SMB_VFS_FGET_NT_ACL(fsp, fsp->fh->fd,
+       status = SMB_VFS_FGET_NT_ACL(fsp,
                        (OWNER_SECURITY_INFORMATION|GROUP_SECURITY_INFORMATION|DACL_SECURITY_INFORMATION), &psd);
        close_file(fsp, NORMAL_CLOSE);
 
@@ -987,10 +985,7 @@ static bool user_can_write_file(connection_struct *conn, char *name, SMB_STRUCT_
                return True;
        }
 
-       /* If we can't stat it does not show it */
-       if (!VALID_STAT(*pst) && (SMB_VFS_STAT(conn, name, pst) != 0)) {
-               return False;
-       }
+       SMB_ASSERT(VALID_STAT(*pst));
 
        /* Pseudo-open the file */
 
@@ -1012,7 +1007,7 @@ static bool user_can_write_file(connection_struct *conn, char *name, SMB_STRUCT_
        }
 
        /* Get NT ACL -allocated in main loop talloc context. No free needed here. */
-       status = SMB_VFS_FGET_NT_ACL(fsp, fsp->fh->fd,
+       status = SMB_VFS_FGET_NT_ACL(fsp,
                        (OWNER_SECURITY_INFORMATION|GROUP_SECURITY_INFORMATION|DACL_SECURITY_INFORMATION), &psd);
        close_file(fsp, NORMAL_CLOSE);
 
@@ -1039,9 +1034,7 @@ static bool file_is_special(connection_struct *conn, char *name, SMB_STRUCT_STAT
        if (conn->admin_user)
                return False;
 
-       /* If we can't stat it does not show it */
-       if (!VALID_STAT(*pst) && (SMB_VFS_STAT(conn, name, pst) != 0))
-               return True;
+       SMB_ASSERT(VALID_STAT(*pst));
 
        if (S_ISREG(pst->st_mode) || S_ISDIR(pst->st_mode) || S_ISLNK(pst->st_mode))
                return False;
@@ -1050,7 +1043,9 @@ static bool file_is_special(connection_struct *conn, char *name, SMB_STRUCT_STAT
 }
 
 /*******************************************************************
- Should the file be seen by the client ?
+ Should the file be seen by the client ? NOTE: A successful return
+ is no guarantee of the file's existence ... you also have to check
+ whether pst is valid.
 ********************************************************************/
 
 bool is_visible_file(connection_struct *conn, const char *dir_path, const char *name, SMB_STRUCT_STAT *pst, bool use_veto)
@@ -1086,6 +1081,15 @@ bool is_visible_file(connection_struct *conn, const char *dir_path, const char *
                        return True;
                }
 
+               /* If the file name does not exist, there's no point checking
+                * the configuration options. We succeed, on the basis that the
+                * checks *might* have passed if the file was present.
+                */
+               if (SMB_VFS_STAT(conn, entry, pst) != 0) {
+                       SAFE_FREE(entry);
+                       return True;
+               }
+
                /* Honour _hide unreadable_ option */
                if (hide_unreadable && !user_can_read_file(conn, entry, pst)) {
                        DEBUG(10,("is_visible_file: file %s is unreadable.\n", entry ));
@@ -1109,82 +1113,53 @@ bool is_visible_file(connection_struct *conn, const char *dir_path, const char *
        return True;
 }
 
+static int smb_Dir_destructor(struct smb_Dir *dirp)
+{
+       if (dirp->dir) {
+               SMB_VFS_CLOSEDIR(dirp->conn,dirp->dir);
+       }
+       dirhandles_open--;
+       return 0;
+}
+
 /*******************************************************************
  Open a directory.
 ********************************************************************/
 
-struct smb_Dir *OpenDir(connection_struct *conn, const char *name, const char *mask, uint32 attr)
+struct smb_Dir *OpenDir(TALLOC_CTX *mem_ctx, connection_struct *conn,
+                       const char *name, const char *mask, uint32 attr)
 {
-       struct smb_Dir *dirp = SMB_MALLOC_P(struct smb_Dir);
+       struct smb_Dir *dirp = TALLOC_ZERO_P(mem_ctx, struct smb_Dir);
 
        if (!dirp) {
                return NULL;
        }
-       ZERO_STRUCTP(dirp);
 
        dirp->conn = conn;
        dirp->name_cache_size = lp_directory_name_cache_size(SNUM(conn));
 
-       dirp->dir_path = SMB_STRDUP(name);
+       dirp->dir_path = talloc_strdup(dirp, name);
        if (!dirp->dir_path) {
                goto fail;
        }
+
+       dirhandles_open++;
+       talloc_set_destructor(dirp, smb_Dir_destructor);
+
        dirp->dir = SMB_VFS_OPENDIR(conn, dirp->dir_path, mask, attr);
        if (!dirp->dir) {
-               DEBUG(5,("OpenDir: Can't open %s. %s\n", dirp->dir_path, strerror(errno) ));
+               DEBUG(5,("OpenDir: Can't open %s. %s\n", dirp->dir_path,
+                        strerror(errno) ));
                goto fail;
        }
 
-       if (dirp->name_cache_size) {
-               dirp->name_cache = SMB_CALLOC_ARRAY(struct name_cache_entry,
-                               dirp->name_cache_size);
-               if (!dirp->name_cache) {
-                       goto fail;
-               }
-       } else {
-               dirp->name_cache = NULL;
-       }
-
-       dirhandles_open++;
        return dirp;
 
   fail:
-
-       if (dirp) {
-               if (dirp->dir) {
-                       SMB_VFS_CLOSEDIR(conn,dirp->dir);
-               }
-               SAFE_FREE(dirp->dir_path);
-               SAFE_FREE(dirp->name_cache);
-               SAFE_FREE(dirp);
-       }
+       TALLOC_FREE(dirp);
        return NULL;
 }
 
-
-/*******************************************************************
- Close a directory.
-********************************************************************/
-
-int CloseDir(struct smb_Dir *dirp)
-{
-       int i, ret = 0;
-
-       if (dirp->dir) {
-               ret = SMB_VFS_CLOSEDIR(dirp->conn,dirp->dir);
-       }
-       SAFE_FREE(dirp->dir_path);
-       if (dirp->name_cache) {
-               for (i = 0; i < dirp->name_cache_size; i++) {
-                       SAFE_FREE(dirp->name_cache[i].name);
-               }
-       }
-       SAFE_FREE(dirp->name_cache);
-       SAFE_FREE(dirp);
-       dirhandles_open--;
-       return ret;
-}
-
 /*******************************************************************
  Read from a directory. Also return current offset.
  Don't check for veto or invisible files.
@@ -1291,15 +1266,24 @@ void DirCacheAdd(struct smb_Dir *dirp, const char *name, long offset)
 {
        struct name_cache_entry *e;
 
-       if (!dirp->name_cache_size || !dirp->name_cache) {
+       if (dirp->name_cache_size == 0) {
                return;
        }
 
+       if (dirp->name_cache == NULL) {
+               dirp->name_cache = TALLOC_ZERO_ARRAY(
+                       dirp, struct name_cache_entry, dirp->name_cache_size);
+
+               if (dirp->name_cache == NULL) {
+                       return;
+               }
+       }
+
        dirp->name_cache_index = (dirp->name_cache_index+1) %
                                        dirp->name_cache_size;
        e = &dirp->name_cache[dirp->name_cache_index];
-       SAFE_FREE(e->name);
-       e->name = SMB_STRDUP(name);
+       TALLOC_FREE(e->name);
+       e->name = talloc_strdup(dirp, name);
        e->offset = offset;
 }
 
@@ -1356,7 +1340,8 @@ NTSTATUS can_delete_directory(struct connection_struct *conn,
        NTSTATUS status = NT_STATUS_OK;
        long dirpos = 0;
        const char *dname;
-       struct smb_Dir *dir_hnd = OpenDir(conn, dirname, NULL, 0);
+       struct smb_Dir *dir_hnd = OpenDir(talloc_tos(), conn, dirname,
+                                         NULL, 0);
 
        if (!dir_hnd) {
                return map_nt_error_from_unix(errno);
@@ -1380,7 +1365,7 @@ NTSTATUS can_delete_directory(struct connection_struct *conn,
                status = NT_STATUS_DIRECTORY_NOT_EMPTY;
                break;
        }
-       CloseDir(dir_hnd);
+       TALLOC_FREE(dir_hnd);
 
        return status;
 }
index 05e9138ea97920bad5e7b51e6debf57fcf4d3e84..620baf199e42cf8634af6a8e4f9b50b9b8f640ef 100644 (file)
@@ -46,7 +46,7 @@ bool dmapi_have_session(void) { return False; }
 #define DMAPI_SESSION_NAME "samba"
 #define DMAPI_TRACE 10
 
-static dm_sessid_t dmapi_session = DM_NO_SESSION;
+static dm_sessid_t samba_dmapi_session = DM_NO_SESSION;
 
 /* Initialise the DMAPI interface. Make sure that we only end up initialising
  * once per process to avoid resource leaks across different DMAPI
@@ -75,7 +75,7 @@ static int init_dmapi_service(void)
 
 bool dmapi_have_session(void)
 {
-       return dmapi_session != DM_NO_SESSION;
+       return samba_dmapi_session != DM_NO_SESSION;
 }
 
 static dm_sessid_t *realloc_session_list(dm_sessid_t * sessions, int count)
@@ -110,7 +110,7 @@ int dmapi_init_session(void)
         */
        SMB_WARN(getuid() == 0, "dmapi_init_session must be called as root");
 
-       dmapi_session = DM_NO_SESSION;
+       samba_dmapi_session = DM_NO_SESSION;
        if (init_dmapi_service() < 0) {
                return -1;
        }
@@ -139,7 +139,7 @@ retry:
                err = dm_query_session(sessions[i], sizeof(buf), buf, &buflen);
                buf[sizeof(buf) - 1] = '\0';
                if (err == 0 && strcmp(DMAPI_SESSION_NAME, buf) == 0) {
-                       dmapi_session = sessions[i];
+                       samba_dmapi_session = sessions[i];
                        DEBUGADD(DMAPI_TRACE,
                                ("attached to existing DMAPI session "
                                 "named '%s'\n", buf));
@@ -150,16 +150,15 @@ retry:
        TALLOC_FREE(sessions);
 
        /* No session already defined. */
-       if (dmapi_session == DM_NO_SESSION) {
-               err = dm_create_session(DM_NO_SESSION,
-                                       CONST_DISCARD(char *,
-                                                     DMAPI_SESSION_NAME),
-                                       &dmapi_session);
+       if (samba_dmapi_session == DM_NO_SESSION) {
+               err = dm_create_session(DM_NO_SESSION, 
+                                       CONST_DISCARD(char *, DMAPI_SESSION_NAME),
+                                       &samba_dmapi_session);
                if (err < 0) {
                        DEBUGADD(DMAPI_TRACE,
                                ("failed to create new DMAPI session: %s\n",
                                strerror(errno)));
-                       dmapi_session = DM_NO_SESSION;
+                       samba_dmapi_session = DM_NO_SESSION;
                        return -1;
                }
 
@@ -185,22 +184,22 @@ static int reattach_dmapi_session(void)
        char    buf[DM_SESSION_INFO_LEN];
        size_t  buflen;
 
-       if (dmapi_session != DM_NO_SESSION ) {
+       if (samba_dmapi_session != DM_NO_SESSION ) {
                become_root();
 
                /* NOTE: On Linux, this call opens /dev/dmapi, costing us a
                 * file descriptor. Ideally, we would close this when we fork.
                 */
                if (init_dmapi_service() < 0) {
-                       dmapi_session = DM_NO_SESSION;
+                       samba_dmapi_session = DM_NO_SESSION;
                        unbecome_root();
                        return -1;
                }
 
-               if (dm_query_session(dmapi_session, sizeof(buf),
+               if (dm_query_session(samba_dmapi_session, sizeof(buf),
                            buf, &buflen) < 0) {
                        /* Session is stale. Disable DMAPI. */
-                       dmapi_session = DM_NO_SESSION;
+                       samba_dmapi_session = DM_NO_SESSION;
                        unbecome_root();
                        return -1;
                }
@@ -214,33 +213,42 @@ static int reattach_dmapi_session(void)
        return 0;
 }
 
-uint32 dmapi_file_flags(const char * const path)
+/* If a DMAPI session has been initialised, then we need to make sure
+ * we are attached to it and have the correct privileges. This is
+ * necessary to be able to do DMAPI operations across a fork(2). If
+ * it fails, there is no likelihood of that failure being transient.
+ *
+ * Note that this use of the static attached flag relies on the fact
+ * that dmapi_file_flags() is never called prior to forking the
+ * per-client server process.
+ */
+const void * dmapi_get_current_session(void) 
 {
        static int attached = 0;
+       if (dmapi_have_session() && !attached) {
+               attached++;
+               if (reattach_dmapi_session() < 0) {
+                       return DM_NO_SESSION;
+               }
+       }
+       return &samba_dmapi_session;
+}
 
+uint32 dmapi_file_flags(const char * const path)
+{
+       dm_sessid_t dmapi_session;
        int             err;
        dm_eventset_t   events = {0};
        uint            nevents;
 
-       void    *dm_handle;
-       size_t  dm_handle_len;
+       void    *dm_handle = NULL;
+       size_t  dm_handle_len = 0;
 
        uint32  flags = 0;
 
-       /* If a DMAPI session has been initialised, then we need to make sure
-        * we are attached to it and have the correct privileges. This is
-        * necessary to be able to do DMAPI operations across a fork(2). If
-        * it fails, there is no liklihood of that failure being transient.
-        *
-        * Note that this use of the static attached flag relies on the fact
-        * that dmapi_file_flags() is never called prior to forking the
-        * per-client server process.
-        */
-       if (dmapi_have_session() && !attached) {
-               attached++;
-               if (reattach_dmapi_session() < 0) {
-                       return 0;
-               }
+       dmapi_session = *(dm_sessid_t*) dmapi_get_current_session();
+       if (dmapi_session == DM_NO_SESSION) {
+               return 0;
        }
 
        /* AIX has DMAPI but no POSIX capablities support. In this case,
@@ -313,4 +321,5 @@ done:
        return flags;
 }
 
+
 #endif /* USE_DMAPI */
index 44bd39f64e9353c7b3335a9fefd79b7572fb264d..2319097ca564bd6371b4541c050b871c0070c7ec 100644 (file)
@@ -41,7 +41,6 @@ struct dns_reg_state {
 
 void dns_register_close(struct dns_reg_state **dns_state_ptr)
 {
-       int mdnsd_conn_fd;
        struct dns_reg_state *dns_state = *dns_state_ptr;
 
        if (dns_state == NULL) {
@@ -74,7 +73,7 @@ static void dns_register_smbd_retry(struct event_context *ctx,
        /* Clear previous registration state to force new
         * registration attempt. Clears event handler.
         */
-       dns_register_close(dns_state);
+       dns_register_close(&dns_state);
 }
 
 static void schedule_dns_register_smbd_retry(struct dns_reg_state *dns_state,
index 8e3c9b4c91b20aed18ab375c643bf40471e23b37..eb18f65fca9dc4541925294778c758d9e361ad24 100644 (file)
@@ -30,23 +30,6 @@ static int set_sparse_flag(const SMB_STRUCT_STAT * const sbuf)
        return 0;
 }
 
-/****************************************************************************
- Work out whether this file is offline
-****************************************************************************/
-
-static uint32 set_offline_flag(connection_struct *conn, const char *const path)
-{
-       if (ISDOT(path) || ISDOTDOT(path)) {
-               return 0;
-       }
-
-       if (!lp_dmapi_support(SNUM(conn)) || !dmapi_have_session()) {
-               return 0;
-       }
-
-       return dmapi_file_flags(path);
-}
-
 /****************************************************************************
  Change a dos mode to a unix mode.
     Base permission for files:
@@ -366,6 +349,7 @@ uint32 dos_mode_msdfs(connection_struct *conn, const char *path,SMB_STRUCT_STAT
 uint32 dos_mode(connection_struct *conn, const char *path,SMB_STRUCT_STAT *sbuf)
 {
        uint32 result = 0;
+       bool offline;
 
        DEBUG(8,("dos_mode: %s\n", path));
 
@@ -395,8 +379,10 @@ uint32 dos_mode(connection_struct *conn, const char *path,SMB_STRUCT_STAT *sbuf)
                result |= dos_mode_from_sbuf(conn, path, sbuf);
        }
 
-       if (S_ISREG(sbuf->st_mode)) {
-               result |= set_offline_flag(conn, path);
+       
+       offline = SMB_VFS_IS_OFFLINE(conn, path, sbuf);
+       if (S_ISREG(sbuf->st_mode) && offline) {
+               result |= FILE_ATTRIBUTE_OFFLINE;
        }
 
        /* Optimization : Only call is_hidden_path if it's not already
@@ -432,18 +418,25 @@ int file_set_dosmode(connection_struct *conn, const char *fname,
        int mask=0;
        mode_t tmp;
        mode_t unixmode;
-       int ret = -1;
+       int ret = -1, lret = -1;
 
        /* We only allow READONLY|HIDDEN|SYSTEM|DIRECTORY|ARCHIVE here. */
        dosmode &= SAMBA_ATTRIBUTES_MASK;
 
        DEBUG(10,("file_set_dosmode: setting dos mode 0x%x on file %s\n", dosmode, fname));
-       if (!st || (st && !VALID_STAT(*st))) {
+
+       if (st == NULL) {
+               SET_STAT_INVALID(st1);
                st = &st1;
+       }
+
+       if (!VALID_STAT(*st)) {
                if (SMB_VFS_STAT(conn,fname,st))
                        return(-1);
        }
 
+       unixmode = st->st_mode;
+
        get_acl_group_bits(conn, fname, &st->st_mode);
 
        if (S_ISDIR(st->st_mode))
@@ -451,8 +444,10 @@ int file_set_dosmode(connection_struct *conn, const char *fname,
        else
                dosmode &= ~aDIR;
 
-       if (dos_mode(conn,fname,st) == dosmode)
+       if (dos_mode(conn,fname,st) == dosmode) {
+               st->st_mode = unixmode;
                return(0);
+       }
 
        /* Store the DOS attributes in an EA by preference. */
        if (set_ea_dos_attribute(conn, fname, st, dosmode)) {
@@ -460,6 +455,7 @@ int file_set_dosmode(connection_struct *conn, const char *fname,
                        notify_fname(conn, NOTIFY_ACTION_MODIFIED,
                                FILE_NOTIFY_CHANGE_ATTRIBUTES, fname);
                }
+               st->st_mode = unixmode;
                return 0;
        }
 
@@ -495,11 +491,23 @@ int file_set_dosmode(connection_struct *conn, const char *fname,
                unixmode |= (st->st_mode & (S_IWUSR|S_IWGRP|S_IWOTH));
        }
 
-       if ((ret = SMB_VFS_CHMOD(conn,fname,unixmode)) == 0) {
-               if (!newfile) {
+       if (dosmode & FILE_ATTRIBUTE_OFFLINE) {
+               lret = SMB_VFS_SET_OFFLINE(conn, fname);
+               if (lret == -1) {
+                       DEBUG(0, ("set_dos_mode: client has asked to set "
+                                 "FILE_ATTRIBUTE_OFFLINE to %s/%s but there was "
+                                 "an error while setting it or it is not supported.\n", 
+                                 parent_dir, fname));
+               }
+       }
+
+       ret = SMB_VFS_CHMOD(conn, fname, unixmode);
+       if (ret == 0) {
+               if(!newfile || (lret != -1)) {
                        notify_fname(conn, NOTIFY_ACTION_MODIFIED,
-                               FILE_NOTIFY_CHANGE_ATTRIBUTES, fname);
+                                    FILE_NOTIFY_CHANGE_ATTRIBUTES, fname);
                }
+               st->st_mode = unixmode;
                return 0;
        }
 
@@ -527,13 +535,16 @@ int file_set_dosmode(connection_struct *conn, const char *fname,
                if (!NT_STATUS_IS_OK(open_file_fchmod(conn,fname,st,&fsp)))
                        return -1;
                become_root();
-               ret = SMB_VFS_FCHMOD(fsp, fsp->fh->fd, unixmode);
+               ret = SMB_VFS_FCHMOD(fsp, unixmode);
                unbecome_root();
                close_file_fchmod(fsp);
                if (!newfile) {
                        notify_fname(conn, NOTIFY_ACTION_MODIFIED,
                                FILE_NOTIFY_CHANGE_ATTRIBUTES, fname);
                }
+               if (ret == 0) {
+                       st->st_mode = unixmode;
+               }
        }
 
        return( ret );
index 12eff42023a5facd65683c66f8a486349847b121..de2de088ec222f30d0c7328bf628217173b49a77 100644 (file)
@@ -24,34 +24,6 @@ extern struct unix_error_map unix_dos_nt_errmap[];
 
 extern uint32 global_client_caps;
 
-/****************************************************************************
- Create an error packet from errno.
-****************************************************************************/
-
-int unix_error_packet(char *outbuf,int def_class,uint32 def_code, NTSTATUS def_status, int line, const char *file)
-{
-       int eclass=def_class;
-       int ecode=def_code;
-       NTSTATUS ntstatus = def_status;
-       int i=0;
-
-       if (errno != 0) {
-               DEBUG(3,("unix_error_packet: error string = %s\n",strerror(errno)));
-  
-               while (unix_dos_nt_errmap[i].dos_class != 0) {
-                       if (unix_dos_nt_errmap[i].unix_error == errno) {
-                               eclass = unix_dos_nt_errmap[i].dos_class;
-                               ecode = unix_dos_nt_errmap[i].dos_code;
-                               ntstatus = unix_dos_nt_errmap[i].nt_error;
-                               break;
-                       }
-                       i++;
-               }
-       }
-
-       return error_packet(outbuf,eclass,ecode,ntstatus,line,file);
-}
-
 bool use_nt_status(void)
 {
        return lp_nt_status_support() && (global_client_caps & CAP_STATUS32);
@@ -111,7 +83,7 @@ void error_packet_set(char *outbuf, uint8 eclass, uint32 ecode, NTSTATUS ntstatu
 
 int error_packet(char *outbuf, uint8 eclass, uint32 ecode, NTSTATUS ntstatus, int line, const char *file)
 {
-       int outsize = set_message(outbuf,0,0,True);
+       int outsize = srv_set_message(outbuf,0,0,True);
        error_packet_set(outbuf, eclass, ecode, ntstatus, line, file);
        return outsize;
 }
@@ -150,8 +122,24 @@ void reply_both_error(struct smb_request *req, uint8 eclass, uint32 ecode,
                         line, file);
 }
 
+void reply_openerror(struct smb_request *req, NTSTATUS status)
+{
+       if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_COLLISION)) {
+               /*
+                * We hit an existing file, and if we're returning DOS
+                * error codes OBJECT_NAME_COLLISION would map to
+                * ERRDOS/183, we need to return ERRDOS/80, see bug
+                * 4852.
+                */
+               reply_botherror(req, NT_STATUS_OBJECT_NAME_COLLISION,
+                       ERRDOS, ERRfilexists);
+       } else {
+               reply_nterror(req, status);
+       }
+}
+
 void reply_unix_error(struct smb_request *req, uint8 defclass, uint32 defcode,
-                     NTSTATUS defstatus, int line, const char *file)
+                       NTSTATUS defstatus, int line, const char *file)
 {
        int eclass=defclass;
        int ecode=defcode;
@@ -163,7 +151,7 @@ void reply_unix_error(struct smb_request *req, uint8 defclass, uint32 defcode,
 
        if (errno != 0) {
                DEBUG(3,("unix_error_packet: error string = %s\n",
-                        strerror(errno)));
+                       strerror(errno)));
 
                while (unix_dos_nt_errmap[i].dos_class != 0) {
                        if (unix_dos_nt_errmap[i].unix_error == errno) {
@@ -177,22 +165,5 @@ void reply_unix_error(struct smb_request *req, uint8 defclass, uint32 defcode,
        }
 
        error_packet_set((char *)req->outbuf, eclass, ecode, ntstatus,
-                        line, file);
+               line, file);
 }
-
-void reply_openerror(struct smb_request *req, NTSTATUS status)
-{
-       if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_COLLISION)) {
-               /*
-                * We hit an existing file, and if we're returning DOS
-                * error codes OBJECT_NAME_COLLISION would map to
-                * ERRDOS/183, we need to return ERRDOS/80, see bug
-                * 4852.
-                */
-               reply_botherror(req, NT_STATUS_OBJECT_NAME_COLLISION,
-                       ERRDOS, ERRfilexists);
-       } else {
-               reply_nterror(req, status);
-       }
-}
-
index a58bcdd8915c361210e1d2f595090998b304a5ac..964d1af2588d2a7e0c9883f80cd21afe51558801 100644 (file)
@@ -25,67 +25,6 @@ extern struct current_user current_user;
 #undef  DBGC_CLASS
 #define DBGC_CLASS DBGC_ACLS
 
-/****************************************************************************
- Helper function that gets a security descriptor by connection and
- file name.
- NOTE: This is transitional, in the sense that SMB_VFS_GET_NT_ACL really
- should *not* get a files_struct pointer but a connection_struct ptr
- (automatic by the vfs handle) and the file name and _use_ that!
-****************************************************************************/
-static NTSTATUS conn_get_nt_acl(TALLOC_CTX *mem_ctx,
-                               struct connection_struct *conn,
-                               const char *fname,
-                               SMB_STRUCT_STAT *psbuf,
-                               struct security_descriptor **psd)
-{
-       NTSTATUS status;
-       struct files_struct *fsp = NULL;
-       struct security_descriptor *secdesc = NULL;
-
-       if (!VALID_STAT(*psbuf)) {
-               if (SMB_VFS_STAT(conn, fname, psbuf) != 0) {
-                       return map_nt_error_from_unix(errno);
-               }
-       }
-
-       /* fake a files_struct ptr: */
-
-       if (S_ISDIR(psbuf->st_mode)) {
-               status = open_directory(conn, NULL, fname, psbuf,
-                                       READ_CONTROL_ACCESS,
-                                       FILE_SHARE_READ|FILE_SHARE_WRITE,
-                                       FILE_OPEN,
-                                       0,
-                                       FILE_ATTRIBUTE_DIRECTORY,
-                                       NULL, &fsp);
-       }
-       else {
-               status = open_file_stat(conn, NULL, fname, psbuf, &fsp);
-       }
-
-       if (!NT_STATUS_IS_OK(status)) {
-               DEBUG(3, ("Unable to open file %s: %s\n", fname,
-                         nt_errstr(status)));
-               return status;
-       }
-
-       status = SMB_VFS_GET_NT_ACL(fsp, fname,
-                                   (OWNER_SECURITY_INFORMATION |
-                                    GROUP_SECURITY_INFORMATION |
-                                    DACL_SECURITY_INFORMATION),
-                                   &secdesc);
-       if (!NT_STATUS_IS_OK(status)) {
-               DEBUG(5, ("Unable to get NT ACL for file %s\n", fname));
-               goto done;
-       }
-
-       *psd = talloc_move(mem_ctx, &secdesc);
-
-done:
-       close_file(fsp, NORMAL_CLOSE);
-       return status;
-}
-
 static bool can_access_file_acl(struct connection_struct *conn,
                                const char * fname, SMB_STRUCT_STAT *psbuf,
                                uint32_t access_mask)
@@ -95,7 +34,11 @@ static bool can_access_file_acl(struct connection_struct *conn,
        uint32_t access_granted;
        struct security_descriptor *secdesc = NULL;
 
-       status = conn_get_nt_acl(talloc_tos(), conn, fname, psbuf, &secdesc);
+       status = SMB_VFS_GET_NT_ACL(conn, fname,
+                                   (OWNER_SECURITY_INFORMATION |
+                                    GROUP_SECURITY_INFORMATION |
+                                    DACL_SECURITY_INFORMATION),
+                                   &secdesc);
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(5, ("Could not get acl: %s\n", nt_errstr(status)));
                return false;
index 8037510d8058b8240e5ac497b3beba6cbed83b51..8cea4989f5b4dd16f5d3ad26208e951094a1e908 100644 (file)
@@ -77,7 +77,7 @@ ssize_t read_file(files_struct *fsp,char *data,SMB_OFF_T pos,size_t n)
 #ifdef DMF_FIX
                int numretries = 3;
 tryagain:
-               readret = SMB_VFS_PREAD(fsp,fsp->fh->fd,data,n,pos);
+               readret = SMB_VFS_PREAD(fsp,data,n,pos);
 
                if (readret == -1) {
                        if ((errno == EAGAIN) && numretries) {
@@ -89,7 +89,7 @@ tryagain:
                        return -1;
                }
 #else /* NO DMF fix. */
-               readret = SMB_VFS_PREAD(fsp,fsp->fh->fd,data,n,pos);
+               readret = SMB_VFS_PREAD(fsp,data,n,pos);
 
                if (readret == -1) {
                        return -1;
@@ -184,7 +184,7 @@ static int wcp_file_size_change(files_struct *fsp)
        write_cache *wcp = fsp->wcp;
 
        wcp->file_size = wcp->offset + wcp->data_size;
-       ret = SMB_VFS_FTRUNCATE(fsp, fsp->fh->fd, wcp->file_size);
+       ret = SMB_VFS_FTRUNCATE(fsp, wcp->file_size);
        if (ret == -1) {
                DEBUG(0,("wcp_file_size_change (%s): ftruncate of size %.0f error %s\n",
                        fsp->fsp_name, (double)wcp->file_size, strerror(errno) ));
@@ -229,7 +229,7 @@ ssize_t write_file(struct smb_request *req,
                SMB_STRUCT_STAT st;
                fsp->modified = True;
 
-               if (SMB_VFS_FSTAT(fsp,fsp->fh->fd,&st) == 0) {
+               if (SMB_VFS_FSTAT(fsp, &st) == 0) {
                        int dosmode = dos_mode(fsp->conn,fsp->fsp_name,&st);
                        if ((lp_store_dos_attributes(SNUM(fsp->conn)) ||
                                        MAP_ARCHIVE(fsp->conn)) &&
@@ -879,7 +879,7 @@ NTSTATUS sync_file(connection_struct *conn, files_struct *fsp, bool write_throug
                if (ret == -1) {
                        return map_nt_error_from_unix(errno);
                }
-               ret = SMB_VFS_FSYNC(fsp,fsp->fh->fd);
+               ret = SMB_VFS_FSYNC(fsp);
                if (ret == -1) {
                        return map_nt_error_from_unix(errno);
                }
@@ -896,6 +896,6 @@ int fsp_stat(files_struct *fsp, SMB_STRUCT_STAT *pst)
        if (fsp->fh->fd == -1) {
                return SMB_VFS_STAT(fsp->conn, fsp->fsp_name, pst);
        } else {
-               return SMB_VFS_FSTAT(fsp,fsp->fh->fd, pst);
+               return SMB_VFS_FSTAT(fsp, pst);
        }
 }
index dc733d456863811bed35fd432c94a2dc8dece04a..10e958304905c05ca8714d81c508c338fb224871 100644 (file)
 
 static bool scan_directory(connection_struct *conn, const char *path,
                           char *name, char **found_name);
+static NTSTATUS build_stream_path(TALLOC_CTX *mem_ctx,
+                                 connection_struct *conn,
+                                 const char *orig_path,
+                                 const char *basepath,
+                                 const char *streamname,
+                                 SMB_STRUCT_STAT *pst,
+                                 char **path);
 
 /****************************************************************************
  Mangle the 2nd name and check if it is then equal to the first name.
@@ -119,6 +126,7 @@ NTSTATUS unix_convert(TALLOC_CTX *ctx,
        char *start, *end;
        char *dirpath = NULL;
        char *name = NULL;
+       char *stream = NULL;
        bool component_was_mangled = False;
        bool name_has_wildcard = False;
        NTSTATUS result;
@@ -206,6 +214,20 @@ NTSTATUS unix_convert(TALLOC_CTX *ctx,
                return NT_STATUS_NO_MEMORY;
        }
 
+       if (!lp_posix_pathnames()) {
+               stream = strchr_m(name, ':');
+
+               if (stream != NULL) {
+                       char *tmp = talloc_strdup(ctx, stream);
+                       if (tmp == NULL) {
+                               TALLOC_FREE(name);
+                               return NT_STATUS_NO_MEMORY;
+                       }
+                       *stream = '\0';
+                       stream = tmp;
+               }
+       }
+
        /*
         * Large directory fix normalization. If we're case sensitive, and
         * the case preserving parameters are set to "no", normalize the case of
@@ -222,8 +244,14 @@ NTSTATUS unix_convert(TALLOC_CTX *ctx,
 
        start = name;
 
-       if(!conn->case_sensitive
-          && stat_cache_lookup(conn, &name, &dirpath, &start, &st)) {
+       /* If we're providing case insentive semantics or
+        * the underlying filesystem is case insensitive,
+        * then a case-normalized hit in the stat-cache is
+        * authoratitive. JRA.
+        */
+
+       if((!conn->case_sensitive || !(conn->fs_capabilities & FILE_CASE_SENSITIVE_SEARCH)) &&
+                       stat_cache_lookup(conn, &name, &dirpath, &start, &st)) {
                *pst = st;
                goto done;
        }
@@ -269,10 +297,11 @@ NTSTATUS unix_convert(TALLOC_CTX *ctx,
 
        /*
         * A special case - if we don't have any mangling chars and are case
-        * sensitive then searching won't help.
+        * sensitive or the underlying filesystem is case insentive then searching
+        * won't help.
         */
 
-       if (conn->case_sensitive &&
+       if ((conn->case_sensitive || !(conn->fs_capabilities & FILE_CASE_SENSITIVE_SEARCH)) &&
                        !mangle_is_mangled(name, conn->params)) {
                goto done;
        }
@@ -646,6 +675,20 @@ NTSTATUS unix_convert(TALLOC_CTX *ctx,
        DEBUG(5,("conversion finished %s -> %s\n",orig_path, name));
 
  done:
+       if (stream != NULL) {
+               char *tmp = NULL;
+
+               result = build_stream_path(ctx, conn, orig_path, name, stream,
+                                          pst, &tmp);
+               if (!NT_STATUS_IS_OK(result)) {
+                       goto fail;
+               }
+
+               DEBUG(10, ("build_stream_path returned %s\n", tmp));
+
+               TALLOC_FREE(name);
+               name = tmp;
+       }
        *pp_conv_path = name;
        TALLOC_FREE(dirpath);
        return NT_STATUS_OK;
@@ -735,6 +778,15 @@ static bool scan_directory(connection_struct *conn, const char *path,
                path = ".";
        }
 
+       /* If we have a case-sensitive filesystem, it doesn't do us any
+        * good to search for a name. If a case variation of the name was
+        * there, then the original stat(2) would have found it.
+        */
+       if (!mangled && !(conn->fs_capabilities & FILE_CASE_SENSITIVE_SEARCH)) {
+               errno = ENOENT;
+               return False;
+       }
+
        /*
         * The incoming name can be mangled, and if we de-mangle it
         * here it will not compare correctly against the filename (name2)
@@ -762,7 +814,7 @@ static bool scan_directory(connection_struct *conn, const char *path,
        }
 
        /* open the directory */
-       if (!(cur_dir = OpenDir(conn, path, NULL, 0))) {
+       if (!(cur_dir = OpenDir(talloc_tos(), conn, path, NULL, 0))) {
                DEBUG(3,("scan dir didn't open dir [%s]\n",path));
                TALLOC_FREE(unmangled_name);
                return(False);
@@ -793,7 +845,7 @@ static bool scan_directory(connection_struct *conn, const char *path,
                        /* we've found the file, change it's name and return */
                        *found_name = talloc_strdup(ctx,dname);
                        TALLOC_FREE(unmangled_name);
-                       CloseDir(cur_dir);
+                       TALLOC_FREE(cur_dir);
                        if (!*found_name) {
                                errno = ENOMEM;
                                return False;
@@ -803,7 +855,94 @@ static bool scan_directory(connection_struct *conn, const char *path,
        }
 
        TALLOC_FREE(unmangled_name);
-       CloseDir(cur_dir);
+       TALLOC_FREE(cur_dir);
        errno = ENOENT;
        return False;
 }
+
+static NTSTATUS build_stream_path(TALLOC_CTX *mem_ctx,
+                                 connection_struct *conn,
+                                 const char *orig_path,
+                                 const char *basepath,
+                                 const char *streamname,
+                                 SMB_STRUCT_STAT *pst,
+                                 char **path)
+{
+       SMB_STRUCT_STAT st;
+       char *result = NULL;
+       NTSTATUS status;
+       unsigned int i, num_streams;
+       struct stream_struct *streams = NULL;
+
+       result = talloc_asprintf(mem_ctx, "%s%s", basepath, streamname);
+       if (result == NULL) {
+               return NT_STATUS_NO_MEMORY;
+       }
+
+       if (SMB_VFS_STAT(conn, result, &st) == 0) {
+               *pst = st;
+               *path = result;
+               return NT_STATUS_OK;
+       }
+
+       if (errno != ENOENT) {
+               status = map_nt_error_from_unix(errno);
+               DEBUG(10, ("vfs_stat failed: %s\n", nt_errstr(status)));
+               goto fail;
+       }
+
+       status = SMB_VFS_STREAMINFO(conn, NULL, basepath, mem_ctx,
+                                   &num_streams, &streams);
+
+       if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_NOT_FOUND)) {
+               SET_STAT_INVALID(*pst);
+               *path = result;
+               return NT_STATUS_OK;
+       }
+
+       if (!NT_STATUS_IS_OK(status)) {
+               DEBUG(10, ("vfs_streaminfo failed: %s\n", nt_errstr(status)));
+               goto fail;
+       }
+
+       for (i=0; i<num_streams; i++) {
+               DEBUG(10, ("comparing [%s] and [%s]: ",
+                          streamname, streams[i].name));
+               if (fname_equal(streamname, streams[i].name,
+                               conn->case_sensitive)) {
+                       DEBUGADD(10, ("equal\n"));
+                       break;
+               }
+               DEBUGADD(10, ("not equal\n"));
+       }
+
+       if (i == num_streams) {
+               SET_STAT_INVALID(*pst);
+               *path = result;
+               TALLOC_FREE(streams);
+               return NT_STATUS_OK;
+       }
+
+       TALLOC_FREE(result);
+
+       result = talloc_asprintf(mem_ctx, "%s%s", basepath, streams[i].name);
+       if (result == NULL) {
+               status = NT_STATUS_NO_MEMORY;
+               goto fail;
+       }
+
+       SET_STAT_INVALID(*pst);
+
+       if (SMB_VFS_STAT(conn, result, pst) == 0) {
+               stat_cache_add(orig_path, result, conn->case_sensitive);
+       }
+
+       *path = result;
+       TALLOC_FREE(streams);
+       return NT_STATUS_OK;
+
+ fail:
+       TALLOC_FREE(result);
+       TALLOC_FREE(streams);
+       return status;
+}
index 179963dae9b5250995608386b2dc5b17cb98362f..95f01b88ce185945d31a753125192fea609d2c31 100644 (file)
@@ -460,6 +460,11 @@ void file_free(files_struct *fsp)
                ZERO_STRUCT(fsp_fi_cache);
        }
 
+       /* Drop all remaining extensions. */
+       while (fsp->vfs_extension) {
+               vfs_remove_fsp_extension(fsp->vfs_extension->owner, fsp);
+       }
+
        SAFE_FREE(fsp);
 }
 
index f28016ccb3f3a34ace57bd0f47db1a0d374f4860..68a13d692f6189fb9b7a6b270767109175cdc574 100644 (file)
@@ -30,7 +30,7 @@ extern int max_send;
 
 #define NERR_notsupported 50
 
-static void api_no_reply(struct smb_request *req);
+static void api_no_reply(connection_struct *conn, struct smb_request *req);
 
 /*******************************************************************
  copies parameters and data, as needed, into the smb buffer
@@ -81,7 +81,8 @@ static void copy_trans_params_and_data(char *outbuf, int align,
  Send a trans reply.
  ****************************************************************************/
 
-void send_trans_reply(struct smb_request *req,
+void send_trans_reply(connection_struct *conn,
+                       struct smb_request *req,
                      char *rparam, int rparam_len,
                      char *rdata, int rdata_len,
                      bool buffer_too_large)
@@ -129,8 +130,10 @@ void send_trans_reply(struct smb_request *req,
        }
 
        show_msg((char *)req->outbuf);
-       if (!send_smb(smbd_server_fd(),(char *)req->outbuf))
-               exit_server_cleanly("send_trans_reply: send_smb failed.");
+       if (!srv_send_smb(smbd_server_fd(),
+                       (char *)req->outbuf,
+                       IS_CONN_ENCRYPTED(conn)))
+               exit_server_cleanly("send_trans_reply: srv_send_smb failed.");
 
        TALLOC_FREE(req->outbuf);
 
@@ -175,8 +178,10 @@ void send_trans_reply(struct smb_request *req,
                }
 
                show_msg((char *)req->outbuf);
-               if (!send_smb(smbd_server_fd(), (char *)req->outbuf))
-                       exit_server_cleanly("send_trans_reply: send_smb failed.");
+               if (!srv_send_smb(smbd_server_fd(),
+                               (char *)req->outbuf,
+                               IS_CONN_ENCRYPTED(conn)))
+                       exit_server_cleanly("send_trans_reply: srv_send_smb failed.");
 
                tot_data_sent  += this_ldata;
                tot_param_sent += this_lparam;
@@ -188,7 +193,7 @@ void send_trans_reply(struct smb_request *req,
  Start the first part of an RPC reply which began with an SMBtrans request.
 ****************************************************************************/
 
-static void api_rpc_trans_reply(struct smb_request *req, smb_np_struct *p)
+static void api_rpc_trans_reply(connection_struct *conn, struct smb_request *req, smb_np_struct *p)
 {
        bool is_data_outstanding;
        char *rdata = (char *)SMB_MALLOC(p->max_trans_reply);
@@ -203,11 +208,11 @@ static void api_rpc_trans_reply(struct smb_request *req, smb_np_struct *p)
        if((data_len = read_from_pipe( p, rdata, p->max_trans_reply,
                                        &is_data_outstanding)) < 0) {
                SAFE_FREE(rdata);
-               api_no_reply(req);
+               api_no_reply(conn,req);
                return;
        }
 
-       send_trans_reply(req, NULL, 0, rdata, data_len, is_data_outstanding);
+       send_trans_reply(conn, req, NULL, 0, rdata, data_len, is_data_outstanding);
        SAFE_FREE(rdata);
        return;
 }
@@ -216,7 +221,7 @@ static void api_rpc_trans_reply(struct smb_request *req, smb_np_struct *p)
  WaitNamedPipeHandleState 
 ****************************************************************************/
 
-static void api_WNPHS(struct smb_request *req, smb_np_struct *p,
+static void api_WNPHS(connection_struct *conn, struct smb_request *req, smb_np_struct *p,
                      char *param, int param_len)
 {
        uint16 priority;
@@ -231,10 +236,10 @@ static void api_WNPHS(struct smb_request *req, smb_np_struct *p,
 
        if (wait_rpc_pipe_hnd_state(p, priority)) {
                /* now send the reply */
-               send_trans_reply(req, NULL, 0, NULL, 0, False);
+               send_trans_reply(conn, req, NULL, 0, NULL, 0, False);
                return;
        }
-       api_no_reply(req);
+       api_no_reply(conn,req);
 }
 
 
@@ -242,7 +247,7 @@ static void api_WNPHS(struct smb_request *req, smb_np_struct *p,
  SetNamedPipeHandleState 
 ****************************************************************************/
 
-static void api_SNPHS(struct smb_request *req, smb_np_struct *p,
+static void api_SNPHS(connection_struct *conn, struct smb_request *req, smb_np_struct *p,
                      char *param, int param_len)
 {
        uint16 id;
@@ -257,10 +262,10 @@ static void api_SNPHS(struct smb_request *req, smb_np_struct *p,
 
        if (set_rpc_pipe_hnd_state(p, id)) {
                /* now send the reply */
-               send_trans_reply(req, NULL, 0, NULL, 0, False);
+               send_trans_reply(conn, req, NULL, 0, NULL, 0, False);
                return;
        }
-       api_no_reply(req);
+       api_no_reply(conn,req);
 }
 
 
@@ -268,7 +273,7 @@ static void api_SNPHS(struct smb_request *req, smb_np_struct *p,
  When no reply is generated, indicate unsupported.
  ****************************************************************************/
 
-static void api_no_reply(struct smb_request *req)
+static void api_no_reply(connection_struct *conn, struct smb_request *req)
 {
        char rparam[4];
 
@@ -279,7 +284,7 @@ static void api_no_reply(struct smb_request *req)
        DEBUG(3,("Unsupported API fd command\n"));
 
        /* now send the reply */
-       send_trans_reply(req, rparam, 4, NULL, 0, False);
+       send_trans_reply(conn, req, rparam, 4, NULL, 0, False);
 
        return;
 }
@@ -321,7 +326,7 @@ static void api_fd_reply(connection_struct *conn, uint16 vuid,
                        /* Win9x does this call with a unicode pipe name, not a pnum. */
                        /* Just return success for now... */
                        DEBUG(3,("Got TRANSACT_WAITNAMEDPIPEHANDLESTATE on text pipe name\n"));
-                       send_trans_reply(req, NULL, 0, NULL, 0, False);
+                       send_trans_reply(conn, req, NULL, 0, NULL, 0, False);
                        return;
                }
 
@@ -349,18 +354,18 @@ static void api_fd_reply(connection_struct *conn, uint16 vuid,
                /* dce/rpc command */
                reply = write_to_pipe(p, data, tdscnt);
                if (!reply) {
-                       api_no_reply(req);
+                       api_no_reply(conn, req);
                        return;
                }
-               api_rpc_trans_reply(req, p);
+               api_rpc_trans_reply(conn, req, p);
                break;
        case TRANSACT_WAITNAMEDPIPEHANDLESTATE:
                /* Wait Named Pipe Handle state */
-               api_WNPHS(req, p, params, tpscnt);
+               api_WNPHS(conn, req, p, params, tpscnt);
                break;
        case TRANSACT_SETNAMEDPIPEHANDLESTATE:
                /* Set Named Pipe Handle state */
-               api_SNPHS(req, p, params, tpscnt);
+               api_SNPHS(conn, req, p, params, tpscnt);
                break;
        default:
                reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
@@ -472,8 +477,10 @@ static void handle_trans(connection_struct *conn, struct smb_request *req,
                   state->max_data_return,
                   state->max_param_return);
 
-       if (state->close_on_completion)
+       if (state->close_on_completion) {
                close_cnum(conn,state->vuid);
+               req->conn = NULL;
+       }
 
        return;
 }
@@ -482,8 +489,9 @@ static void handle_trans(connection_struct *conn, struct smb_request *req,
  Reply to a SMBtrans.
  ****************************************************************************/
 
-void reply_trans(connection_struct *conn, struct smb_request *req)
+void reply_trans(struct smb_request *req)
 {
+       connection_struct *conn = req->conn;
        unsigned int dsoff;
        unsigned int dscnt;
        unsigned int psoff;
@@ -662,8 +670,9 @@ void reply_trans(connection_struct *conn, struct smb_request *req)
  Reply to a secondary SMBtrans.
  ****************************************************************************/
 
-void reply_transs(connection_struct *conn, struct smb_request *req)
+void reply_transs(struct smb_request *req)
 {
+       connection_struct *conn = req->conn;
        unsigned int pcnt,poff,dcnt,doff,pdisp,ddisp;
        struct trans_state *state;
        int size;
index 3ab216c062acda94dd08dffc00bf8c88e5dc223b..5a6df1f13911dd98e8210b800061cd1e5ce8aa36 100644 (file)
@@ -4605,7 +4605,7 @@ void api_reply(connection_struct *conn, uint16 vuid,
 
        /* If api_Unsupported returns false we can't return anything. */
        if (reply) {
-               send_trans_reply(req, rparam, rparam_len,
+               send_trans_reply(conn, req, rparam, rparam_len,
                                 rdata, rdata_len, False);
        }
 
index c369f6eda49beb42461aa43ecb0c8b2025c3da56..1dc9c67dcc1a8202deca792caabb0b850c103840 100644 (file)
@@ -57,8 +57,7 @@ static char magic_char = '~';
 static const char basechars[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_-!@#$%";
 #define MANGLE_BASE       (sizeof(basechars)/sizeof(char)-1)
 
-static unsigned char chartest[256]  = { 0 };
-static bool          ct_initialized = False;
+static unsigned char *chartest;
 
 #define mangle(V) ((char)(basechars[(V) % MANGLE_BASE]))
 #define BASECHAR_MASK 0xf0
@@ -334,13 +333,13 @@ static void init_chartest( void )
 {
        const unsigned char *s;
 
-       memset( (char *)chartest, '\0', 256 );
+       chartest = SMB_MALLOC_ARRAY(unsigned char, 256);
+
+       SMB_ASSERT(chartest != NULL);
 
        for( s = (const unsigned char *)basechars; *s; s++ ) {
                chartest[*s] |= BASECHAR_MASK;
        }
-
-       ct_initialized = True;
 }
 
 /* ************************************************************************** **
@@ -367,8 +366,9 @@ static bool is_mangled(const char *s, const struct share_params *p)
 
        magic_char = lp_magicchar(p);
 
-       if( !ct_initialized )
+       if (chartest == NULL) {
                init_chartest();
+       }
 
        magic = strchr_m( s, magic_char );
        while( magic && magic[1] && magic[2] ) {         /* 3 chars, 1st is magic. */
index 7066c2a4e5c9ea9651dccb971ebdd5301bfa67d6..a9b94aabc3877fcaf5d1014ebfd2a72efa80442d 100644 (file)
@@ -93,15 +93,6 @@ static unsigned char char_flags[256];
 */
 static unsigned mangle_prefix;
 
-/* we will use a very simple direct mapped prefix cache. The big
-   advantage of this cache structure is speed and low memory usage 
-
-   The cache is indexed by the low-order bits of the hash, and confirmed by
-   hashing the resulting cache entry to match the known hash
-*/
-static char **prefix_cache;
-static unsigned int *prefix_cache_hashes;
-
 /* these are the characters we use in the 8.3 hash. Must be 36 chars long */
 static const char *basechars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
 static unsigned char base_reverse[256];
@@ -147,57 +138,39 @@ static unsigned int mangle_hash(const char *key, unsigned int length)
        return value & ~0x80000000;  
 }
 
-/* 
-   initialise (ie. allocate) the prefix cache
- */
-static bool cache_init(void)
-{
-       if (prefix_cache) {
-               return True;
-       }
-
-       prefix_cache = SMB_CALLOC_ARRAY(char *,MANGLE_CACHE_SIZE);
-       if (!prefix_cache) {
-               return False;
-       }
-
-       prefix_cache_hashes = SMB_CALLOC_ARRAY(unsigned int, MANGLE_CACHE_SIZE);
-       if (!prefix_cache_hashes) {
-               SAFE_FREE(prefix_cache);
-               return False;
-       }
-
-       return True;
-}
-
 /*
   insert an entry into the prefix cache. The string might not be null
   terminated */
 static void cache_insert(const char *prefix, int length, unsigned int hash)
 {
-       int i = hash % MANGLE_CACHE_SIZE;
+       char *str = SMB_STRNDUP(prefix, length);
 
-       if (prefix_cache[i]) {
-               free(prefix_cache[i]);
+       if (str == NULL) {
+               return;
        }
 
-       prefix_cache[i] = SMB_STRNDUP(prefix, length);
-       prefix_cache_hashes[i] = hash;
+       memcache_add(smbd_memcache(), MANGLE_HASH2_CACHE,
+                    data_blob_const(&hash, sizeof(hash)),
+                    data_blob_const(str, length+1));
+       SAFE_FREE(str);
 }
 
 /*
   lookup an entry in the prefix cache. Return NULL if not found.
 */
-static const char *cache_lookup(unsigned int hash)
+static char *cache_lookup(TALLOC_CTX *mem_ctx, unsigned int hash)
 {
-       int i = hash % MANGLE_CACHE_SIZE;
+       DATA_BLOB value;
 
-       if (!prefix_cache[i] || hash != prefix_cache_hashes[i]) {
+       if (!memcache_lookup(smbd_memcache(), MANGLE_HASH2_CACHE,
+                            data_blob_const(&hash, sizeof(hash)), &value)) {
                return NULL;
        }
 
-       /* yep, it matched */
-       return prefix_cache[i];
+       SMB_ASSERT((value.length > 0)
+                  && (value.data[value.length-1] == '\0'));
+
+       return talloc_strdup(mem_ctx, (char *)value.data);
 }
 
 
@@ -377,7 +350,7 @@ static bool lookup_name_from_8_3(TALLOC_CTX *ctx,
 {
        unsigned int hash, multiplier;
        unsigned int i;
-       const char *prefix;
+       char *prefix;
        char extension[4];
 
        *pp_out = NULL;
@@ -397,7 +370,7 @@ static bool lookup_name_from_8_3(TALLOC_CTX *ctx,
        }
 
        /* now look in the prefix cache for that hash */
-       prefix = cache_lookup(hash);
+       prefix = cache_lookup(ctx, hash);
        if (!prefix) {
                M_DEBUG(10,("lookup_name_from_8_3: %s -> %08X -> not found\n",
                                        name, hash));
@@ -421,7 +394,9 @@ static bool lookup_name_from_8_3(TALLOC_CTX *ctx,
                *pp_out = talloc_strdup(ctx, prefix);
        }
 
-       if (!pp_out) {
+       TALLOC_FREE(prefix);
+
+       if (!*pp_out) {
                M_DEBUG(0,("talloc_fail"));
                return False;
        }
@@ -728,10 +703,6 @@ struct mangle_fns *mangle_hash2_init(void)
        init_tables();
        mangle_reset();
 
-       if (!cache_init()) {
-               return NULL;
-       }
-
        return &mangle_fns;
 }
 
index c04e0f1ae236877798e61bbc799b7546f09e6e05..7290f7054722c4a40b80de193a0c29c435e0a987 100644 (file)
  any incoming or new username - in order to canonicalize the name.
  This is being done to de-couple the case conversions from the user mapping
  function. Previously, the map_username was being called
- every time Get_Pwnam was called.
+ every time Get_Pwnam_alloc was called.
  Returns True if username was changed, false otherwise.
 ********************************************************************/
 
+static char *last_from, *last_to;
+
+static const char *get_last_from(void)
+{
+       if (!last_from) {
+               return "";
+       }
+       return last_from;
+}
+
+static const char *get_last_to(void)
+{
+       if (!last_to) {
+               return "";
+       }
+       return last_to;
+}
+
+static bool set_last_from_to(const char *from, const char *to)
+{
+       char *orig_from = last_from;
+       char *orig_to = last_to;
+
+       last_from = SMB_STRDUP(from);
+       last_to = SMB_STRDUP(to);
+
+       SAFE_FREE(orig_from);
+       SAFE_FREE(orig_to);
+
+       if (!last_from || !last_to) {
+               SAFE_FREE(last_from);
+               SAFE_FREE(last_to);
+               return false;
+       }
+       return true;
+}
+
 bool map_username(fstring user)
 {
-       static bool initialised=False;
-       static fstring last_from,last_to;
        XFILE *f;
        char *mapfile = lp_username_map();
        char *s;
@@ -46,12 +81,12 @@ bool map_username(fstring user)
        if (!*user)
                return false;
 
-       if (strequal(user,last_to))
+       if (strequal(user,get_last_to()))
                return false;
 
-       if (strequal(user,last_from)) {
-               DEBUG(3,("Mapped user %s to %s\n",user,last_to));
-               fstrcpy(user,last_to);
+       if (strequal(user,get_last_from())) {
+               DEBUG(3,("Mapped user %s to %s\n",user,get_last_to()));
+               fstrcpy(user,get_last_to());
                return true;
        }
 
@@ -98,15 +133,9 @@ bool map_username(fstring user)
        }
 
        /* ok.  let's try the mapfile */
-       
        if (!*mapfile)
                return False;
 
-       if (!initialised) {
-               *last_from = *last_to = 0;
-               initialised = True;
-       }
-  
        f = x_fopen(mapfile,O_RDONLY, 0);
        if (!f) {
                DEBUG(0,("can't open username map %s. Error %s\n",mapfile, strerror(errno) ));
@@ -135,7 +164,7 @@ bool map_username(fstring user)
                        while (*unixname && isspace((int)*unixname))
                                unixname++;
                }
-    
+
                if (!*unixname || strchr_m("#;",*unixname))
                        continue;
 
@@ -159,27 +188,28 @@ bool map_username(fstring user)
                    user_in_list(user, (const char **)dosuserlist)) {
                        DEBUG(3,("Mapped user %s to %s\n",user,unixname));
                        mapped_user = True;
-                       fstrcpy( last_from,user );
+
+                       set_last_from_to(user, unixname);
                        fstrcpy( user, unixname );
-                       fstrcpy( last_to,user );
+
                        if ( return_if_mapped ) {
                                str_list_free (&dosuserlist);
                                x_fclose(f);
                                return True;
                        }
                }
-    
+
                str_list_free (&dosuserlist);
        }
 
        x_fclose(f);
 
        /*
-        * Setup the last_from and last_to as an optimization so 
+        * Setup the last_from and last_to as an optimization so
         * that we don't scan the file again for the same user.
         */
-       fstrcpy(last_from,user);
-       fstrcpy(last_to,user);
+
+       set_last_from_to(user, user);
 
        return mapped_user;
 }
index d0b524da0e65adbb39aa70f2d3fcbf11606d6feb..a870f03df98c945add02c81ba3b13b15292e3adb 100644 (file)
@@ -137,7 +137,7 @@ static void msg_deliver(struct msg_state *state)
  conn POINTER CAN BE NULL HERE !
 ****************************************************************************/
 
-void reply_sends(connection_struct *conn, struct smb_request *req)
+void reply_sends(struct smb_request *req)
 {
        struct msg_state *state;
        int len;
@@ -190,7 +190,7 @@ void reply_sends(connection_struct *conn, struct smb_request *req)
  conn POINTER CAN BE NULL HERE !
 ****************************************************************************/
 
-void reply_sendstrt(connection_struct *conn, struct smb_request *req)
+void reply_sendstrt(struct smb_request *req)
 {
        char *p;
 
@@ -234,7 +234,7 @@ void reply_sendstrt(connection_struct *conn, struct smb_request *req)
  conn POINTER CAN BE NULL HERE !
 ****************************************************************************/
 
-void reply_sendtxt(connection_struct *conn, struct smb_request *req)
+void reply_sendtxt(struct smb_request *req)
 {
        int len;
        char *msg;
@@ -287,7 +287,7 @@ void reply_sendtxt(connection_struct *conn, struct smb_request *req)
  conn POINTER CAN BE NULL HERE !
 ****************************************************************************/
 
-void reply_sendend(connection_struct *conn, struct smb_request *req)
+void reply_sendend(struct smb_request *req)
 {
        START_PROFILE(SMBsendend);
 
index 4ae735633b57b52a32ea0a1f6d908d7689362e00..8ffa0f7751cb4ce1cd0d1d0c9cb0a2143ab71da4 100644 (file)
@@ -288,12 +288,13 @@ static bool parse_msdfs_symlink(TALLOC_CTX *ctx,
        char **alt_path = NULL;
        int count = 0, i;
        struct referral *reflist;
+       char *saveptr;
 
        temp = talloc_strdup(ctx, target);
        if (!temp) {
                return False;
        }
-       prot = strtok(temp,":");
+       prot = strtok_r(temp, ":", &saveptr);
        if (!prot) {
                DEBUG(0,("parse_msdfs_symlink: invalid path !\n"));
                return False;
@@ -306,7 +307,7 @@ static bool parse_msdfs_symlink(TALLOC_CTX *ctx,
 
        /* parse out the alternate paths */
        while((count<MAX_REFERRAL_COUNT) &&
-             ((alt_path[count] = strtok(NULL,",")) != NULL)) {
+             ((alt_path[count] = strtok_r(NULL, ",", &saveptr)) != NULL)) {
                count++;
        }
 
index 02f752fd679a74cfd5729491dafc7b723af3b5b8..9f56949eeb2f765caf9b8f2eaeb8c4c5a9f8ba24 100644 (file)
@@ -505,7 +505,7 @@ static const struct {
  conn POINTER CAN BE NULL HERE !
 ****************************************************************************/
 
-void reply_negprot(connection_struct *conn, struct smb_request *req)
+void reply_negprot(struct smb_request *req)
 {
        size_t size = smb_len(req->inbuf) + 4;
        int choice= -1;
index 0dd7fbb20e912ce8be7d45048a5dfe0ec8f0ede1..55009ce0b1c06d7d4f7b5fdb3aae4869b62205ad 100644 (file)
@@ -65,6 +65,8 @@ static bool notify_marshall_changes(int num_changes,
        int i;
        UNISTR uni_name;
 
+       uni_name.buffer = NULL;
+
        for (i=0; i<num_changes; i++) {
                struct notify_change *c;
                size_t namelen;
@@ -128,7 +130,8 @@ static bool notify_marshall_changes(int num_changes,
  Setup the common parts of the return packet and send it.
 *****************************************************************************/
 
-static void change_notify_reply_packet(const uint8 *request_buf,
+static void change_notify_reply_packet(connection_struct *conn,
+                               const uint8 *request_buf,
                                       NTSTATUS error_code)
 {
        char outbuf[smb_size+38];
@@ -142,15 +145,18 @@ static void change_notify_reply_packet(const uint8 *request_buf,
         * Seems NT needs a transact command with an error code
         * in it. This is a longer packet than a simple error.
         */
-       set_message(outbuf,18,0,False);
+       srv_set_message(outbuf,18,0,False);
 
        show_msg(outbuf);
-       if (!send_smb(smbd_server_fd(),outbuf))
-               exit_server_cleanly("change_notify_reply_packet: send_smb "
+       if (!srv_send_smb(smbd_server_fd(),
+                       outbuf,
+                       IS_CONN_ENCRYPTED(conn)))
+               exit_server_cleanly("change_notify_reply_packet: srv_send_smb "
                                    "failed.");
 }
 
-void change_notify_reply(const uint8 *request_buf, uint32 max_param,
+void change_notify_reply(connection_struct *conn,
+                       const uint8 *request_buf, uint32 max_param,
                         struct notify_change_buf *notify_buf)
 {
        prs_struct ps;
@@ -158,7 +164,7 @@ void change_notify_reply(const uint8 *request_buf, uint32 max_param,
        uint8 tmp_request[smb_size];
 
        if (notify_buf->num_changes == -1) {
-               change_notify_reply_packet(request_buf, NT_STATUS_OK);
+               change_notify_reply_packet(conn, request_buf, NT_STATUS_OK);
                notify_buf->num_changes = 0;
                return;
        }
@@ -171,12 +177,12 @@ void change_notify_reply(const uint8 *request_buf, uint32 max_param,
                 * We exceed what the client is willing to accept. Send
                 * nothing.
                 */
-               change_notify_reply_packet(request_buf, NT_STATUS_OK);
+               change_notify_reply_packet(conn, request_buf, NT_STATUS_OK);
                goto done;
        }
 
        if (!(req = talloc(talloc_tos(), struct smb_request))) {
-               change_notify_reply_packet(request_buf, NT_STATUS_NO_MEMORY);
+               change_notify_reply_packet(conn, request_buf, NT_STATUS_NO_MEMORY);
                goto done;
        }
 
@@ -189,9 +195,9 @@ void change_notify_reply(const uint8 *request_buf, uint32 max_param,
        smb_setlen((char *)tmp_request, smb_size);
        SCVAL(tmp_request, smb_wct, 0);
 
-       init_smb_request(req, tmp_request,0);
+       init_smb_request(req, tmp_request,0, conn->encrypted_tid);
 
-       send_nt_replies(req, NT_STATUS_OK, prs_data_p(&ps),
+       send_nt_replies(conn, req, NT_STATUS_OK, prs_data_p(&ps),
                        prs_offset(&ps), NULL, 0);
 
  done:
@@ -229,6 +235,7 @@ NTSTATUS change_notify_create(struct files_struct *fsp, uint32 filter,
                return NT_STATUS_NO_MEMORY;
        }
 
+       ZERO_STRUCT(e);
        e.path = fullpath;
        e.filter = filter;
        e.subdir_filter = 0;
@@ -242,9 +249,10 @@ NTSTATUS change_notify_create(struct files_struct *fsp, uint32 filter,
        return status;
 }
 
-NTSTATUS change_notify_add_request(const uint8 *inbuf, uint32 max_param,
-                                  uint32 filter, bool recursive,
-                                  struct files_struct *fsp)
+NTSTATUS change_notify_add_request(const struct smb_request *req,
+                               uint32 max_param,
+                               uint32 filter, bool recursive,
+                               struct files_struct *fsp)
 {
        struct notify_change_request *request = NULL;
        struct notify_mid_map *map = NULL;
@@ -258,7 +266,7 @@ NTSTATUS change_notify_add_request(const uint8 *inbuf, uint32 max_param,
        request->mid_map = map;
        map->req = request;
 
-       memcpy(request->request_buf, inbuf, sizeof(request->request_buf));
+       memcpy(request->request_buf, req->inbuf, sizeof(request->request_buf));
        request->max_param = max_param;
        request->filter = filter;
        request->fsp = fsp;
@@ -267,11 +275,11 @@ NTSTATUS change_notify_add_request(const uint8 *inbuf, uint32 max_param,
        DLIST_ADD_END(fsp->notify->requests, request,
                      struct notify_change_request *);
 
-       map->mid = SVAL(inbuf, smb_mid);
+       map->mid = SVAL(req->inbuf, smb_mid);
        DLIST_ADD(notify_changes_by_mid, map);
 
        /* Push the MID of this packet on the signing queue. */
-       srv_defer_sign_response(SVAL(inbuf,smb_mid));
+       srv_defer_sign_response(SVAL(req->inbuf,smb_mid));
 
        return NT_STATUS_OK;
 }
@@ -324,7 +332,8 @@ void remove_pending_change_notify_requests_by_mid(uint16 mid)
                return;
        }
 
-       change_notify_reply_packet(map->req->request_buf, NT_STATUS_CANCELLED);
+       change_notify_reply_packet(map->req->fsp->conn,
+                       map->req->request_buf, NT_STATUS_CANCELLED);
        change_notify_remove_request(map->req);
 }
 
@@ -340,7 +349,7 @@ void remove_pending_change_notify_requests_by_fid(files_struct *fsp,
        }
 
        while (fsp->notify->requests != NULL) {
-               change_notify_reply_packet(
+               change_notify_reply_packet(fsp->conn,
                        fsp->notify->requests->request_buf, status);
                change_notify_remove_request(fsp->notify->requests);
        }
@@ -434,7 +443,8 @@ static void notify_fsp(files_struct *fsp, uint32 action, const char *name)
         * TODO: do we have to walk the lists of requests pending?
         */
 
-       change_notify_reply(fsp->notify->requests->request_buf,
+       change_notify_reply(fsp->conn,
+                       fsp->notify->requests->request_buf,
                            fsp->notify->requests->max_param,
                            fsp->notify);
 
index 1fbb681c720f68dd5b5b3ba5138f8669ce8b0954..9381174af0c542baaa51dfc7659ce01effa7f86a 100644 (file)
@@ -66,7 +66,8 @@ static char *nttrans_realloc(char **ptr, size_t size)
  HACK ! Always assumes smb_setup field is zero.
 ****************************************************************************/
 
-void send_nt_replies(struct smb_request *req, NTSTATUS nt_error,
+void send_nt_replies(connection_struct *conn,
+                       struct smb_request *req, NTSTATUS nt_error,
                     char *params, int paramsize,
                     char *pdata, int datasize)
 {
@@ -242,8 +243,10 @@ void send_nt_replies(struct smb_request *req, NTSTATUS nt_error,
 
                /* Send the packet */
                show_msg((char *)req->outbuf);
-               if (!send_smb(smbd_server_fd(),(char *)req->outbuf)) {
-                       exit_server_cleanly("send_nt_replies: send_smb failed.");
+               if (!srv_send_smb(smbd_server_fd(),
+                               (char *)req->outbuf,
+                               IS_CONN_ENCRYPTED(conn))) {
+                       exit_server_cleanly("send_nt_replies: srv_send_smb failed.");
                }
 
                TALLOC_FREE(req->outbuf);
@@ -268,6 +271,9 @@ void send_nt_replies(struct smb_request *req, NTSTATUS nt_error,
 
 /****************************************************************************
  Is it an NTFS stream name ?
+ An NTFS file name is <path>.<extention>:<stream name>:<stream type>
+ $DATA can be used as both a stream name and a stream type. A missing stream
+ name or type implies $DATA.
 ****************************************************************************/
 
 bool is_ntfs_stream_name(const char *fname)
@@ -410,8 +416,9 @@ static void do_ntcreate_pipe_open(connection_struct *conn,
  Reply to an NT create and X call.
 ****************************************************************************/
 
-void reply_ntcreate_and_X(connection_struct *conn, struct smb_request *req)
+void reply_ntcreate_and_X(struct smb_request *req)
 {
+       connection_struct *conn = req->conn;
        char *fname = NULL;
        uint32 flags;
        uint32 access_mask;
@@ -726,7 +733,7 @@ static void do_nt_transact_create_pipe(connection_struct *conn,
        DEBUG(5,("do_nt_transact_create_pipe: open name = %s\n", fname));
 
        /* Send the required number of replies */
-       send_nt_replies(req, NT_STATUS_OK, params, param_len, *ppdata, 0);
+       send_nt_replies(conn, req, NT_STATUS_OK, params, param_len, *ppdata, 0);
 
        return;
 }
@@ -765,8 +772,7 @@ static NTSTATUS set_sd(files_struct *fsp, uint8 *data, uint32 sd_len,
        }
 
        if (fsp->fh->fd != -1) {
-               status = SMB_VFS_FSET_NT_ACL(fsp, fsp->fh->fd,
-                                            security_info_sent, psd);
+               status = SMB_VFS_FSET_NT_ACL(fsp, security_info_sent, psd);
        }
        else {
                status = SMB_VFS_SET_NT_ACL(fsp, fsp->fsp_name,
@@ -1080,7 +1086,7 @@ static void call_nt_transact_create(connection_struct *conn,
        DEBUG(5,("call_nt_transact_create: open name = %s\n", fname));
 
        /* Send the required number of replies */
-       send_nt_replies(req, NT_STATUS_OK, params, param_len, *ppdata, 0);
+       send_nt_replies(conn, req, NT_STATUS_OK, params, param_len, *ppdata, 0);
 
        return;
 }
@@ -1090,7 +1096,7 @@ static void call_nt_transact_create(connection_struct *conn,
  conn POINTER CAN BE NULL HERE !
 ****************************************************************************/
 
-void reply_ntcancel(connection_struct *conn, struct smb_request *req)
+void reply_ntcancel(struct smb_request *req)
 {
        /*
         * Go through and cancel any pending change notifies.
@@ -1252,8 +1258,9 @@ static NTSTATUS copy_internals(TALLOC_CTX *ctx,
  Reply to a NT rename request.
 ****************************************************************************/
 
-void reply_ntrename(connection_struct *conn, struct smb_request *req)
+void reply_ntrename(struct smb_request *req)
 {
+       connection_struct *conn = req->conn;
        char *oldname = NULL;
        char *newname = NULL;
        char *p;
@@ -1474,7 +1481,7 @@ static void call_nt_transact_notify_change(connection_struct *conn,
                 * here.
                 */
 
-               change_notify_reply(req->inbuf, max_param_count, fsp->notify);
+               change_notify_reply(fsp->conn, req->inbuf, max_param_count, fsp->notify);
 
                /*
                 * change_notify_reply() above has independently sent its
@@ -1487,7 +1494,9 @@ static void call_nt_transact_notify_change(connection_struct *conn,
         * No changes pending, queue the request
         */
 
-       status = change_notify_add_request(req->inbuf, max_param_count, filter,
+       status = change_notify_add_request(req,
+                       max_param_count,
+                       filter,
                        recursive, fsp);
        if (!NT_STATUS_IS_OK(status)) {
                reply_nterror(req, status);
@@ -1554,7 +1563,7 @@ static void call_nt_transact_rename(connection_struct *conn,
        /*
         * Rename was successful.
         */
-       send_nt_replies(req, NT_STATUS_OK, NULL, 0, NULL, 0);
+       send_nt_replies(conn, req, NT_STATUS_OK, NULL, 0, NULL, 0);
 
        DEBUG(3,("nt transact rename from = %s, to = %s succeeded.\n",
                 fsp->fsp_name, new_name));
@@ -1598,7 +1607,6 @@ static void call_nt_transact_query_security_desc(connection_struct *conn,
        SEC_DESC *psd = NULL;
        size_t sd_size;
        uint32 security_info_wanted;
-       TALLOC_CTX *frame;
        files_struct *fsp = NULL;
        NTSTATUS status;
        DATA_BLOB blob;
@@ -1625,8 +1633,6 @@ static void call_nt_transact_query_security_desc(connection_struct *conn,
                return;
        }
 
-       frame = talloc_stackframe();
-
        /*
         * Get the permissions to return.
         */
@@ -1636,30 +1642,28 @@ static void call_nt_transact_query_security_desc(connection_struct *conn,
        } else {
                if (fsp->fh->fd != -1) {
                        status = SMB_VFS_FGET_NT_ACL(
-                               fsp, fsp->fh->fd, security_info_wanted, &psd);
+                               fsp, security_info_wanted, &psd);
                }
                else {
                        status = SMB_VFS_GET_NT_ACL(
-                               fsp, fsp->fsp_name, security_info_wanted, &psd);
+                               conn, fsp->fsp_name, security_info_wanted, &psd);
                }
        }
 
        if (!NT_STATUS_IS_OK(status)) {
-               TALLOC_FREE(frame);
                reply_nterror(req, status);
                return;
        }
 
-       sd_size = sec_desc_size(psd);
+       sd_size = ndr_size_security_descriptor(psd, 0);
 
        DEBUG(3,("call_nt_transact_query_security_desc: sd_size = %lu.\n",(unsigned long)sd_size));
 
        SIVAL(params,0,(uint32)sd_size);
 
        if (max_data_count < sd_size) {
-               send_nt_replies(req, NT_STATUS_BUFFER_TOO_SMALL,
+               send_nt_replies(conn, req, NT_STATUS_BUFFER_TOO_SMALL,
                                params, 4, *ppdata, 0);
-               TALLOC_FREE(frame);
                return;
        }
 
@@ -1669,7 +1673,6 @@ static void call_nt_transact_query_security_desc(connection_struct *conn,
 
        data = nttrans_realloc(ppdata, sd_size);
        if(data == NULL) {
-               TALLOC_FREE(frame);
                reply_doserror(req, ERRDOS, ERRnomem);
                return;
        }
@@ -1678,7 +1681,6 @@ static void call_nt_transact_query_security_desc(connection_struct *conn,
                                   &blob.data, &blob.length);
 
        if (!NT_STATUS_IS_OK(status)) {
-               TALLOC_FREE(frame);
                reply_nterror(req, status);
                return;
        }
@@ -1686,9 +1688,8 @@ static void call_nt_transact_query_security_desc(connection_struct *conn,
        SMB_ASSERT(sd_size == blob.length);
        memcpy(data, blob.data, sd_size);
 
-       send_nt_replies(req, NT_STATUS_OK, params, 4, data, (int)sd_size);
+       send_nt_replies(conn, req, NT_STATUS_OK, params, 4, data, (int)sd_size);
 
-       TALLOC_FREE(frame);
        return;
 }
 
@@ -1744,7 +1745,7 @@ static void call_nt_transact_set_security_desc(connection_struct *conn,
        }
 
   done:
-       send_nt_replies(req, NT_STATUS_OK, NULL, 0, NULL, 0);
+       send_nt_replies(conn, req, NT_STATUS_OK, NULL, 0, NULL, 0);
        return;
 }
 
@@ -1793,7 +1794,7 @@ static void call_nt_transact_ioctl(connection_struct *conn,
                   so we can know if we need to pre-allocate or not */
 
                DEBUG(10,("FSCTL_SET_SPARSE: called on FID[0x%04X](but not implemented)\n", fidnum));
-               send_nt_replies(req, NT_STATUS_OK, NULL, 0, NULL, 0);
+               send_nt_replies(conn, req, NT_STATUS_OK, NULL, 0, NULL, 0);
                return;
 
        case FSCTL_CREATE_OR_GET_OBJECT_ID:
@@ -1819,7 +1820,7 @@ static void call_nt_transact_ioctl(connection_struct *conn,
                push_file_id_16(pdata, &fsp->file_id);
                memcpy(pdata+16,create_volume_objectid(conn,objid),16);
                push_file_id_16(pdata+32, &fsp->file_id);
-               send_nt_replies(req, NT_STATUS_OK, NULL, 0,
+               send_nt_replies(conn, req, NT_STATUS_OK, NULL, 0,
                                pdata, data_count);
                return;
        }
@@ -1964,7 +1965,7 @@ static void call_nt_transact_ioctl(connection_struct *conn,
 
                talloc_destroy(shadow_data->mem_ctx);
 
-               send_nt_replies(req, NT_STATUS_OK, NULL, 0,
+               send_nt_replies(conn, req, NT_STATUS_OK, NULL, 0,
                                pdata, data_count);
 
                return;
@@ -2020,7 +2021,7 @@ static void call_nt_transact_ioctl(connection_struct *conn,
                 */
 
                /* this works for now... */
-               send_nt_replies(req, NT_STATUS_OK, NULL, 0, NULL, 0);
+               send_nt_replies(conn, req, NT_STATUS_OK, NULL, 0, NULL, 0);
                return;
        }
        default:
@@ -2174,7 +2175,8 @@ static void call_nt_transact_get_user_quota(connection_struct *conn,
                        for (;((tmp_list!=NULL)&&((qt_len +40+SID_MAX_SIZE)<max_data_count));
                                tmp_list=tmp_list->next,entry+=entry_len,qt_len+=entry_len) {
 
-                               sid_len = sid_size(&tmp_list->quotas->sid);
+                               sid_len = ndr_size_dom_sid(
+                                       &tmp_list->quotas->sid, 0);
                                entry_len = 40 + sid_len;
 
                                /* nextoffset entry 4 bytes */
@@ -2305,7 +2307,7 @@ static void call_nt_transact_get_user_quota(connection_struct *conn,
                        break;
        }
 
-       send_nt_replies(req, nt_status, params, param_len,
+       send_nt_replies(conn, req, nt_status, params, param_len,
                        pdata, data_len);
 }
 
@@ -2435,7 +2437,7 @@ static void call_nt_transact_set_user_quota(connection_struct *conn,
                return;
        }
 
-       send_nt_replies(req, NT_STATUS_OK, params, param_len,
+       send_nt_replies(conn, req, NT_STATUS_OK, params, param_len,
                        pdata, data_len);
 }
 #endif /* HAVE_SYS_QUOTAS */
@@ -2572,8 +2574,9 @@ static void handle_nttrans(connection_struct *conn,
  Reply to a SMBNTtrans.
 ****************************************************************************/
 
-void reply_nttrans(connection_struct *conn, struct smb_request *req)
+void reply_nttrans(struct smb_request *req)
 {
+       connection_struct *conn = req->conn;
        uint32 pscnt;
        uint32 psoff;
        uint32 dscnt;
@@ -2763,8 +2766,9 @@ void reply_nttrans(connection_struct *conn, struct smb_request *req)
  Reply to a SMBnttranss
  ****************************************************************************/
 
-void reply_nttranss(connection_struct *conn, struct smb_request *req)
+void reply_nttranss(struct smb_request *req)
 {
+       connection_struct *conn = req->conn;
        unsigned int pcnt,poff,dcnt,doff,pdisp,ddisp;
        struct trans_state *state;
 
index b83d6844d6e907c46932ad03ae1dd35e6552c2ad..aa4bc48f3d1197e71c43eff0bae8e769be7f36c2 100644 (file)
@@ -70,7 +70,7 @@ static NTSTATUS fd_open(struct connection_struct *conn,
  Close the file associated with a fsp.
 ****************************************************************************/
 
-NTSTATUS fd_close(struct connection_struct *conn, files_struct *fsp)
+NTSTATUS fd_close(files_struct *fsp)
 {
        if (fsp->fh->fd == -1) {
                return NT_STATUS_OK; /* What we used to call a stat open. */
@@ -78,7 +78,7 @@ NTSTATUS fd_close(struct connection_struct *conn, files_struct *fsp)
        if (fsp->fh->ref_count > 1) {
                return NT_STATUS_OK; /* Shared handle. Only close last reference. */
        }
-       return fd_close_posix(conn, fsp);
+       return fd_close_posix(fsp);
 }
 
 /****************************************************************************
@@ -102,7 +102,7 @@ static void change_file_owner_to_parent(connection_struct *conn,
        }
 
        become_root();
-       ret = SMB_VFS_FCHOWN(fsp, fsp->fh->fd, parent_st.st_uid, (gid_t)-1);
+       ret = SMB_VFS_FCHOWN(fsp, parent_st.st_uid, (gid_t)-1);
        unbecome_root();
        if (ret == -1) {
                DEBUG(0,("change_file_owner_to_parent: failed to fchown "
@@ -125,7 +125,7 @@ static NTSTATUS change_dir_owner_to_parent(connection_struct *conn,
        char *saved_dir = NULL;
        SMB_STRUCT_STAT sbuf;
        SMB_STRUCT_STAT parent_st;
-       TALLOC_CTX *ctx = talloc_stackframe();
+       TALLOC_CTX *ctx = talloc_tos();
        NTSTATUS status = NT_STATUS_OK;
        int ret;
 
@@ -135,7 +135,6 @@ static NTSTATUS change_dir_owner_to_parent(connection_struct *conn,
                DEBUG(0,("change_dir_owner_to_parent: failed to stat parent "
                         "directory %s. Error was %s\n",
                         inherit_from_dir, strerror(errno) ));
-               TALLOC_FREE(ctx);
                return status;
        }
 
@@ -152,7 +151,6 @@ static NTSTATUS change_dir_owner_to_parent(connection_struct *conn,
                DEBUG(0,("change_dir_owner_to_parent: failed to get "
                         "current working directory. Error was %s\n",
                         strerror(errno)));
-               TALLOC_FREE(ctx);
                return status;
        }
 
@@ -202,7 +200,6 @@ static NTSTATUS change_dir_owner_to_parent(connection_struct *conn,
 
  out:
 
-       TALLOC_FREE(ctx);
        vfs_ChDir(conn,saved_dir);
        return status;
 }
@@ -342,7 +339,7 @@ static NTSTATUS open_file(files_struct *fsp,
                if (fsp->fh->fd == -1) {
                        ret = SMB_VFS_STAT(conn, path, psbuf);
                } else {
-                       ret = SMB_VFS_FSTAT(fsp,fsp->fh->fd,psbuf);
+                       ret = SMB_VFS_FSTAT(fsp, psbuf);
                        /* If we have an fd, this stat should succeed. */
                        if (ret == -1) {
                                DEBUG(0,("Error doing fstat on open file %s "
@@ -353,7 +350,7 @@ static NTSTATUS open_file(files_struct *fsp,
                /* For a non-io open, this stat failing means file not found. JRA */
                if (ret == -1) {
                        status = map_nt_error_from_unix(errno);
-                       fd_close(conn, fsp);
+                       fd_close(fsp);
                        return status;
                }
        }
@@ -365,7 +362,7 @@ static NTSTATUS open_file(files_struct *fsp,
         */
 
        if(S_ISDIR(psbuf->st_mode)) {
-               fd_close(conn, fsp);
+               fd_close(fsp);
                errno = EISDIR;
                return NT_STATUS_FILE_IS_A_DIRECTORY;
        }
@@ -601,12 +598,6 @@ static NTSTATUS open_mode_check(connection_struct *conn,
        }
 
        *file_existed = True;
-       
-       if (is_stat_open(access_mask)) {
-               /* Stat open that doesn't trigger oplock breaks or share mode
-                * checks... ! JRA. */
-               return NT_STATUS_OK;
-       }
 
        /* A delete on close prohibits everything */
 
@@ -614,6 +605,12 @@ static NTSTATUS open_mode_check(connection_struct *conn,
                return NT_STATUS_DELETE_PENDING;
        }
 
+       if (is_stat_open(access_mask)) {
+               /* Stat open that doesn't trigger oplock breaks or share mode
+                * checks... ! JRA. */
+               return NT_STATUS_OK;
+       }
+
        /*
         * Check if the share modes will give us access.
         */
@@ -1224,7 +1221,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
                request_time = pml->request_time;
 
                /* Remove the deferred open entry under lock. */
-               lck = get_share_mode_lock(NULL, state->id, NULL, NULL);
+               lck = get_share_mode_lock(talloc_tos(), state->id, NULL, NULL);
                if (lck == NULL) {
                        DEBUG(0, ("could not get share mode lock\n"));
                } else {
@@ -1405,7 +1402,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
        }
 #endif /* O_SYNC */
   
-       if (posix_open & (access_mask & FILE_APPEND_DATA)) {
+       if (posix_open && (access_mask & FILE_APPEND_DATA)) {
                flags2 |= O_APPEND;
        }
 
@@ -1454,7 +1451,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
        if (file_existed) {
                id = vfs_file_id_from_sbuf(conn, psbuf);
 
-               lck = get_share_mode_lock(NULL, id,
+               lck = get_share_mode_lock(talloc_tos(), id,
                                          conn->connectpath,
                                          fname);
 
@@ -1681,14 +1678,14 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
 
                id = fsp->file_id;
 
-               lck = get_share_mode_lock(NULL, id,
+               lck = get_share_mode_lock(talloc_tos(), id,
                                          conn->connectpath,
                                          fname);
 
                if (lck == NULL) {
                        DEBUG(0, ("open_file_ntcreate: Could not get share "
                                  "mode lock for %s\n", fname));
-                       fd_close(conn, fsp);
+                       fd_close(fsp);
                        file_free(fsp);
                        return NT_STATUS_SHARING_VIOLATION;
                }
@@ -1699,7 +1696,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
                                         oplock_request)) {
                        schedule_defer_open(lck, request_time, req);
                        TALLOC_FREE(lck);
-                       fd_close(conn, fsp);
+                       fd_close(fsp);
                        file_free(fsp);
                        return NT_STATUS_SHARING_VIOLATION;
                }
@@ -1718,7 +1715,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
                                                 oplock_request)) {
                                schedule_defer_open(lck, request_time, req);
                                TALLOC_FREE(lck);
-                               fd_close(conn, fsp);
+                               fd_close(fsp);
                                file_free(fsp);
                                return NT_STATUS_SHARING_VIOLATION;
                        }
@@ -1727,7 +1724,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
                if (!NT_STATUS_IS_OK(status)) {
                        struct deferred_open_record state;
 
-                       fd_close(conn, fsp);
+                       fd_close(fsp);
                        file_free(fsp);
 
                        state.delayed_for_oplocks = False;
@@ -1764,14 +1761,16 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
            the kernel refuses the operations then the kernel is wrong.
           note that GPFS supports it as well - jmcd */
 
-       ret_flock = SMB_VFS_KERNEL_FLOCK(fsp, fsp->fh->fd, share_access);
-       if(ret_flock == -1 ){
+       if (fsp->fh->fd != -1) {
+               ret_flock = SMB_VFS_KERNEL_FLOCK(fsp, share_access);
+               if(ret_flock == -1 ){
 
-               TALLOC_FREE(lck);
-               fd_close(conn, fsp);
-               file_free(fsp);
-               
-               return NT_STATUS_SHARING_VIOLATION;
+                       TALLOC_FREE(lck);
+                       fd_close(fsp);
+                       file_free(fsp);
+
+                       return NT_STATUS_SHARING_VIOLATION;
+               }
        }
 
        /*
@@ -1789,11 +1788,11 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
                 * We are modifing the file after open - update the stat
                 * struct..
                 */
-               if ((SMB_VFS_FTRUNCATE(fsp,fsp->fh->fd,0) == -1) ||
-                   (SMB_VFS_FSTAT(fsp,fsp->fh->fd,psbuf)==-1)) {
+               if ((SMB_VFS_FTRUNCATE(fsp, 0) == -1) ||
+                   (SMB_VFS_FSTAT(fsp, psbuf)==-1)) {
                        status = map_nt_error_from_unix(errno);
                        TALLOC_FREE(lck);
-                       fd_close(conn,fsp);
+                       fd_close(fsp);
                        file_free(fsp);
                        return status;
                }
@@ -1843,14 +1842,16 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
        set_share_mode(lck, fsp, current_user.ut.uid, 0, fsp->oplock_type, new_file_created);
 
        /* Handle strange delete on close create semantics. */
-       if ((create_options & FILE_DELETE_ON_CLOSE) && can_set_initial_delete_on_close(lck)) {
+       if ((create_options & FILE_DELETE_ON_CLOSE)
+           && (is_ntfs_stream_name(fname)
+               || can_set_initial_delete_on_close(lck))) {
                status = can_set_delete_on_close(fsp, True, new_dos_attributes);
 
                if (!NT_STATUS_IS_OK(status)) {
                        /* Remember to delete the mode we just added. */
                        del_share_mode(lck, fsp);
                        TALLOC_FREE(lck);
-                       fd_close(conn,fsp);
+                       fd_close(fsp);
                        file_free(fsp);
                        return status;
                }
@@ -1864,10 +1865,15 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
                if (lp_map_archive(SNUM(conn)) ||
                    lp_store_dos_attributes(SNUM(conn))) {
                        if (!posix_open) {
-                               file_set_dosmode(conn, fname,
-                                        new_dos_attributes | aARCH, NULL,
-                                        parent_dir,
-                                        true);
+                               SMB_STRUCT_STAT tmp_sbuf;
+                               SET_STAT_INVALID(tmp_sbuf);
+                               if (file_set_dosmode(
+                                           conn, fname,
+                                           new_dos_attributes | aARCH,
+                                           &tmp_sbuf, parent_dir,
+                                           true) == 0) {
+                                       unx_mode = tmp_sbuf.st_mode;
+                               }
                        }
                }
        }
@@ -1882,7 +1888,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
                int saved_errno = errno; /* We might get ENOSYS in the next
                                          * call.. */
 
-               if (SMB_VFS_FCHMOD_ACL(fsp, fsp->fh->fd, unx_mode) == -1 &&
+               if (SMB_VFS_FCHMOD_ACL(fsp, unx_mode) == -1 &&
                    errno == ENOSYS) {
                        errno = saved_errno; /* Ignore ENOSYS */
                }
@@ -1896,8 +1902,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
                {
                        int saved_errno = errno; /* We might get ENOSYS in the
                                                  * next call.. */
-                       ret = SMB_VFS_FCHMOD_ACL(fsp, fsp->fh->fd,
-                                                new_unx_mode);
+                       ret = SMB_VFS_FCHMOD_ACL(fsp, new_unx_mode);
 
                        if (ret == -1 && errno == ENOSYS) {
                                errno = saved_errno; /* Ignore ENOSYS */
@@ -1910,7 +1915,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
                }
 
                if ((ret == -1) &&
-                   (SMB_VFS_FCHMOD(fsp, fsp->fh->fd, new_unx_mode) == -1))
+                   (SMB_VFS_FCHMOD(fsp, new_unx_mode) == -1))
                        DEBUG(5, ("open_file_ntcreate: failed to reset "
                                  "attributes of file %s to 0%o\n",
                                  fname, (unsigned int)new_unx_mode));
@@ -1974,7 +1979,7 @@ NTSTATUS open_file_fchmod(connection_struct *conn, const char *fname,
 
 NTSTATUS close_file_fchmod(files_struct *fsp)
 {
-       NTSTATUS status = fd_close(fsp->conn, fsp);
+       NTSTATUS status = fd_close(fsp);
        file_free(fsp);
        return status;
 }
@@ -2101,7 +2106,7 @@ NTSTATUS open_directory(connection_struct *conn,
                 (unsigned int)create_disposition,
                 (unsigned int)file_attributes));
 
-       if (is_ntfs_stream_name(fname)) {
+       if (!(file_attributes & FILE_FLAG_POSIX_SEMANTICS) && is_ntfs_stream_name(fname)) {
                DEBUG(2, ("open_directory: %s is a stream name!\n", fname));
                return NT_STATUS_NOT_A_DIRECTORY;
        }
@@ -2211,7 +2216,7 @@ NTSTATUS open_directory(connection_struct *conn,
 
        string_set(&fsp->fsp_name,fname);
 
-       lck = get_share_mode_lock(NULL, fsp->file_id,
+       lck = get_share_mode_lock(talloc_tos(), fsp->file_id,
                                  conn->connectpath,
                                  fname);
 
@@ -2262,7 +2267,7 @@ NTSTATUS open_directory(connection_struct *conn,
        return NT_STATUS_OK;
 }
 
-NTSTATUS create_directory(connection_struct *conn, const char *directory)
+NTSTATUS create_directory(connection_struct *conn, struct smb_request *req, const char *directory)
 {
        NTSTATUS status;
        SMB_STRUCT_STAT sbuf;
@@ -2270,7 +2275,7 @@ NTSTATUS create_directory(connection_struct *conn, const char *directory)
 
        SET_STAT_INVALID(sbuf);
        
-       status = open_directory(conn, NULL, directory, &sbuf,
+       status = open_directory(conn, req, directory, &sbuf,
                                FILE_READ_ATTRIBUTES, /* Just a stat open */
                                FILE_SHARE_NONE, /* Ignored for stat opens */
                                FILE_CREATE,
@@ -2440,6 +2445,116 @@ static struct case_semantics_state *set_posix_case_semantics(TALLOC_CTX *mem_ctx
        return result;
 }
 
+/*
+ * If a main file is opened for delete, all streams need to be checked for
+ * !FILE_SHARE_DELETE. Do this by opening with DELETE_ACCESS.
+ * If that works, delete them all by setting the delete on close and close.
+ */
+
+static NTSTATUS open_streams_for_delete(connection_struct *conn,
+                                       const char *fname)
+{
+       struct stream_struct *stream_info;
+       files_struct **streams;
+       int i;
+       unsigned int num_streams;
+       TALLOC_CTX *frame = talloc_stackframe();
+       NTSTATUS status;
+
+       status = SMB_VFS_STREAMINFO(conn, NULL, fname, talloc_tos(),
+                                   &num_streams, &stream_info);
+
+       if (NT_STATUS_EQUAL(status, NT_STATUS_NOT_IMPLEMENTED)
+           || NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_NOT_FOUND)) {
+               DEBUG(10, ("no streams around\n"));
+               TALLOC_FREE(frame);
+               return NT_STATUS_OK;
+       }
+
+       if (!NT_STATUS_IS_OK(status)) {
+               DEBUG(10, ("SMB_VFS_STREAMINFO failed: %s\n",
+                          nt_errstr(status)));
+               goto fail;
+       }
+
+       DEBUG(10, ("open_streams_for_delete found %d streams\n",
+                  num_streams));
+
+       if (num_streams == 0) {
+               TALLOC_FREE(frame);
+               return NT_STATUS_OK;
+       }
+
+       streams = TALLOC_ARRAY(talloc_tos(), files_struct *, num_streams);
+       if (streams == NULL) {
+               DEBUG(0, ("talloc failed\n"));
+               status = NT_STATUS_NO_MEMORY;
+               goto fail;
+       }
+
+       for (i=0; i<num_streams; i++) {
+               char *streamname;
+
+               if (strequal(stream_info[i].name, "::$DATA")) {
+                       streams[i] = NULL;
+                       continue;
+               }
+
+               streamname = talloc_asprintf(talloc_tos(), "%s%s", fname,
+                                            stream_info[i].name);
+
+               if (streamname == NULL) {
+                       DEBUG(0, ("talloc_aprintf failed\n"));
+                       status = NT_STATUS_NO_MEMORY;
+                       goto fail;
+               }
+
+               status = create_file_unixpath
+                       (conn,                  /* conn */
+                        NULL,                  /* req */
+                        streamname,            /* fname */
+                        DELETE_ACCESS,         /* access_mask */
+                        FILE_SHARE_READ | FILE_SHARE_WRITE
+                        | FILE_SHARE_DELETE,   /* share_access */
+                        FILE_OPEN,             /* create_disposition*/
+                        NTCREATEX_OPTIONS_PRIVATE_STREAM_DELETE, /* create_options */
+                        FILE_ATTRIBUTE_NORMAL, /* file_attributes */
+                        0,                     /* oplock_request */
+                        0,                     /* allocation_size */
+                        NULL,                  /* sd */
+                        NULL,                  /* ea_list */
+                        &streams[i],           /* result */
+                        NULL,                  /* pinfo */
+                        NULL);                 /* psbuf */
+
+               TALLOC_FREE(streamname);
+
+               if (!NT_STATUS_IS_OK(status)) {
+                       DEBUG(10, ("Could not open stream %s: %s\n",
+                                  streamname, nt_errstr(status)));
+                       break;
+               }
+       }
+
+       /*
+        * don't touch the variable "status" beyond this point :-)
+        */
+
+       for (i -= 1 ; i >= 0; i--) {
+               if (streams[i] == NULL) {
+                       continue;
+               }
+
+               DEBUG(10, ("Closing stream # %d, %s\n", i,
+                          streams[i]->fsp_name));
+               close_file(streams[i], NORMAL_CLOSE);
+       }
+
+ fail:
+       TALLOC_FREE(frame);
+       return status;
+}
+
 /*
  * Wrapper around open_file_ntcreate and open_directory
  */
@@ -2463,6 +2578,7 @@ NTSTATUS create_file_unixpath(connection_struct *conn,
 {
        SMB_STRUCT_STAT sbuf;
        int info = FILE_WAS_OPENED;
+       files_struct *base_fsp = NULL;
        files_struct *fsp = NULL;
        NTSTATUS status;
 
@@ -2492,7 +2608,23 @@ NTSTATUS create_file_unixpath(connection_struct *conn,
                sbuf = *psbuf;
        }
        else {
-               SET_STAT_INVALID(sbuf);
+               if (SMB_VFS_STAT(conn, fname, &sbuf) == -1) {
+                       SET_STAT_INVALID(sbuf);
+               }
+       }
+
+       if ((conn->fs_capabilities & FILE_NAMED_STREAMS)
+           && (access_mask & DELETE_ACCESS)
+           && !is_ntfs_stream_name(fname)) {
+               /*
+                * We can't open a file with DELETE access if any of the
+                * streams is open without FILE_SHARE_DELETE
+                */
+               status = open_streams_for_delete(conn, fname);
+
+               if (!NT_STATUS_IS_OK(status)) {
+                       goto fail;
+               }
        }
 
        /* This is the correct thing to do (check every time) but can_delete
@@ -2525,12 +2657,61 @@ NTSTATUS create_file_unixpath(connection_struct *conn,
        }
 #endif
 
+       if ((conn->fs_capabilities & FILE_NAMED_STREAMS)
+           && is_ntfs_stream_name(fname)
+           && (!(create_options & NTCREATEX_OPTIONS_PRIVATE_STREAM_DELETE))) {
+               char *base;
+               uint32 base_create_disposition;
+
+               if (create_options & FILE_DIRECTORY_FILE) {
+                       status = NT_STATUS_NOT_A_DIRECTORY;
+                       goto fail;
+               }
+
+               status = split_ntfs_stream_name(talloc_tos(), fname,
+                                               &base, NULL);
+               if (!NT_STATUS_IS_OK(status)) {
+                       DEBUG(10, ("split_ntfs_stream_name failed: %s\n",
+                                  nt_errstr(status)));
+                       goto fail;
+               }
+
+               SMB_ASSERT(!is_ntfs_stream_name(base)); /* paranoia.. */
+
+               switch (create_disposition) {
+               case FILE_OPEN:
+                       base_create_disposition = FILE_OPEN;
+                       break;
+               default:
+                       base_create_disposition = FILE_OPEN_IF;
+                       break;
+               }
+
+               status = create_file_unixpath(conn, NULL, base, 0,
+                                             FILE_SHARE_READ
+                                             | FILE_SHARE_WRITE
+                                             | FILE_SHARE_DELETE,
+                                             base_create_disposition,
+                                             0, 0, 0, 0, NULL, NULL,
+                                             &base_fsp, NULL, NULL);
+               if (!NT_STATUS_IS_OK(status)) {
+                       DEBUG(10, ("create_file_unixpath for base %s failed: "
+                                  "%s\n", base, nt_errstr(status)));
+                       goto fail;
+               }
+       }
+
        /*
         * If it's a request for a directory open, deal with it separately.
         */
 
        if (create_options & FILE_DIRECTORY_FILE) {
 
+               if (create_options & FILE_NON_DIRECTORY_FILE) {
+                       status = NT_STATUS_INVALID_PARAMETER;
+                       goto fail;
+               }
+
                /* Can't open a temp directory. IFS kit test. */
                if (file_attributes & FILE_ATTRIBUTE_TEMPORARY) {
                        status = NT_STATUS_INVALID_PARAMETER;
@@ -2601,23 +2782,22 @@ NTSTATUS create_file_unixpath(connection_struct *conn,
                uint32_t sec_info_sent = ALL_SECURITY_INFORMATION;
                uint32_t saved_access_mask = fsp->access_mask;
 
-               if (sd->owner_sid==0) {
+               if (sd->owner_sid == NULL) {
                        sec_info_sent &= ~OWNER_SECURITY_INFORMATION;
                }
-               if (sd->group_sid==0) {
+               if (sd->group_sid == NULL) {
                        sec_info_sent &= ~GROUP_SECURITY_INFORMATION;
                }
-               if (sd->sacl==0) {
+               if (sd->sacl == NULL) {
                        sec_info_sent &= ~SACL_SECURITY_INFORMATION;
                }
-               if (sd->dacl==0) {
+               if (sd->dacl == NULL) {
                        sec_info_sent &= ~DACL_SECURITY_INFORMATION;
                }
 
                fsp->access_mask = FILE_GENERIC_ALL;
 
-               status = SMB_VFS_FSET_NT_ACL(
-                       fsp, fsp->fh->fd, sec_info_sent, sd);
+               status = SMB_VFS_FSET_NT_ACL(fsp, sec_info_sent, sd);
 
                fsp->access_mask = saved_access_mask;
 
@@ -2662,12 +2842,27 @@ NTSTATUS create_file_unixpath(connection_struct *conn,
 
        DEBUG(10, ("create_file: info=%d\n", info));
 
+       /*
+        * Set fsp->base_fsp late enough that we can't "goto fail" anymore. In
+        * the fail: branch we call close_file(fsp, ERROR_CLOSE) which would
+        * also close fsp->base_fsp which we have to also do explicitly in
+        * this routine here, as not in all "goto fail:" we have the fsp set
+        * up already to be initialized with the base_fsp.
+        */
+
+       fsp->base_fsp = base_fsp;
+
        *result = fsp;
        if (pinfo != NULL) {
                *pinfo = info;
        }
        if (psbuf != NULL) {
-               *psbuf = sbuf;
+               if ((fsp->fh == NULL) || (fsp->fh->fd == -1)) {
+                       *psbuf = sbuf;
+               }
+               else {
+                       SMB_VFS_FSTAT(fsp, psbuf);
+               }
        }
        return NT_STATUS_OK;
 
@@ -2678,6 +2873,10 @@ NTSTATUS create_file_unixpath(connection_struct *conn,
                close_file(fsp, ERROR_CLOSE);
                fsp = NULL;
        }
+       if (base_fsp != NULL) {
+               close_file(base_fsp, ERROR_CLOSE);
+               base_fsp = NULL;
+       }
        return status;
 }
 
@@ -2699,7 +2898,6 @@ NTSTATUS create_file(connection_struct *conn,
                     int *pinfo,
                     SMB_STRUCT_STAT *psbuf)
 {
-       TALLOC_CTX *frame = talloc_stackframe();
        struct case_semantics_state *case_state = NULL;
        SMB_STRUCT_STAT sbuf;
        int info = FILE_WAS_OPENED;
@@ -2806,19 +3004,18 @@ NTSTATUS create_file(connection_struct *conn,
                        status = NT_STATUS_NO_MEMORY;
                        goto fail;
                }
-       } else {
-               /*
-                * Check to see if this is a mac fork of some kind.
-                */
+       }
 
-               if (is_ntfs_stream_name(fname)) {
-                       enum FAKE_FILE_TYPE fake_file_type;
+       /*
+        * Check to see if this is a mac fork of some kind.
+        */
 
-                       fake_file_type = is_fake_file(fname);
+       if (is_ntfs_stream_name(fname)) {
+               enum FAKE_FILE_TYPE fake_file_type;
 
-                       if (fake_file_type == FAKE_FILE_TYPE_NONE) {
-                               return NT_STATUS_OBJECT_PATH_NOT_FOUND;
-                       }
+               fake_file_type = is_fake_file(fname);
+
+               if (fake_file_type != FAKE_FILE_TYPE_NONE) {
 
                        /*
                         * Here we go! support for changing the disk quotas
@@ -2837,6 +3034,7 @@ NTSTATUS create_file(connection_struct *conn,
                                goto fail;
                        }
 
+                       ZERO_STRUCT(sbuf);
                        goto done;
                }
        }
@@ -2881,6 +3079,8 @@ NTSTATUS create_file(connection_struct *conn,
                fname = converted_fname;
        }
 
+       TALLOC_FREE(case_state);
+
        /* All file access must go through check_name() */
 
        status = check_name(conn, fname);
@@ -2908,7 +3108,6 @@ NTSTATUS create_file(connection_struct *conn,
        if (psbuf != NULL) {
                *psbuf = sbuf;
        }
-       TALLOC_FREE(frame);
        return NT_STATUS_OK;
 
  fail:
@@ -2918,6 +3117,5 @@ NTSTATUS create_file(connection_struct *conn,
                close_file(fsp, ERROR_CLOSE);
                fsp = NULL;
        }
-       TALLOC_FREE(frame);
        return status;
 }
index 961abd277b4384c841c9358e584a234726125b71..420aa94fe6998eeb5ccdb1ec36d33d901954deb5 100644 (file)
@@ -181,7 +181,7 @@ bool remove_oplock(files_struct *fsp)
        struct share_mode_lock *lck;
 
        /* Remove the oplock flag from the sharemode. */
-       lck = get_share_mode_lock(NULL, fsp->file_id, NULL, NULL);
+       lck = get_share_mode_lock(talloc_tos(), fsp->file_id, NULL, NULL);
        if (lck == NULL) {
                DEBUG(0,("remove_oplock: failed to lock share entry for "
                         "file %s\n", fsp->fsp_name ));
@@ -206,7 +206,7 @@ bool downgrade_oplock(files_struct *fsp)
        bool ret;
        struct share_mode_lock *lck;
 
-       lck = get_share_mode_lock(NULL, fsp->file_id, NULL, NULL);
+       lck = get_share_mode_lock(talloc_tos(), fsp->file_id, NULL, NULL);
        if (lck == NULL) {
                DEBUG(0,("downgrade_oplock: failed to lock share entry for "
                         "file %s\n", fsp->fsp_name ));
@@ -252,7 +252,7 @@ static char *new_break_smb_message(TALLOC_CTX *mem_ctx,
        }
 
        memset(result,'\0',smb_size);
-       set_message(result,8,0,True);
+       srv_set_message(result,8,0,true);
        SCVAL(result,smb_com,SMBlockingX);
        SSVAL(result,smb_tid,fsp->conn->cnum);
        SSVAL(result,smb_pid,0xFFFF);
@@ -449,8 +449,10 @@ static void process_oplock_async_level2_break_message(struct messaging_context *
        sign_state = srv_oplock_set_signing(False);
 
        show_msg(break_msg);
-       if (!send_smb(smbd_server_fd(), break_msg)) {
-               exit_server_cleanly("oplock_break: send_smb failed.");
+       if (!srv_send_smb(smbd_server_fd(),
+                       break_msg,
+                       IS_CONN_ENCRYPTED(fsp->conn))) {
+               exit_server_cleanly("oplock_break: srv_send_smb failed.");
        }
 
        /* Restore the sign state to what it was. */
@@ -554,8 +556,10 @@ static void process_oplock_break_message(struct messaging_context *msg_ctx,
        sign_state = srv_oplock_set_signing(False);
 
        show_msg(break_msg);
-       if (!send_smb(smbd_server_fd(), break_msg)) {
-               exit_server_cleanly("oplock_break: send_smb failed.");
+       if (!srv_send_smb(smbd_server_fd(),
+                       break_msg,
+                       IS_CONN_ENCRYPTED(fsp->conn))) {
+               exit_server_cleanly("oplock_break: srv_send_smb failed.");
        }
 
        /* Restore the sign state to what it was. */
@@ -631,8 +635,10 @@ static void process_kernel_oplock_break(struct messaging_context *msg_ctx,
        sign_state = srv_oplock_set_signing(False);
 
        show_msg(break_msg);
-       if (!send_smb(smbd_server_fd(), break_msg)) {
-               exit_server_cleanly("oplock_break: send_smb failed.");
+       if (!srv_send_smb(smbd_server_fd(),
+                       break_msg,
+                       IS_CONN_ENCRYPTED(fsp->conn))) {
+               exit_server_cleanly("oplock_break: srv_send_smb failed.");
        }
 
        /* Restore the sign state to what it was. */
@@ -751,7 +757,7 @@ void release_level_2_oplocks_on_change(files_struct *fsp)
        if (!LEVEL_II_OPLOCK_TYPE(fsp->oplock_type))
                return;
 
-       lck = get_share_mode_lock(NULL, fsp->file_id, NULL, NULL);
+       lck = get_share_mode_lock(talloc_tos(), fsp->file_id, NULL, NULL);
        if (lck == NULL) {
                DEBUG(0,("release_level_2_oplocks_on_change: failed to lock "
                         "share mode entry for file %s.\n", fsp->fsp_name ));
index 086f105b892e2d4d3a0fb07d7ec73dfe5c41468b..fa7cb42bc6d9ca4bcb17e617ad0a35ef01fa755e 100644 (file)
@@ -93,17 +93,27 @@ static void set_capability(unsigned capability)
                return;
        }
 
-       data.effective |= (1<<capability);
+       if (0 == (data.effective & (1<<capability))) {
+               data.effective |= (1<<capability);
 
-       if (capset(&header, &data) == -1) {
-               DEBUG(3,("Unable to set %d capability (%s)\n", 
-                        capability, strerror(errno)));
+               if (capset(&header, &data) == -1) {
+                       DEBUG(3,("Unable to set %d capability (%s)\n", 
+                                capability, strerror(errno)));
+               }
        }
 }
 
 /*
- Call to set the kernel lease signal handler
-*/
+ * public function to get linux lease capability. Needed by some VFS modules (eg. gpfs.c)
+ */
+void linux_set_lease_capability(void)
+{
+       set_capability(CAP_LEASE);
+}
+
+/* 
+ * Call to set the kernel lease signal handler
+ */
 int linux_set_lease_sighandler(int fd)
 {
         if (fcntl(fd, F_SETSIG, RT_SIGNAL_LEASE) == -1) {
@@ -164,7 +174,7 @@ static files_struct *linux_oplock_receive_message(fd_set *fds)
 
 static bool linux_set_kernel_oplock(files_struct *fsp, int oplock_type)
 {
-       if ( SMB_VFS_LINUX_SETLEASE(fsp,fsp->fh->fd, F_WRLCK) == -1) {
+       if ( SMB_VFS_LINUX_SETLEASE(fsp, F_WRLCK) == -1) {
                DEBUG(3,("linux_set_kernel_oplock: Refused oplock on file %s, "
                         "fd = %d, file_id = %s. (%s)\n",
                         fsp->fsp_name, fsp->fh->fd, 
@@ -202,7 +212,7 @@ static void linux_release_kernel_oplock(files_struct *fsp)
        /*
         * Remove the kernel oplock on this file.
         */
-       if ( SMB_VFS_LINUX_SETLEASE(fsp,fsp->fh->fd, F_UNLCK) == -1) {
+       if ( SMB_VFS_LINUX_SETLEASE(fsp, F_UNLCK) == -1) {
                if (DEBUGLVL(0)) {
                        dbgtext("linux_release_kernel_oplock: Error when "
                                "removing kernel oplock on file " );
index b3005ba0824b4bdab83ebdca4305f098ab48191b..85e1ccf0a7f27c7fa365205475517f666ef06f65 100644 (file)
@@ -759,6 +759,7 @@ bool authorise_login(int snum, fstring user, DATA_BLOB password,
        if (!ok) {
                char *auser;
                char *user_list = NULL;
+               char *saveptr;
 
                if ( session_userlist )
                        user_list = SMB_STRDUP(session_userlist);
@@ -768,8 +769,9 @@ bool authorise_login(int snum, fstring user, DATA_BLOB password,
                if (!user_list)
                        return(False);
 
-               for (auser=strtok(user_list,LIST_SEP); !ok && auser;
-                    auser = strtok(NULL,LIST_SEP)) {
+               for (auser = strtok_r(user_list, LIST_SEP, &saveptr);
+                    !ok && auser;
+                    auser = strtok_r(NULL, LIST_SEP, &saveptr)) {
                        fstring user2;
                        fstrcpy(user2,auser);
                        if (!user_ok(user2,snum))
@@ -792,6 +794,7 @@ bool authorise_login(int snum, fstring user, DATA_BLOB password,
                TALLOC_CTX *ctx = talloc_tos();
                char *auser;
                char *user_list = talloc_strdup(ctx, lp_username(snum));
+               char *saveptr;
 
                if (!user_list) {
                        goto check_guest;
@@ -806,8 +809,9 @@ bool authorise_login(int snum, fstring user, DATA_BLOB password,
                        goto check_guest;
                }
 
-               for (auser=strtok(user_list,LIST_SEP); auser && !ok;
-                    auser = strtok(NULL,LIST_SEP)) {
+               for (auser = strtok_r(user_list, LIST_SEP, &saveptr);
+                    auser && !ok;
+                    auser = strtok_r(NULL, LIST_SEP, &saveptr)) {
                        if (*auser == '@') {
                                auser = validate_group(auser+1,password,snum);
                                if (auser) {
@@ -837,9 +841,11 @@ bool authorise_login(int snum, fstring user, DATA_BLOB password,
 
        /* check for a normal guest connection */
        if (!ok && GUEST_OK(snum)) {
+               struct passwd *guest_pw;
                fstring guestname;
                fstrcpy(guestname,lp_guestaccount());
-               if (Get_Pwnam(guestname)) {
+               guest_pw = Get_Pwnam_alloc(talloc_tos(), guestname);
+               if (guest_pw != NULL) {
                        fstrcpy(user,guestname);
                        ok = True;
                        DEBUG(3,("authorise_login: ACCEPTED: guest account "
@@ -848,6 +854,7 @@ bool authorise_login(int snum, fstring user, DATA_BLOB password,
                        DEBUG(0,("authorise_login: Invalid guest account "
                                 "%s??\n",guestname));
                }
+               TALLOC_FREE(guest_pw);
                *guest = True;
        }
 
index 0ddc00c7676d06dfc0fd1d0369cff91ed7c82a1a..6b4b83d97dd446006a2c5598a426d403f8eba189 100644 (file)
@@ -291,7 +291,7 @@ void reply_pipe_read_and_X(struct smb_request *req)
                return;
        }
 
-       set_message((char *)req->outbuf, 12, nread, False);
+       srv_set_message((char *)req->outbuf, 12, nread, False);
   
        SSVAL(req->outbuf,smb_vwv5,nread);
        SSVAL(req->outbuf,smb_vwv6,smb_offset(data,req->outbuf));
index ccfed69721b541c717e5ccb7a996cea24f96eede..f60329a039a95b0c2a2d2550853205aa4afb5bc3 100644 (file)
@@ -229,7 +229,7 @@ static void store_inheritance_attributes(files_struct *fsp, canon_ace *file_ace_
        if (!pai_protected && num_inherited_entries(file_ace_list) == 0 && num_inherited_entries(dir_ace_list) == 0) {
                /* Instead just remove the attribute if it exists. */
                if (fsp->fh->fd != -1)
-                       SMB_VFS_FREMOVEXATTR(fsp, fsp->fh->fd, SAMBA_POSIX_INHERITANCE_EA_NAME);
+                       SMB_VFS_FREMOVEXATTR(fsp, SAMBA_POSIX_INHERITANCE_EA_NAME);
                else
                        SMB_VFS_REMOVEXATTR(fsp->conn, fsp->fsp_name, SAMBA_POSIX_INHERITANCE_EA_NAME);
                return;
@@ -238,7 +238,7 @@ static void store_inheritance_attributes(files_struct *fsp, canon_ace *file_ace_
        pai_buf = create_pai_buf(file_ace_list, dir_ace_list, pai_protected, &store_size);
 
        if (fsp->fh->fd != -1)
-               ret = SMB_VFS_FSETXATTR(fsp, fsp->fh->fd, SAMBA_POSIX_INHERITANCE_EA_NAME,
+               ret = SMB_VFS_FSETXATTR(fsp, SAMBA_POSIX_INHERITANCE_EA_NAME,
                                pai_buf, store_size, 0);
        else
                ret = SMB_VFS_SETXATTR(fsp->conn,fsp->fsp_name, SAMBA_POSIX_INHERITANCE_EA_NAME,
@@ -430,7 +430,7 @@ static struct pai_val *create_pai_val(char *buf, size_t size)
  Load the user.SAMBA_PAI attribute.
 ************************************************************************/
 
-static struct pai_val *load_inherited_info(files_struct *fsp)
+static struct pai_val *fload_inherited_info(files_struct *fsp)
 {
        char *pai_buf;
        size_t pai_buf_size = 1024;
@@ -445,7 +445,7 @@ static struct pai_val *load_inherited_info(files_struct *fsp)
 
        do {
                if (fsp->fh->fd != -1)
-                       ret = SMB_VFS_FGETXATTR(fsp, fsp->fh->fd, SAMBA_POSIX_INHERITANCE_EA_NAME,
+                       ret = SMB_VFS_FGETXATTR(fsp, SAMBA_POSIX_INHERITANCE_EA_NAME,
                                        pai_buf, pai_buf_size);
                else
                        ret = SMB_VFS_GETXATTR(fsp->conn,fsp->fsp_name,SAMBA_POSIX_INHERITANCE_EA_NAME,
@@ -490,6 +490,71 @@ static struct pai_val *load_inherited_info(files_struct *fsp)
        return paiv;
 }
 
+/************************************************************************
+ Load the user.SAMBA_PAI attribute.
+************************************************************************/
+
+static struct pai_val *load_inherited_info(const struct connection_struct *conn,
+                                          const char *fname)
+{
+       char *pai_buf;
+       size_t pai_buf_size = 1024;
+       struct pai_val *paiv = NULL;
+       ssize_t ret;
+
+       if (!lp_map_acl_inherit(SNUM(conn))) {
+               return NULL;
+       }
+
+       if ((pai_buf = (char *)SMB_MALLOC(pai_buf_size)) == NULL) {
+               return NULL;
+       }
+
+       do {
+               ret = SMB_VFS_GETXATTR(conn, fname,
+                                      SAMBA_POSIX_INHERITANCE_EA_NAME,
+                                      pai_buf, pai_buf_size);
+
+               if (ret == -1) {
+                       if (errno != ERANGE) {
+                               break;
+                       }
+                       /* Buffer too small - enlarge it. */
+                       pai_buf_size *= 2;
+                       SAFE_FREE(pai_buf);
+                       if (pai_buf_size > 1024*1024) {
+                               return NULL; /* Limit malloc to 1mb. */
+                       }
+                       if ((pai_buf = (char *)SMB_MALLOC(pai_buf_size)) == NULL)
+                               return NULL;
+               }
+       } while (ret == -1);
+
+       DEBUG(10,("load_inherited_info: ret = %lu for file %s\n", (unsigned long)ret, fname));
+
+       if (ret == -1) {
+               /* No attribute or not supported. */
+#if defined(ENOATTR)
+               if (errno != ENOATTR)
+                       DEBUG(10,("load_inherited_info: Error %s\n", strerror(errno) ));
+#else
+               if (errno != ENOSYS)
+                       DEBUG(10,("load_inherited_info: Error %s\n", strerror(errno) ));
+#endif
+               SAFE_FREE(pai_buf);
+               return NULL;
+       }
+
+       paiv = create_pai_val(pai_buf, ret);
+
+       if (paiv && paiv->pai_protected) {
+               DEBUG(10,("load_inherited_info: ACL is protected for file %s\n", fname));
+       }
+
+       SAFE_FREE(pai_buf);
+       return paiv;
+}
+
 /****************************************************************************
  Functions to manipulate the internal ACE format.
 ****************************************************************************/
@@ -826,7 +891,7 @@ static bool nt4_compatible_acls(void)
 ****************************************************************************/
 
 static SEC_ACCESS map_canon_ace_perms(int snum,
-                               int *pacl_type,
+                               enum security_ace_type *pacl_type,
                                mode_t perms,
                                bool directory_ace)
 {
@@ -999,20 +1064,21 @@ NTSTATUS unpack_nt_owners(int snum, uid_t *puser, gid_t *pgrp, uint32 security_i
  Ensure the enforced permissions for this share apply.
 ****************************************************************************/
 
-static void apply_default_perms(const files_struct *fsp, canon_ace *pace, mode_t type)
+static void apply_default_perms(const struct share_params *params,
+                               const bool is_directory, canon_ace *pace,
+                               mode_t type)
 {
-       int snum = SNUM(fsp->conn);
        mode_t and_bits = (mode_t)0;
        mode_t or_bits = (mode_t)0;
 
        /* Get the initial bits to apply. */
 
-       if (fsp->is_directory) {
-               and_bits = lp_dir_security_mask(snum);
-               or_bits = lp_force_dir_security_mode(snum);
+       if (is_directory) {
+               and_bits = lp_dir_security_mask(params->service);
+               or_bits = lp_force_dir_security_mode(params->service);
        } else {
-               and_bits = lp_security_mask(snum);
-               or_bits = lp_force_security_mode(snum);
+               and_bits = lp_security_mask(params->service);
+               or_bits = lp_force_security_mode(params->service);
        }
 
        /* Now bounce them into the S_USR space. */     
@@ -1020,7 +1086,7 @@ static void apply_default_perms(const files_struct *fsp, canon_ace *pace, mode_t
        case S_IRUSR:
                /* Ensure owner has read access. */
                pace->perms |= S_IRUSR;
-               if (fsp->is_directory)
+               if (is_directory)
                        pace->perms |= (S_IWUSR|S_IXUSR);
                and_bits = unix_perms_to_acl_perms(and_bits, S_IRUSR, S_IWUSR, S_IXUSR);
                or_bits = unix_perms_to_acl_perms(or_bits, S_IRUSR, S_IWUSR, S_IXUSR);
@@ -1076,7 +1142,8 @@ static bool uid_entry_in_group( canon_ace *uid_ace, canon_ace *group_ace )
 ****************************************************************************/
 
 static bool ensure_canon_entry_valid(canon_ace **pp_ace,
-                                                       const files_struct *fsp,
+                                    const struct share_params *params,
+                                    const bool is_directory,
                                                        const DOM_SID *pfile_owner_sid,
                                                        const DOM_SID *pfile_grp_sid,
                                                        const SMB_STRUCT_STAT *pst,
@@ -1092,7 +1159,7 @@ static bool ensure_canon_entry_valid(canon_ace **pp_ace,
                if (pace->type == SMB_ACL_USER_OBJ) {
 
                        if (setting_acl)
-                               apply_default_perms(fsp, pace, S_IRUSR);
+                               apply_default_perms(params, is_directory, pace, S_IRUSR);
                        got_user = True;
 
                } else if (pace->type == SMB_ACL_GROUP_OBJ) {
@@ -1102,7 +1169,7 @@ static bool ensure_canon_entry_valid(canon_ace **pp_ace,
                         */
 
                        if (setting_acl)
-                               apply_default_perms(fsp, pace, S_IRGRP);
+                               apply_default_perms(params, is_directory, pace, S_IRGRP);
                        got_grp = True;
 
                } else if (pace->type == SMB_ACL_OTHER) {
@@ -1112,7 +1179,7 @@ static bool ensure_canon_entry_valid(canon_ace **pp_ace,
                         */
 
                        if (setting_acl)
-                               apply_default_perms(fsp, pace, S_IROTH);
+                               apply_default_perms(params, is_directory, pace, S_IROTH);
                        got_other = True;
                        pace_other = pace;
                }
@@ -1155,7 +1222,7 @@ static bool ensure_canon_entry_valid(canon_ace **pp_ace,
                                        pace->perms = 0;
                        }
 
-                       apply_default_perms(fsp, pace, S_IRUSR);
+                       apply_default_perms(params, is_directory, pace, S_IRUSR);
                } else {
                        pace->perms = unix_perms_to_acl_perms(pst->st_mode, S_IRUSR, S_IWUSR, S_IXUSR);
                }
@@ -1181,7 +1248,7 @@ static bool ensure_canon_entry_valid(canon_ace **pp_ace,
                                pace->perms = pace_other->perms;
                        else
                                pace->perms = 0;
-                       apply_default_perms(fsp, pace, S_IRGRP);
+                       apply_default_perms(params, is_directory, pace, S_IRGRP);
                } else {
                        pace->perms = unix_perms_to_acl_perms(pst->st_mode, S_IRGRP, S_IWGRP, S_IXGRP);
                }
@@ -1203,7 +1270,7 @@ static bool ensure_canon_entry_valid(canon_ace **pp_ace,
                pace->attr = ALLOW_ACE;
                if (setting_acl) {
                        pace->perms = 0;
-                       apply_default_perms(fsp, pace, S_IROTH);
+                       apply_default_perms(params, is_directory, pace, S_IROTH);
                } else
                        pace->perms = unix_perms_to_acl_perms(pst->st_mode, S_IROTH, S_IWOTH, S_IXOTH);
 
@@ -1341,12 +1408,12 @@ static bool create_canon_ace_lists(files_struct *fsp, SMB_STRUCT_STAT *pst,
 
                                psa1->flags |= (psa2->flags & (SEC_ACE_FLAG_CONTAINER_INHERIT|SEC_ACE_FLAG_OBJECT_INHERIT));
                                psa2->flags &= ~(SEC_ACE_FLAG_CONTAINER_INHERIT|SEC_ACE_FLAG_OBJECT_INHERIT);
-                               
+
                        } else if (psa2->flags & SEC_ACE_FLAG_INHERIT_ONLY) {
 
                                psa2->flags |= (psa1->flags & (SEC_ACE_FLAG_CONTAINER_INHERIT|SEC_ACE_FLAG_OBJECT_INHERIT));
                                psa1->flags &= ~(SEC_ACE_FLAG_CONTAINER_INHERIT|SEC_ACE_FLAG_OBJECT_INHERIT);
-                               
+
                        }
                }
        }
@@ -1407,10 +1474,22 @@ static bool create_canon_ace_lists(files_struct *fsp, SMB_STRUCT_STAT *pst,
 
                } else if (sid_to_uid( &current_ace->trustee, &current_ace->unix_ug.uid)) {
                        current_ace->owner_type = UID_ACE;
-                       current_ace->type = SMB_ACL_USER;
+                       /* If it's the owning user, this is a user_obj, not
+                        * a user. */
+                       if (current_ace->unix_ug.uid == pst->st_uid) {
+                               current_ace->type = SMB_ACL_USER_OBJ;
+                       } else {
+                               current_ace->type = SMB_ACL_USER;
+                       }
                } else if (sid_to_gid( &current_ace->trustee, &current_ace->unix_ug.gid)) {
                        current_ace->owner_type = GID_ACE;
-                       current_ace->type = SMB_ACL_GROUP;
+                       /* If it's the primary group, this is a group_obj, not
+                        * a group. */
+                       if (current_ace->unix_ug.gid == pst->st_gid) {
+                               current_ace->type = SMB_ACL_GROUP_OBJ;
+                       } else {
+                               current_ace->type = SMB_ACL_GROUP;
+                       }
                } else {
                        /*
                         * Silently ignore map failures in non-mappable SIDs (NT Authority, BUILTIN etc).
@@ -2014,7 +2093,7 @@ static bool unpack_canon_ace(files_struct *fsp,
 
        pst->st_mode = create_default_mode(fsp, False);
 
-       if (!ensure_canon_entry_valid(&file_ace, fsp, pfile_owner_sid, pfile_grp_sid, pst, True)) {
+       if (!ensure_canon_entry_valid(&file_ace, fsp->conn->params, fsp->is_directory, pfile_owner_sid, pfile_grp_sid, pst, True)) {
                free_canon_ace_list(file_ace);
                free_canon_ace_list(dir_ace);
                return False;
@@ -2030,7 +2109,7 @@ static bool unpack_canon_ace(files_struct *fsp,
 
        pst->st_mode = create_default_mode(fsp, True);
 
-       if (dir_ace && !ensure_canon_entry_valid(&dir_ace, fsp, pfile_owner_sid, pfile_grp_sid, pst, True)) {
+       if (dir_ace && !ensure_canon_entry_valid(&dir_ace, fsp->conn->params, fsp->is_directory, pfile_owner_sid, pfile_grp_sid, pst, True)) {
                free_canon_ace_list(file_ace);
                free_canon_ace_list(dir_ace);
                return False;
@@ -2108,10 +2187,11 @@ static void arrange_posix_perms(const char *filename, canon_ace **pp_list_head)
  Create a linked list of canonical ACE entries.
 ****************************************************************************/
 
-static canon_ace *canonicalise_acl( const files_struct *fsp, SMB_ACL_T posix_acl, SMB_STRUCT_STAT *psbuf,
-                                       const DOM_SID *powner, const DOM_SID *pgroup, struct pai_val *pal, SMB_ACL_TYPE_T the_acl_type)
+static canon_ace *canonicalise_acl(struct connection_struct *conn,
+                                  const char *fname, SMB_ACL_T posix_acl,
+                                  const SMB_STRUCT_STAT *psbuf,
+                                  const DOM_SID *powner, const DOM_SID *pgroup, struct pai_val *pal, SMB_ACL_TYPE_T the_acl_type)
 {
-       connection_struct *conn = fsp->conn;
        mode_t acl_mask = (S_IRUSR|S_IWUSR|S_IXUSR);
        canon_ace *list_head = NULL;
        canon_ace *ace = NULL;
@@ -2226,7 +2306,9 @@ static canon_ace *canonicalise_acl( const files_struct *fsp, SMB_ACL_T posix_acl
         * This next call will ensure we have at least a user/group/world set.
         */
 
-       if (!ensure_canon_entry_valid(&list_head, fsp, powner, pgroup, psbuf, False))
+       if (!ensure_canon_entry_valid(&list_head, conn->params,
+                                     S_ISDIR(psbuf->st_mode), powner, pgroup,
+                                     psbuf, False))
                goto fail;
 
        /*
@@ -2252,7 +2334,7 @@ static canon_ace *canonicalise_acl( const files_struct *fsp, SMB_ACL_T posix_acl
                }
        }
 
-       arrange_posix_perms(fsp->fsp_name,&list_head );
+       arrange_posix_perms(fname,&list_head );
 
        print_canon_ace_list( "canonicalise_acl: ace entries after arrange", list_head );
 
@@ -2503,7 +2585,7 @@ static bool set_canon_ace_list(files_struct *fsp, canon_ace *the_ace, bool defau
                        }
                }
        } else {
-               if (SMB_VFS_SYS_ACL_SET_FD(fsp, fsp->fh->fd, the_acl) == -1) {
+               if (SMB_VFS_SYS_ACL_SET_FD(fsp, the_acl) == -1) {
                        /*
                         * Some systems allow all the above calls and only fail with no ACL support
                         * when attempting to apply the acl. HPUX with HFS is an example of this. JRA.
@@ -2519,7 +2601,7 @@ static bool set_canon_ace_list(files_struct *fsp, canon_ace *the_ace, bool defau
                                        fsp->fsp_name ));
 
                                become_root();
-                               sret = SMB_VFS_SYS_ACL_SET_FD(fsp, fsp->fh->fd, the_acl);
+                               sret = SMB_VFS_SYS_ACL_SET_FD(fsp, the_acl);
                                unbecome_root();
                                if (sret == 0) {
                                        ret = True;
@@ -2719,6 +2801,7 @@ static size_t merge_default_aces( SEC_ACE *nt_ace_list, size_t num_aces)
 
        return num_aces;
 }
+
 /****************************************************************************
  Reply to query a security descriptor from an fsp. If it succeeds it allocates
  the space for the return elements and returns the size needed to return the
@@ -2726,11 +2809,15 @@ static size_t merge_default_aces( SEC_ACE *nt_ace_list, size_t num_aces)
  the UNIX style get ACL.
 ****************************************************************************/
 
-NTSTATUS get_nt_acl(files_struct *fsp, uint32 security_info, SEC_DESC **ppdesc)
+static NTSTATUS posix_get_nt_acl_common(struct connection_struct *conn,
+                                     const char *name,
+                                     const SMB_STRUCT_STAT *sbuf,
+                                     struct pai_val *pal,
+                                     SMB_ACL_T posix_acl,
+                                     SMB_ACL_T def_acl,
+                                     uint32_t security_info,
+                                     SEC_DESC **ppdesc)
 {
-       connection_struct *conn = fsp->conn;
-       SMB_STRUCT_STAT sbuf;
-       SEC_ACE *nt_ace_list = NULL;
        DOM_SID owner_sid;
        DOM_SID group_sid;
        size_t sd_size = 0;
@@ -2738,57 +2825,12 @@ NTSTATUS get_nt_acl(files_struct *fsp, uint32 security_info, SEC_DESC **ppdesc)
        size_t num_acls = 0;
        size_t num_def_acls = 0;
        size_t num_aces = 0;
-       SMB_ACL_T posix_acl = NULL;
-       SMB_ACL_T def_acl = NULL;
        canon_ace *file_ace = NULL;
        canon_ace *dir_ace = NULL;
+       SEC_ACE *nt_ace_list = NULL;
        size_t num_profile_acls = 0;
-       struct pai_val *pal = NULL;
        SEC_DESC *psd = NULL;
 
-       *ppdesc = NULL;
-
-       DEBUG(10,("get_nt_acl: called for file %s\n", fsp->fsp_name ));
-
-       if(fsp->is_directory || fsp->fh->fd == -1) {
-
-               /* Get the stat struct for the owner info. */
-               if(SMB_VFS_STAT(fsp->conn,fsp->fsp_name, &sbuf) != 0) {
-                       return map_nt_error_from_unix(errno);
-               }
-               /*
-                * Get the ACL from the path.
-                */
-
-               posix_acl = SMB_VFS_SYS_ACL_GET_FILE(conn, fsp->fsp_name, SMB_ACL_TYPE_ACCESS);
-
-               /*
-                * If it's a directory get the default POSIX ACL.
-                */
-
-               if(fsp->is_directory) {
-                       def_acl = SMB_VFS_SYS_ACL_GET_FILE(conn, fsp->fsp_name, SMB_ACL_TYPE_DEFAULT);
-                       def_acl = free_empty_sys_acl(conn, def_acl);
-               }
-
-       } else {
-
-               /* Get the stat struct for the owner info. */
-               if(SMB_VFS_FSTAT(fsp,fsp->fh->fd,&sbuf) != 0) {
-                       return map_nt_error_from_unix(errno);
-               }
-               /*
-                * Get the ACL from the fd.
-                */
-               posix_acl = SMB_VFS_SYS_ACL_GET_FD(fsp, fsp->fh->fd);
-       }
-
-       DEBUG(5,("get_nt_acl : file ACL %s, directory ACL %s\n",
-                       posix_acl ? "present" :  "absent",
-                       def_acl ? "present" :  "absent" ));
-
-       pal = load_inherited_info(fsp);
-
        /*
         * Get the owner, group and world SIDs.
         */
@@ -2799,7 +2841,7 @@ NTSTATUS get_nt_acl(files_struct *fsp, uint32 security_info, SEC_DESC **ppdesc)
                sid_copy(&group_sid, &global_sid_Builtin_Users);
                num_profile_acls = 2;
        } else {
-               create_file_sids(&sbuf, &owner_sid, &group_sid);
+               create_file_sids(sbuf, &owner_sid, &group_sid);
        }
 
        if ((security_info & DACL_SECURITY_INFORMATION) && !(security_info & PROTECTED_DACL_SECURITY_INFORMATION)) {
@@ -2814,19 +2856,23 @@ NTSTATUS get_nt_acl(files_struct *fsp, uint32 security_info, SEC_DESC **ppdesc)
                 */
 
                /* Create the canon_ace lists. */
-               file_ace = canonicalise_acl( fsp, posix_acl, &sbuf, &owner_sid, &group_sid, pal, SMB_ACL_TYPE_ACCESS );
+               file_ace = canonicalise_acl(conn, name, posix_acl, sbuf,
+                                           &owner_sid, &group_sid, pal,
+                                           SMB_ACL_TYPE_ACCESS);
 
                /* We must have *some* ACLS. */
        
                if (count_canon_ace_list(file_ace) == 0) {
-                       DEBUG(0,("get_nt_acl : No ACLs on file (%s) !\n", fsp->fsp_name ));
+                       DEBUG(0,("get_nt_acl : No ACLs on file (%s) !\n", name));
                        goto done;
                }
 
-               if (fsp->is_directory && def_acl) {
-                       dir_ace = canonicalise_acl(fsp, def_acl, &sbuf,
-                                       &global_sid_Creator_Owner,
-                                       &global_sid_Creator_Group, pal, SMB_ACL_TYPE_DEFAULT );
+               if (S_ISDIR(sbuf->st_mode) && def_acl) {
+                       dir_ace = canonicalise_acl(conn, name, def_acl,
+                                                  sbuf,
+                                                  &global_sid_Creator_Owner,
+                                                  &global_sid_Creator_Group,
+                                                  pal, SMB_ACL_TYPE_DEFAULT);
                }
 
                /*
@@ -2835,7 +2881,7 @@ NTSTATUS get_nt_acl(files_struct *fsp, uint32 security_info, SEC_DESC **ppdesc)
 
                {
                        canon_ace *ace;
-                       int nt_acl_type;
+                       enum security_ace_type nt_acl_type;
                        int i;
 
                        if (nt4_compatible_acls() && dir_ace) {
@@ -2910,7 +2956,7 @@ NTSTATUS get_nt_acl(files_struct *fsp, uint32 security_info, SEC_DESC **ppdesc)
                                acc = map_canon_ace_perms(SNUM(conn),
                                                &nt_acl_type,
                                                ace->perms,
-                                               fsp->is_directory);
+                                               S_ISDIR(sbuf->st_mode));
                                init_sec_ace(&nt_ace_list[num_aces++],
                                        &ace->trustee,
                                        nt_acl_type,
@@ -2939,7 +2985,7 @@ NTSTATUS get_nt_acl(files_struct *fsp, uint32 security_info, SEC_DESC **ppdesc)
                                acc = map_canon_ace_perms(SNUM(conn),
                                                &nt_acl_type,
                                                ace->perms,
-                                               fsp->is_directory);
+                                               S_ISDIR(sbuf->st_mode));
                                init_sec_ace(&nt_ace_list[num_aces++],
                                        &ace->trustee,
                                        nt_acl_type,
@@ -3028,6 +3074,69 @@ NTSTATUS get_nt_acl(files_struct *fsp, uint32 security_info, SEC_DESC **ppdesc)
        return NT_STATUS_OK;
 }
 
+NTSTATUS posix_fget_nt_acl(struct files_struct *fsp, uint32_t security_info,
+                          SEC_DESC **ppdesc)
+{
+       SMB_STRUCT_STAT sbuf;
+       SMB_ACL_T posix_acl = NULL;
+       struct pai_val *pal;
+
+       *ppdesc = NULL;
+
+       DEBUG(10,("posix_fget_nt_acl: called for file %s\n", fsp->fsp_name ));
+
+       /* can it happen that fsp_name == NULL ? */
+       if (fsp->is_directory ||  fsp->fh->fd == -1) {
+               return posix_get_nt_acl(fsp->conn, fsp->fsp_name,
+                                       security_info, ppdesc);
+       }
+
+       /* Get the stat struct for the owner info. */
+       if(SMB_VFS_FSTAT(fsp, &sbuf) != 0) {
+               return map_nt_error_from_unix(errno);
+       }
+
+       /* Get the ACL from the fd. */
+       posix_acl = SMB_VFS_SYS_ACL_GET_FD(fsp);
+
+       pal = fload_inherited_info(fsp);
+
+       return posix_get_nt_acl_common(fsp->conn, fsp->fsp_name, &sbuf, pal,
+                                      posix_acl, NULL, security_info, ppdesc);
+}
+
+NTSTATUS posix_get_nt_acl(struct connection_struct *conn, const char *name,
+                         uint32_t security_info, SEC_DESC **ppdesc)
+{
+       SMB_STRUCT_STAT sbuf;
+       SMB_ACL_T posix_acl = NULL;
+       SMB_ACL_T def_acl = NULL;
+       struct pai_val *pal;
+
+       *ppdesc = NULL;
+
+       DEBUG(10,("posix_get_nt_acl: called for file %s\n", name ));
+
+       /* Get the stat struct for the owner info. */
+       if(SMB_VFS_STAT(conn, name, &sbuf) != 0) {
+               return map_nt_error_from_unix(errno);
+       }
+
+       /* Get the ACL from the path. */
+       posix_acl = SMB_VFS_SYS_ACL_GET_FILE(conn, name, SMB_ACL_TYPE_ACCESS);
+
+       /* If it's a directory get the default POSIX ACL. */
+       if(S_ISDIR(sbuf.st_mode)) {
+               def_acl = SMB_VFS_SYS_ACL_GET_FILE(conn, name, SMB_ACL_TYPE_DEFAULT);
+               def_acl = free_empty_sys_acl(conn, def_acl);
+       }
+
+       pal = load_inherited_info(conn, name);
+
+       return posix_get_nt_acl_common(conn, name, &sbuf, pal, posix_acl,
+                                      def_acl, security_info, ppdesc);
+}
+
 /****************************************************************************
  Try to chown a file. We will be able to chown it under the following conditions.
 
@@ -3097,7 +3206,7 @@ int try_chown(connection_struct *conn, const char *fname, uid_t uid, gid_t gid)
 
        become_root();
        /* Keep the current file gid the same. */
-       ret = SMB_VFS_FCHOWN(fsp, fsp->fh->fd, uid, (gid_t)-1);
+       ret = SMB_VFS_FCHOWN(fsp, uid, (gid_t)-1);
        unbecome_root();
 
        close_file_fchmod(fsp);
@@ -3105,57 +3214,8 @@ int try_chown(connection_struct *conn, const char *fname, uid_t uid, gid_t gid)
        return ret;
 }
 
-static NTSTATUS append_ugw_ace(files_struct *fsp,
-                       SMB_STRUCT_STAT *psbuf,
-                       mode_t unx_mode,
-                       int ugw,
-                       SEC_ACE *se)
-{
-       mode_t perms;
-       SEC_ACCESS acc;
-       int nt_acl_type;
-       DOM_SID trustee;
-
-       switch (ugw) {
-               case S_IRUSR:
-                       perms = unix_perms_to_acl_perms(unx_mode,
-                                                       S_IRUSR,
-                                                       S_IWUSR,
-                                                       S_IXUSR);
-                       uid_to_sid(&trustee, psbuf->st_uid );
-                       break;
-               case S_IRGRP:
-                       perms = unix_perms_to_acl_perms(unx_mode,
-                                                       S_IRGRP,
-                                                       S_IWGRP,
-                                                       S_IXGRP);
-                       gid_to_sid(&trustee, psbuf->st_gid );
-                       break;
-               case S_IROTH:
-                       perms = unix_perms_to_acl_perms(unx_mode,
-                                                       S_IROTH,
-                                                       S_IWOTH,
-                                                       S_IXOTH);
-                       sid_copy(&trustee, &global_sid_World);
-                       break;
-               default:
-                       return NT_STATUS_INVALID_PARAMETER;
-       }
-       acc = map_canon_ace_perms(SNUM(fsp->conn),
-                               &nt_acl_type,
-                               perms,
-                               fsp->is_directory);
-
-       init_sec_ace(se,
-               &trustee,
-               nt_acl_type,
-               acc,
-               0);
-       return NT_STATUS_OK;
-}
-
 /****************************************************************************
- If this is an
+ Take care of parent ACL inheritance.
 ****************************************************************************/
 
 static NTSTATUS append_parent_acl(files_struct *fsp,
@@ -3173,7 +3233,7 @@ static NTSTATUS append_parent_acl(files_struct *fsp,
        NTSTATUS status;
        int info;
        unsigned int i, j;
-       mode_t unx_mode;
+       bool is_dacl_protected = (psd->type & SE_DESC_DACL_PROTECTED);
 
        ZERO_STRUCT(sbuf);
 
@@ -3188,12 +3248,6 @@ static NTSTATUS append_parent_acl(files_struct *fsp,
                return NT_STATUS_NO_MEMORY;
        }
 
-       /* Create a default mode for u/g/w. */
-       unx_mode = unix_mode(fsp->conn,
-                       aARCH | (fsp->is_directory ? aDIR : 0),
-                       fsp->fsp_name,
-                       parent_name);
-
        status = open_directory(fsp->conn,
                                NULL,
                                parent_name,
@@ -3210,7 +3264,7 @@ static NTSTATUS append_parent_acl(files_struct *fsp,
                return status;
        }
 
-       status = SMB_VFS_GET_NT_ACL(parent_fsp, parent_fsp->fsp_name,
+       status = SMB_VFS_GET_NT_ACL(parent_fsp->conn, parent_fsp->fsp_name,
                                    DACL_SECURITY_INFORMATION, &parent_sd );
 
        close_file(parent_fsp, NORMAL_CLOSE);
@@ -3221,20 +3275,23 @@ static NTSTATUS append_parent_acl(files_struct *fsp,
 
        /*
         * Make room for potentially all the ACLs from
-        * the parent, plus the user/group/other triple.
+        * the parent. We used to add the ugw triple here,
+        * as we knew we were dealing with POSIX ACLs.
+        * We no longer need to do so as we can guarentee
+        * that a default ACL from the parent directory will
+        * be well formed for POSIX ACLs if it came from a
+        * POSIX ACL source, and if we're not writing to a
+        * POSIX ACL sink then we don't care if it's not well
+        * formed. JRA.
         */
 
-       num_aces += parent_sd->dacl->num_aces + 3;
+       num_aces += parent_sd->dacl->num_aces;
 
        if((new_ace = TALLOC_ZERO_ARRAY(mem_ctx, SEC_ACE,
                                        num_aces)) == NULL) {
                return NT_STATUS_NO_MEMORY;
        }
 
-       DEBUG(10,("append_parent_acl: parent ACL has %u entries. New "
-               "ACL has %u entries\n",
-               parent_sd->dacl->num_aces, num_aces ));
-
        /* Start by copying in all the given ACE entries. */
        for (i = 0; i < psd->dacl->num_aces; i++) {
                sec_ace_copy(&new_ace[i], &psd->dacl->aces[i]);
@@ -3245,49 +3302,95 @@ static NTSTATUS append_parent_acl(files_struct *fsp,
         * as that really only applies to newly created files. JRA.
         */
 
-        /*
-         * Append u/g/w.
-         */
-
-       status = append_ugw_ace(fsp, psbuf, unx_mode, S_IRUSR, &new_ace[i++]);
-       if (!NT_STATUS_IS_OK(status)) {
-               return status;
-       }
-       status = append_ugw_ace(fsp, psbuf, unx_mode, S_IRGRP, &new_ace[i++]);
-       if (!NT_STATUS_IS_OK(status)) {
-               return status;
-       }
-       status = append_ugw_ace(fsp, psbuf, unx_mode, S_IROTH, &new_ace[i++]);
-       if (!NT_STATUS_IS_OK(status)) {
-               return status;
-       }
-
        /* Finally append any inherited ACEs. */
        for (j = 0; j < parent_sd->dacl->num_aces; j++) {
                SEC_ACE *se = &parent_sd->dacl->aces[j];
-               uint32 i_flags = se->flags & (SEC_ACE_FLAG_OBJECT_INHERIT|
-                                       SEC_ACE_FLAG_CONTAINER_INHERIT|
-                                       SEC_ACE_FLAG_INHERIT_ONLY);
 
                if (fsp->is_directory) {
-                       if (i_flags == SEC_ACE_FLAG_OBJECT_INHERIT) {
-                               /* Should only apply to a file - ignore. */
+                       if (!(se->flags & SEC_ACE_FLAG_CONTAINER_INHERIT)) {
+                               /* Doesn't apply to a directory - ignore. */
+                               DEBUG(10,("append_parent_acl: directory %s "
+                                       "ignoring non container "
+                                       "inherit flags %u on ACE with sid %s "
+                                       "from parent %s\n",
+                                       fsp->fsp_name,
+                                       (unsigned int)se->flags,
+                                       sid_string_dbg(&se->trustee),
+                                       parent_name));
                                continue;
                        }
                } else {
-                       if ((i_flags & (SEC_ACE_FLAG_OBJECT_INHERIT|
-                                       SEC_ACE_FLAG_INHERIT_ONLY)) !=
-                                       SEC_ACE_FLAG_OBJECT_INHERIT) {
-                               /* Should not apply to a file - ignore. */
+                       if (!(se->flags & SEC_ACE_FLAG_OBJECT_INHERIT)) {
+                               /* Doesn't apply to a file - ignore. */
+                               DEBUG(10,("append_parent_acl: file %s "
+                                       "ignoring non object "
+                                       "inherit flags %u on ACE with sid %s "
+                                       "from parent %s\n",
+                                       fsp->fsp_name,
+                                       (unsigned int)se->flags,
+                                       sid_string_dbg(&se->trustee),
+                                       parent_name));
+                               continue;
+                       }
+               }
+
+               if (is_dacl_protected) {
+                       /* If the DACL is protected it means we must
+                        * not overwrite an existing ACE entry with the
+                        * same SID. This is order N^2. Ouch :-(. JRA. */
+                       unsigned int k;
+                       for (k = 0; k < psd->dacl->num_aces; k++) {
+                               if (sid_equal(&psd->dacl->aces[k].trustee,
+                                               &se->trustee)) {
+                                       break;
+                               }
+                       }
+                       if (k < psd->dacl->num_aces) {
+                               /* SID matched. Ignore. */
+                               DEBUG(10,("append_parent_acl: path %s "
+                                       "ignoring ACE with protected sid %s "
+                                       "from parent %s\n",
+                                       fsp->fsp_name,
+                                       sid_string_dbg(&se->trustee),
+                                       parent_name));
                                continue;
                        }
                }
+
                sec_ace_copy(&new_ace[i], se);
                if (se->flags & SEC_ACE_FLAG_NO_PROPAGATE_INHERIT) {
                        new_ace[i].flags &= ~(SEC_ACE_FLAG_VALID_INHERIT);
                }
                new_ace[i].flags |= SEC_ACE_FLAG_INHERITED_ACE;
+
+               if (fsp->is_directory) {
+                       /*
+                        * Strip off any inherit only. It's applied.
+                        */
+                       new_ace[i].flags &= ~(SEC_ACE_FLAG_INHERIT_ONLY);
+                       if (se->flags & SEC_ACE_FLAG_NO_PROPAGATE_INHERIT) {
+                               /* No further inheritance. */
+                               new_ace[i].flags &=
+                                       ~(SEC_ACE_FLAG_CONTAINER_INHERIT|
+                                       SEC_ACE_FLAG_OBJECT_INHERIT);
+                       }
+               } else {
+                       /*
+                        * Strip off any container or inherit
+                        * flags, they can't apply to objects.
+                        */
+                       new_ace[i].flags &= ~(SEC_ACE_FLAG_CONTAINER_INHERIT|
+                                               SEC_ACE_FLAG_INHERIT_ONLY|
+                                               SEC_ACE_FLAG_NO_PROPAGATE_INHERIT);
+               }
                i++;
+
+               DEBUG(10,("append_parent_acl: path %s "
+                       "inheriting ACE with sid %s "
+                       "from parent %s\n",
+                       fsp->fsp_name,
+                       sid_string_dbg(&se->trustee),
+                       parent_name));
        }
 
        parent_sd->dacl->aces = new_ace;
@@ -3316,6 +3419,9 @@ NTSTATUS set_nt_acl(files_struct *fsp, uint32 security_info_sent, SEC_DESC *psd)
        bool acl_perms = False;
        mode_t orig_mode = (mode_t)0;
        NTSTATUS status;
+       uid_t orig_uid;
+       gid_t orig_gid;
+       bool need_chown = False;
 
        DEBUG(10,("set_nt_acl: called for file %s\n", fsp->fsp_name ));
 
@@ -3332,12 +3438,14 @@ NTSTATUS set_nt_acl(files_struct *fsp, uint32 security_info_sent, SEC_DESC *psd)
                if(SMB_VFS_STAT(fsp->conn,fsp->fsp_name, &sbuf) != 0)
                        return map_nt_error_from_unix(errno);
        } else {
-               if(SMB_VFS_FSTAT(fsp,fsp->fh->fd,&sbuf) != 0)
+               if(SMB_VFS_FSTAT(fsp, &sbuf) != 0)
                        return map_nt_error_from_unix(errno);
        }
 
        /* Save the original elements we check against. */
        orig_mode = sbuf.st_mode;
+       orig_uid = sbuf.st_uid;
+       orig_gid = sbuf.st_gid;
 
        /*
         * Unpack the user/group/world id's.
@@ -3352,7 +3460,11 @@ NTSTATUS set_nt_acl(files_struct *fsp, uint32 security_info_sent, SEC_DESC *psd)
         * Do we need to chown ?
         */
 
-       if (((user != (uid_t)-1) && (sbuf.st_uid != user)) || (( grp != (gid_t)-1) && (sbuf.st_gid != grp))) {
+       if (((user != (uid_t)-1) && (orig_uid != user)) || (( grp != (gid_t)-1) && (orig_gid != grp))) {
+               need_chown = True;
+       }
+
+       if (need_chown && (user == (uid_t)-1 || user == current_user.ut.uid)) {
 
                DEBUG(3,("set_nt_acl: chown %s. uid = %u, gid = %u.\n",
                                fsp->fsp_name, (unsigned int)user, (unsigned int)grp ));
@@ -3382,7 +3494,7 @@ NTSTATUS set_nt_acl(files_struct *fsp, uint32 security_info_sent, SEC_DESC *psd)
                        if(fsp->fh->fd == -1)
                                ret = SMB_VFS_STAT(fsp->conn, fsp->fsp_name, &sbuf);
                        else
-                               ret = SMB_VFS_FSTAT(fsp,fsp->fh->fd,&sbuf);
+                               ret = SMB_VFS_FSTAT(fsp, &sbuf);
 
                        if(ret != 0)
                                return map_nt_error_from_unix(errno);
@@ -3390,6 +3502,11 @@ NTSTATUS set_nt_acl(files_struct *fsp, uint32 security_info_sent, SEC_DESC *psd)
 
                /* Save the original elements we check against. */
                orig_mode = sbuf.st_mode;
+               orig_uid = sbuf.st_uid;
+               orig_gid = sbuf.st_gid;
+
+               /* We did chown already, drop the flag */
+               need_chown = False;
        }
 
        create_file_sids(&sbuf, &file_owner_sid, &file_grp_sid);
@@ -3533,6 +3650,21 @@ NTSTATUS set_nt_acl(files_struct *fsp, uint32 security_info_sent, SEC_DESC *psd)
                free_canon_ace_list(dir_ace_list); 
        }
 
+       /* Any chown pending? */
+       if (need_chown) {
+               DEBUG(3,("set_nt_acl: chown %s. uid = %u, gid = %u.\n",
+                        fsp->fsp_name, (unsigned int)user, (unsigned int)grp ));
+               
+               if(try_chown( fsp->conn, fsp->fsp_name, user, grp) == -1) {
+                       DEBUG(3,("set_nt_acl: chown %s, %u, %u failed. Error = %s.\n",
+                                fsp->fsp_name, (unsigned int)user, (unsigned int)grp, strerror(errno) ));
+                       if (errno == EPERM) {
+                               return NT_STATUS_INVALID_OWNER;
+                       }
+                       return map_nt_error_from_unix(errno);
+               }
+       }
+       
        return NT_STATUS_OK;
 }
 
@@ -3705,19 +3837,19 @@ int inherit_access_acl(connection_struct *conn, const char *inherit_from_dir,
  and set the mask to rwx. Needed to preserve complex ACLs set by NT.
 ****************************************************************************/
 
-int fchmod_acl(files_struct *fsp, int fd, mode_t mode)
+int fchmod_acl(files_struct *fsp, mode_t mode)
 {
        connection_struct *conn = fsp->conn;
        SMB_ACL_T posix_acl = NULL;
        int ret = -1;
 
-       if ((posix_acl = SMB_VFS_SYS_ACL_GET_FD(fsp, fd)) == NULL)
+       if ((posix_acl = SMB_VFS_SYS_ACL_GET_FD(fsp)) == NULL)
                return -1;
 
        if ((ret = chmod_acl_internals(conn, posix_acl, mode)) == -1)
                goto done;
 
-       ret = SMB_VFS_SYS_ACL_SET_FD(fsp, fd, posix_acl);
+       ret = SMB_VFS_SYS_ACL_SET_FD(fsp, posix_acl);
 
   done:
 
@@ -4002,7 +4134,7 @@ static bool remove_posix_acl(connection_struct *conn, files_struct *fsp, const c
 
        /* Get the current file ACL. */
        if (fsp && fsp->fh->fd != -1) {
-               file_acl = SMB_VFS_SYS_ACL_GET_FD(fsp, fsp->fh->fd);
+               file_acl = SMB_VFS_SYS_ACL_GET_FD(fsp);
        } else {
                file_acl = SMB_VFS_SYS_ACL_GET_FILE( conn, fname, SMB_ACL_TYPE_ACCESS);
        }
@@ -4055,7 +4187,7 @@ static bool remove_posix_acl(connection_struct *conn, files_struct *fsp, const c
 
        /* Set the new empty file ACL. */
        if (fsp && fsp->fh->fd != -1) {
-               if (SMB_VFS_SYS_ACL_SET_FD(fsp, fsp->fh->fd, new_file_acl) == -1) {
+               if (SMB_VFS_SYS_ACL_SET_FD(fsp, new_file_acl) == -1) {
                        DEBUG(5,("remove_posix_acl: acl_set_file failed on %s (%s)\n",
                                fname, strerror(errno) ));
                        goto done;
@@ -4102,7 +4234,7 @@ bool set_unix_posix_acl(connection_struct *conn, files_struct *fsp, const char *
 
        if (fsp && fsp->fh->fd != -1) {
                /* The preferred way - use an open fd. */
-               if (SMB_VFS_SYS_ACL_SET_FD(fsp, fsp->fh->fd, file_acl) == -1) {
+               if (SMB_VFS_SYS_ACL_SET_FD(fsp, file_acl) == -1) {
                        DEBUG(5,("set_unix_posix_acl: acl_set_file failed on %s (%s)\n",
                                fname, strerror(errno) ));
                        SMB_VFS_SYS_ACL_FREE_ACL(conn, file_acl);
@@ -4171,8 +4303,7 @@ SEC_DESC *get_nt_acl_no_snum( TALLOC_CTX *ctx, const char *fname)
        finfo.fh->fd = -1;
        finfo.fsp_name = CONST_DISCARD(char *,fname);
 
-       if (!NT_STATUS_IS_OK(get_nt_acl( &finfo, DACL_SECURITY_INFORMATION,
-                                        &psd ))) {
+       if (!NT_STATUS_IS_OK(posix_fget_nt_acl( &finfo, DACL_SECURITY_INFORMATION, &psd))) {
                DEBUG(0,("get_nt_acl_no_snum: get_nt_acl returned zero.\n"));
                conn_free_internal( &conn );
                return NULL;
index ffc9e106f60afee614314adc8c66edd24ce24acc..4672510d8d03f7a2ac224cf48947d3c3062ac4cb 100644 (file)
 
 #include "includes.h"
 
-extern struct auth_context *negprot_global_auth_context;
 extern int smb_echo_count;
 
-const int total_buffer_size = (BUFFER_SIZE + LARGE_WRITEX_HDR_SIZE + SAFETY_MARGIN);
 static enum smb_read_errors smb_read_error = SMB_READ_OK;
 
 /*
@@ -38,7 +36,6 @@ int max_send = BUFFER_SIZE;
  */
 int max_recv = BUFFER_SIZE;
 
-extern int last_message;
 SIG_ATOMIC_T reload_after_sighup = 0;
 SIG_ATOMIC_T got_sig_term = 0;
 extern bool global_machine_password_needs_changing;
@@ -51,6 +48,73 @@ enum smb_read_errors *get_srv_read_error(void)
        return &smb_read_error;
 }
 
+/****************************************************************************
+ Send an smb to a fd.
+****************************************************************************/
+
+bool srv_send_smb(int fd, char *buffer, bool do_encrypt)
+{
+       size_t len;
+       size_t nwritten=0;
+       ssize_t ret;
+       char *buf_out = buffer;
+
+       /* Sign the outgoing packet if required. */
+       srv_calculate_sign_mac(buf_out);
+
+       if (do_encrypt) {
+               NTSTATUS status = srv_encrypt_buffer(buffer, &buf_out);
+               if (!NT_STATUS_IS_OK(status)) {
+                       DEBUG(0, ("send_smb: SMB encryption failed "
+                               "on outgoing packet! Error %s\n",
+                               nt_errstr(status) ));
+                       return false;
+               }
+       }
+
+       len = smb_len(buf_out) + 4;
+
+       while (nwritten < len) {
+               ret = write_data(fd,buf_out+nwritten,len - nwritten);
+               if (ret <= 0) {
+                       DEBUG(0,("Error writing %d bytes to client. %d. (%s)\n",
+                               (int)len,(int)ret, strerror(errno) ));
+                       srv_free_enc_buffer(buf_out);
+                       return false;
+               }
+               nwritten += ret;
+       }
+
+       srv_free_enc_buffer(buf_out);
+       return true;
+}
+
+/*******************************************************************
+ Setup the word count and byte count for a smb message.
+********************************************************************/
+
+int srv_set_message(char *buf,
+                        int num_words,
+                        int num_bytes,
+                        bool zero)
+{
+       if (zero && (num_words || num_bytes)) {
+               memset(buf + smb_size,'\0',num_words*2 + num_bytes);
+       }
+       SCVAL(buf,smb_wct,num_words);
+       SSVAL(buf,smb_vwv + num_words*SIZEOFWORD,num_bytes);
+       smb_setlen(buf,(smb_size + num_words*2 + num_bytes - 4));
+       return (smb_size + num_words*2 + num_bytes);
+}
+
+static bool valid_smb_header(const uint8_t *inbuf)
+{
+       if (is_encrypted_packet(inbuf)) {
+               return true;
+       }
+       return (strncmp(smb_base(inbuf),"\377SMB",4) == 0);
+}
+
 /* Socket functions for smbd packet processing. */
 
 static bool valid_packet_size(size_t len)
@@ -90,16 +154,8 @@ static ssize_t read_packet_remainder(int fd,
                return len;
        }
 
-       if (timeout > 0) {
-               ret = read_socket_with_timeout(fd,
-                                               buffer,
-                                               len,
-                                               len,
-                                               timeout,
-                                               get_srv_read_error());
-       } else {
-               ret = read_data(fd, buffer, len, get_srv_read_error());
-       }
+       ret = read_socket_with_timeout(fd, buffer, len, len, timeout,
+                                      get_srv_read_error());
 
        if (ret != len) {
                cond_set_smb_read_error(get_srv_read_error(),
@@ -126,7 +182,7 @@ static ssize_t read_packet_remainder(int fd,
                                (2*14) + /* word count (including bcc) */ \
                                1 /* pad byte */)
 
-ssize_t receive_smb_raw_talloc_partial_read(TALLOC_CTX *mem_ctx,
+static ssize_t receive_smb_raw_talloc_partial_read(TALLOC_CTX *mem_ctx,
                                        const char lenbuf[4],
                                        int fd,
                                        char **buffer,
@@ -141,19 +197,10 @@ ssize_t receive_smb_raw_talloc_partial_read(TALLOC_CTX *mem_ctx,
 
        memcpy(writeX_header, lenbuf, sizeof(lenbuf));
 
-       if (timeout > 0) {
-               ret = read_socket_with_timeout(fd,
-                                       writeX_header + 4,
-                                       STANDARD_WRITE_AND_X_HEADER_SIZE,
-                                       STANDARD_WRITE_AND_X_HEADER_SIZE,
-                                       timeout,
-                                       get_srv_read_error());
-       } else {
-               ret = read_data(fd,
-                               writeX_header+4,
-                               STANDARD_WRITE_AND_X_HEADER_SIZE,
-                               get_srv_read_error());
-       }
+       ret = read_socket_with_timeout(fd, writeX_header + 4,
+                                      STANDARD_WRITE_AND_X_HEADER_SIZE,
+                                      STANDARD_WRITE_AND_X_HEADER_SIZE,
+                                      timeout, get_srv_read_error());
 
        if (ret != STANDARD_WRITE_AND_X_HEADER_SIZE) {
                cond_set_smb_read_error(get_srv_read_error(),
@@ -166,7 +213,7 @@ ssize_t receive_smb_raw_talloc_partial_read(TALLOC_CTX *mem_ctx,
         * valid writeX call.
         */
 
-       if (is_valid_writeX_buffer(writeX_header)) {
+       if (is_valid_writeX_buffer((uint8_t *)writeX_header)) {
                /*
                 * If the data offset is beyond what
                 * we've read, drain the extra bytes.
@@ -274,7 +321,7 @@ static ssize_t receive_smb_raw_talloc(TALLOC_CTX *mem_ctx,
                return -1;
        }
 
-       if (CVAL(lenbuf,0) != SMBkeepalive &&
+       if (CVAL(lenbuf,0) == 0 &&
                        min_recv_size &&
                        smb_len_large(lenbuf) > min_recv_size && /* Could be a UNIX large writeX. */
                        !srv_is_signing_active()) {
@@ -314,17 +361,36 @@ static ssize_t receive_smb_raw_talloc(TALLOC_CTX *mem_ctx,
        return len + 4;
 }
 
-ssize_t receive_smb_talloc(TALLOC_CTX *mem_ctx, int fd, char **buffer,
-                          unsigned int timeout, size_t *p_unread)
+static ssize_t receive_smb_talloc(TALLOC_CTX *mem_ctx,
+                               int fd,
+                               char **buffer,
+                               unsigned int timeout,
+                               size_t *p_unread,
+                               bool *p_encrypted)
 {
        ssize_t len;
 
+       *p_encrypted = false;
+
        len = receive_smb_raw_talloc(mem_ctx, fd, buffer, timeout, p_unread);
 
        if (len < 0) {
                return -1;
        }
 
+       if (is_encrypted_packet((uint8_t *)*buffer)) {
+               NTSTATUS status = srv_decrypt_buffer(*buffer);
+               if (!NT_STATUS_IS_OK(status)) {
+                       DEBUG(0, ("receive_smb_talloc: SMB decryption failed on "
+                               "incoming packet! Error %s\n",
+                               nt_errstr(status) ));
+                       cond_set_smb_read_error(get_srv_read_error(),
+                                       SMB_READ_BAD_DECRYPT);
+                       return -1;
+               }
+               *p_encrypted = true;
+       }
+
        /* Check the incoming SMB signature. */
        if (!srv_check_sign_mac(*buffer, true)) {
                DEBUG(0, ("receive_smb: SMB Signature verification failed on "
@@ -342,7 +408,8 @@ ssize_t receive_smb_talloc(TALLOC_CTX *mem_ctx, int fd, char **buffer,
 
 void init_smb_request(struct smb_request *req,
                        const uint8 *inbuf,
-                       size_t unread_bytes)
+                       size_t unread_bytes,
+                       bool encrypted)
 {
        size_t req_size = smb_len(inbuf) + 4;
        /* Ensure we have at least smb_size bytes. */
@@ -358,6 +425,8 @@ void init_smb_request(struct smb_request *req,
        req->tid    = SVAL(inbuf, smb_tid);
        req->wct    = CVAL(inbuf, smb_wct);
        req->unread_bytes = unread_bytes;
+       req->encrypted = encrypted;
+       req->conn = conn_find(req->tid);
 
        /* Ensure we have at least wct words and 2 bytes of bcc. */
        if (smb_size + req->wct*2 > req_size) {
@@ -415,6 +484,7 @@ static bool push_queued_message(struct smb_request *req,
 
        msg->request_time = request_time;
        msg->end_time = end_time;
+       msg->encrypted = req->encrypted;
 
        if (private_data) {
                msg->private_data = data_blob_talloc(msg, private_data,
@@ -690,7 +760,8 @@ static bool receive_message_or_smb(TALLOC_CTX *mem_ctx,
                                char **buffer,
                                size_t *buffer_len,
                                int timeout,
-                               size_t *p_unread)
+                               size_t *p_unread,
+                               bool *p_encrypted)
 {
        fd_set r_fds, w_fds;
        int selrtn;
@@ -757,6 +828,7 @@ static bool receive_message_or_smb(TALLOC_CTX *mem_ctx,
                                return False;
                        }
                        *buffer_len = msg->buf.length;
+                       *p_encrypted = msg->encrypted;
 
                        /* We leave this message on the queue so the open code can
                           know this is a retry. */
@@ -873,7 +945,8 @@ static bool receive_message_or_smb(TALLOC_CTX *mem_ctx,
                goto again;
        }
 
-       len = receive_smb_talloc(mem_ctx, smbd_server_fd(), buffer, 0, p_unread);
+       len = receive_smb_talloc(mem_ctx, smbd_server_fd(),
+                               buffer, 0, p_unread, p_encrypted);
 
        if (len == -1) {
                return False;
@@ -953,7 +1026,7 @@ force write permissions on print services.
 */
 static const struct smb_message_struct {
        const char *name;
-       void (*fn_new)(connection_struct *conn, struct smb_request *req);
+       void (*fn_new)(struct smb_request *req);
        int flags;
 } smb_messages[256] = {
 
@@ -1240,7 +1313,7 @@ void reply_outbuf(struct smb_request *req, uint8 num_words, uint32 num_bytes)
        }
 
        construct_reply_common((char *)req->inbuf, (char *)req->outbuf);
-       set_message((char *)req->outbuf, num_words, num_bytes, False);
+       srv_set_message((char *)req->outbuf, num_words, num_bytes, false);
        /*
         * Zero out the word area, the caller has to take care of the bcc area
         * himself
@@ -1298,21 +1371,19 @@ static void smb_dump(const char *name, int type, const char *data, ssize_t len)
  find.
 ****************************************************************************/
 
-static void switch_message(uint8 type, struct smb_request *req, int size)
+static connection_struct *switch_message(uint8 type, struct smb_request *req, int size)
 {
        int flags;
        uint16 session_tag;
-       connection_struct *conn;
+       connection_struct *conn = NULL;
 
        static uint16 last_session_tag = UID_FIELD_INVALID;
 
        errno = 0;
 
-       last_message = type;
-
        /* Make sure this is an SMB packet. smb_size contains NetBIOS header
         * so subtract 4 from it. */
-       if ((strncmp(smb_base(req->inbuf),"\377SMB",4) != 0)
+       if (!valid_smb_header(req->inbuf)
            || (size < (smb_size - 4))) {
                DEBUG(2,("Non-SMB packet of length %d. Terminating server\n",
                         smb_len(req->inbuf)));
@@ -1323,7 +1394,7 @@ static void switch_message(uint8 type, struct smb_request *req, int size)
                DEBUG(0,("Unknown message type %d!\n",type));
                smb_dump("Unknown", 1, (char *)req->inbuf, size);
                reply_unknown_new(req, type);
-               return;
+               return NULL;
        }
 
        flags = smb_messages[type].flags;
@@ -1331,7 +1402,7 @@ static void switch_message(uint8 type, struct smb_request *req, int size)
        /* In share mode security we must ignore the vuid. */
        session_tag = (lp_security() == SEC_SHARE)
                ? UID_FIELD_INVALID : req->vuid;
-       conn = conn_find(req->tid);
+       conn = req->conn;
 
        DEBUG(3,("switch message %s (pid %d) conn 0x%lx\n", smb_fn_name(type),
                 (int)sys_getpid(), (unsigned long)conn));
@@ -1376,12 +1447,12 @@ static void switch_message(uint8 type, struct smb_request *req, int size)
                        } else {
                                reply_doserror(req, ERRSRV, ERRinvnid);
                        }
-                       return;
+                       return NULL;
                }
 
                if (!change_to_user(conn,session_tag)) {
                        reply_nterror(req, NT_STATUS_DOS(ERRSRV, ERRbaduid));
-                       return;
+                       return conn;
                }
 
                /* All NEED_WRITE and CAN_IPC flags must also have AS_USER. */
@@ -1389,13 +1460,13 @@ static void switch_message(uint8 type, struct smb_request *req, int size)
                /* Does it need write permission? */
                if ((flags & NEED_WRITE) && !CAN_WRITE(conn)) {
                        reply_nterror(req, NT_STATUS_MEDIA_WRITE_PROTECTED);
-                       return;
+                       return conn;
                }
 
                /* IPC services are limited */
                if (IS_IPC(conn) && !(flags & CAN_IPC)) {
                        reply_doserror(req, ERRSRV,ERRaccess);
-                       return;
+                       return conn;
                }
        } else {
                /* This call needs to be run as root */
@@ -1404,11 +1475,24 @@ static void switch_message(uint8 type, struct smb_request *req, int size)
 
        /* load service specific parameters */
        if (conn) {
+               if (req->encrypted) {
+                       conn->encrypted_tid = true;
+                       /* encrypted required from now on. */
+                       conn->encrypt_level = Required;
+               } else if (ENCRYPTION_REQUIRED(conn)) {
+                       uint8 com = CVAL(req->inbuf,smb_com);
+                       if (com != SMBtrans2 && com != SMBtranss2) {
+                               exit_server_cleanly("encryption required "
+                                       "on connection");
+                               return conn;
+                       }
+               }
+
                if (!set_current_service(conn,SVAL(req->inbuf,smb_flg),
                                         (flags & (AS_USER|DO_CHDIR)
                                          ?True:False))) {
                        reply_doserror(req, ERRSRV, ERRaccess);
-                       return;
+                       return conn;
                }
                conn->num_smb_operations++;
        }
@@ -1419,19 +1503,21 @@ static void switch_message(uint8 type, struct smb_request *req, int size)
                !check_access(smbd_server_fd(), lp_hostsallow(-1),
                              lp_hostsdeny(-1)))) {
                reply_doserror(req, ERRSRV, ERRaccess);
-               return;
+               return conn;
        }
 
-       smb_messages[type].fn_new(conn, req);
+       smb_messages[type].fn_new(req);
+       return req->conn;
 }
 
 /****************************************************************************
  Construct a reply to the incoming packet.
 ****************************************************************************/
 
-static void construct_reply(char *inbuf, int size, size_t unread_bytes)
+static void construct_reply(char *inbuf, int size, size_t unread_bytes, bool encrypted)
 {
        uint8 type = CVAL(inbuf,smb_com);
+       connection_struct *conn;
        struct smb_request *req;
 
        chain_size = 0;
@@ -1441,9 +1527,9 @@ static void construct_reply(char *inbuf, int size, size_t unread_bytes)
        if (!(req = talloc(talloc_tos(), struct smb_request))) {
                smb_panic("could not allocate smb_request");
        }
-       init_smb_request(req, (uint8 *)inbuf, unread_bytes);
+       init_smb_request(req, (uint8 *)inbuf, unread_bytes, encrypted);
 
-       switch_message(type, req, size);
+       conn = switch_message(type, req, size);
 
        if (req->unread_bytes) {
                /* writeX failed. drain socket. */
@@ -1462,8 +1548,10 @@ static void construct_reply(char *inbuf, int size, size_t unread_bytes)
                show_msg((char *)req->outbuf);
        }
 
-       if (!send_smb(smbd_server_fd(), (char *)req->outbuf)) {
-               exit_server_cleanly("construct_reply: send_smb failed.");
+       if (!srv_send_smb(smbd_server_fd(),
+                       (char *)req->outbuf,
+                       IS_CONN_ENCRYPTED(conn)||req->encrypted)) {
+               exit_server_cleanly("construct_reply: srv_send_smb failed.");
        }
 
        TALLOC_FREE(req);
@@ -1475,7 +1563,7 @@ static void construct_reply(char *inbuf, int size, size_t unread_bytes)
  Process an smb from the client
 ****************************************************************************/
 
-static void process_smb(char *inbuf, size_t nread, size_t unread_bytes)
+static void process_smb(char *inbuf, size_t nread, size_t unread_bytes, bool encrypted)
 {
        static int trans_num;
        int msg_type = CVAL(inbuf,0);
@@ -1496,7 +1584,7 @@ static void process_smb(char *inbuf, size_t nread, size_t unread_bytes)
                        static unsigned char buf[5] = {0x83, 0, 0, 1, 0x81};
                        DEBUG( 1, ( "Connection denied from %s\n",
                                client_addr(get_client_fd(),addr,sizeof(addr)) ) );
-                       (void)send_smb(smbd_server_fd(),(char *)buf);
+                       (void)srv_send_smb(smbd_server_fd(),(char *)buf,false);
                        exit_server_cleanly("connection denied");
                }
        }
@@ -1517,7 +1605,7 @@ static void process_smb(char *inbuf, size_t nread, size_t unread_bytes)
 
        show_msg(inbuf);
 
-       construct_reply(inbuf,nread,unread_bytes);
+       construct_reply(inbuf,nread,unread_bytes,encrypted);
 
        trans_num++;
 }
@@ -1554,7 +1642,7 @@ void remove_from_common_flags2(uint32 v)
 
 void construct_reply_common(const char *inbuf, char *outbuf)
 {
-       set_message(outbuf,0,0,False);
+       srv_set_message(outbuf,0,0,false);
        
        SCVAL(outbuf,smb_com,CVAL(inbuf,smb_com));
        SIVAL(outbuf,smb_rcls,0);
@@ -1677,7 +1765,7 @@ void chain_reply(struct smb_request *req)
        if (!(req2 = talloc(talloc_tos(), struct smb_request))) {
                smb_panic("could not allocate smb_request");
        }
-       init_smb_request(req2, (uint8 *)inbuf2,0);
+       init_smb_request(req2, (uint8 *)inbuf2,0, req->encrypted);
 
        /* process the request */
        switch_message(smb_com2, req2, new_size);
@@ -1963,7 +2051,8 @@ void smbd_process(void)
                int num_echos;
                char *inbuf;
                size_t inbuf_len;
-               TALLOC_CTX *frame = talloc_stackframe();
+               bool encrypted = false;
+               TALLOC_CTX *frame = talloc_stackframe_pool(8192);
 
                errno = 0;
 
@@ -1977,8 +2066,10 @@ void smbd_process(void)
 
                run_events(smbd_event_context(), 0, NULL, NULL);
 
-               while (!receive_message_or_smb(NULL, &inbuf, &inbuf_len,
-                                              select_timeout, &unread_bytes)) {
+               while (!receive_message_or_smb(talloc_tos(), &inbuf, &inbuf_len,
+                                               select_timeout,
+                                               &unread_bytes,
+                                               &encrypted)) {
                        if(!timeout_processing(&select_timeout,
                                               &last_timeout_processing_time))
                                return;
@@ -1997,7 +2088,7 @@ void smbd_process(void)
                 */
                num_echos = smb_echo_count;
 
-               process_smb(inbuf, inbuf_len, unread_bytes);
+               process_smb(inbuf, inbuf_len, unread_bytes, encrypted);
 
                TALLOC_FREE(inbuf);
 
index 45081808e1a2dbf95055d218e8ba7522cb665bcf..18376031eca23711b747384326c7d63912ff780c 100644 (file)
@@ -167,6 +167,7 @@ static NTSTATUS check_path_syntax_internal(char *path,
        }
 
        *d = '\0';
+
        return ret;
 }
 
@@ -391,7 +392,7 @@ void reply_special(char *inbuf)
 
        /*
         * We only really use 4 bytes of the outbuf, but for the smb_setlen
-        * calculation & friends (send_smb uses that) we need the full smb
+        * calculation & friends (srv_send_smb uses that) we need the full smb
         * header.
         */
        char outbuf[smb_size];
@@ -470,7 +471,7 @@ void reply_special(char *inbuf)
        DEBUG(5,("init msg_type=0x%x msg_flags=0x%x\n",
                    msg_type, msg_flags));
 
-       send_smb(smbd_server_fd(), outbuf);
+       srv_send_smb(smbd_server_fd(), outbuf, false);
        return;
 }
 
@@ -479,8 +480,9 @@ void reply_special(char *inbuf)
  conn POINTER CAN BE NULL HERE !
 ****************************************************************************/
 
-void reply_tcon(connection_struct *conn, struct smb_request *req)
+void reply_tcon(struct smb_request *req)
 {
+       connection_struct *conn = req->conn;
        const char *service;
        char *service_buf = NULL;
        char *password = NULL;
@@ -523,6 +525,7 @@ void reply_tcon(connection_struct *conn, struct smb_request *req)
        password_blob = data_blob(password, pwlen+1);
 
        conn = make_connection(service,password_blob,dev,req->vuid,&nt_status);
+       req->conn = conn;
 
        data_blob_clear_free(&password_blob);
 
@@ -549,8 +552,9 @@ void reply_tcon(connection_struct *conn, struct smb_request *req)
  conn POINTER CAN BE NULL HERE !
 ****************************************************************************/
 
-void reply_tcon_and_X(connection_struct *conn, struct smb_request *req)
+void reply_tcon_and_X(struct smb_request *req)
 {
+       connection_struct *conn = req->conn;
        char *service = NULL;
        DATA_BLOB password;
        TALLOC_CTX *ctx = talloc_tos();
@@ -578,6 +582,8 @@ void reply_tcon_and_X(connection_struct *conn, struct smb_request *req)
        /* we might have to close an old one */
        if ((tcon_flags & 0x1) && conn) {
                close_cnum(conn,req->vuid);
+               req->conn = NULL;
+               conn = NULL;
        }
 
        if ((passlen > MAX_PASS_LEN) || (passlen >= smb_buflen(req->inbuf))) {
@@ -587,7 +593,8 @@ void reply_tcon_and_X(connection_struct *conn, struct smb_request *req)
        }
 
        if (global_encrypted_passwords_negotiated) {
-               password = data_blob(smb_buf(req->inbuf),passlen);
+               password = data_blob_talloc(talloc_tos(), smb_buf(req->inbuf),
+                                           passlen);
                if (lp_security() == SEC_SHARE) {
                        /*
                         * Security = share always has a pad byte
@@ -598,7 +605,8 @@ void reply_tcon_and_X(connection_struct *conn, struct smb_request *req)
                        p = smb_buf(req->inbuf) + passlen;
                }
        } else {
-               password = data_blob(smb_buf(req->inbuf),passlen+1);
+               password = data_blob_talloc(talloc_tos(), smb_buf(req->inbuf),
+                                           passlen+1);
                /* Ensure correct termination */
                password.data[passlen]=0;
                p = smb_buf(req->inbuf) + passlen + 1;
@@ -646,6 +654,7 @@ void reply_tcon_and_X(connection_struct *conn, struct smb_request *req)
 
        conn = make_connection(service, password, client_devicetype,
                               req->vuid, &nt_status);
+       req->conn =conn;
 
        data_blob_clear_free(&password);
 
@@ -731,17 +740,6 @@ void reply_tcon_and_X(connection_struct *conn, struct smb_request *req)
  Reply to an unknown type.
 ****************************************************************************/
 
-int reply_unknown(char *inbuf,char *outbuf)
-{
-       int type;
-       type = CVAL(inbuf,smb_com);
-  
-       DEBUG(0,("unknown command type (%s): type=%d (0x%X)\n",
-                smb_fn_name(type), type, type));
-  
-       return(ERROR_DOS(ERRSRV,ERRunknownsmb));
-}
-
 void reply_unknown_new(struct smb_request *req, uint8 type)
 {
        DEBUG(0, ("unknown command type (%s): type=%d (0x%X)\n",
@@ -755,8 +753,9 @@ void reply_unknown_new(struct smb_request *req, uint8 type)
  conn POINTER CAN BE NULL HERE !
 ****************************************************************************/
 
-void reply_ioctl(connection_struct *conn, struct smb_request *req)
+void reply_ioctl(struct smb_request *req)
 {
+       connection_struct *conn = req->conn;
        uint16 device;
        uint16 function;
        uint32 ioctl_code;
@@ -844,8 +843,9 @@ static NTSTATUS map_checkpath_error(const char *inbuf, NTSTATUS status)
  Reply to a checkpath.
 ****************************************************************************/
 
-void reply_checkpath(connection_struct *conn, struct smb_request *req)
+void reply_checkpath(struct smb_request *req)
 {
+       connection_struct *conn = req->conn;
        char *name = NULL;
        SMB_STRUCT_STAT sbuf;
        NTSTATUS status;
@@ -938,8 +938,9 @@ void reply_checkpath(connection_struct *conn, struct smb_request *req)
  Reply to a getatr.
 ****************************************************************************/
 
-void reply_getatr(connection_struct *conn, struct smb_request *req)
+void reply_getatr(struct smb_request *req)
 {
+       connection_struct *conn = req->conn;
        char *fname = NULL;
        SMB_STRUCT_STAT sbuf;
        int mode=0;
@@ -1039,8 +1040,9 @@ void reply_getatr(connection_struct *conn, struct smb_request *req)
  Reply to a setatr.
 ****************************************************************************/
 
-void reply_setatr(connection_struct *conn, struct smb_request *req)
+void reply_setatr(struct smb_request *req)
 {
+       connection_struct *conn = req->conn;
        char *fname = NULL;
        int mode;
        time_t mtime;
@@ -1139,8 +1141,9 @@ void reply_setatr(connection_struct *conn, struct smb_request *req)
  Reply to a dskattr.
 ****************************************************************************/
 
-void reply_dskattr(connection_struct *conn, struct smb_request *req)
+void reply_dskattr(struct smb_request *req)
 {
+       connection_struct *conn = req->conn;
        SMB_BIG_UINT dfree,dsize,bsize;
        START_PROFILE(SMBdskattr);
 
@@ -1163,8 +1166,8 @@ void reply_dskattr(connection_struct *conn, struct smb_request *req)
                total_space = dsize * (double)bsize;
                free_space = dfree * (double)bsize;
 
-               dsize = (total_space+63*512) / (64*512);
-               dfree = (free_space+63*512) / (64*512);
+               dsize = (SMB_BIG_UINT)((total_space+63*512) / (64*512));
+               dfree = (SMB_BIG_UINT)((free_space+63*512) / (64*512));
                
                if (dsize > 0xFFFF) dsize = 0xFFFF;
                if (dfree > 0xFFFF) dfree = 0xFFFF;
@@ -1191,8 +1194,9 @@ void reply_dskattr(connection_struct *conn, struct smb_request *req)
  Can be called from SMBsearch, SMBffirst or SMBfunique.
 ****************************************************************************/
 
-void reply_search(connection_struct *conn, struct smb_request *req)
+void reply_search(struct smb_request *req)
 {
+       connection_struct *conn = req->conn;
        char *mask = NULL;
        char *directory = NULL;
        char *fname = NULL;
@@ -1493,7 +1497,7 @@ void reply_search(connection_struct *conn, struct smb_request *req)
  Reply to a fclose (stop directory search).
 ****************************************************************************/
 
-void reply_fclose(connection_struct *conn, struct smb_request *req)
+void reply_fclose(struct smb_request *req)
 {
        int status_len;
        char status[21];
@@ -1557,8 +1561,9 @@ void reply_fclose(connection_struct *conn, struct smb_request *req)
  Reply to an open.
 ****************************************************************************/
 
-void reply_open(connection_struct *conn, struct smb_request *req)
+void reply_open(struct smb_request *req)
 {
+       connection_struct *conn = req->conn;
        char *fname = NULL;
        uint32 fattr=0;
        SMB_OFF_T size = 0;
@@ -1597,51 +1602,30 @@ void reply_open(connection_struct *conn, struct smb_request *req)
                return;
        }
 
-       status = resolve_dfspath(ctx, conn,
-                               req->flags2 & FLAGS2_DFS_PATHNAMES,
-                               fname,
-                               &fname);
-       if (!NT_STATUS_IS_OK(status)) {
-               if (NT_STATUS_EQUAL(status,NT_STATUS_PATH_NOT_COVERED)) {
-                       reply_botherror(req, NT_STATUS_PATH_NOT_COVERED,
-                                       ERRSRV, ERRbadpath);
-                       END_PROFILE(SMBopen);
-                       return;
-               }
-               reply_nterror(req, status);
-               END_PROFILE(SMBopen);
-               return;
-       }
-
-       status = unix_convert(ctx, conn, fname, False, &fname, NULL, &sbuf);
-       if (!NT_STATUS_IS_OK(status)) {
-               reply_nterror(req, status);
-               END_PROFILE(SMBopen);
-               return;
-       }
-
-       status = check_name(conn, fname);
-       if (!NT_STATUS_IS_OK(status)) {
-               reply_nterror(req, status);
-               END_PROFILE(SMBopen);
-               return;
-       }
-
-       if (!map_open_params_to_ntcreate(fname, deny_mode, OPENX_FILE_EXISTS_OPEN,
-                       &access_mask, &share_mode, &create_disposition, &create_options)) {
+       if (!map_open_params_to_ntcreate(
+                   fname, deny_mode, OPENX_FILE_EXISTS_OPEN, &access_mask,
+                   &share_mode, &create_disposition, &create_options)) {
                reply_nterror(req, NT_STATUS_DOS(ERRDOS, ERRbadaccess));
                END_PROFILE(SMBopen);
                return;
        }
 
-       status = open_file_ntcreate(conn, req, fname, &sbuf,
-                       access_mask,
-                       share_mode,
-                       create_disposition,
-                       create_options,
-                       dos_attr,
-                       oplock_request,
-                       &info, &fsp);
+       status = create_file(conn,                      /* conn */
+                            req,                       /* req */
+                            0,                         /* root_dir_fid */
+                            fname,                     /* fname */
+                            access_mask,               /* access_mask */
+                            share_mode,                /* share_access */
+                            create_disposition,        /* create_disposition*/
+                            create_options,            /* create_options */
+                            dos_attr,                  /* file_attributes */
+                            oplock_request,            /* oplock_request */
+                            0,                         /* allocation_size */
+                            NULL,                      /* sd */
+                            NULL,                      /* ea_list */
+                            &fsp,                      /* result */
+                            &info,                     /* pinfo */
+                            &sbuf);                    /* psbuf */
 
        if (!NT_STATUS_IS_OK(status)) {
                if (open_was_deferred(req->mid)) {
@@ -1694,8 +1678,9 @@ void reply_open(connection_struct *conn, struct smb_request *req)
  Reply to an open and X.
 ****************************************************************************/
 
-void reply_open_and_X(connection_struct *conn, struct smb_request *req)
+void reply_open_and_X(struct smb_request *req)
 {
+       connection_struct *conn = req->conn;
        char *fname = NULL;
        uint16 open_flags;
        int deny_mode;
@@ -1762,53 +1747,30 @@ void reply_open_and_X(connection_struct *conn, struct smb_request *req)
                return;
        }
 
-       status = resolve_dfspath(ctx, conn,
-                               req->flags2 & FLAGS2_DFS_PATHNAMES,
-                               fname,
-                               &fname);
-       if (!NT_STATUS_IS_OK(status)) {
-               END_PROFILE(SMBopenX);
-               if (NT_STATUS_EQUAL(status,NT_STATUS_PATH_NOT_COVERED)) {
-                       reply_botherror(req, NT_STATUS_PATH_NOT_COVERED,
-                                       ERRSRV, ERRbadpath);
-                       return;
-               }
-               reply_nterror(req, status);
-               return;
-       }
-
-       status = unix_convert(ctx, conn, fname, False, &fname, NULL, &sbuf);
-       if (!NT_STATUS_IS_OK(status)) {
-               reply_nterror(req, status);
-               END_PROFILE(SMBopenX);
-               return;
-       }
-
-       status = check_name(conn, fname);
-       if (!NT_STATUS_IS_OK(status)) {
-               reply_nterror(req, status);
-               END_PROFILE(SMBopenX);
-               return;
-       }
-
-       if (!map_open_params_to_ntcreate(fname, deny_mode, smb_ofun,
-                               &access_mask,
-                               &share_mode,
-                               &create_disposition,
-                               &create_options)) {
+       if (!map_open_params_to_ntcreate(
+                   fname, deny_mode, smb_ofun, &access_mask,
+                   &share_mode, &create_disposition, &create_options)) {
                reply_nterror(req, NT_STATUS_DOS(ERRDOS, ERRbadaccess));
                END_PROFILE(SMBopenX);
                return;
        }
 
-       status = open_file_ntcreate(conn, req, fname, &sbuf,
-                       access_mask,
-                       share_mode,
-                       create_disposition,
-                       create_options,
-                       smb_attr,
-                       oplock_request,
-                       &smb_action, &fsp);
+       status = create_file(conn,                      /* conn */
+                            req,                       /* req */
+                            0,                         /* root_dir_fid */
+                            fname,                     /* fname */
+                            access_mask,               /* access_mask */
+                            share_mode,                /* share_access */
+                            create_disposition,        /* create_disposition*/
+                            create_options,            /* create_options */
+                            smb_attr,                  /* file_attributes */
+                            oplock_request,            /* oplock_request */
+                            0,                         /* allocation_size */
+                            NULL,                      /* sd */
+                            NULL,                      /* ea_list */
+                            &fsp,                      /* result */
+                            &smb_action,               /* pinfo */
+                            &sbuf);                    /* psbuf */
 
        if (!NT_STATUS_IS_OK(status)) {
                END_PROFILE(SMBopenX);
@@ -1905,10 +1867,9 @@ void reply_open_and_X(connection_struct *conn, struct smb_request *req)
 
 /****************************************************************************
  Reply to a SMBulogoffX.
- conn POINTER CAN BE NULL HERE !
 ****************************************************************************/
 
-void reply_ulogoffX(connection_struct *conn, struct smb_request *req)
+void reply_ulogoffX(struct smb_request *req)
 {
        user_struct *vuser;
 
@@ -1941,8 +1902,9 @@ void reply_ulogoffX(connection_struct *conn, struct smb_request *req)
  Reply to a mknew or a create.
 ****************************************************************************/
 
-void reply_mknew(connection_struct *conn, struct smb_request *req)
+void reply_mknew(struct smb_request *req)
 {
+       connection_struct *conn = req->conn;
        char *fname = NULL;
        int com;
        uint32 fattr = 0;
@@ -1982,35 +1944,6 @@ void reply_mknew(connection_struct *conn, struct smb_request *req)
                return;
        }
 
-       status = resolve_dfspath(ctx, conn,
-                       req->flags2 & FLAGS2_DFS_PATHNAMES,
-                       fname,
-                       &fname);
-       if (!NT_STATUS_IS_OK(status)) {
-               END_PROFILE(SMBcreate);
-               if (NT_STATUS_EQUAL(status,NT_STATUS_PATH_NOT_COVERED)) {
-                       reply_botherror(req, NT_STATUS_PATH_NOT_COVERED,
-                                       ERRSRV, ERRbadpath);
-                       return;
-               }
-               reply_nterror(req, status);
-               return;
-       }
-
-       status = unix_convert(ctx, conn, fname, False, &fname, NULL, &sbuf);
-       if (!NT_STATUS_IS_OK(status)) {
-               reply_nterror(req, status);
-               END_PROFILE(SMBcreate);
-               return;
-       }
-
-       status = check_name(conn, fname);
-       if (!NT_STATUS_IS_OK(status)) {
-               reply_nterror(req, status);
-               END_PROFILE(SMBcreate);
-               return;
-       }
-
        if (fattr & aVOLID) {
                DEBUG(0,("Attempt to create file (%s) with volid set - "
                        "please report this\n", fname));
@@ -2024,15 +1957,22 @@ void reply_mknew(connection_struct *conn, struct smb_request *req)
                create_disposition = FILE_OVERWRITE_IF;
        }
 
-       /* Open file using ntcreate. */
-       status = open_file_ntcreate(conn, req, fname, &sbuf,
-                               access_mask,
-                               share_mode,
-                               create_disposition,
-                               create_options,
-                               fattr,
-                               oplock_request,
-                               NULL, &fsp);
+       status = create_file(conn,                      /* conn */
+                            req,                       /* req */
+                            0,                         /* root_dir_fid */
+                            fname,                     /* fname */
+                            access_mask,               /* access_mask */
+                            share_mode,                /* share_access */
+                            create_disposition,        /* create_disposition*/
+                            create_options,            /* create_options */
+                            fattr,                     /* file_attributes */
+                            oplock_request,            /* oplock_request */
+                            0,                         /* allocation_size */
+                            NULL,                      /* sd */
+                            NULL,                      /* ea_list */
+                            &fsp,                      /* result */
+                            NULL,                      /* pinfo */
+                            &sbuf);                    /* psbuf */
 
        if (!NT_STATUS_IS_OK(status)) {
                END_PROFILE(SMBcreate);
@@ -2072,8 +2012,9 @@ void reply_mknew(connection_struct *conn, struct smb_request *req)
  Reply to a create temporary file.
 ****************************************************************************/
 
-void reply_ctemp(connection_struct *conn, struct smb_request *req)
+void reply_ctemp(struct smb_request *req)
 {
+       connection_struct *conn = req->conn;
        char *fname = NULL;
        uint32 fattr;
        files_struct *fsp;
@@ -2349,14 +2290,22 @@ static NTSTATUS do_unlink(connection_struct *conn,
        /* On open checks the open itself will check the share mode, so
           don't do it here as we'll get it wrong. */
 
-       status = open_file_ntcreate(conn, req, fname, &sbuf,
-                                   DELETE_ACCESS,
-                                   FILE_SHARE_NONE,
-                                   FILE_OPEN,
-                                   0,
-                                   FILE_ATTRIBUTE_NORMAL,
-                                   req != NULL ? 0 : INTERNAL_OPEN_ONLY,
-                                   NULL, &fsp);
+       status = create_file_unixpath
+               (conn,                  /* conn */
+                req,                   /* req */
+                fname,                 /* fname */
+                DELETE_ACCESS,         /* access_mask */
+                FILE_SHARE_NONE,       /* share_access */
+                FILE_OPEN,             /* create_disposition*/
+                FILE_NON_DIRECTORY_FILE, /* create_options */
+                FILE_ATTRIBUTE_NORMAL, /* file_attributes */
+                0,                     /* oplock_request */
+                0,                     /* allocation_size */
+                NULL,                  /* sd */
+                NULL,                  /* ea_list */
+                &fsp,                  /* result */
+                NULL,                  /* pinfo */
+                &sbuf);                /* psbuf */
 
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(10, ("open_file_ntcreate failed: %s\n",
@@ -2470,7 +2419,8 @@ NTSTATUS unlink_internals(connection_struct *conn, struct smb_request *req,
                        return status;
                }
 
-               dir_hnd = OpenDir(conn, directory, mask, dirtype);
+               dir_hnd = OpenDir(talloc_tos(), conn, directory, mask,
+                                 dirtype);
                if (dir_hnd == NULL) {
                        return map_nt_error_from_unix(errno);
                }
@@ -2508,7 +2458,7 @@ NTSTATUS unlink_internals(connection_struct *conn, struct smb_request *req,
 
                        status = check_name(conn, fname);
                        if (!NT_STATUS_IS_OK(status)) {
-                               CloseDir(dir_hnd);
+                               TALLOC_FREE(dir_hnd);
                                return status;
                        }
 
@@ -2524,7 +2474,7 @@ NTSTATUS unlink_internals(connection_struct *conn, struct smb_request *req,
 
                        TALLOC_FREE(fname);
                }
-               CloseDir(dir_hnd);
+               TALLOC_FREE(dir_hnd);
        }
 
        if (count == 0 && NT_STATUS_IS_OK(status)) {
@@ -2538,8 +2488,9 @@ NTSTATUS unlink_internals(connection_struct *conn, struct smb_request *req,
  Reply to a unlink
 ****************************************************************************/
 
-void reply_unlink(connection_struct *conn, struct smb_request *req)
+void reply_unlink(struct smb_request *req)
 {
+       connection_struct *conn = req->conn;
        char *name = NULL;
        uint32 dirtype;
        NTSTATUS status;
@@ -2713,7 +2664,7 @@ void send_file_readbraw(connection_struct *conn,
                _smb_setlen(header,nread);
                header_blob = data_blob_const(header, 4);
 
-               if ( SMB_VFS_SENDFILE( smbd_server_fd(), fsp, fsp->fh->fd,
+               if (SMB_VFS_SENDFILE(smbd_server_fd(), fsp,
                                &header_blob, startpos, nread) == -1) {
                        /* Returning ENOSYS means no data at all was sent.
                         * Do this as a normal read. */
@@ -2780,8 +2731,9 @@ normal_readbraw:
  Reply to a readbraw (core+ protocol).
 ****************************************************************************/
 
-void reply_readbraw(connection_struct *conn, struct smb_request *req)
+void reply_readbraw(struct smb_request *req)
 {
+       connection_struct *conn = req->conn;
        ssize_t maxcount,mincount;
        size_t nread = 0;
        SMB_OFF_T startpos;
@@ -2791,8 +2743,8 @@ void reply_readbraw(connection_struct *conn, struct smb_request *req)
 
        START_PROFILE(SMBreadbraw);
 
-       if (srv_is_signing_active()) {
-               exit_server_cleanly("reply_readbraw: SMB signing is active - "
+       if (srv_is_signing_active() || is_encrypted_packet(req->inbuf)) {
+               exit_server_cleanly("reply_readbraw: SMB signing/sealing is active - "
                        "raw reads/writes are disallowed.");
        }
 
@@ -2895,7 +2847,7 @@ void reply_readbraw(connection_struct *conn, struct smb_request *req)
                return;
        }
 
-       if (SMB_VFS_FSTAT(fsp,fsp->fh->fd,&st) == 0) {
+       if (SMB_VFS_FSTAT(fsp, &st) == 0) {
                size = st.st_size;
        }
 
@@ -2930,8 +2882,9 @@ void reply_readbraw(connection_struct *conn, struct smb_request *req)
  Reply to a lockread (core+ protocol).
 ****************************************************************************/
 
-void reply_lockread(connection_struct *conn, struct smb_request *req)
+void reply_lockread(struct smb_request *req)
 {
+       connection_struct *conn = req->conn;
        ssize_t nread = -1;
        char *data;
        SMB_OFF_T startpos;
@@ -3017,7 +2970,7 @@ Returning short read of maximum allowed for compatibility with Windows 2000.\n",
                return;
        }
        
-       set_message((char *)req->outbuf, 5, nread+3, False);
+       srv_set_message((char *)req->outbuf, 5, nread+3, False);
 
        SSVAL(req->outbuf,smb_vwv0,nread);
        SSVAL(req->outbuf,smb_vwv5,nread+3);
@@ -3039,8 +2992,9 @@ Returning short read of maximum allowed for compatibility with Windows 2000.\n",
  Reply to a read.
 ****************************************************************************/
 
-void reply_read(connection_struct *conn, struct smb_request *req)
+void reply_read(struct smb_request *req)
 {
+       connection_struct *conn = req->conn;
        size_t numtoread;
        ssize_t nread = 0;
        char *data;
@@ -3104,7 +3058,7 @@ Returning short read of maximum allowed for compatibility with Windows 2000.\n",
                return;
        }
 
-       set_message((char *)req->outbuf, 5, nread+3, False);
+       srv_set_message((char *)req->outbuf, 5, nread+3, False);
 
        SSVAL(req->outbuf,smb_vwv0,nread);
        SSVAL(req->outbuf,smb_vwv5,nread+3);
@@ -3127,7 +3081,7 @@ static int setup_readX_header(char *outbuf, size_t smb_maxcnt)
        int outsize;
        char *data;
 
-       outsize = set_message(outbuf,12,smb_maxcnt,False);
+       outsize = srv_set_message(outbuf,12,smb_maxcnt,False);
        data = smb_buf(outbuf);
 
        memset(outbuf+smb_vwv0,'\0',24); /* valgrind init. */
@@ -3154,7 +3108,7 @@ static void send_file_readX(connection_struct *conn, struct smb_request *req,
        SMB_STRUCT_STAT sbuf;
        ssize_t nread = -1;
 
-       if(SMB_VFS_FSTAT(fsp,fsp->fh->fd, &sbuf) == -1) {
+       if(SMB_VFS_FSTAT(fsp, &sbuf) == -1) {
                reply_unixerror(req, ERRDOS, ERRnoaccess);
                return;
        }
@@ -3177,6 +3131,7 @@ static void send_file_readX(connection_struct *conn, struct smb_request *req,
         */
 
        if ((chain_size == 0) && (CVAL(req->inbuf,smb_vwv0) == 0xFF) &&
+           !is_encrypted_packet(req->inbuf) &&
            lp_use_sendfile(SNUM(conn)) && (fsp->wcp == NULL) ) {
                uint8 headerbuf[smb_size + 12 * 2];
                DATA_BLOB header;
@@ -3192,7 +3147,7 @@ static void send_file_readX(connection_struct *conn, struct smb_request *req,
                construct_reply_common((char *)req->inbuf, (char *)headerbuf);
                setup_readX_header((char *)headerbuf, smb_maxcnt);
 
-               if ((nread = SMB_VFS_SENDFILE( smbd_server_fd(), fsp, fsp->fh->fd, &header, startpos, smb_maxcnt)) == -1) {
+               if ((nread = SMB_VFS_SENDFILE(smbd_server_fd(), fsp, &header, startpos, smb_maxcnt)) == -1) {
                        /* Returning ENOSYS means no data at all was sent. Do this as a normal read. */
                        if (errno == ENOSYS) {
                                goto normal_read;
@@ -3283,8 +3238,9 @@ normal_read:
  Reply to a read and X.
 ****************************************************************************/
 
-void reply_read_and_X(connection_struct *conn, struct smb_request *req)
+void reply_read_and_X(struct smb_request *req)
 {
+       connection_struct *conn = req->conn;
        files_struct *fsp;
        SMB_OFF_T startpos;
        size_t smb_maxcnt;
@@ -3332,8 +3288,8 @@ void reply_read_and_X(connection_struct *conn, struct smb_request *req)
                                END_PROFILE(SMBreadX);
                                return;
                        }
-                       /* We currently don't do this on signed data. */
-                       if (srv_is_signing_active()) {
+                       /* We currently don't do this on signed or sealed data. */
+                       if (srv_is_signing_active() || is_encrypted_packet(req->inbuf)) {
                                reply_nterror(req, NT_STATUS_NOT_SUPPORTED);
                                END_PROFILE(SMBreadX);
                                return;
@@ -3382,8 +3338,8 @@ void reply_read_and_X(connection_struct *conn, struct smb_request *req)
                return;
        }
 
-       if (!big_readX
-           && schedule_aio_read_and_X(conn, req, fsp, startpos, smb_maxcnt)) {
+       if (!big_readX &&
+           schedule_aio_read_and_X(conn, req, fsp, startpos, smb_maxcnt)) {
                END_PROFILE(SMBreadX);
                return;
        }
@@ -3412,9 +3368,9 @@ void error_to_writebrawerr(struct smb_request *req)
  Reply to a writebraw (core+ or LANMAN1.0 protocol).
 ****************************************************************************/
 
-void reply_writebraw(connection_struct *conn, struct smb_request *req)
+void reply_writebraw(struct smb_request *req)
 {
-       int outsize = 0;
+       connection_struct *conn = req->conn;
        char *buf = NULL;
        ssize_t nwritten=0;
        ssize_t total_written=0;
@@ -3524,13 +3480,14 @@ void reply_writebraw(connection_struct *conn, struct smb_request *req)
         * it to send more bytes */
 
        memcpy(buf, req->inbuf, smb_size);
-       outsize = set_message(buf,
-                       Protocol>PROTOCOL_COREPLUS?1:0,0,True);
+       srv_set_message(buf,Protocol>PROTOCOL_COREPLUS?1:0,0,True);
        SCVAL(buf,smb_com,SMBwritebraw);
        SSVALS(buf,smb_vwv0,0xFFFF);
        show_msg(buf);
-       if (!send_smb(smbd_server_fd(),buf)) {
-               exit_server_cleanly("reply_writebraw: send_smb "
+       if (!srv_send_smb(smbd_server_fd(),
+                       buf,
+                       IS_CONN_ENCRYPTED(conn))) {
+               exit_server_cleanly("reply_writebraw: srv_send_smb "
                        "failed.");
        }
 
@@ -3639,8 +3596,9 @@ void reply_writebraw(connection_struct *conn, struct smb_request *req)
  Reply to a writeunlock (core+).
 ****************************************************************************/
 
-void reply_writeunlock(connection_struct *conn, struct smb_request *req)
+void reply_writeunlock(struct smb_request *req)
 {
+       connection_struct *conn = req->conn;
        ssize_t nwritten = -1;
        size_t numtowrite;
        SMB_OFF_T startpos;
@@ -3738,8 +3696,9 @@ void reply_writeunlock(connection_struct *conn, struct smb_request *req)
  Reply to a write.
 ****************************************************************************/
 
-void reply_write(connection_struct *conn, struct smb_request *req)
+void reply_write(struct smb_request *req)
 {
+       connection_struct *conn = req->conn;
        size_t numtowrite;
        ssize_t nwritten = -1;
        SMB_OFF_T startpos;
@@ -3849,13 +3808,19 @@ void reply_write(connection_struct *conn, struct smb_request *req)
                                                (2*14) + /* word count (including bcc) */ \
                                                1 /* pad byte */)
 
-bool is_valid_writeX_buffer(const char *inbuf)
+bool is_valid_writeX_buffer(const uint8_t *inbuf)
 {
        size_t numtowrite;
        connection_struct *conn = NULL;
        unsigned int doff = 0;
        size_t len = smb_len_large(inbuf);
 
+       if (is_encrypted_packet(inbuf)) {
+               /* Can't do this on encrypted
+                * connections. */
+               return false;
+       }
+
        if (CVAL(inbuf,smb_com) != SMBwriteX) {
                return false;
        }
@@ -3920,8 +3885,9 @@ bool is_valid_writeX_buffer(const char *inbuf)
  Reply to a write and X.
 ****************************************************************************/
 
-void reply_write_and_X(connection_struct *conn, struct smb_request *req)
+void reply_write_and_X(struct smb_request *req)
 {
+       connection_struct *conn = req->conn;
        files_struct *fsp;
        SMB_OFF_T startpos;
        size_t numtowrite;
@@ -4042,13 +4008,13 @@ void reply_write_and_X(connection_struct *conn, struct smb_request *req)
                nwritten = 0;
        } else {
 
-               if (req->unread_bytes == 0 &&
-                               schedule_aio_write_and_X(conn, req, fsp, data,
-                                                       startpos, numtowrite)) {
+               if ((req->unread_bytes == 0) &&
+                   schedule_aio_write_and_X(conn, req, fsp, data, startpos,
+                                            numtowrite)) {
                        END_PROFILE(SMBwriteX);
                        return;
                }
-
+               
                nwritten = write_file(req,fsp,data,startpos,numtowrite);
        }
 
@@ -4088,8 +4054,9 @@ void reply_write_and_X(connection_struct *conn, struct smb_request *req)
  Reply to a lseek.
 ****************************************************************************/
 
-void reply_lseek(connection_struct *conn, struct smb_request *req)
+void reply_lseek(struct smb_request *req)
 {
+       connection_struct *conn = req->conn;
        SMB_OFF_T startpos;
        SMB_OFF_T res= -1;
        int mode,umode;
@@ -4134,12 +4101,12 @@ void reply_lseek(connection_struct *conn, struct smb_request *req)
        }
 
        if (umode == SEEK_END) {
-               if((res = SMB_VFS_LSEEK(fsp,fsp->fh->fd,startpos,umode)) == -1) {
+               if((res = SMB_VFS_LSEEK(fsp,startpos,umode)) == -1) {
                        if(errno == EINVAL) {
                                SMB_OFF_T current_pos = startpos;
                                SMB_STRUCT_STAT sbuf;
 
-                               if(SMB_VFS_FSTAT(fsp,fsp->fh->fd, &sbuf) == -1) {
+                               if(SMB_VFS_FSTAT(fsp, &sbuf) == -1) {
                                        reply_unixerror(req, ERRDOS,
                                                        ERRnoaccess);
                                        END_PROFILE(SMBlseek);
@@ -4148,7 +4115,7 @@ void reply_lseek(connection_struct *conn, struct smb_request *req)
 
                                current_pos += sbuf.st_size;
                                if(current_pos < 0)
-                                       res = SMB_VFS_LSEEK(fsp,fsp->fh->fd,0,SEEK_SET);
+                                       res = SMB_VFS_LSEEK(fsp,0,SEEK_SET);
                        }
                }
 
@@ -4175,8 +4142,9 @@ void reply_lseek(connection_struct *conn, struct smb_request *req)
  Reply to a flush.
 ****************************************************************************/
 
-void reply_flush(connection_struct *conn, struct smb_request *req)
+void reply_flush(struct smb_request *req)
 {
+       connection_struct *conn = req->conn;
        uint16 fnum;
        files_struct *fsp;
 
@@ -4219,7 +4187,7 @@ void reply_flush(connection_struct *conn, struct smb_request *req)
  conn POINTER CAN BE NULL HERE !
 ****************************************************************************/
 
-void reply_exit(connection_struct *conn, struct smb_request *req)
+void reply_exit(struct smb_request *req)
 {
        START_PROFILE(SMBexit);
 
@@ -4237,8 +4205,9 @@ void reply_exit(connection_struct *conn, struct smb_request *req)
  Reply to a close - has to deal with closing a directory opened by NT SMB's.
 ****************************************************************************/
 
-void reply_close(connection_struct *conn, struct smb_request *req)
+void reply_close(struct smb_request *req)
 {
+       connection_struct *conn = req->conn;
        NTSTATUS status = NT_STATUS_OK;
        files_struct *fsp = NULL;
        START_PROFILE(SMBclose);
@@ -4315,8 +4284,9 @@ void reply_close(connection_struct *conn, struct smb_request *req)
  Reply to a writeclose (Core+ protocol).
 ****************************************************************************/
 
-void reply_writeclose(connection_struct *conn, struct smb_request *req)
+void reply_writeclose(struct smb_request *req)
 {
+       connection_struct *conn = req->conn;
        size_t numtowrite;
        ssize_t nwritten = -1;
        NTSTATUS close_status = NT_STATUS_OK;
@@ -4404,8 +4374,9 @@ void reply_writeclose(connection_struct *conn, struct smb_request *req)
  Reply to a lock.
 ****************************************************************************/
 
-void reply_lock(connection_struct *conn, struct smb_request *req)
+void reply_lock(struct smb_request *req)
 {
+       connection_struct *conn = req->conn;
        SMB_BIG_UINT count,offset;
        NTSTATUS status;
        files_struct *fsp;
@@ -4463,8 +4434,9 @@ void reply_lock(connection_struct *conn, struct smb_request *req)
  Reply to a unlock.
 ****************************************************************************/
 
-void reply_unlock(connection_struct *conn, struct smb_request *req)
+void reply_unlock(struct smb_request *req)
 {
+       connection_struct *conn = req->conn;
        SMB_BIG_UINT count,offset;
        NTSTATUS status;
        files_struct *fsp;
@@ -4517,8 +4489,9 @@ void reply_unlock(connection_struct *conn, struct smb_request *req)
  conn POINTER CAN BE NULL HERE !
 ****************************************************************************/
 
-void reply_tdis(connection_struct *conn, struct smb_request *req)
+void reply_tdis(struct smb_request *req)
 {
+       connection_struct *conn = req->conn;
        START_PROFILE(SMBtdis);
 
        if (!conn) {
@@ -4531,6 +4504,7 @@ void reply_tdis(connection_struct *conn, struct smb_request *req)
        conn->used = False;
 
        close_cnum(conn,req->vuid);
+       req->conn = NULL;
 
        reply_outbuf(req, 0, 0);
        END_PROFILE(SMBtdis);
@@ -4542,8 +4516,9 @@ void reply_tdis(connection_struct *conn, struct smb_request *req)
  conn POINTER CAN BE NULL HERE !
 ****************************************************************************/
 
-void reply_echo(connection_struct *conn, struct smb_request *req)
+void reply_echo(struct smb_request *req)
 {
+       connection_struct *conn = req->conn;
        int smb_reverb;
        int seq_num;
        unsigned int data_len = smb_buflen(req->inbuf);
@@ -4581,8 +4556,10 @@ void reply_echo(connection_struct *conn, struct smb_request *req)
                SSVAL(req->outbuf,smb_vwv0,seq_num);
 
                show_msg((char *)req->outbuf);
-               if (!send_smb(smbd_server_fd(),(char *)req->outbuf))
-                       exit_server_cleanly("reply_echo: send_smb failed.");
+               if (!srv_send_smb(smbd_server_fd(),
+                               (char *)req->outbuf,
+                               IS_CONN_ENCRYPTED(conn)||req->encrypted))
+                       exit_server_cleanly("reply_echo: srv_send_smb failed.");
        }
 
        DEBUG(3,("echo %d times\n", smb_reverb));
@@ -4599,8 +4576,9 @@ void reply_echo(connection_struct *conn, struct smb_request *req)
  Reply to a printopen.
 ****************************************************************************/
 
-void reply_printopen(connection_struct *conn, struct smb_request *req)
+void reply_printopen(struct smb_request *req)
 {
+       connection_struct *conn = req->conn;
        files_struct *fsp;
        NTSTATUS status;
        
@@ -4641,8 +4619,9 @@ void reply_printopen(connection_struct *conn, struct smb_request *req)
  Reply to a printclose.
 ****************************************************************************/
 
-void reply_printclose(connection_struct *conn, struct smb_request *req)
+void reply_printclose(struct smb_request *req)
 {
+       connection_struct *conn = req->conn;
        files_struct *fsp;
        NTSTATUS status;
 
@@ -4686,8 +4665,9 @@ void reply_printclose(connection_struct *conn, struct smb_request *req)
  Reply to a printqueue.
 ****************************************************************************/
 
-void reply_printqueue(connection_struct *conn, struct smb_request *req)
+void reply_printqueue(struct smb_request *req)
 {
+       connection_struct *conn = req->conn;
        int max_count;
        int start_index;
 
@@ -4778,8 +4758,9 @@ void reply_printqueue(connection_struct *conn, struct smb_request *req)
  Reply to a printwrite.
 ****************************************************************************/
 
-void reply_printwrite(connection_struct *conn, struct smb_request *req)
+void reply_printwrite(struct smb_request *req)
 {
+       connection_struct *conn = req->conn;
        int numtowrite;
        char *data;
        files_struct *fsp;
@@ -4837,8 +4818,9 @@ void reply_printwrite(connection_struct *conn, struct smb_request *req)
  Reply to a mkdir.
 ****************************************************************************/
 
-void reply_mkdir(connection_struct *conn, struct smb_request *req)
+void reply_mkdir(struct smb_request *req)
 {
+       connection_struct *conn = req->conn;
        char *directory = NULL;
        NTSTATUS status;
        SMB_STRUCT_STAT sbuf;
@@ -4885,7 +4867,7 @@ void reply_mkdir(connection_struct *conn, struct smb_request *req)
                return;
        }
 
-       status = create_directory(conn, directory);
+       status = create_directory(conn, req, directory);
 
        DEBUG(5, ("create_directory returned %s\n", nt_errstr(status)));
 
@@ -4927,7 +4909,8 @@ static bool recursive_rmdir(TALLOC_CTX *ctx,
        const char *dname = NULL;
        bool ret = True;
        long offset = 0;
-       struct smb_Dir *dir_hnd = OpenDir(conn, directory, NULL, 0);
+       struct smb_Dir *dir_hnd = OpenDir(talloc_tos(), conn, directory,
+                                         NULL, 0);
 
        if(dir_hnd == NULL)
                return False;
@@ -4975,7 +4958,7 @@ static bool recursive_rmdir(TALLOC_CTX *ctx,
                }
                TALLOC_FREE(fullname);
        }
-       CloseDir(dir_hnd);
+       TALLOC_FREE(dir_hnd);
        return ret;
 }
 
@@ -5023,7 +5006,8 @@ NTSTATUS rmdir_internals(TALLOC_CTX *ctx,
                 */
                const char *dname;
                long dirpos = 0;
-               struct smb_Dir *dir_hnd = OpenDir(conn, directory, NULL, 0);
+               struct smb_Dir *dir_hnd = OpenDir(talloc_tos(), conn,
+                                                 directory, NULL, 0);
 
                if(dir_hnd == NULL) {
                        errno = ENOTEMPTY;
@@ -5036,7 +5020,7 @@ NTSTATUS rmdir_internals(TALLOC_CTX *ctx,
                        if (!is_visible_file(conn, directory, dname, &st, False))
                                continue;
                        if(!IS_VETO_PATH(conn, dname)) {
-                               CloseDir(dir_hnd);
+                               TALLOC_FREE(dir_hnd);
                                errno = ENOTEMPTY;
                                goto err;
                        }
@@ -5081,7 +5065,7 @@ NTSTATUS rmdir_internals(TALLOC_CTX *ctx,
                        }
                        TALLOC_FREE(fullname);
                }
-               CloseDir(dir_hnd);
+               TALLOC_FREE(dir_hnd);
                /* Retry the rmdir */
                ret = SMB_VFS_RMDIR(conn,directory);
        }
@@ -5105,8 +5089,9 @@ NTSTATUS rmdir_internals(TALLOC_CTX *ctx,
  Reply to a rmdir.
 ****************************************************************************/
 
-void reply_rmdir(connection_struct *conn, struct smb_request *req)
+void reply_rmdir(struct smb_request *req)
 {
+       connection_struct *conn = req->conn;
        char *directory = NULL;
        SMB_STRUCT_STAT sbuf;
        NTSTATUS status;
@@ -5512,7 +5497,7 @@ NTSTATUS rename_internals_fsp(connection_struct *conn,
 
        /* Ensure we have a valid stat struct for the source. */
        if (fsp->fh->fd != -1) {
-               if (SMB_VFS_FSTAT(fsp,fsp->fh->fd,&sbuf) == -1) {
+               if (SMB_VFS_FSTAT(fsp, &sbuf) == -1) {
                        return map_nt_error_from_unix(errno);
                }
        } else {
@@ -5535,7 +5520,7 @@ NTSTATUS rename_internals_fsp(connection_struct *conn,
                return NT_STATUS_ACCESS_DENIED;
        }
 
-       lck = get_share_mode_lock(NULL, fsp->file_id, NULL, NULL);
+       lck = get_share_mode_lock(talloc_tos(), fsp->file_id, NULL, NULL);
 
        /*
         * We have the file open ourselves, so not being able to get the
@@ -5776,7 +5761,7 @@ NTSTATUS rename_internals(TALLOC_CTX *ctx,
                return status;
        }
 
-       dir_hnd = OpenDir(conn, directory, mask, attrs);
+       dir_hnd = OpenDir(talloc_tos(), conn, directory, mask, attrs);
        if (dir_hnd == NULL) {
                return map_nt_error_from_unix(errno);
        }
@@ -5876,7 +5861,7 @@ NTSTATUS rename_internals(TALLOC_CTX *ctx,
                TALLOC_FREE(fname);
                TALLOC_FREE(destname);
        }
-       CloseDir(dir_hnd);
+       TALLOC_FREE(dir_hnd);
 
        if (count == 0 && NT_STATUS_IS_OK(status)) {
                status = map_nt_error_from_unix(errno);
@@ -5889,8 +5874,9 @@ NTSTATUS rename_internals(TALLOC_CTX *ctx,
  Reply to a mv.
 ****************************************************************************/
 
-void reply_mv(connection_struct *conn, struct smb_request *req)
+void reply_mv(struct smb_request *req)
 {
+       connection_struct *conn = req->conn;
        char *name = NULL;
        char *newname = NULL;
        char *p;
@@ -6078,7 +6064,7 @@ NTSTATUS copy_file(TALLOC_CTX *ctx,
        }
 
        if ((ofun&3) == 1) {
-               if(SMB_VFS_LSEEK(fsp2,fsp2->fh->fd,0,SEEK_END) == -1) {
+               if(SMB_VFS_LSEEK(fsp2,0,SEEK_END) == -1) {
                        DEBUG(0,("copy_file: error - vfs lseek returned error %s\n", strerror(errno) ));
                        /*
                         * Stop the copy from occurring.
@@ -6120,8 +6106,9 @@ NTSTATUS copy_file(TALLOC_CTX *ctx,
  Reply to a file copy.
 ****************************************************************************/
 
-void reply_copy(connection_struct *conn, struct smb_request *req)
+void reply_copy(struct smb_request *req)
 {
+       connection_struct *conn = req->conn;
        char *name = NULL;
        char *newname = NULL;
        char *directory = NULL;
@@ -6348,7 +6335,7 @@ void reply_copy(connection_struct *conn, struct smb_request *req)
                        return;
                }
 
-               dir_hnd = OpenDir(conn, directory, mask, 0);
+               dir_hnd = OpenDir(talloc_tos(), conn, directory, mask, 0);
                if (dir_hnd == NULL) {
                        status = map_nt_error_from_unix(errno);
                        reply_nterror(req, status);
@@ -6380,6 +6367,7 @@ void reply_copy(connection_struct *conn, struct smb_request *req)
                                        directory,
                                        dname);
                        if (!fname) {
+                               TALLOC_FREE(dir_hnd);
                                reply_nterror(req, NT_STATUS_NO_MEMORY);
                                END_PROFILE(SMBcopy);
                                return;
@@ -6390,6 +6378,7 @@ void reply_copy(connection_struct *conn, struct smb_request *req)
                                continue;
                        }
                        if (!destname) {
+                               TALLOC_FREE(dir_hnd);
                                reply_nterror(req, NT_STATUS_NO_MEMORY);
                                END_PROFILE(SMBcopy);
                                return;
@@ -6397,6 +6386,7 @@ void reply_copy(connection_struct *conn, struct smb_request *req)
 
                        status = check_name(conn, fname);
                        if (!NT_STATUS_IS_OK(status)) {
+                               TALLOC_FREE(dir_hnd);
                                reply_nterror(req, status);
                                END_PROFILE(SMBcopy);
                                return;
@@ -6404,6 +6394,7 @@ void reply_copy(connection_struct *conn, struct smb_request *req)
 
                        status = check_name(conn, destname);
                        if (!NT_STATUS_IS_OK(status)) {
+                               TALLOC_FREE(dir_hnd);
                                reply_nterror(req, status);
                                END_PROFILE(SMBcopy);
                                return;
@@ -6419,7 +6410,7 @@ void reply_copy(connection_struct *conn, struct smb_request *req)
                        TALLOC_FREE(fname);
                        TALLOC_FREE(destname);
                }
-               CloseDir(dir_hnd);
+               TALLOC_FREE(dir_hnd);
        }
 
        if (count == 0) {
@@ -6583,8 +6574,9 @@ SMB_BIG_UINT get_lock_offset( char *data, int data_offset, bool large_file_forma
  Reply to a lockingX request.
 ****************************************************************************/
 
-void reply_lockingX(connection_struct *conn, struct smb_request *req)
+void reply_lockingX(struct smb_request *req)
 {
+       connection_struct *conn = req->conn;
        files_struct *fsp;
        unsigned char locktype;
        unsigned char oplocklevel;
@@ -6858,8 +6850,7 @@ void reply_lockingX(connection_struct *conn, struct smb_request *req)
                                 * onto the blocking lock queue.
                                 */
                                if(push_blocking_lock_request(br_lck,
-                                                       (char *)req->inbuf,
-                                                       smb_len(req->inbuf)+4,
+                                                       req,
                                                        fsp,
                                                        lock_timeout,
                                                        i,
@@ -6942,7 +6933,7 @@ void reply_lockingX(connection_struct *conn, struct smb_request *req)
  please contact vl@samba.org
 ****************************************************************************/
 
-void reply_readbmpx(connection_struct *conn, struct smb_request *req)
+void reply_readbmpx(struct smb_request *req)
 {
        START_PROFILE(SMBreadBmpx);
        reply_doserror(req, ERRSRV, ERRuseSTD);
@@ -6956,7 +6947,7 @@ void reply_readbmpx(connection_struct *conn, struct smb_request *req)
  please contact vl@samba.org
 ****************************************************************************/
 
-void reply_readbs(connection_struct *conn, struct smb_request *req)
+void reply_readbs(struct smb_request *req)
 {
        START_PROFILE(SMBreadBs);
        reply_doserror(req, ERRSRV, ERRuseSTD);
@@ -6968,8 +6959,9 @@ void reply_readbs(connection_struct *conn, struct smb_request *req)
  Reply to a SMBsetattrE.
 ****************************************************************************/
 
-void reply_setattrE(connection_struct *conn, struct smb_request *req)
+void reply_setattrE(struct smb_request *req)
 {
+       connection_struct *conn = req->conn;
        struct timespec ts[2];
        files_struct *fsp;
 
@@ -7046,7 +7038,7 @@ void reply_setattrE(connection_struct *conn, struct smb_request *req)
  please contact vl@samba.org
 ****************************************************************************/
 
-void reply_writebmpx(connection_struct *conn, struct smb_request *req)
+void reply_writebmpx(struct smb_request *req)
 {
        START_PROFILE(SMBwriteBmpx);
        reply_doserror(req, ERRSRV, ERRuseSTD);
@@ -7060,7 +7052,7 @@ void reply_writebmpx(connection_struct *conn, struct smb_request *req)
  please contact vl@samba.org
 ****************************************************************************/
 
-void reply_writebs(connection_struct *conn, struct smb_request *req)
+void reply_writebs(struct smb_request *req)
 {
        START_PROFILE(SMBwriteBs);
        reply_doserror(req, ERRSRV, ERRuseSTD);
@@ -7072,8 +7064,9 @@ void reply_writebs(connection_struct *conn, struct smb_request *req)
  Reply to a SMBgetattrE.
 ****************************************************************************/
 
-void reply_getattrE(connection_struct *conn, struct smb_request *req)
+void reply_getattrE(struct smb_request *req)
 {
+       connection_struct *conn = req->conn;
        SMB_STRUCT_STAT sbuf;
        int mode;
        files_struct *fsp;
diff --git a/source/smbd/seal.c b/source/smbd/seal.c
new file mode 100644 (file)
index 0000000..ea017e0
--- /dev/null
@@ -0,0 +1,728 @@
+/* 
+   Unix SMB/CIFS implementation.
+   SMB Transport encryption (sealing) code - server code.
+   Copyright (C) Jeremy Allison 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"
+
+/******************************************************************************
+ Server side encryption.
+******************************************************************************/
+
+/******************************************************************************
+ Global server state.
+******************************************************************************/
+
+struct smb_srv_trans_enc_ctx {
+       struct smb_trans_enc_state *es;
+       AUTH_NTLMSSP_STATE *auth_ntlmssp_state; /* Must be kept in sync with pointer in ec->ntlmssp_state. */
+};
+
+static struct smb_srv_trans_enc_ctx *partial_srv_trans_enc_ctx;
+static struct smb_srv_trans_enc_ctx *srv_trans_enc_ctx;
+
+/******************************************************************************
+ Return global enc context - this must change if we ever do multiple contexts.
+******************************************************************************/
+
+uint16_t srv_enc_ctx(void)
+{
+       return srv_trans_enc_ctx->es->enc_ctx_num;
+}
+
+/******************************************************************************
+ Is this an incoming encrypted packet ?
+******************************************************************************/
+
+bool is_encrypted_packet(const uint8_t *inbuf)
+{
+       NTSTATUS status;
+       uint16_t enc_num;
+
+       /* Ignore non-session messages or non 0xFF'E' messages. */
+       if(CVAL(inbuf,0) || !(inbuf[4] == 0xFF && inbuf[5] == 'E')) {
+               return false;
+       }
+
+       status = get_enc_ctx_num(inbuf, &enc_num);
+       if (!NT_STATUS_IS_OK(status)) {
+               return false;
+       }
+
+       /* Encrypted messages are 0xFF'E'<ctx> */
+       if (srv_trans_enc_ctx && enc_num == srv_enc_ctx()) {
+               return true;
+       }
+       return false;
+}
+
+/******************************************************************************
+ Create an auth_ntlmssp_state and ensure pointer copy is correct.
+******************************************************************************/
+
+static NTSTATUS make_auth_ntlmssp(struct smb_srv_trans_enc_ctx *ec)
+{
+       NTSTATUS status = auth_ntlmssp_start(&ec->auth_ntlmssp_state);
+       if (!NT_STATUS_IS_OK(status)) {
+               return nt_status_squash(status);
+       }
+
+       /*
+        * We must remember to update the pointer copy for the common
+        * functions after any auth_ntlmssp_start/auth_ntlmssp_end.
+        */
+       ec->es->s.ntlmssp_state = ec->auth_ntlmssp_state->ntlmssp_state;
+       return status;
+}
+
+/******************************************************************************
+ Destroy an auth_ntlmssp_state and ensure pointer copy is correct.
+******************************************************************************/
+
+static void destroy_auth_ntlmssp(struct smb_srv_trans_enc_ctx *ec)
+{
+       /*
+        * We must remember to update the pointer copy for the common
+        * functions after any auth_ntlmssp_start/auth_ntlmssp_end.
+        */
+
+       if (ec->auth_ntlmssp_state) {
+               auth_ntlmssp_end(&ec->auth_ntlmssp_state);
+               /* The auth_ntlmssp_end killed this already. */
+               ec->es->s.ntlmssp_state = NULL;
+       }
+}
+
+#if defined(HAVE_GSSAPI) && defined(HAVE_KRB5)
+
+/******************************************************************************
+ Import a name.
+******************************************************************************/
+
+static NTSTATUS get_srv_gss_creds(const char *service,
+                               const char *name,
+                               gss_cred_usage_t cred_type,
+                               gss_cred_id_t *p_srv_cred)
+{
+       OM_uint32 ret;
+       OM_uint32 min;
+       gss_name_t srv_name;
+       gss_buffer_desc input_name;
+       char *host_princ_s = NULL;
+       NTSTATUS status = NT_STATUS_OK;
+
+       gss_OID_desc nt_hostbased_service =
+       {10, CONST_DISCARD(char *,"\x2a\x86\x48\x86\xf7\x12\x01\x02\x01\x04")};
+
+       asprintf(&host_princ_s, "%s@%s", service, name);
+       if (host_princ_s == NULL) {
+               return NT_STATUS_NO_MEMORY;
+       }
+
+       input_name.value = host_princ_s;
+       input_name.length = strlen(host_princ_s) + 1;
+
+       ret = gss_import_name(&min,
+                               &input_name,
+                               &nt_hostbased_service,
+                               &srv_name);
+
+       DEBUG(10,("get_srv_gss_creds: imported name %s\n",
+               host_princ_s ));
+
+       if (ret != GSS_S_COMPLETE) {
+               SAFE_FREE(host_princ_s);
+               return map_nt_error_from_gss(ret, min);
+       }
+
+       /*
+        * We're accessing the krb5.keytab file here.
+        * ensure we have permissions to do so.
+        */
+       become_root();
+
+       ret = gss_acquire_cred(&min,
+                               srv_name,
+                               GSS_C_INDEFINITE,
+                               GSS_C_NULL_OID_SET,
+                               cred_type,
+                               p_srv_cred,
+                               NULL,
+                               NULL);
+       unbecome_root();
+
+       if (ret != GSS_S_COMPLETE) {
+               ADS_STATUS adss = ADS_ERROR_GSS(ret, min);
+               DEBUG(10,("get_srv_gss_creds: gss_acquire_cred failed with %s\n",
+                       ads_errstr(adss)));
+               status = map_nt_error_from_gss(ret, min);
+       }
+
+       SAFE_FREE(host_princ_s);
+       gss_release_name(&min, &srv_name);
+       return status;
+}
+
+/******************************************************************************
+ Create a gss state.
+ Try and get the cifs/server@realm principal first, then fall back to
+ host/server@realm.
+******************************************************************************/
+
+static NTSTATUS make_auth_gss(struct smb_srv_trans_enc_ctx *ec)
+{
+       NTSTATUS status;
+       gss_cred_id_t srv_cred;
+       fstring fqdn;
+
+       name_to_fqdn(fqdn, global_myname());
+       strlower_m(fqdn);
+
+       status = get_srv_gss_creds("cifs", fqdn, GSS_C_ACCEPT, &srv_cred);
+       if (!NT_STATUS_IS_OK(status)) {
+               status = get_srv_gss_creds("host", fqdn, GSS_C_ACCEPT, &srv_cred);
+               if (!NT_STATUS_IS_OK(status)) {
+                       return nt_status_squash(status);
+               }
+       }
+
+       ec->es->s.gss_state = SMB_MALLOC_P(struct smb_tran_enc_state_gss);
+       if (!ec->es->s.gss_state) {
+               OM_uint32 min;
+               gss_release_cred(&min, &srv_cred);
+               return NT_STATUS_NO_MEMORY;
+       }
+       ZERO_STRUCTP(ec->es->s.gss_state);
+       ec->es->s.gss_state->creds = srv_cred;
+
+       /* No context yet. */
+       ec->es->s.gss_state->gss_ctx = GSS_C_NO_CONTEXT;
+
+       return NT_STATUS_OK;
+}
+#endif
+
+/******************************************************************************
+ Shutdown a server encryption context.
+******************************************************************************/
+
+static void srv_free_encryption_context(struct smb_srv_trans_enc_ctx **pp_ec)
+{
+       struct smb_srv_trans_enc_ctx *ec = *pp_ec;
+
+       if (!ec) {
+               return;
+       }
+
+       if (ec->es) {
+               switch (ec->es->smb_enc_type) {
+                       case SMB_TRANS_ENC_NTLM:
+                               destroy_auth_ntlmssp(ec);
+                               break;
+#if defined(HAVE_GSSAPI) && defined(HAVE_KRB5)
+                       case SMB_TRANS_ENC_GSS:
+                               break;
+#endif
+               }
+               common_free_encryption_state(&ec->es);
+       }
+
+       SAFE_FREE(ec);
+       *pp_ec = NULL;
+}
+
+/******************************************************************************
+ Create a server encryption context.
+******************************************************************************/
+
+static NTSTATUS make_srv_encryption_context(enum smb_trans_enc_type smb_enc_type, struct smb_srv_trans_enc_ctx **pp_ec)
+{
+       struct smb_srv_trans_enc_ctx *ec;
+
+       *pp_ec = NULL;
+
+       ec = SMB_MALLOC_P(struct smb_srv_trans_enc_ctx);
+       if (!ec) {
+               return NT_STATUS_NO_MEMORY;
+       }
+       ZERO_STRUCTP(partial_srv_trans_enc_ctx);
+       ec->es = SMB_MALLOC_P(struct smb_trans_enc_state);
+       if (!ec->es) {
+               SAFE_FREE(ec);
+               return NT_STATUS_NO_MEMORY;
+       }
+       ZERO_STRUCTP(ec->es);
+       ec->es->smb_enc_type = smb_enc_type;
+       switch (smb_enc_type) {
+               case SMB_TRANS_ENC_NTLM:
+                       {
+                               NTSTATUS status = make_auth_ntlmssp(ec);
+                               if (!NT_STATUS_IS_OK(status)) {
+                                       srv_free_encryption_context(&ec);
+                                       return status;
+                               }
+                       }
+                       break;
+
+#if defined(HAVE_GSSAPI) && defined(HAVE_KRB5)
+               case SMB_TRANS_ENC_GSS:
+                       /* Acquire our credentials by calling gss_acquire_cred here. */
+                       {
+                               NTSTATUS status = make_auth_gss(ec);
+                               if (!NT_STATUS_IS_OK(status)) {
+                                       srv_free_encryption_context(&ec);
+                                       return status;
+                               }
+                       }
+                       break;
+#endif
+               default:
+                       srv_free_encryption_context(&ec);
+                       return NT_STATUS_INVALID_PARAMETER;
+       }
+       *pp_ec = ec;
+       return NT_STATUS_OK;
+}
+
+/******************************************************************************
+ Free an encryption-allocated buffer.
+******************************************************************************/
+
+void srv_free_enc_buffer(char *buf)
+{
+       /* We know this is an smb buffer, and we
+        * didn't malloc, only copy, for a keepalive,
+        * so ignore non-session messages. */
+
+       if(CVAL(buf,0)) {
+               return;
+       }
+
+       if (srv_trans_enc_ctx) {
+               common_free_enc_buffer(srv_trans_enc_ctx->es, buf);
+       }
+}
+
+/******************************************************************************
+ Decrypt an incoming buffer.
+******************************************************************************/
+
+NTSTATUS srv_decrypt_buffer(char *buf)
+{
+       /* Ignore non-session messages. */
+       if(CVAL(buf,0)) {
+               return NT_STATUS_OK;
+       }
+
+       if (srv_trans_enc_ctx) {
+               return common_decrypt_buffer(srv_trans_enc_ctx->es, buf);
+       }
+
+       return NT_STATUS_OK;
+}
+
+/******************************************************************************
+ Encrypt an outgoing buffer. Return the encrypted pointer in buf_out.
+******************************************************************************/
+
+NTSTATUS srv_encrypt_buffer(char *buf, char **buf_out)
+{
+       *buf_out = buf;
+
+       /* Ignore non-session messages. */
+       if(CVAL(buf,0)) {
+               return NT_STATUS_OK;
+       }
+
+       if (srv_trans_enc_ctx) {
+               return common_encrypt_buffer(srv_trans_enc_ctx->es, buf, buf_out);
+       }
+       /* Not encrypting. */
+       return NT_STATUS_OK;
+}
+
+/******************************************************************************
+ Do the gss encryption negotiation. Parameters are in/out.
+ Until success we do everything on the partial enc ctx.
+******************************************************************************/
+
+#if defined(HAVE_GSSAPI) && defined(HAVE_KRB5)
+static NTSTATUS srv_enc_spnego_gss_negotiate(unsigned char **ppdata, size_t *p_data_size, DATA_BLOB secblob)
+{
+       OM_uint32 ret;
+       OM_uint32 min;
+       OM_uint32 flags = 0;
+       gss_buffer_desc in_buf, out_buf;
+       struct smb_tran_enc_state_gss *gss_state;
+       DATA_BLOB auth_reply = data_blob_null;
+       DATA_BLOB response = data_blob_null;
+       NTSTATUS status;
+
+       if (!partial_srv_trans_enc_ctx) {
+               status = make_srv_encryption_context(SMB_TRANS_ENC_GSS, &partial_srv_trans_enc_ctx);
+               if (!NT_STATUS_IS_OK(status)) {
+                       return status;
+               }
+       }
+
+       gss_state = partial_srv_trans_enc_ctx->es->s.gss_state;
+
+       in_buf.value = secblob.data;
+       in_buf.length = secblob.length;
+
+       out_buf.value = NULL;
+       out_buf.length = 0;
+
+       become_root();
+
+       ret = gss_accept_sec_context(&min,
+                               &gss_state->gss_ctx,
+                               gss_state->creds,
+                               &in_buf,
+                               GSS_C_NO_CHANNEL_BINDINGS,
+                               NULL,
+                               NULL,           /* Ignore oids. */
+                               &out_buf,       /* To return. */
+                               &flags,
+                               NULL,           /* Ingore time. */
+                               NULL);          /* Ignore delegated creds. */
+       unbecome_root();
+
+       status = gss_err_to_ntstatus(ret, min);
+       if (ret != GSS_S_COMPLETE && ret != GSS_S_CONTINUE_NEEDED) {
+               return status;
+       }
+
+       /* Ensure we've got sign+seal available. */
+       if (ret == GSS_S_COMPLETE) {
+               if ((flags & (GSS_C_INTEG_FLAG|GSS_C_CONF_FLAG|GSS_C_REPLAY_FLAG|GSS_C_SEQUENCE_FLAG)) !=
+                               (GSS_C_INTEG_FLAG|GSS_C_CONF_FLAG|GSS_C_REPLAY_FLAG|GSS_C_SEQUENCE_FLAG)) {
+                       DEBUG(0,("srv_enc_spnego_gss_negotiate: quality of service not good enough "
+                               "for SMB sealing.\n"));
+                       gss_release_buffer(&min, &out_buf);
+                       return NT_STATUS_ACCESS_DENIED;
+               }
+       }
+
+       auth_reply = data_blob(out_buf.value, out_buf.length);
+       gss_release_buffer(&min, &out_buf);
+
+       /* Wrap in SPNEGO. */
+       response = spnego_gen_auth_response(&auth_reply, status, OID_KERBEROS5);
+       data_blob_free(&auth_reply);
+
+       SAFE_FREE(*ppdata);
+       *ppdata = response.data;
+       *p_data_size = response.length;
+
+       return status;
+}
+#endif
+
+/******************************************************************************
+ Do the NTLM SPNEGO (or raw) encryption negotiation. Parameters are in/out.
+ Until success we do everything on the partial enc ctx.
+******************************************************************************/
+
+static NTSTATUS srv_enc_ntlm_negotiate(unsigned char **ppdata, size_t *p_data_size, DATA_BLOB secblob, bool spnego_wrap)
+{
+       NTSTATUS status;
+       DATA_BLOB chal = data_blob_null;
+       DATA_BLOB response = data_blob_null;
+
+       status = make_srv_encryption_context(SMB_TRANS_ENC_NTLM, &partial_srv_trans_enc_ctx);
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       status = auth_ntlmssp_update(partial_srv_trans_enc_ctx->auth_ntlmssp_state, secblob, &chal);
+
+       /* status here should be NT_STATUS_MORE_PROCESSING_REQUIRED
+        * for success ... */
+
+       if (spnego_wrap) {
+               response = spnego_gen_auth_response(&chal, status, OID_NTLMSSP);
+               data_blob_free(&chal);
+       } else {
+               /* Return the raw blob. */
+               response = chal;
+       }
+
+       SAFE_FREE(*ppdata);
+       *ppdata = response.data;
+       *p_data_size = response.length;
+       return status;
+}
+
+/******************************************************************************
+ Do the SPNEGO encryption negotiation. Parameters are in/out.
+ Based off code in smbd/sesssionsetup.c
+ Until success we do everything on the partial enc ctx.
+******************************************************************************/
+
+static NTSTATUS srv_enc_spnego_negotiate(connection_struct *conn,
+                                       unsigned char **ppdata,
+                                       size_t *p_data_size,
+                                       unsigned char **pparam,
+                                       size_t *p_param_size)
+{
+       NTSTATUS status;
+       DATA_BLOB blob = data_blob_null;
+       DATA_BLOB secblob = data_blob_null;
+       bool got_kerberos_mechanism = false;
+
+       blob = data_blob_const(*ppdata, *p_data_size);
+
+       status = parse_spnego_mechanisms(blob, &secblob, &got_kerberos_mechanism);
+       if (!NT_STATUS_IS_OK(status)) {
+               return nt_status_squash(status);
+       }
+
+       /* We should have no partial context at this point. */
+
+       srv_free_encryption_context(&partial_srv_trans_enc_ctx);
+
+#if defined(HAVE_GSSAPI) && defined(HAVE_KRB5)
+       if (got_kerberos_mechanism && lp_use_kerberos_keytab() ) {
+               status = srv_enc_spnego_gss_negotiate(ppdata, p_data_size, secblob);
+       } else 
+#endif
+       {
+               status = srv_enc_ntlm_negotiate(ppdata, p_data_size, secblob, true);
+       }
+
+       data_blob_free(&secblob);
+
+       if (!NT_STATUS_EQUAL(status,NT_STATUS_MORE_PROCESSING_REQUIRED) && !NT_STATUS_IS_OK(status)) {
+               srv_free_encryption_context(&partial_srv_trans_enc_ctx);
+               return nt_status_squash(status);
+       }
+
+       if (NT_STATUS_IS_OK(status)) {
+               /* Return the context we're using for this encryption state. */
+               if (!(*pparam = SMB_MALLOC_ARRAY(unsigned char, 2))) {
+                       return NT_STATUS_NO_MEMORY;
+               }
+               SSVAL(*pparam,0,partial_srv_trans_enc_ctx->es->enc_ctx_num);
+               *p_param_size = 2;
+       }
+
+       return status;
+}
+
+/******************************************************************************
+ Complete a SPNEGO encryption negotiation. Parameters are in/out.
+ We only get this for a NTLM auth second stage.
+******************************************************************************/
+
+static NTSTATUS srv_enc_spnego_ntlm_auth(connection_struct *conn,
+                                       unsigned char **ppdata,
+                                       size_t *p_data_size,
+                                       unsigned char **pparam,
+                                       size_t *p_param_size)
+{
+       NTSTATUS status;
+       DATA_BLOB blob = data_blob_null;
+       DATA_BLOB auth = data_blob_null;
+       DATA_BLOB auth_reply = data_blob_null;
+       DATA_BLOB response = data_blob_null;
+       struct smb_srv_trans_enc_ctx *ec = partial_srv_trans_enc_ctx;
+
+       /* We must have a partial context here. */
+
+       if (!ec || !ec->es || ec->auth_ntlmssp_state == NULL || ec->es->smb_enc_type != SMB_TRANS_ENC_NTLM) {
+               srv_free_encryption_context(&partial_srv_trans_enc_ctx);
+               return NT_STATUS_INVALID_PARAMETER;
+       }
+
+       blob = data_blob_const(*ppdata, *p_data_size);
+       if (!spnego_parse_auth(blob, &auth)) {
+               srv_free_encryption_context(&partial_srv_trans_enc_ctx);
+               return NT_STATUS_INVALID_PARAMETER;
+       }
+
+       status = auth_ntlmssp_update(ec->auth_ntlmssp_state, auth, &auth_reply);
+       data_blob_free(&auth);
+
+       response = spnego_gen_auth_response(&auth_reply, status, OID_NTLMSSP);
+       data_blob_free(&auth_reply);
+
+       if (NT_STATUS_IS_OK(status)) {
+               /* Return the context we're using for this encryption state. */
+               if (!(*pparam = SMB_MALLOC_ARRAY(unsigned char, 2))) {
+                       return NT_STATUS_NO_MEMORY;
+               }
+               SSVAL(*pparam,0,ec->es->enc_ctx_num);
+               *p_param_size = 2;
+       }
+
+       SAFE_FREE(*ppdata);
+       *ppdata = response.data;
+       *p_data_size = response.length;
+       return status;
+}
+
+/******************************************************************************
+ Raw NTLM encryption negotiation. Parameters are in/out.
+ This function does both steps.
+******************************************************************************/
+
+static NTSTATUS srv_enc_raw_ntlm_auth(connection_struct *conn,
+                                       unsigned char **ppdata,
+                                       size_t *p_data_size,
+                                       unsigned char **pparam,
+                                       size_t *p_param_size)
+{
+       NTSTATUS status;
+       DATA_BLOB blob = data_blob_const(*ppdata, *p_data_size);
+       DATA_BLOB response = data_blob_null;
+       struct smb_srv_trans_enc_ctx *ec;
+
+       if (!partial_srv_trans_enc_ctx) {
+               /* This is the initial step. */
+               status = srv_enc_ntlm_negotiate(ppdata, p_data_size, blob, false);
+               if (!NT_STATUS_EQUAL(status,NT_STATUS_MORE_PROCESSING_REQUIRED) && !NT_STATUS_IS_OK(status)) {
+                       srv_free_encryption_context(&partial_srv_trans_enc_ctx);
+                       return nt_status_squash(status);
+               }
+               return status;
+       }
+
+       ec = partial_srv_trans_enc_ctx;
+       if (!ec || !ec->es || ec->auth_ntlmssp_state == NULL || ec->es->smb_enc_type != SMB_TRANS_ENC_NTLM) {
+               srv_free_encryption_context(&partial_srv_trans_enc_ctx);
+               return NT_STATUS_INVALID_PARAMETER;
+       }
+
+       /* Second step. */
+       status = auth_ntlmssp_update(partial_srv_trans_enc_ctx->auth_ntlmssp_state, blob, &response);
+
+       if (NT_STATUS_IS_OK(status)) {
+               /* Return the context we're using for this encryption state. */
+               if (!(*pparam = SMB_MALLOC_ARRAY(unsigned char, 2))) {
+                       return NT_STATUS_NO_MEMORY;
+               }
+               SSVAL(*pparam,0,ec->es->enc_ctx_num);
+               *p_param_size = 2;
+       }
+
+       /* Return the raw blob. */
+       SAFE_FREE(*ppdata);
+       *ppdata = response.data;
+       *p_data_size = response.length;
+       return status;
+}
+
+/******************************************************************************
+ Do the SPNEGO encryption negotiation. Parameters are in/out.
+******************************************************************************/
+
+NTSTATUS srv_request_encryption_setup(connection_struct *conn,
+                                       unsigned char **ppdata,
+                                       size_t *p_data_size,
+                                       unsigned char **pparam,
+                                       size_t *p_param_size)
+{
+       unsigned char *pdata = *ppdata;
+
+       SAFE_FREE(*pparam);
+       *p_param_size = 0;
+
+       if (*p_data_size < 1) {
+               return NT_STATUS_INVALID_PARAMETER;
+       }
+
+       if (pdata[0] == ASN1_APPLICATION(0)) {
+               /* its a negTokenTarg packet */
+               return srv_enc_spnego_negotiate(conn, ppdata, p_data_size, pparam, p_param_size);
+       }
+
+       if (pdata[0] == ASN1_CONTEXT(1)) {
+               /* It's an auth packet */
+               return srv_enc_spnego_ntlm_auth(conn, ppdata, p_data_size, pparam, p_param_size);
+       }
+
+       /* Maybe it's a raw unwrapped auth ? */
+       if (*p_data_size < 7) {
+               return NT_STATUS_INVALID_PARAMETER;
+       }
+
+       if (strncmp((char *)pdata, "NTLMSSP", 7) == 0) {
+               return srv_enc_raw_ntlm_auth(conn, ppdata, p_data_size, pparam, p_param_size);
+       }
+
+       DEBUG(1,("srv_request_encryption_setup: Unknown packet\n"));
+
+       return NT_STATUS_LOGON_FAILURE;
+}
+
+/******************************************************************************
+ Negotiation was successful - turn on server-side encryption.
+******************************************************************************/
+
+static NTSTATUS check_enc_good(struct smb_srv_trans_enc_ctx *ec)
+{
+       if (!ec || !ec->es) {
+               return NT_STATUS_LOGON_FAILURE;
+       }
+
+       if (ec->es->smb_enc_type == SMB_TRANS_ENC_NTLM) {
+               if ((ec->es->s.ntlmssp_state->neg_flags & (NTLMSSP_NEGOTIATE_SIGN|NTLMSSP_NEGOTIATE_SEAL)) !=
+                               (NTLMSSP_NEGOTIATE_SIGN|NTLMSSP_NEGOTIATE_SEAL)) {
+                       return NT_STATUS_INVALID_PARAMETER;
+               }
+       }
+       /* Todo - check gssapi case. */
+
+       return NT_STATUS_OK;
+}
+
+/******************************************************************************
+ Negotiation was successful - turn on server-side encryption.
+******************************************************************************/
+
+NTSTATUS srv_encryption_start(connection_struct *conn)
+{
+       NTSTATUS status;
+
+       /* Check that we are really doing sign+seal. */
+       status = check_enc_good(partial_srv_trans_enc_ctx);
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+       /* Throw away the context we're using currently (if any). */
+       srv_free_encryption_context(&srv_trans_enc_ctx);
+
+       /* Steal the partial pointer. Deliberate shallow copy. */
+       srv_trans_enc_ctx = partial_srv_trans_enc_ctx;
+       srv_trans_enc_ctx->es->enc_on = true;
+
+       partial_srv_trans_enc_ctx = NULL;
+
+       DEBUG(1,("srv_encryption_start: context negotiated\n"));
+       return NT_STATUS_OK;
+}
+
+/******************************************************************************
+ Shutdown all server contexts.
+******************************************************************************/
+
+void server_encryption_shutdown(void)
+{
+       srv_free_encryption_context(&partial_srv_trans_enc_ctx);
+       srv_free_encryption_context(&srv_trans_enc_ctx);
+}
index 6edcc3676425e5e2711029fdebb58a849110eb9f..0f307f6a647b09eb9398692d68d18851b64f0f4d 100644 (file)
@@ -32,6 +32,23 @@ struct sec_ctx {
 static struct sec_ctx sec_ctx_stack[MAX_SEC_CTX_DEPTH + 1];
 static int sec_ctx_stack_ndx;
 
+/****************************************************************************
+ Are two UNIX tokens equal ?
+****************************************************************************/
+
+bool unix_token_equal(const UNIX_USER_TOKEN *t1, const UNIX_USER_TOKEN *t2)
+{
+       if (t1->uid != t2->uid || t1->gid != t2->gid ||
+                       t1->ngroups != t2->ngroups) {
+               return false;
+       }
+       if (memcmp(t1->groups, t2->groups,
+                       t1->ngroups*sizeof(gid_t)) != 0) {
+               return false;
+       }
+       return true;
+}
+
 /****************************************************************************
  Become the specified uid.
 ****************************************************************************/
index 41d036a8b91e76fc0d86581a59747de5e8485615..db241103ed7a0923acd1df3f500e12319c2e0b39 100644 (file)
@@ -27,12 +27,6 @@ static_decl_rpc;
 
 static int am_parent = 1;
 
-/* the last message the was processed */
-int last_message = -1;
-
-/* a useful macro to debug the last message processed */
-#define LAST_MESSAGE() smb_fn_name(last_message)
-
 extern struct auth_context *negprot_global_auth_context;
 extern SIG_ATOMIC_T got_sig_term;
 extern SIG_ATOMIC_T reload_after_sighup;
@@ -86,6 +80,19 @@ struct messaging_context *smbd_messaging_context(void)
        return ctx;
 }
 
+struct memcache *smbd_memcache(void)
+{
+       static struct memcache *cache;
+
+       if (!cache
+           && !(cache = memcache_init(NULL,
+                                      lp_max_stat_cache_size()*1024))) {
+
+               smb_panic("Could not init smbd memcache");
+       }
+       return cache;
+}
+
 /*******************************************************************
  What to do when smb.conf is updated.
  ********************************************************************/
@@ -261,10 +268,20 @@ static void add_child_pid(pid_t pid)
        num_children += 1;
 }
 
-static void remove_child_pid(pid_t pid)
+static void remove_child_pid(pid_t pid, bool unclean_shutdown)
 {
        struct child_pid *child;
 
+       if (unclean_shutdown) {
+               /* a child terminated uncleanly so tickle all processes to see 
+                  if they can grab any of the pending locks
+               */
+               messaging_send_buf(smbd_messaging_context(), procid_self(), 
+                                  MSG_SMB_BRL_VALIDATE, NULL, 0);
+               message_send_all(smbd_messaging_context(), 
+                                MSG_SMB_UNLOCK, NULL, 0, NULL);
+       }
+
        if (lp_max_smbd_processes() == 0) {
                /* Don't bother with the child list if we don't care anyway */
                return;
@@ -383,8 +400,11 @@ static bool open_sockets_smbd(bool is_daemon, bool interactive, const char *smb_
                                }
 
                                s = fd_listenset[num_sockets] =
-                                       open_socket_in(SOCK_STREAM, port, 0,
-                                                       ifss, True);
+                                       open_socket_in(SOCK_STREAM,
+                                                       port,
+                                                       num_sockets == 0 ? 0 : 2,
+                                                       ifss,
+                                                       true);
                                if(s == -1) {
                                        continue;
                                }
@@ -460,8 +480,11 @@ static bool open_sockets_smbd(bool is_daemon, bool interactive, const char *smb_
                                        continue;
                                }
 
-                               s = open_socket_in(SOCK_STREAM, port, 0,
-                                                  &ss, true);
+                               s = open_socket_in(SOCK_STREAM,
+                                               port,
+                                               num_sockets == 0 ? 0 : 2,
+                                               &ss,
+                                               true);
                                if (s == -1) {
                                        continue;
                                }
@@ -547,10 +570,27 @@ static bool open_sockets_smbd(bool is_daemon, bool interactive, const char *smb_
 
                if (got_sig_cld) {
                        pid_t pid;
+                       int status;
+
                        got_sig_cld = False;
 
-                       while ((pid = sys_waitpid(-1, NULL, WNOHANG)) > 0) {
-                               remove_child_pid(pid);
+                       while ((pid = sys_waitpid(-1, &status, WNOHANG)) > 0) {
+                               bool unclean_shutdown = False;
+                               
+                               /* If the child terminated normally, assume
+                                  it was an unclean shutdown unless the
+                                  status is 0 
+                               */
+                               if (WIFEXITED(status)) {
+                                       unclean_shutdown = WEXITSTATUS(status);
+                               }
+                               /* If the child terminated due to a signal
+                                  we always assume it was unclean.
+                               */
+                               if (WIFSIGNALED(status)) {
+                                       unclean_shutdown = True;
+                               }
+                               remove_child_pid(pid, unclean_shutdown);
                        }
                }
 
@@ -590,6 +630,15 @@ static bool open_sockets_smbd(bool is_daemon, bool interactive, const char *smb_
 
                        continue;
                }
+               
+
+               /* If the idle timeout fired and we don't have any connected
+                * users, exit gracefully. We should be running under a process
+                * controller that will restart us if necessry.
+                */
+               if (num == 0 && count_all_current_connections() == 0) {
+                       exit_server_cleanly("idle timeout");
+               }
 
                /* process pending nDNS responses */
                if (dns_register_smbd_reply(dns_reg, &r_fds, &idle_timeout)) {
@@ -893,6 +942,29 @@ void exit_server_fault(void)
        exit_server("critical server fault");
 }
 
+
+/****************************************************************************
+received when we should release a specific IP
+****************************************************************************/
+static void msg_release_ip(struct messaging_context *msg_ctx, void *private_data, 
+                          uint32_t msg_type, struct server_id server_id, DATA_BLOB *data)
+{
+       const char *ip = (const char *)data->data;
+       char addr[INET6_ADDRSTRLEN];
+
+       if (strcmp(client_socket_addr(get_client_fd(),addr,sizeof(addr)), ip) == 0) {
+               /* we can't afford to do a clean exit - that involves
+                  database writes, which would potentially mean we
+                  are still running after the failover has finished -
+                  we have to get rid of this process ID straight
+                  away */
+               DEBUG(0,("Got release IP message for our IP %s - exiting immediately\n",
+                       ip));
+               _exit(0);
+       }
+}
+
+
 /****************************************************************************
  Initialise connect, service and file structs.
 ****************************************************************************/
@@ -1184,6 +1256,12 @@ extern void build_options(bool screen);
        if (smbd_messaging_context() == NULL)
                exit(1);
 
+       if (smbd_memcache() == NULL) {
+               exit(1);
+       }
+
+       memcache_set_global(smbd_memcache());
+
        /* Initialise the password backed before the global_sam_sid
           to ensure that we fetch from ldap before we make a domain sid up */
 
@@ -1286,6 +1364,8 @@ extern void build_options(bool screen);
        /* register our message handlers */
        messaging_register(smbd_messaging_context(), NULL,
                           MSG_SMB_FORCE_TDIS, msg_force_tdis);
+       messaging_register(smbd_messaging_context(), NULL,
+                          MSG_SMB_RELEASE_IP, msg_release_ip);
 
        if ((lp_keepalive() != 0)
            && !(event_add_idle(smbd_event_context(), NULL,
index 88ab9f0048c30e800650d4e3489b497ecae5d965..a8aa25405a9d81d1450dc2c3d76b68976f5ffb8f 100644 (file)
@@ -219,44 +219,6 @@ bool set_current_service(connection_struct *conn, uint16 flags, bool do_chdir)
        return(True);
 }
 
-/****************************************************************************
- Add a home service. Returns the new service number or -1 if fail.
-****************************************************************************/
-
-int add_home_service(const char *service, const char *username, const char *homedir)
-{
-       int iHomeService;
-
-       if (!service || !homedir)
-               return -1;
-
-       if ((iHomeService = lp_servicenumber(HOMES_NAME)) < 0)
-               return -1;
-
-       /*
-        * If this is a winbindd provided username, remove
-        * the domain component before adding the service.
-        * Log a warning if the "path=" parameter does not
-        * include any macros.
-        */
-
-       {
-               const char *p = strchr(service,*lp_winbind_separator());
-
-               /* We only want the 'user' part of the string */
-               if (p) {
-                       service = p + 1;
-               }
-       }
-
-       if (!lp_add_home(service, iHomeService, username, homedir)) {
-               return -1;
-       }
-       
-       return lp_servicenumber(service);
-
-}
-
 static int load_registry_service(const char *servicename)
 {
        struct registry_key *key;
@@ -348,6 +310,47 @@ void load_registry_shares(void)
        return;
 }
 
+/****************************************************************************
+ Add a home service. Returns the new service number or -1 if fail.
+****************************************************************************/
+
+int add_home_service(const char *service, const char *username, const char *homedir)
+{
+       int iHomeService;
+
+       if (!service || !homedir)
+               return -1;
+
+       if ((iHomeService = lp_servicenumber(HOMES_NAME)) < 0) {
+               if ((iHomeService = load_registry_service(HOMES_NAME)) < 0) {
+                       return -1;
+               }
+       }
+
+       /*
+        * If this is a winbindd provided username, remove
+        * the domain component before adding the service.
+        * Log a warning if the "path=" parameter does not
+        * include any macros.
+        */
+
+       {
+               const char *p = strchr(service,*lp_winbind_separator());
+
+               /* We only want the 'user' part of the string */
+               if (p) {
+                       service = p + 1;
+               }
+       }
+
+       if (!lp_add_home(service, iHomeService, username, homedir)) {
+               return -1;
+       }
+       
+       return lp_servicenumber(service);
+
+}
+
 /**
  * Find a service entry.
  *
@@ -364,7 +367,7 @@ int find_service(fstring service)
 
        /* now handle the special case of a home directory */
        if (iService < 0) {
-               char *phome_dir = get_user_home_dir(service);
+               char *phome_dir = get_user_home_dir(talloc_tos(), service);
 
                if(!phome_dir) {
                        /*
@@ -372,7 +375,8 @@ int find_service(fstring service)
                         * be a Windows to unix mapped user name.
                         */
                        if(map_username(service))
-                               phome_dir = get_user_home_dir(service);
+                               phome_dir = get_user_home_dir(
+                                       talloc_tos(), service);
                }
 
                DEBUG(3,("checking for home directory %s gave %s\n",service,
@@ -385,7 +389,10 @@ int find_service(fstring service)
        if (iService < 0) {
                int iPrinterService;
 
-               if ((iPrinterService = lp_servicenumber(PRINTERS_NAME)) >= 0) {
+               if ((iPrinterService = lp_servicenumber(PRINTERS_NAME)) < 0) {
+                       iPrinterService = load_registry_service(PRINTERS_NAME);
+               }
+               if (iPrinterService) {
                        DEBUG(3,("checking whether %s is a valid printer name...\n", service));
                        if (pcap_printername_ok(service)) {
                                DEBUG(3,("%s is a valid printer name\n", service));
@@ -744,11 +751,12 @@ static connection_struct *make_connection_snum(int snum, user_struct *vuser,
                        *status = NT_STATUS_WRONG_PASSWORD;
                        return NULL;
                }
-               pass = Get_Pwnam(user);
+               pass = Get_Pwnam_alloc(talloc_tos(), user);
                status2 = create_token_from_username(conn->mem_ctx, pass->pw_name, True,
                                                     &conn->uid, &conn->gid,
                                                     &found_username,
                                                     &conn->nt_user_token);
+               TALLOC_FREE(pass);
                if (!NT_STATUS_IS_OK(status2)) {
                        conn_free(conn);
                        *status = status2;
@@ -790,6 +798,8 @@ static connection_struct *make_connection_snum(int snum, user_struct *vuser,
        conn->case_preserve = lp_preservecase(snum);
        conn->short_case_preserve = lp_shortpreservecase(snum);
 
+       conn->encrypt_level = lp_smb_encrypt(snum);
+
        conn->veto_list = NULL;
        conn->hide_list = NULL;
        conn->veto_oplock_list = NULL;
@@ -1143,23 +1153,27 @@ static connection_struct *make_connection_snum(int snum, user_struct *vuser,
 #if SOFTLINK_OPTIMISATION
        /* resolve any soft links early if possible */
        if (vfs_ChDir(conn,conn->connectpath) == 0) {
-               TALLOC_CTX *ctx = talloc_stackframe();
+               TALLOC_CTX *ctx = talloc_tos();
                char *s = vfs_GetWd(ctx,s);
                if (!s) {
                        *status = map_nt_error_from_unix(errno);
-                       TALLOC_FREE(ctx);
                        goto err_root_exit;
                }
                if (!set_conn_connectpath(conn,s)) {
                        *status = NT_STATUS_NO_MEMORY;
-                       TALLOC_FREE(ctx);
                        goto err_root_exit;
                }
                vfs_ChDir(conn,conn->connectpath);
-               TALLOC_FREE(ctx);
        }
 #endif
 
+       /* Figure out the characteristics of the underlying filesystem. This
+        * assumes that all the filesystem mounted withing a share path have
+        * the same characteristics, which is likely but not guaranteed.
+        */
+
+       conn->fs_capabilities = SMB_VFS_FS_CAPABILITIES(conn);
+
        /*
         * Print out the 'connected as' stuff here as we need
         * to know the effective uid and gid we will be using
index 8ca012ff248f6dacb032d85edbbfa80dc6822d2b..aee8e498e9d258d906aae384a36d8e49bc41be84 100644 (file)
@@ -118,8 +118,7 @@ static void sessionsetup_start_signing_engine(
  Send a security blob via a session setup reply.
 ****************************************************************************/
 
-static void reply_sesssetup_blob(connection_struct *conn,
-                                struct smb_request *req,
+static void reply_sesssetup_blob(struct smb_request *req,
                                 DATA_BLOB blob,
                                 NTSTATUS nt_status)
 {
@@ -139,7 +138,7 @@ static void reply_sesssetup_blob(connection_struct *conn,
        }
 
        show_msg((char *)req->outbuf);
-       send_smb(smbd_server_fd(),(char *)req->outbuf);
+       srv_send_smb(smbd_server_fd(),(char *)req->outbuf,req->encrypted);
        TALLOC_FREE(req->outbuf);
 }
 
@@ -247,8 +246,7 @@ static bool make_krb5_skew_error(DATA_BLOB *pblob_out)
  Reply to a session setup spnego negotiate packet for kerberos.
 ****************************************************************************/
 
-static void reply_spnego_kerberos(connection_struct *conn,
-                                 struct smb_request *req,
+static void reply_spnego_kerberos(struct smb_request *req,
                                  DATA_BLOB *secblob,
                                  uint16 vuid,
                                  bool *p_invalidate_vuid)
@@ -261,7 +259,7 @@ static void reply_spnego_kerberos(connection_struct *conn,
        fstring user;
        int sess_vuid = req->vuid;
        NTSTATUS ret = NT_STATUS_OK;
-       PAC_DATA *pac_data;
+       PAC_DATA *pac_data = NULL;
        DATA_BLOB ap_rep, ap_rep_wrapped, response;
        auth_serversupplied_info *server_info = NULL;
        DATA_BLOB session_key = data_blob_null;
@@ -273,7 +271,6 @@ static void reply_spnego_kerberos(connection_struct *conn,
        PAC_LOGON_INFO *logon_info = NULL;
 
        ZERO_STRUCT(ticket);
-       ZERO_STRUCT(pac_data);
        ZERO_STRUCT(ap_rep);
        ZERO_STRUCT(ap_rep_wrapped);
        ZERO_STRUCT(response);
@@ -539,7 +536,9 @@ static void reply_spnego_kerberos(connection_struct *conn,
                }
        }
 
-       server_info->was_mapped |= username_was_mapped;
+       if (username_was_mapped) {
+               server_info->was_mapped = username_was_mapped;
+       }
 
        /* we need to build the token for the user. make_server_info_guest()
           already does this */
@@ -605,7 +604,7 @@ static void reply_spnego_kerberos(connection_struct *conn,
        }
        response = spnego_gen_auth_response(&ap_rep_wrapped, ret,
                        OID_KERBEROS5_OLD);
-       reply_sesssetup_blob(conn, req, response, ret);
+       reply_sesssetup_blob(req, response, ret);
 
        data_blob_free(&ap_rep);
        data_blob_free(&ap_rep_wrapped);
@@ -623,8 +622,7 @@ static void reply_spnego_kerberos(connection_struct *conn,
  leg of the NTLM auth steps.
 ***************************************************************************/
 
-static void reply_spnego_ntlmssp(connection_struct *conn,
-                                struct smb_request *req,
+static void reply_spnego_ntlmssp(struct smb_request *req,
                                 uint16 vuid,
                                 AUTH_NTLMSSP_STATE **auth_ntlmssp_state,
                                 DATA_BLOB *ntlmssp_blob, NTSTATUS nt_status,
@@ -693,7 +691,7 @@ static void reply_spnego_ntlmssp(connection_struct *conn,
                response = *ntlmssp_blob;
        }
 
-       reply_sesssetup_blob(conn, req, response, nt_status);
+       reply_sesssetup_blob(req, response, nt_status);
        if (wrap) {
                data_blob_free(&response);
        }
@@ -756,8 +754,7 @@ NTSTATUS parse_spnego_mechanisms(DATA_BLOB blob_in, DATA_BLOB *pblob_out,
  Reply to a session setup spnego negotiate packet.
 ****************************************************************************/
 
-static void reply_spnego_negotiate(connection_struct *conn,
-                                  struct smb_request *req,
+static void reply_spnego_negotiate(struct smb_request *req,
                                   uint16 vuid,
                                   DATA_BLOB blob1,
                                   AUTH_NTLMSSP_STATE **auth_ntlmssp_state)
@@ -783,7 +780,7 @@ static void reply_spnego_negotiate(connection_struct *conn,
        if ( got_kerberos_mechanism && ((lp_security()==SEC_ADS) ||
                                lp_use_kerberos_keytab()) ) {
                bool destroy_vuid = True;
-               reply_spnego_kerberos(conn, req, &secblob, vuid,
+               reply_spnego_kerberos(req, &secblob, vuid,
                                      &destroy_vuid);
                data_blob_free(&secblob);
                if (destroy_vuid) {
@@ -811,7 +808,7 @@ static void reply_spnego_negotiate(connection_struct *conn,
 
        data_blob_free(&secblob);
 
-       reply_spnego_ntlmssp(conn, req, vuid, auth_ntlmssp_state,
+       reply_spnego_ntlmssp(req, vuid, auth_ntlmssp_state,
                             &chal, status, True);
 
        data_blob_free(&chal);
@@ -824,8 +821,7 @@ static void reply_spnego_negotiate(connection_struct *conn,
  Reply to a session setup spnego auth packet.
 ****************************************************************************/
 
-static void reply_spnego_auth(connection_struct *conn,
-                             struct smb_request *req,
+static void reply_spnego_auth(struct smb_request *req,
                              uint16 vuid,
                              DATA_BLOB blob1,
                              AUTH_NTLMSSP_STATE **auth_ntlmssp_state)
@@ -860,7 +856,7 @@ static void reply_spnego_auth(connection_struct *conn,
                        if ( got_krb5_mechanism && ((lp_security()==SEC_ADS) ||
                                                lp_use_kerberos_keytab()) ) {
                                bool destroy_vuid = True;
-                               reply_spnego_kerberos(conn, req, &secblob,
+                               reply_spnego_kerberos(req, &secblob,
                                                      vuid, &destroy_vuid);
                                data_blob_free(&secblob);
                                data_blob_free(&auth);
@@ -892,7 +888,7 @@ static void reply_spnego_auth(connection_struct *conn,
 
        data_blob_free(&auth);
 
-       reply_spnego_ntlmssp(conn, req, vuid,
+       reply_spnego_ntlmssp(req, vuid,
                             auth_ntlmssp_state,
                             &auth_reply, status, True);
 
@@ -1104,8 +1100,7 @@ static NTSTATUS check_spnego_blob_complete(uint16 smbpid, uint16 vuid,
  conn POINTER CAN BE NULL HERE !
 ****************************************************************************/
 
-static void reply_sesssetup_and_X_spnego(connection_struct *conn,
-                                        struct smb_request *req)
+static void reply_sesssetup_and_X_spnego(struct smb_request *req)
 {
        uint8 *p;
        DATA_BLOB blob1;
@@ -1225,7 +1220,7 @@ static void reply_sesssetup_and_X_spnego(connection_struct *conn,
 
                /* its a negTokenTarg packet */
 
-               reply_spnego_negotiate(conn, req, vuid, blob1,
+               reply_spnego_negotiate(req, vuid, blob1,
                                       &vuser->auth_ntlmssp_state);
                data_blob_free(&blob1);
                return;
@@ -1235,7 +1230,7 @@ static void reply_sesssetup_and_X_spnego(connection_struct *conn,
 
                /* its a auth packet */
 
-               reply_spnego_auth(conn, req, vuid, blob1,
+               reply_spnego_auth(req, vuid, blob1,
                                  &vuser->auth_ntlmssp_state);
                data_blob_free(&blob1);
                return;
@@ -1260,7 +1255,7 @@ static void reply_sesssetup_and_X_spnego(connection_struct *conn,
 
                data_blob_free(&blob1);
 
-               reply_spnego_ntlmssp(conn, req, vuid,
+               reply_spnego_ntlmssp(req, vuid,
                                     &vuser->auth_ntlmssp_state,
                                     &chal, status, False);
                data_blob_free(&chal);
@@ -1326,7 +1321,7 @@ static void setup_new_vc_session(void)
  Reply to a session setup command.
 ****************************************************************************/
 
-void reply_sesssetup_and_X(connection_struct *conn, struct smb_request *req)
+void reply_sesssetup_and_X(struct smb_request *req)
 {
        int sess_vuid;
        int smb_bufsize;
@@ -1377,7 +1372,7 @@ void reply_sesssetup_and_X(connection_struct *conn, struct smb_request *req)
                        setup_new_vc_session();
                }
 
-               reply_sesssetup_and_X_spnego(conn, req);
+               reply_sesssetup_and_X_spnego(req);
                END_PROFILE(SMBsesssetupX);
                return;
        }
index 8f1e008985fd872d6e16692f4b4a0bc04d0b772c..72fed008a2a5ba0dda09e7137a808b6a2d3e68e6 100644 (file)
@@ -26,8 +26,6 @@
  Stat cache code used in unix_convert.
 *****************************************************************************/
 
-static TDB_CONTEXT *tdb_stat_cache;
-
 /**
  * Add an entry into the stat cache.
  *
@@ -45,10 +43,8 @@ void stat_cache_add( const char *full_orig_name,
                bool case_sensitive)
 {
        size_t translated_path_length;
-       TDB_DATA data_val;
        char *original_path;
        size_t original_path_length;
-       size_t sc_size = lp_max_stat_cache_size();
        char saved_char;
        TALLOC_CTX *ctx = talloc_tos();
 
@@ -56,12 +52,6 @@ void stat_cache_add( const char *full_orig_name,
                return;
        }
 
-       if (sc_size && (tdb_map_size(tdb_stat_cache) > sc_size*1024)) {
-               reset_stat_cache();
-       }
-
-       ZERO_STRUCT(data_val);
-
        /*
         * Don't cache trivial valid directory entries such as . and ..
         */
@@ -132,24 +122,20 @@ void stat_cache_add( const char *full_orig_name,
        saved_char = translated_path[translated_path_length];
        translated_path[translated_path_length] = '\0';
 
-       data_val.dsize = translated_path_length + 1;
-       data_val.dptr = (uint8 *)translated_path;
-
        /*
         * New entry or replace old entry.
         */
 
-       if (tdb_store_bystring(tdb_stat_cache, original_path, data_val,
-                               TDB_REPLACE) != 0) {
-               DEBUG(0,("stat_cache_add: Error storing entry %s -> %s\n",
-                                       original_path, translated_path));
-       } else {
-               DEBUG(5,("stat_cache_add: Added entry (%lx:size%x) %s -> %s\n",
-                       (unsigned long)data_val.dptr,
-                       (unsigned int)data_val.dsize,
-                       original_path,
-                       translated_path));
-       }
+       memcache_add(
+               smbd_memcache(), STAT_CACHE,
+               data_blob_const(original_path, original_path_length),
+               data_blob_const(translated_path, translated_path_length + 1));
+
+       DEBUG(5,("stat_cache_add: Added entry (%lx:size %x) %s -> %s\n",
+                (unsigned long)translated_path,
+                (unsigned int)translated_path_length,
+                original_path,
+                translated_path));
 
        translated_path[translated_path_length] = saved_char;
        TALLOC_FREE(original_path);
@@ -186,7 +172,7 @@ bool stat_cache_lookup(connection_struct *conn,
        unsigned int num_components = 0;
        char *translated_path;
        size_t translated_path_length;
-       TDB_DATA data_val;
+       DATA_BLOB data_val;
        char *name;
        TALLOC_CTX *ctx = talloc_tos();
 
@@ -236,9 +222,12 @@ bool stat_cache_lookup(connection_struct *conn,
        while (1) {
                char *sp;
 
-               data_val = tdb_fetch_bystring(tdb_stat_cache, chk_name);
+               data_val = data_blob_null;
 
-               if (data_val.dptr != NULL && data_val.dsize != 0) {
+               if (memcache_lookup(
+                           smbd_memcache(), STAT_CACHE,
+                           data_blob_const(chk_name, strlen(chk_name)),
+                           &data_val)) {
                        break;
                }
 
@@ -275,12 +264,11 @@ bool stat_cache_lookup(connection_struct *conn,
                }
        }
 
-       translated_path = talloc_strdup(ctx,(char *)data_val.dptr);
+       translated_path = talloc_strdup(ctx,(char *)data_val.data);
        if (!translated_path) {
                smb_panic("talloc failed");
        }
-       translated_path_length = data_val.dsize - 1;
-       SAFE_FREE(data_val.dptr);
+       translated_path_length = data_val.length - 1;
 
        DEBUG(10,("stat_cache_lookup: lookup succeeded for name [%s] "
                  "-> [%s]\n", chk_name, translated_path ));
@@ -288,7 +276,8 @@ bool stat_cache_lookup(connection_struct *conn,
 
        if (SMB_VFS_STAT(conn, translated_path, pst) != 0) {
                /* Discard this entry - it doesn't exist in the filesystem. */
-               tdb_delete_bystring(tdb_stat_cache, chk_name);
+               memcache_delete(smbd_memcache(), STAT_CACHE,
+                               data_blob_const(chk_name, strlen(chk_name)));
                TALLOC_FREE(chk_name);
                TALLOC_FREE(translated_path);
                return False;
@@ -366,7 +355,8 @@ void stat_cache_delete(const char *name)
        DEBUG(10,("stat_cache_delete: deleting name [%s] -> %s\n",
                        lname, name ));
 
-       tdb_delete_bystring(tdb_stat_cache, lname);
+       memcache_delete(smbd_memcache(), STAT_CACHE,
+                       data_blob_const(lname, talloc_get_size(lname)-1));
        TALLOC_FREE(lname);
 }
 
@@ -395,15 +385,7 @@ bool reset_stat_cache( void )
        if (!lp_stat_cache())
                return True;
 
-       if (tdb_stat_cache) {
-               tdb_close(tdb_stat_cache);
-       }
+       memcache_flush(smbd_memcache(), STAT_CACHE);
 
-       /* Create the in-memory tdb using our custom hash function. */
-       tdb_stat_cache = tdb_open_ex("statcache", 1031, TDB_INTERNAL,
-                               (O_RDWR|O_CREAT), 0644, NULL, fast_string_hash);
-
-       if (!tdb_stat_cache)
-               return False;
        return True;
 }
index f6663208eab97e8adff4670844d30783a8c03ca1..0e9a2c2ebe0b316ad979a9a5a8317a06ce508694 100644 (file)
@@ -3,6 +3,7 @@
    VFS API's statvfs abstraction
    Copyright (C) Alexander Bokovoy                     2005
    Copyright (C) Steve French                          2005
+   Copyright (C) James Peach                           2006
    
    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
@@ -37,11 +38,93 @@ static int linux_statvfs(const char *path, vfs_statvfs_struct *statbuf)
                statbuf->TotalFileNodes = statvfs_buf.f_files;
                statbuf->FreeFileNodes = statvfs_buf.f_ffree;
                statbuf->FsIdentifier = statvfs_buf.f_fsid;
+
+               /* Good defaults for Linux filesystems are case sensitive
+                * and case preserving.
+                */
+               statbuf->FsCapabilities =
+                   FILE_CASE_SENSITIVE_SEARCH | FILE_CASE_PRESERVED_NAMES;
        }
        return result;
 }
 #endif
 
+#if defined(DARWINOS)
+
+#include <sys/attr.h>
+
+static int darwin_fs_capabilities(const char * path)
+{
+       int caps = 0;
+       vol_capabilities_attr_t *vcaps;
+       struct attrlist attrlist;
+       char attrbuf[sizeof(u_int32_t) + sizeof(vol_capabilities_attr_t)];
+
+#define FORMAT_CAP(vinfo, cap) \
+       ( ((vinfo)->valid[VOL_CAPABILITIES_FORMAT] & (cap)) && \
+          ((vinfo)->capabilities[VOL_CAPABILITIES_FORMAT] & (cap)) )
+
+#define INTERFACE_CAP(vinfo, cap) \
+       ( ((vinfo)->valid[VOL_CAPABILITIES_INTERFACES] & (cap)) && \
+          ((vinfo)->capabilities[VOL_CAPABILITIES_INTERFACES] & (cap)) )
+
+       ZERO_STRUCT(attrlist);
+       attrlist.bitmapcount = ATTR_BIT_MAP_COUNT;
+       attrlist.volattr = ATTR_VOL_CAPABILITIES;
+
+       if (getattrlist(path, &attrlist, attrbuf, sizeof(attrbuf), 0) != 0) {
+               DEBUG(0, ("getattrlist for %s capabilities failed: %s\n",
+                           path, strerror(errno)));
+               /* Return no capabilities on failure. */
+               return 0;
+       }
+
+       vcaps =
+           (vol_capabilities_attr_t *)(attrbuf + sizeof(u_int32_t));
+
+       if (FORMAT_CAP(vcaps, VOL_CAP_FMT_SPARSE_FILES)) {
+               caps |= FILE_SUPPORTS_SPARSE_FILES;
+       }
+
+       if (FORMAT_CAP(vcaps, VOL_CAP_FMT_CASE_SENSITIVE)) {
+               caps |= FILE_CASE_SENSITIVE_SEARCH;
+       }
+
+       if (FORMAT_CAP(vcaps, VOL_CAP_FMT_CASE_PRESERVING)) {
+               caps |= FILE_CASE_PRESERVED_NAMES;
+       }
+
+       if (INTERFACE_CAP(vcaps, VOL_CAP_INT_EXTENDED_SECURITY)) {
+               caps |= FILE_PERSISTENT_ACLS;
+       }
+
+       return caps;
+}
+
+static int darwin_statvfs(const char *path, vfs_statvfs_struct *statbuf)
+{
+       struct statfs sbuf;
+       int ret;
+
+       ret = statfs(path, &sbuf);
+       if (ret != 0) {
+               return ret;
+       }
+
+       statbuf->OptimalTransferSize = sbuf.f_iosize;
+       statbuf->BlockSize = sbuf.f_bsize;
+       statbuf->TotalBlocks = sbuf.f_blocks;
+       statbuf->BlocksAvail = sbuf.f_bfree;
+       statbuf->UserBlocksAvail = sbuf.f_bavail;
+       statbuf->TotalFileNodes = sbuf.f_files;
+       statbuf->FreeFileNodes = sbuf.f_ffree;
+       statbuf->FsIdentifier = *(SMB_BIG_UINT *)(&sbuf.f_fsid); /* Ick. */
+       statbuf->FsCapabilities = darwin_fs_capabilities(sbuf.f_mntonname);
+
+       return 0;
+}
+#endif
+
 /* 
  sys_statvfs() is an abstraction layer over system-dependent statvfs()/statfs()
  for particular POSIX systems. Due to controversy of what is considered more important
@@ -52,6 +135,8 @@ int sys_statvfs(const char *path, vfs_statvfs_struct *statbuf)
 {
 #if defined(LINUX) && defined(HAVE_FSID_INT)
        return linux_statvfs(path, statbuf);
+#elif defined(DARWINOS)
+       return darwin_statvfs(path, statbuf);
 #else
        /* BB change this to return invalid level */
 #ifdef EOPNOTSUPP
index e37f6ffbfd0393d42e2d2a2fa223985ea20a9dac..1f7af82670b2cee17f76ada7148a69bc2900494e 100644 (file)
@@ -5,7 +5,7 @@
    Copyright (C) Stefan (metze) Metzmacher     2003
    Copyright (C) Volker Lendecke               2005-2007
    Copyright (C) Steve French                  2005
-   Copyright (C) James Peach                   2007
+   Copyright (C) James Peach                   2006-2007
 
    Extensively modified by Andrew Tridgell, 1995
 
@@ -105,17 +105,22 @@ static bool samba_private_attr_name(const char *unix_ea_name)
 
        for (i = 0; prohibited_ea_names[i]; i++) {
                if (strequal( prohibited_ea_names[i], unix_ea_name))
-                       return True;
+                       return true;
        }
-       return False;
+       if (StrnCaseCmp(unix_ea_name, SAMBA_XATTR_DOSSTREAM_PREFIX,
+                       strlen(SAMBA_XATTR_DOSSTREAM_PREFIX)) == 0) {
+               return true;
+       }
+       return false;
 }
 
 /****************************************************************************
  Get one EA value. Fill in a struct ea_struct.
 ****************************************************************************/
 
-static bool get_ea_value(TALLOC_CTX *mem_ctx, connection_struct *conn, files_struct *fsp,
-                               const char *fname, char *ea_name, struct ea_struct *pea)
+NTSTATUS get_ea_value(TALLOC_CTX *mem_ctx, connection_struct *conn,
+                     files_struct *fsp, const char *fname,
+                     const char *ea_name, struct ea_struct *pea)
 {
        /* Get the value of this xattr. Max size is 64k. */
        size_t attr_size = 256;
@@ -126,11 +131,11 @@ static bool get_ea_value(TALLOC_CTX *mem_ctx, connection_struct *conn, files_str
 
        val = TALLOC_REALLOC_ARRAY(mem_ctx, val, char, attr_size);
        if (!val) {
-               return False;
+               return NT_STATUS_NO_MEMORY;
        }
 
        if (fsp && fsp->fh->fd != -1) {
-               sizeret = SMB_VFS_FGETXATTR(fsp, fsp->fh->fd, ea_name, val, attr_size);
+               sizeret = SMB_VFS_FGETXATTR(fsp, ea_name, val, attr_size);
        } else {
                sizeret = SMB_VFS_GETXATTR(conn, fname, ea_name, val, attr_size);
        }
@@ -141,7 +146,7 @@ static bool get_ea_value(TALLOC_CTX *mem_ctx, connection_struct *conn, files_str
        }
 
        if (sizeret == -1) {
-               return False;
+               return map_nt_error_from_unix(errno);
        }
 
        DEBUG(10,("get_ea_value: EA %s is of length %u\n", ea_name, (unsigned int)sizeret));
@@ -149,93 +154,192 @@ static bool get_ea_value(TALLOC_CTX *mem_ctx, connection_struct *conn, files_str
 
        pea->flags = 0;
        if (strnequal(ea_name, "user.", 5)) {
-               pea->name = &ea_name[5];
+               pea->name = talloc_strdup(mem_ctx, &ea_name[5]);
        } else {
-               pea->name = ea_name;
+               pea->name = talloc_strdup(mem_ctx, ea_name);
+       }
+       if (pea->name == NULL) {
+               TALLOC_FREE(val);
+               return NT_STATUS_NO_MEMORY;
        }
        pea->value.data = (unsigned char *)val;
        pea->value.length = (size_t)sizeret;
-       return True;
+       return NT_STATUS_OK;
 }
 
-/****************************************************************************
- Return a linked list of the total EA's. Plus the total size
-****************************************************************************/
-
-static struct ea_list *get_ea_list_from_file(TALLOC_CTX *mem_ctx, connection_struct *conn, files_struct *fsp,
-                                       const char *fname, size_t *pea_total_len)
+NTSTATUS get_ea_names_from_file(TALLOC_CTX *mem_ctx, connection_struct *conn,
+                               files_struct *fsp, const char *fname,
+                               char ***pnames, size_t *pnum_names)
 {
        /* Get a list of all xattrs. Max namesize is 64k. */
        size_t ea_namelist_size = 1024;
-       char *ea_namelist;
+       char *ea_namelist = NULL;
+
        char *p;
+       char **names, **tmp;
+       size_t num_names;
        ssize_t sizeret;
-       int i;
-       struct ea_list *ea_list_head = NULL;
-
-       *pea_total_len = 0;
 
        if (!lp_ea_support(SNUM(conn))) {
-               return NULL;
+               *pnames = NULL;
+               *pnum_names = 0;
+               return NT_STATUS_OK;
        }
 
-       for (i = 0, ea_namelist = TALLOC_ARRAY(mem_ctx, char, ea_namelist_size); i < 6;
-            ea_namelist = TALLOC_REALLOC_ARRAY(mem_ctx, ea_namelist, char, ea_namelist_size), i++) {
+       /*
+        * TALLOC the result early to get the talloc hierarchy right.
+        */
 
-               if (!ea_namelist) {
-                       return NULL;
+       names = TALLOC_ARRAY(mem_ctx, char *, 1);
+       if (names == NULL) {
+               DEBUG(0, ("talloc failed\n"));
+               return NT_STATUS_NO_MEMORY;
+       }
+
+       while (ea_namelist_size <= 65536) {
+
+               ea_namelist = TALLOC_REALLOC_ARRAY(
+                       names, ea_namelist, char, ea_namelist_size);
+               if (ea_namelist == NULL) {
+                       DEBUG(0, ("talloc failed\n"));
+                       TALLOC_FREE(names);
+                       return NT_STATUS_NO_MEMORY;
                }
 
                if (fsp && fsp->fh->fd != -1) {
-                       sizeret = SMB_VFS_FLISTXATTR(fsp, fsp->fh->fd, ea_namelist, ea_namelist_size);
+                       sizeret = SMB_VFS_FLISTXATTR(fsp, ea_namelist,
+                                                    ea_namelist_size);
                } else {
-                       sizeret = SMB_VFS_LISTXATTR(conn, fname, ea_namelist, ea_namelist_size);
+                       sizeret = SMB_VFS_LISTXATTR(conn, fname, ea_namelist,
+                                                   ea_namelist_size);
                }
 
-               if (sizeret == -1 && errno == ERANGE) {
+               if ((sizeret == -1) && (errno == ERANGE)) {
                        ea_namelist_size *= 2;
-               } else {
+               }
+               else {
                        break;
                }
        }
 
-       if (sizeret == -1)
-               return NULL;
+       if (sizeret == -1) {
+               TALLOC_FREE(names);
+               return map_nt_error_from_unix(errno);
+       }
 
-       DEBUG(10,("get_ea_list_from_file: ea_namelist size = %u\n", (unsigned int)sizeret ));
+       DEBUG(10, ("get_ea_list_from_file: ea_namelist size = %u\n",
+                  (unsigned int)sizeret));
 
-       if (sizeret) {
-               for (p = ea_namelist; p - ea_namelist < sizeret; p += strlen(p) + 1) {
-                       struct ea_list *listp;
+       if (sizeret == 0) {
+               TALLOC_FREE(names);
+               *pnames = NULL;
+               *pnum_names = 0;
+               return NT_STATUS_OK;
+       }
 
-                       if (strnequal(p, "system.", 7) || samba_private_attr_name(p))
-                               continue;
+       /*
+        * Ensure the result is 0-terminated
+        */
 
-                       listp = TALLOC_P(mem_ctx, struct ea_list);
-                       if (!listp)
-                               return NULL;
+       if (ea_namelist[sizeret-1] != '\0') {
+               TALLOC_FREE(names);
+               return NT_STATUS_INTERNAL_ERROR;
+       }
 
-                       if (!get_ea_value(mem_ctx, conn, fsp, fname, p, &listp->ea)) {
-                               return NULL;
-                       }
+       /*
+        * count the names
+        */
+       num_names = 0;
 
-                       {
-                               fstring dos_ea_name;
-                               push_ascii_fstring(dos_ea_name, listp->ea.name);
-                               *pea_total_len += 4 + strlen(dos_ea_name) + 1 + listp->ea.value.length;
-                               DEBUG(10,("get_ea_list_from_file: total_len = %u, %s, val len = %u\n",
-                                       (unsigned int)*pea_total_len, dos_ea_name,
-                                       (unsigned int)listp->ea.value.length ));
-                       }
-                       DLIST_ADD_END(ea_list_head, listp, struct ea_list *);
+       for (p = ea_namelist; p - ea_namelist < sizeret; p += strlen(p)+1) {
+               num_names += 1;
+       }
+
+       tmp = TALLOC_REALLOC_ARRAY(mem_ctx, names, char *, num_names);
+       if (tmp == NULL) {
+               DEBUG(0, ("talloc failed\n"));
+               TALLOC_FREE(names);
+               return NT_STATUS_NO_MEMORY;
+       }
+
+       names = tmp;
+       num_names = 0;
+
+       for (p = ea_namelist; p - ea_namelist < sizeret; p += strlen(p)+1) {
+               names[num_names++] = p;
+       }
+
+       *pnames = names;
+       *pnum_names = num_names;
+       return NT_STATUS_OK;
+}
+
+/****************************************************************************
+ Return a linked list of the total EA's. Plus the total size
+****************************************************************************/
+
+static struct ea_list *get_ea_list_from_file(TALLOC_CTX *mem_ctx, connection_struct *conn, files_struct *fsp,
+                                       const char *fname, size_t *pea_total_len)
+{
+       /* Get a list of all xattrs. Max namesize is 64k. */
+       size_t i, num_names;
+       char **names;
+       struct ea_list *ea_list_head = NULL;
+       NTSTATUS status;
+
+       *pea_total_len = 0;
+
+       if (!lp_ea_support(SNUM(conn))) {
+               return NULL;
+       }
+
+       status = get_ea_names_from_file(talloc_tos(), conn, fsp, fname,
+                                       &names, &num_names);
+
+       if (!NT_STATUS_IS_OK(status) || (num_names == 0)) {
+               return NULL;
+       }
+
+       for (i=0; i<num_names; i++) {
+               struct ea_list *listp;
+               fstring dos_ea_name;
+
+               if (strnequal(names[i], "system.", 7)
+                   || samba_private_attr_name(names[i]))
+                       continue;
+
+               listp = TALLOC_P(mem_ctx, struct ea_list);
+               if (listp == NULL) {
+                       return NULL;
                }
-               /* Add on 4 for total length. */
-               if (*pea_total_len) {
-                       *pea_total_len += 4;
+
+               if (!NT_STATUS_IS_OK(get_ea_value(mem_ctx, conn, fsp,
+                                                 fname, names[i],
+                                                 &listp->ea))) {
+                       return NULL;
                }
+
+               push_ascii_fstring(dos_ea_name, listp->ea.name);
+
+               *pea_total_len +=
+                       4 + strlen(dos_ea_name) + 1 + listp->ea.value.length;
+
+               DEBUG(10,("get_ea_list_from_file: total_len = %u, %s, val len "
+                         "= %u\n", (unsigned int)*pea_total_len, dos_ea_name,
+                         (unsigned int)listp->ea.value.length));
+
+               DLIST_ADD_END(ea_list_head, listp, struct ea_list *);
+
        }
 
-       DEBUG(10,("get_ea_list_from_file: total_len = %u\n", (unsigned int)*pea_total_len));
+       /* Add on 4 for total length. */
+       if (*pea_total_len) {
+               *pea_total_len += 4;
+       }
+
+       DEBUG(10, ("get_ea_list_from_file: total_len = %u\n",
+                  (unsigned int)*pea_total_len));
+
        return ea_list_head;
 }
 
@@ -297,9 +401,8 @@ static unsigned int estimate_ea_size(connection_struct *conn, files_struct *fsp,
        if (!lp_ea_support(SNUM(conn))) {
                return 0;
        }
-       mem_ctx = talloc_init("estimate_ea_size");
+       mem_ctx = talloc_tos();
        (void)get_ea_list_from_file(mem_ctx, conn, fsp, fname, &total_ea_len);
-       talloc_destroy(mem_ctx);
        return total_ea_len;
 }
 
@@ -310,7 +413,7 @@ static unsigned int estimate_ea_size(connection_struct *conn, files_struct *fsp,
 static void canonicalize_ea_name(connection_struct *conn, files_struct *fsp, const char *fname, fstring unix_ea_name)
 {
        size_t total_ea_len;
-       TALLOC_CTX *mem_ctx = talloc_init("canonicalize_ea_name");
+       TALLOC_CTX *mem_ctx = talloc_tos();
        struct ea_list *ea_list = get_ea_list_from_file(mem_ctx, conn, fsp, fname, &total_ea_len);
 
        for (; ea_list; ea_list = ea_list->next) {
@@ -321,7 +424,6 @@ static void canonicalize_ea_name(connection_struct *conn, files_struct *fsp, con
                        break;
                }
        }
-       talloc_destroy(mem_ctx);
 }
 
 /****************************************************************************
@@ -355,7 +457,7 @@ NTSTATUS set_ea(connection_struct *conn, files_struct *fsp, const char *fname, s
                        if (fsp && (fsp->fh->fd != -1)) {
                                DEBUG(10,("set_ea: deleting ea name %s on file %s by file descriptor.\n",
                                        unix_ea_name, fsp->fsp_name));
-                               ret = SMB_VFS_FREMOVEXATTR(fsp, fsp->fh->fd, unix_ea_name);
+                               ret = SMB_VFS_FREMOVEXATTR(fsp, unix_ea_name);
                        } else {
                                DEBUG(10,("set_ea: deleting ea name %s on file %s.\n",
                                        unix_ea_name, fname));
@@ -373,7 +475,7 @@ NTSTATUS set_ea(connection_struct *conn, files_struct *fsp, const char *fname, s
                        if (fsp && (fsp->fh->fd != -1)) {
                                DEBUG(10,("set_ea: setting ea name %s on file %s by file descriptor.\n",
                                        unix_ea_name, fsp->fsp_name));
-                               ret = SMB_VFS_FSETXATTR(fsp, fsp->fh->fd, unix_ea_name,
+                               ret = SMB_VFS_FSETXATTR(fsp, unix_ea_name,
                                                        ea_list->ea.value.data, ea_list->ea.value.length, 0);
                        } else {
                                DEBUG(10,("set_ea: setting ea name %s on file %s.\n",
@@ -575,7 +677,8 @@ static struct ea_list *ea_list_union(struct ea_list *name_list, struct ea_list *
   HACK ! Always assumes smb_setup field is zero.
 ****************************************************************************/
 
-void send_trans2_replies(struct smb_request *req,
+void send_trans2_replies(connection_struct *conn,
+                       struct smb_request *req,
                         const char *params,
                         int paramsize,
                         const char *pdata,
@@ -737,8 +840,10 @@ void send_trans2_replies(struct smb_request *req,
 
                /* Send the packet */
                show_msg((char *)req->outbuf);
-               if (!send_smb(smbd_server_fd(),(char *)req->outbuf))
-                       exit_server_cleanly("send_trans2_replies: send_smb failed.");
+               if (!srv_send_smb(smbd_server_fd(),
+                               (char *)req->outbuf,
+                               IS_CONN_ENCRYPTED(conn)))
+                       exit_server_cleanly("send_trans2_replies: srv_send_smb failed.");
 
                TALLOC_FREE(req->outbuf);
 
@@ -841,20 +946,6 @@ static void call_trans2open(connection_struct *conn,
                fname, (unsigned int)deny_mode, (unsigned int)open_attr,
                (unsigned int)open_ofun, open_size));
 
-       /* XXXX we need to handle passed times, sattr and flags */
-
-       status = unix_convert(ctx, conn, fname, False, &fname, NULL, &sbuf);
-       if (!NT_STATUS_IS_OK(status)) {
-               reply_nterror(req, status);
-               return;
-       }
-
-       status = check_name(conn, fname);
-       if (!NT_STATUS_IS_OK(status)) {
-               reply_nterror(req, status);
-               return;
-       }
-
        if (open_ofun == 0) {
                reply_nterror(req, NT_STATUS_OBJECT_NAME_COLLISION);
                return;
@@ -899,14 +990,22 @@ static void call_trans2open(connection_struct *conn,
                return;
        }
 
-       status = open_file_ntcreate(conn, req, fname, &sbuf,
-               access_mask,
-               share_mode,
-               create_disposition,
-               create_options,
-               open_attr,
-               oplock_request,
-               &smb_action, &fsp);
+       status = create_file(conn,                      /* conn */
+                            req,                       /* req */
+                            0,                         /* root_dir_fid */
+                            fname,                     /* fname */
+                            access_mask,               /* access_mask */
+                            share_mode,                /* share_access */
+                            create_disposition,        /* create_disposition*/
+                            create_options,            /* create_options */
+                            open_attr,                 /* file_attributes */
+                            oplock_request,            /* oplock_request */
+                            open_size,                 /* allocation_size */
+                            NULL,                      /* sd */
+                            ea_list,                   /* ea_list */
+                            &fsp,                      /* result */
+                            &smb_action,               /* pinfo */
+                            &sbuf);                    /* psbuf */
 
        if (!NT_STATUS_IS_OK(status)) {
                if (open_was_deferred(req->mid)) {
@@ -927,41 +1026,6 @@ static void call_trans2open(connection_struct *conn,
                return;
        }
 
-       /* Save the requested allocation size. */
-       /* Allocate space for the file if a size hint is supplied */
-       if ((smb_action == FILE_WAS_CREATED) || (smb_action == FILE_WAS_OVERWRITTEN)) {
-               SMB_BIG_UINT allocation_size = (SMB_BIG_UINT)open_size;
-               if (allocation_size && (allocation_size > (SMB_BIG_UINT)size)) {
-                        fsp->initial_allocation_size = smb_roundup(fsp->conn, allocation_size);
-                        if (fsp->is_directory) {
-                                close_file(fsp,ERROR_CLOSE);
-                                /* Can't set allocation size on a directory. */
-                               reply_nterror(req, NT_STATUS_ACCESS_DENIED);
-                               return;
-                        }
-                        if (vfs_allocate_file_space(fsp, fsp->initial_allocation_size) == -1) {
-                                close_file(fsp,ERROR_CLOSE);
-                               reply_nterror(req, NT_STATUS_DISK_FULL);
-                               return;
-                        }
-
-                       /* Adjust size here to return the right size in the reply.
-                          Windows does it this way. */
-                       size = fsp->initial_allocation_size;
-                } else {
-                        fsp->initial_allocation_size = smb_roundup(fsp->conn,(SMB_BIG_UINT)size);
-                }
-       }
-
-       if (ea_list && smb_action == FILE_WAS_CREATED) {
-               status = set_ea(conn, fsp, fname, ea_list);
-               if (!NT_STATUS_IS_OK(status)) {
-                       close_file(fsp,ERROR_CLOSE);
-                       reply_nterror(req, status);
-                       return;
-               }
-       }
-
        /* Realloc the size of parameters and data we will return */
        *pparams = (char *)SMB_REALLOC(*pparams, 30);
        if(*pparams == NULL ) {
@@ -997,7 +1061,7 @@ static void call_trans2open(connection_struct *conn,
        }
 
        /* Send the required number of replies */
-       send_trans2_replies(req, params, 30, *ppdata, 0, max_data_bytes);
+       send_trans2_replies(conn, req, params, 30, *ppdata, 0, max_data_bytes);
 }
 
 /*********************************************************
@@ -1993,9 +2057,7 @@ total_data=%u (should be %u)\n", (unsigned int)total_data, (unsigned int)IVAL(pd
                        out_of_space = True;
                        finished = False;
                } else {
-                       TALLOC_CTX *sub_ctx = talloc_stackframe();
-
-                       finished = !get_lanman2_dir_entry(sub_ctx,
+                       finished = !get_lanman2_dir_entry(ctx,
                                        conn,
                                        req->flags2,
                                        mask,dirtype,info_level,
@@ -2004,8 +2066,6 @@ total_data=%u (should be %u)\n", (unsigned int)total_data, (unsigned int)IVAL(pd
                                        space_remaining, &out_of_space,
                                        &got_exact_match,
                                        &last_entry_off, ea_list);
-
-                       TALLOC_FREE(sub_ctx);
                }
 
                if (finished && out_of_space)
@@ -2067,7 +2127,7 @@ total_data=%u (should be %u)\n", (unsigned int)total_data, (unsigned int)IVAL(pd
        SSVAL(params,6,0); /* Never an EA error */
        SSVAL(params,8,last_entry_off);
 
-       send_trans2_replies(req, params, 10, pdata, PTR_DIFF(p,pdata),
+       send_trans2_replies(conn, req, params, 10, pdata, PTR_DIFF(p,pdata),
                            max_data_bytes);
 
        if ((! *directory) && dptr_path(dptr_num)) {
@@ -2341,9 +2401,7 @@ total_data=%u (should be %u)\n", (unsigned int)total_data, (unsigned int)IVAL(pd
                        out_of_space = True;
                        finished = False;
                } else {
-                       TALLOC_CTX *sub_ctx = talloc_stackframe();
-
-                       finished = !get_lanman2_dir_entry(sub_ctx,
+                       finished = !get_lanman2_dir_entry(ctx,
                                                conn,
                                                req->flags2,
                                                mask,dirtype,info_level,
@@ -2352,8 +2410,6 @@ total_data=%u (should be %u)\n", (unsigned int)total_data, (unsigned int)IVAL(pd
                                                space_remaining, &out_of_space,
                                                &got_exact_match,
                                                &last_entry_off, ea_list);
-
-                       TALLOC_FREE(sub_ctx);
                }
 
                if (finished && out_of_space)
@@ -2391,7 +2447,7 @@ total_data=%u (should be %u)\n", (unsigned int)total_data, (unsigned int)IVAL(pd
        SSVAL(params,4,0); /* Never an EA error */
        SSVAL(params,6,last_entry_off);
 
-       send_trans2_replies(req, params, 8, pdata, PTR_DIFF(p,pdata),
+       send_trans2_replies(conn, req, params, 8, pdata, PTR_DIFF(p,pdata),
                            max_data_bytes);
 
        return;
@@ -2403,6 +2459,41 @@ unsigned char *create_volume_objectid(connection_struct *conn, unsigned char obj
        return objid;
 }
 
+static void samba_extended_info_version(struct smb_extended_info *extended_info)
+{
+       SMB_ASSERT(extended_info != NULL);
+
+       extended_info->samba_magic = SAMBA_EXTENDED_INFO_MAGIC;
+       extended_info->samba_version = ((SAMBA_VERSION_MAJOR & 0xff) << 24)
+                                      | ((SAMBA_VERSION_MINOR & 0xff) << 16)
+                                      | ((SAMBA_VERSION_RELEASE & 0xff) << 8);
+#ifdef SAMBA_VERSION_REVISION
+       extended_info->samba_version |= (tolower(*SAMBA_VERSION_REVISION) - 'a' + 1) & 0xff;
+#endif
+       extended_info->samba_subversion = 0;
+#ifdef SAMBA_VERSION_RC_RELEASE
+       extended_info->samba_subversion |= (SAMBA_VERSION_RC_RELEASE & 0xff) << 24;
+#else
+#ifdef SAMBA_VERSION_PRE_RELEASE
+       extended_info->samba_subversion |= (SAMBA_VERSION_PRE_RELEASE & 0xff) << 16;
+#endif
+#endif
+#ifdef SAMBA_VERSION_VENDOR_PATCH
+       extended_info->samba_subversion |= (SAMBA_VERSION_VENDOR_PATCH & 0xffff);
+#endif
+       extended_info->samba_gitcommitdate = 0;
+#ifdef SAMBA_VERSION_GIT_COMMIT_TIME
+       unix_to_nt_time(&extended_info->samba_gitcommitdate, SAMBA_VERSION_GIT_COMMIT_TIME);
+#endif
+
+       memset(extended_info->samba_version_string, 0,
+              sizeof(extended_info->samba_version_string));
+
+       snprintf (extended_info->samba_version_string,
+                 sizeof(extended_info->samba_version_string),
+                 "%s", samba_version_string());
+}
+
 /****************************************************************************
  Reply to a TRANS2_QFSINFO (query filesystem info).
 ****************************************************************************/
@@ -2421,8 +2512,8 @@ static void call_trans2qfsinfo(connection_struct *conn,
        const char *vname = volume_label(SNUM(conn));
        int snum = SNUM(conn);
        char *fstype = lp_fstype(SNUM(conn));
-       int quota_flag = 0;
-
+       uint32 additional_flags = 0;
+       
        if (total_params < 2) {
                reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
                return;
@@ -2430,6 +2521,27 @@ static void call_trans2qfsinfo(connection_struct *conn,
 
        info_level = SVAL(params,0);
 
+       if (IS_IPC(conn)) {
+               if (info_level != SMB_QUERY_CIFS_UNIX_INFO) {
+                       DEBUG(0,("call_trans2qfsinfo: not an allowed "
+                               "info level (0x%x) on IPC$.\n",
+                               (unsigned int)info_level));
+                       reply_nterror(req, NT_STATUS_ACCESS_DENIED);
+                       return;
+               }
+       }
+
+       if (ENCRYPTION_REQUIRED(conn) && !req->encrypted) {
+               if (info_level != SMB_QUERY_CIFS_UNIX_INFO) {
+                       DEBUG(0,("call_trans2qfsinfo: encryption required "
+                               "and info level 0x%x sent.\n",
+                               (unsigned int)info_level));
+                       exit_server_cleanly("encryption required "
+                               "on connection");
+                       return;
+               }
+       }
+
        DEBUG(3,("call_trans2qfsinfo: level = %d\n", info_level));
 
        if(SMB_VFS_STAT(conn,".",&st)!=0) {
@@ -2514,16 +2626,21 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)st.st_dev, (unsi
                case SMB_QUERY_FS_ATTRIBUTE_INFO:
                case SMB_FS_ATTRIBUTE_INFORMATION:
 
-
+                       additional_flags = 0;
 #if defined(HAVE_SYS_QUOTAS)
-                       quota_flag = FILE_VOLUME_QUOTAS;
+                       additional_flags |= FILE_VOLUME_QUOTAS;
 #endif
 
+                       if(lp_nt_acl_support(SNUM(conn))) {
+                               additional_flags |= FILE_PERSISTENT_ACLS;
+                       }
+
+                       /* Capabilities are filled in at connection time through STATVFS call */
+                       additional_flags |= conn->fs_capabilities;
+
                        SIVAL(pdata,0,FILE_CASE_PRESERVED_NAMES|FILE_CASE_SENSITIVE_SEARCH|
-                               (lp_nt_acl_support(SNUM(conn)) ? FILE_PERSISTENT_ACLS : 0)|
-                               FILE_SUPPORTS_OBJECT_IDS|
-                               FILE_UNICODE_ON_DISK|
-                               quota_flag); /* FS ATTRIBUTES */
+                               FILE_SUPPORTS_OBJECT_IDS|FILE_UNICODE_ON_DISK|
+                               additional_flags); /* FS ATTRIBUTES */
 
                        SIVAL(pdata,4,255); /* Max filename component length */
                        /* NOTE! the fstype must *not* be null terminated or win98 won't recognise it
@@ -2715,7 +2832,14 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)bsize, (unsigned
                case SMB_FS_OBJECTID_INFORMATION:
                {
                        unsigned char objid[16];
+                       struct smb_extended_info extended_info;
                        memcpy(pdata,create_volume_objectid(conn, objid),16);
+                       samba_extended_info_version (&extended_info);
+                       SIVAL(pdata,16,extended_info.samba_magic);
+                       SIVAL(pdata,20,extended_info.samba_version);
+                       SIVAL(pdata,24,extended_info.samba_subversion);
+                       SBIG_UINT(pdata,28,extended_info.samba_gitcommitdate);
+                       memcpy(pdata+36,extended_info.samba_version_string,28);
                        data_len = 64;
                        break;
                }
@@ -2729,22 +2853,45 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)bsize, (unsigned
                {
                        bool large_write = lp_min_receive_file_size() &&
                                                !srv_is_signing_active();
+                       bool large_read = !srv_is_signing_active();
+                       int encrypt_caps = 0;
 
                        if (!lp_unix_extensions()) {
                                reply_nterror(req, NT_STATUS_INVALID_LEVEL);
                                return;
                        }
+
+                       switch (conn->encrypt_level) {
+                       case 0:
+                               encrypt_caps = 0;
+                               break;
+                       case 1:
+                       case Auto:
+                               encrypt_caps = CIFS_UNIX_TRANSPORT_ENCRYPTION_CAP;
+                               break;
+                       case Required:
+                               encrypt_caps = CIFS_UNIX_TRANSPORT_ENCRYPTION_CAP|
+                                               CIFS_UNIX_TRANSPORT_ENCRYPTION_MANDATORY_CAP;
+                               large_write = false;
+                               large_read = false;
+                               break;
+                       }
+
                        data_len = 12;
                        SSVAL(pdata,0,CIFS_UNIX_MAJOR_VERSION);
                        SSVAL(pdata,2,CIFS_UNIX_MINOR_VERSION);
-                       /* We have POSIX ACLs, pathname and locking capability. */
+
+                       /* We have POSIX ACLs, pathname, encryption, 
+                        * large read/write, and locking capability. */
+
                        SBIG_UINT(pdata,4,((SMB_BIG_UINT)(
                                        CIFS_UNIX_POSIX_ACLS_CAP|
                                        CIFS_UNIX_POSIX_PATHNAMES_CAP|
                                        CIFS_UNIX_FCNTL_LOCKS_CAP|
                                        CIFS_UNIX_EXTATTR_CAP|
                                        CIFS_UNIX_POSIX_PATH_OPERATIONS_CAP|
-                                       CIFS_UNIX_LARGE_READ_CAP|
+                                       encrypt_caps|
+                                       (large_read ? CIFS_UNIX_LARGE_READ_CAP : 0) |
                                        (large_write ?
                                        CIFS_UNIX_LARGE_WRITE_CAP : 0))));
                        break;
@@ -2864,8 +3011,8 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)bsize, (unsigned
                         */
                        for (i = 0, sid_bytes = 0;
                            i < current_user.nt_user_token->num_sids; ++i) {
-                               sid_bytes +=
-                                   sid_size(&current_user.nt_user_token->user_sids[i]);
+                               sid_bytes += ndr_size_dom_sid(
+                                       &current_user.nt_user_token->user_sids[i], 0);
                        }
 
                        /* SID list byte count */
@@ -2885,8 +3032,8 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)bsize, (unsigned
                        /* SID list */
                        for (i = 0;
                            i < current_user.nt_user_token->num_sids; ++i) {
-                               int sid_len =
-                                   sid_size(&current_user.nt_user_token->user_sids[i]);
+                               int sid_len = ndr_size_dom_sid(
+                                       &current_user.nt_user_token->user_sids[i], 0);
 
                                sid_linearize(pdata + data_len, sid_len,
                                    &current_user.nt_user_token->user_sids[i]);
@@ -2913,7 +3060,7 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)bsize, (unsigned
        }
 
 
-       send_trans2_replies(req, params, 0, pdata, data_len,
+       send_trans2_replies(conn, req, params, 0, pdata, data_len,
                            max_data_bytes);
 
        DEBUG( 4, ( "%s info_level = %d\n",
@@ -2948,6 +3095,28 @@ static void call_trans2setfsinfo(connection_struct *conn,
 
        info_level = SVAL(params,2);
 
+       if (IS_IPC(conn)) {
+               if (info_level != SMB_REQUEST_TRANSPORT_ENCRYPTION &&
+                               info_level != SMB_SET_CIFS_UNIX_INFO) {
+                       DEBUG(0,("call_trans2setfsinfo: not an allowed "
+                               "info level (0x%x) on IPC$.\n",
+                               (unsigned int)info_level));
+                       reply_nterror(req, NT_STATUS_ACCESS_DENIED);
+                       return;
+               }
+       }
+
+       if (ENCRYPTION_REQUIRED(conn) && !req->encrypted) {
+               if (info_level != SMB_REQUEST_TRANSPORT_ENCRYPTION) {
+                       DEBUG(0,("call_trans2setfsinfo: encryption required "
+                               "and info level 0x%x sent.\n",
+                               (unsigned int)info_level));
+                       exit_server_cleanly("encryption required "
+                               "on connection");
+                       return;
+               }
+       }
+
        switch(info_level) {
                case SMB_SET_CIFS_UNIX_INFO:
                        {
@@ -2998,6 +3167,62 @@ cap_low = 0x%x, cap_high = 0x%x\n",
                                }
                                break;
                        }
+
+               case SMB_REQUEST_TRANSPORT_ENCRYPTION:
+                       {
+                               NTSTATUS status;
+                               size_t param_len = 0;
+                               size_t data_len = total_data;
+
+                               if (!lp_unix_extensions()) {
+                                       reply_nterror(
+                                               req,
+                                               NT_STATUS_INVALID_LEVEL);
+                                       return;
+                               }
+
+                               if (lp_smb_encrypt(SNUM(conn)) == false) {
+                                       reply_nterror(
+                                               req,
+                                               NT_STATUS_NOT_SUPPORTED);
+                                       return;
+                               }
+
+                               DEBUG( 4,("call_trans2setfsinfo: "
+                                       "request transport encrption.\n"));
+
+                               status = srv_request_encryption_setup(conn,
+                                                               (unsigned char **)ppdata,
+                                                               &data_len,
+                                                               (unsigned char **)pparams,
+                                                               &param_len);
+
+                               if (!NT_STATUS_EQUAL(status, NT_STATUS_MORE_PROCESSING_REQUIRED) &&
+                                               !NT_STATUS_IS_OK(status)) {
+                                       reply_nterror(req, status);
+                                       return;
+                               }
+
+                               send_trans2_replies(conn, req,
+                                               *pparams,
+                                               param_len,
+                                               *ppdata,
+                                               data_len,
+                                               max_data_bytes);
+
+                               if (NT_STATUS_IS_OK(status)) {
+                                       /* Server-side transport
+                                        * encryption is now *on*. */
+                                       status = srv_encryption_start(conn);
+                                       if (!NT_STATUS_IS_OK(status)) {
+                                               exit_server_cleanly(
+                                                       "Failure in setting "
+                                                       "up encrypted transport");
+                                       }
+                               }
+                               return;
+                       }
+
                case SMB_FS_QUOTA_INFORMATION:
                        {
                                files_struct *fsp = NULL;
@@ -3389,6 +3614,72 @@ static char *store_file_unix_basic_info2(connection_struct *conn,
        return pdata;
 }
 
+static NTSTATUS marshall_stream_info(unsigned int num_streams,
+                                    const struct stream_struct *streams,
+                                    char *data,
+                                    unsigned int max_data_bytes,
+                                    unsigned int *data_size)
+{
+       unsigned int i;
+       unsigned int ofs = 0;
+
+       for (i=0; i<num_streams; i++) {
+               unsigned int next_offset;
+               size_t namelen;
+               smb_ucs2_t *namebuf;
+
+               namelen = push_ucs2_talloc(talloc_tos(), &namebuf,
+                                           streams[i].name);
+
+               if ((namelen == (size_t)-1) || (namelen <= 2)) {
+                       return NT_STATUS_INVALID_PARAMETER;
+               }
+
+               /*
+                * name_buf is now null-terminated, we need to marshall as not
+                * terminated
+                */
+
+               namelen -= 2;
+
+               if (ofs + 24 + namelen > max_data_bytes) {
+                       TALLOC_FREE(namebuf);
+                       return NT_STATUS_BUFFER_TOO_SMALL;
+               }
+
+               SIVAL(data, ofs+4, namelen);
+               SOFF_T(data, ofs+8, streams[i].size);
+               SOFF_T(data, ofs+16, streams[i].alloc_size);
+               memcpy(data+ofs+24, namebuf, namelen);
+               TALLOC_FREE(namebuf);
+
+               next_offset = ofs + 24 + namelen;
+
+               if (i == num_streams-1) {
+                       SIVAL(data, ofs, 0);
+               }
+               else {
+                       unsigned int align = ndr_align_size(next_offset, 8);
+
+                       if (next_offset + align > max_data_bytes) {
+                               return NT_STATUS_BUFFER_TOO_SMALL;
+                       }
+
+                       memset(data+next_offset, 0, align);
+                       next_offset += align;
+
+                       SIVAL(data, ofs, next_offset - ofs);
+                       ofs = next_offset;
+               }
+
+               ofs = next_offset;
+       }
+
+       *data_size = ofs;
+
+       return NT_STATUS_OK;
+}
+
 /****************************************************************************
  Reply to a TRANSACT2_QFILEINFO on a PIPE !
 ****************************************************************************/
@@ -3454,7 +3745,7 @@ static void call_trans2qpipeinfo(connection_struct *conn,
                        return;
        }
 
-       send_trans2_replies(req, params, param_size, *ppdata, data_size,
+       send_trans2_replies(conn, req, params, param_size, *ppdata, data_size,
                            max_data_bytes);
 
        return;
@@ -3579,7 +3870,7 @@ static void call_trans2qfilepathinfo(connection_struct *conn,
                                return;
                        }
 
-                       if (SMB_VFS_FSTAT(fsp,fsp->fh->fd,&sbuf) != 0) {
+                       if (SMB_VFS_FSTAT(fsp, &sbuf) != 0) {
                                DEBUG(3,("fstat of fnum %d failed (%s)\n", fsp->fnum, strerror(errno)));
                                reply_unixerror(req, ERRDOS, ERRbadfid);
                                return;
@@ -3664,17 +3955,6 @@ static void call_trans2qfilepathinfo(connection_struct *conn,
                }
        }
 
-       nlink = sbuf.st_nlink;
-
-       if ((nlink > 0) && S_ISDIR(sbuf.st_mode)) {
-               /* NTFS does not seem to count ".." */
-               nlink -= 1;
-       }
-
-       if ((nlink > 0) && delete_pending) {
-               nlink -= 1;
-       }
-
        if (INFO_LEVEL_IS_UNIX(info_level) && !lp_unix_extensions()) {
                reply_nterror(req, NT_STATUS_INVALID_LEVEL);
                return;
@@ -3693,6 +3973,16 @@ static void call_trans2qfilepathinfo(connection_struct *conn,
        if (!mode)
                mode = FILE_ATTRIBUTE_NORMAL;
 
+       nlink = sbuf.st_nlink;
+
+       if (nlink && (mode&aDIR)) {
+               nlink = 1;
+       }
+
+       if ((nlink > 0) && delete_pending) {
+               nlink -= 1;
+       }
+
        fullpathname = fname;
        if (!(mode & aDIR))
                file_size = get_file_size(sbuf);
@@ -4087,28 +4377,49 @@ total_data=%u (should be %u)\n", (unsigned int)total_data, (unsigned int)IVAL(pd
                        data_size = 4;
                        break;
 
-#if 0
                /*
-                * NT4 server just returns "invalid query" to this - if we try to answer
-                * it then NTws gets a BSOD! (tridge).
-                * W2K seems to want this. JRA.
+                * NT4 server just returns "invalid query" to this - if we try
+                * to answer it then NTws gets a BSOD! (tridge).  W2K seems to
+                * want this. JRA.
+                */
+               /* The first statement above is false - verified using Thursby
+                * client against NT4 -- gcolley.
                 */
                case SMB_QUERY_FILE_STREAM_INFO:
-#endif
-               case SMB_FILE_STREAM_INFORMATION:
-                       DEBUG(10,("call_trans2qfilepathinfo: SMB_FILE_STREAM_INFORMATION\n"));
-                       if (mode & aDIR) {
-                               data_size = 0;
-                       } else {
-                               size_t byte_len = dos_PutUniCode(pdata+24,"::$DATA", (size_t)0xE, False);
-                               SIVAL(pdata,0,0); /* ??? */
-                               SIVAL(pdata,4,byte_len); /* Byte length of unicode string ::$DATA */
-                               SOFF_T(pdata,8,file_size);
-                               SOFF_T(pdata,16,allocation_size);
-                               data_size = 24 + byte_len;
+               case SMB_FILE_STREAM_INFORMATION: {
+                       unsigned int num_streams;
+                       struct stream_struct *streams;
+                       NTSTATUS status;
+
+                       DEBUG(10,("call_trans2qfilepathinfo: "
+                                 "SMB_FILE_STREAM_INFORMATION\n"));
+
+                       status = SMB_VFS_STREAMINFO(
+                               conn, fsp, fname, talloc_tos(),
+                               &num_streams, &streams);
+
+                       if (!NT_STATUS_IS_OK(status)) {
+                               DEBUG(10, ("could not get stream info: %s\n",
+                                          nt_errstr(status)));
+                               reply_nterror(req, status);
+                               return;
                        }
-                       break;
 
+                       status = marshall_stream_info(num_streams, streams,
+                                                     pdata, max_data_bytes,
+                                                     &data_size);
+
+                       if (!NT_STATUS_IS_OK(status)) {
+                               DEBUG(10, ("marshall_stream_info failed: %s\n",
+                                          nt_errstr(status)));
+                               reply_nterror(req, status);
+                               return;
+                       }
+
+                       TALLOC_FREE(streams);
+
+                       break;
+               }
                case SMB_QUERY_COMPRESSION_INFO:
                case SMB_FILE_COMPRESSION_INFORMATION:
                        DEBUG(10,("call_trans2qfilepathinfo: SMB_FILE_COMPRESSION_INFORMATION\n"));
@@ -4221,7 +4532,7 @@ total_data=%u (should be %u)\n", (unsigned int)total_data, (unsigned int)IVAL(pd
                                uint16 num_def_acls = 0;
 
                                if (fsp && !fsp->is_directory && (fsp->fh->fd != -1)) {
-                                       file_acl = SMB_VFS_SYS_ACL_GET_FD(fsp, fsp->fh->fd);
+                                       file_acl = SMB_VFS_SYS_ACL_GET_FD(fsp);
                                } else {
                                        file_acl = SMB_VFS_SYS_ACL_GET_FILE(conn, fname, SMB_ACL_TYPE_ACCESS);
                                }
@@ -4386,7 +4697,7 @@ total_data=%u (should be %u)\n", (unsigned int)total_data, (unsigned int)IVAL(pd
                        return;
        }
 
-       send_trans2_replies(req, params, param_size, *ppdata, data_size,
+       send_trans2_replies(conn, req, params, param_size, *ppdata, data_size,
                            max_data_bytes);
 
        return;
@@ -4675,17 +4986,12 @@ static NTSTATUS smb_info_set_ea(connection_struct *conn,
                return NT_STATUS_INVALID_PARAMETER;
        }
 
-       ctx = talloc_init("SMB_INFO_SET_EA");
-       if (!ctx) {
-               return NT_STATUS_NO_MEMORY;
-       }
+       ctx = talloc_tos();
        ea_list = read_ea_list(ctx, pdata + 4, total_data - 4);
        if (!ea_list) {
-               talloc_destroy(ctx);
                return NT_STATUS_INVALID_PARAMETER;
        }
        status = set_ea(conn, fsp, fname, ea_list);
-       talloc_destroy(ctx);
 
        return status;
 }
@@ -5090,8 +5396,7 @@ static NTSTATUS smb_set_posix_acl(connection_struct *conn,
 ****************************************************************************/
 
 static NTSTATUS smb_set_posix_lock(connection_struct *conn,
-                               const uint8 *inbuf,
-                               int length,
+                               const struct smb_request *req,
                                const char *pdata,
                                int total_data,
                                files_struct *fsp)
@@ -5101,6 +5406,7 @@ static NTSTATUS smb_set_posix_lock(connection_struct *conn,
        uint32 lock_pid;
        bool blocking_lock = False;
        enum brl_type lock_type;
+
        NTSTATUS status = NT_STATUS_OK;
 
        if (fsp == NULL || fsp->fh->fd == -1) {
@@ -5188,7 +5494,7 @@ static NTSTATUS smb_set_posix_lock(connection_struct *conn,
                         * onto the blocking lock queue.
                         */
                        if(push_blocking_lock_request(br_lck,
-                                               (char *)inbuf, length,
+                                               req,
                                                fsp,
                                                -1, /* infinite timeout. */
                                                0,
@@ -6124,7 +6430,7 @@ static NTSTATUS smb_posix_unlink(connection_struct *conn,
         * non-POSIX opens return SHARING_VIOLATION.
         */
 
-       lck = get_share_mode_lock(NULL, fsp->file_id, NULL, NULL);
+       lck = get_share_mode_lock(talloc_tos(), fsp->file_id, NULL, NULL);
        if (lck == NULL) {
                DEBUG(0, ("smb_posix_unlink: Could not get share mode "
                        "lock for file %s\n", fsp->fsp_name));
@@ -6246,7 +6552,7 @@ static void call_trans2setfilepathinfo(connection_struct *conn,
                                DEBUG(3,("call_trans2setfilepathinfo: Cancelling print job (%s)\n", fsp->fsp_name ));
 
                                SSVAL(params,0,0);
-                               send_trans2_replies(req, params, 2,
+                               send_trans2_replies(conn, req, params, 2,
                                                    *ppdata, 0,
                                                    max_data_bytes);
                                return;
@@ -6262,7 +6568,7 @@ static void call_trans2setfilepathinfo(connection_struct *conn,
                                return;
                        }
 
-                       if (SMB_VFS_FSTAT(fsp, fsp->fh->fd, &sbuf) != 0) {
+                       if (SMB_VFS_FSTAT(fsp, &sbuf) != 0) {
                                DEBUG(3,("call_trans2setfilepathinfo: fstat of fnum %d failed (%s)\n",fsp->fnum, strerror(errno)));
                                reply_unixerror(req, ERRDOS, ERRbadfid);
                                return;
@@ -6536,8 +6842,7 @@ static void call_trans2setfilepathinfo(connection_struct *conn,
                                reply_nterror(req, NT_STATUS_INVALID_LEVEL);
                                return;
                        }
-                       status = smb_set_posix_lock(conn, req->inbuf,
-                                                   smb_len(req->inbuf) + 4,
+                       status = smb_set_posix_lock(conn, req,
                                                    pdata, total_data, fsp);
                        break;
                }
@@ -6605,7 +6910,7 @@ static void call_trans2setfilepathinfo(connection_struct *conn,
        }
 
        SSVAL(params,0,0);
-       send_trans2_replies(req, params, 2, *ppdata, data_return_size,
+       send_trans2_replies(conn, req, params, 2, *ppdata, data_return_size,
                            max_data_bytes);
   
        return;
@@ -6697,7 +7002,7 @@ static void call_trans2mkdir(connection_struct *conn, struct smb_request *req,
                return;
        }
 
-       status = create_directory(conn, directory);
+       status = create_directory(conn, req, directory);
 
        if (!NT_STATUS_IS_OK(status)) {
                reply_nterror(req, status);
@@ -6723,7 +7028,7 @@ static void call_trans2mkdir(connection_struct *conn, struct smb_request *req,
 
        SSVAL(params,0,0);
 
-       send_trans2_replies(req, params, 2, *ppdata, 0, max_data_bytes);
+       send_trans2_replies(conn, req, params, 2, *ppdata, 0, max_data_bytes);
   
        return;
 }
@@ -6777,7 +7082,7 @@ static void call_trans2findnotifyfirst(connection_struct *conn,
        if(fnf_handle == 0)
                fnf_handle = 257;
 
-       send_trans2_replies(req, params, 6, *ppdata, 0, max_data_bytes);
+       send_trans2_replies(conn, req, params, 6, *ppdata, 0, max_data_bytes);
   
        return;
 }
@@ -6808,7 +7113,7 @@ static void call_trans2findnotifynext(connection_struct *conn,
        SSVAL(params,0,0); /* No changes */
        SSVAL(params,2,0); /* No EA errors */
 
-       send_trans2_replies(req, params, 4, *ppdata, 0, max_data_bytes);
+       send_trans2_replies(conn, req, params, 4, *ppdata, 0, max_data_bytes);
   
        return;
 }
@@ -6858,7 +7163,7 @@ static void call_trans2getdfsreferral(connection_struct *conn,
 
        SSVAL(req->inbuf, smb_flg2,
              SVAL(req->inbuf,smb_flg2) | FLAGS2_DFS_PATHNAMES);
-       send_trans2_replies(req,0,0,*ppdata,reply_size, max_data_bytes);
+       send_trans2_replies(conn, req,0,0,*ppdata,reply_size, max_data_bytes);
 
        return;
 }
@@ -6905,7 +7210,7 @@ static void call_trans2ioctl(connection_struct *conn,
                srvstr_push(pdata, req->flags2, pdata+18,
                            lp_servicename(SNUM(conn)), 13,
                            STR_ASCII|STR_TERMINATE); /* Service name */
-               send_trans2_replies(req, *pparams, 0, *ppdata, 32,
+               send_trans2_replies(conn, req, *pparams, 0, *ppdata, 32,
                                    max_data_bytes);
                return;
        }
@@ -6918,7 +7223,7 @@ static void call_trans2ioctl(connection_struct *conn,
  Reply to a SMBfindclose (stop trans2 directory search).
 ****************************************************************************/
 
-void reply_findclose(connection_struct *conn, struct smb_request *req)
+void reply_findclose(struct smb_request *req)
 {
        int dptr_num;
 
@@ -6948,7 +7253,7 @@ void reply_findclose(connection_struct *conn, struct smb_request *req)
  Reply to a SMBfindnclose (stop FINDNOTIFYFIRST directory search).
 ****************************************************************************/
 
-void reply_findnclose(connection_struct *conn, struct smb_request *req)
+void reply_findnclose(struct smb_request *req)
 {
        int dptr_num;
 
@@ -6984,6 +7289,17 @@ static void handle_trans2(connection_struct *conn, struct smb_request *req,
                SSVAL(req->inbuf,smb_flg2,req->flags2);
        }
 
+       if (conn->encrypt_level == Required && !req->encrypted) {
+               if (state->call != TRANSACT2_QFSINFO &&
+                               state->call != TRANSACT2_SETFSINFO) {
+                       DEBUG(0,("handle_trans2: encryption required "
+                               "with call 0x%x\n",
+                               (unsigned int)state->call));
+                       reply_nterror(req, NT_STATUS_ACCESS_DENIED);
+                       return;
+               }
+       }
+
        /* Now we must call the relevant TRANS2 function */
        switch(state->call)  {
        case TRANSACT2_OPEN:
@@ -7131,8 +7447,9 @@ static void handle_trans2(connection_struct *conn, struct smb_request *req,
  Reply to a SMBtrans2.
  ****************************************************************************/
 
-void reply_trans2(connection_struct *conn, struct smb_request *req)
+void reply_trans2(struct smb_request *req)
 {
+       connection_struct *conn = req->conn;
        unsigned int dsoff;
        unsigned int dscnt;
        unsigned int psoff;
@@ -7166,12 +7483,20 @@ void reply_trans2(connection_struct *conn, struct smb_request *req)
                return;
        }
 
-       if (IS_IPC(conn) && (tran_call != TRANSACT2_OPEN)
-            && (tran_call != TRANSACT2_GET_DFS_REFERRAL)
-            && (tran_call != TRANSACT2_QFILEINFO)) {
-               reply_doserror(req, ERRSRV, ERRaccess);
-               END_PROFILE(SMBtrans2);
-               return;
+       if (IS_IPC(conn)) {
+               switch (tran_call) {
+               /* List the allowed trans2 calls on IPC$ */
+               case TRANSACT2_OPEN:
+               case TRANSACT2_GET_DFS_REFERRAL:
+               case TRANSACT2_QFILEINFO:
+               case TRANSACT2_QFSINFO:
+               case TRANSACT2_SETFSINFO:
+                       break;
+               default:
+                       reply_doserror(req, ERRSRV, ERRaccess);
+                       END_PROFILE(SMBtrans2);
+                       return;
+               }
        }
 
        if ((state = TALLOC_P(conn->mem_ctx, struct trans_state)) == NULL) {
@@ -7312,8 +7637,9 @@ void reply_trans2(connection_struct *conn, struct smb_request *req)
  Reply to a SMBtranss2
  ****************************************************************************/
 
-void reply_transs2(connection_struct *conn, struct smb_request *req)
+void reply_transs2(struct smb_request *req)
 {
+       connection_struct *conn = req->conn;
        unsigned int pcnt,poff,dcnt,doff,pdisp,ddisp;
        struct trans_state *state;
        int size;
index e82bbea3b301f6991aae11e6dfbc6a5ec8c9fb7b..5931b2b1d06e2717202e219fb2e0a733953e66af 100644 (file)
@@ -223,7 +223,7 @@ static char *uw_pathname(TALLOC_CTX *ctx,
        }
 
        /* For u-files and non-explicit w-dir, look for "utmp dir" */
-       if (!dirname == 0 || strlen(dirname) == 0) {
+       if ((dirname == NULL) || (strlen(dirname) == 0)) {
                dirname = talloc_strdup(ctx, lp_utmpdir());
                if (!dirname) {
                        return NULL;
index 628d2eec4b9cc30857d45ec6f7ab2938d70972c5..33a3a43aa474a9a76d6e9a18e5d3ba1db2bd23f5 100644 (file)
@@ -31,7 +31,7 @@ static_decl_vfs;
 
 struct vfs_init_function_entry {
        char *name;
-       vfs_op_tuple *vfs_op_tuples;
+       const vfs_op_tuple *vfs_op_tuples;
        struct vfs_init_function_entry *prev, *next;
 };
 
@@ -55,7 +55,7 @@ static struct vfs_init_function_entry *vfs_find_backend_entry(const char *name)
        return NULL;
 }
 
-NTSTATUS smb_register_vfs(int version, const char *name, vfs_op_tuple *vfs_op_tuples)
+NTSTATUS smb_register_vfs(int version, const char *name, const vfs_op_tuple *vfs_op_tuples)
 {
        struct vfs_init_function_entry *entry = backends;
 
@@ -110,13 +110,13 @@ static inline void vfs_set_operation(struct vfs_ops * vfs, vfs_op_type which,
 
 bool vfs_init_custom(connection_struct *conn, const char *vfs_object)
 {
-       vfs_op_tuple *ops;
+       const vfs_op_tuple *ops;
        char *module_path = NULL;
        char *module_name = NULL;
        char *module_param = NULL, *p;
        int i;
        vfs_handle_struct *handle;
-       struct vfs_init_function_entry *entry;
+       const struct vfs_init_function_entry *entry;
        
        if (!conn||!vfs_object||!vfs_object[0]) {
                DEBUG(0,("vfs_init_custon() called with NULL pointer or emtpy vfs_object!\n"));
@@ -263,19 +263,31 @@ void vfs_remove_fsp_extension(vfs_handle_struct *handle, files_struct *fsp)
        }
 }
 
-void *vfs_fetch_fsp_extension(vfs_handle_struct *handle, files_struct *fsp)
+void *vfs_memctx_fsp_extension(vfs_handle_struct *handle, files_struct *fsp)
 {
        struct vfs_fsp_data *head;
 
        for (head = fsp->vfs_extension; head; head = head->next) {
                if (head->owner == handle) {
-                       return EXT_DATA_AREA(head);
+                       return head;
                }
        }
 
        return NULL;
 }
 
+void *vfs_fetch_fsp_extension(vfs_handle_struct *handle, files_struct *fsp)
+{
+       struct vfs_fsp_data *head;
+
+       head = (struct vfs_fsp_data *)vfs_memctx_fsp_extension(handle, fsp);
+       if (head != NULL) {
+               return EXT_DATA_AREA(head);
+       }
+
+       return NULL;
+}
+
 #undef EXT_DATA_AREA
 
 /*****************************************************************
@@ -377,8 +389,8 @@ ssize_t vfs_read_data(files_struct *fsp, char *buf, size_t byte_count)
 
        while (total < byte_count)
        {
-               ssize_t ret = SMB_VFS_READ(fsp, fsp->fh->fd, buf + total,
-                                       byte_count - total);
+               ssize_t ret = SMB_VFS_READ(fsp, buf + total,
+                                          byte_count - total);
 
                if (ret == 0) return total;
                if (ret == -1) {
@@ -399,7 +411,7 @@ ssize_t vfs_pread_data(files_struct *fsp, char *buf,
 
        while (total < byte_count)
        {
-               ssize_t ret = SMB_VFS_PREAD(fsp, fsp->fh->fd, buf + total,
+               ssize_t ret = SMB_VFS_PREAD(fsp, buf + total,
                                        byte_count - total, offset + total);
 
                if (ret == 0) return total;
@@ -433,13 +445,12 @@ ssize_t vfs_write_data(struct smb_request *req,
                req->unread_bytes = 0;
                return SMB_VFS_RECVFILE(smbd_server_fd(),
                                        fsp,
-                                       fsp->fh->fd,
                                        (SMB_OFF_T)-1,
                                        N);
        }
 
        while (total < N) {
-               ret = SMB_VFS_WRITE(fsp,fsp->fh->fd,buffer + total,N - total);
+               ret = SMB_VFS_WRITE(fsp, buffer + total, N - total);
 
                if (ret == -1)
                        return -1;
@@ -467,14 +478,13 @@ ssize_t vfs_pwrite_data(struct smb_request *req,
                req->unread_bytes = 0;
                return SMB_VFS_RECVFILE(smbd_server_fd(),
                                        fsp,
-                                       fsp->fh->fd,
                                        offset,
                                        N);
        }
 
        while (total < N) {
-               ret = SMB_VFS_PWRITE(fsp, fsp->fh->fd, buffer + total,
-                                N - total, offset + total);
+               ret = SMB_VFS_PWRITE(fsp, buffer + total, N - total,
+                                    offset + total);
 
                if (ret == -1)
                        return -1;
@@ -513,7 +523,7 @@ int vfs_allocate_file_space(files_struct *fsp, SMB_BIG_UINT len)
                return -1;
        }
 
-       ret = SMB_VFS_FSTAT(fsp,fsp->fh->fd,&st);
+       ret = SMB_VFS_FSTAT(fsp, &st);
        if (ret == -1)
                return ret;
 
@@ -527,7 +537,7 @@ int vfs_allocate_file_space(files_struct *fsp, SMB_BIG_UINT len)
                                fsp->fsp_name, (double)st.st_size ));
 
                flush_write_cache(fsp, SIZECHANGE_FLUSH);
-               if ((ret = SMB_VFS_FTRUNCATE(fsp, fsp->fh->fd, (SMB_OFF_T)len)) != -1) {
+               if ((ret = SMB_VFS_FTRUNCATE(fsp, (SMB_OFF_T)len)) != -1) {
                        set_filelen_write_cache(fsp, len);
                }
                return ret;
@@ -569,7 +579,7 @@ int vfs_set_filelen(files_struct *fsp, SMB_OFF_T len)
        release_level_2_oplocks_on_change(fsp);
        DEBUG(10,("vfs_set_filelen: ftruncate %s to len %.0f\n", fsp->fsp_name, (double)len));
        flush_write_cache(fsp, SIZECHANGE_FLUSH);
-       if ((ret = SMB_VFS_FTRUNCATE(fsp, fsp->fh->fd, len)) != -1) {
+       if ((ret = SMB_VFS_FTRUNCATE(fsp, len)) != -1) {
                set_filelen_write_cache(fsp, len);
                notify_fname(fsp->conn, NOTIFY_ACTION_MODIFIED,
                             FILE_NOTIFY_CHANGE_SIZE
@@ -600,7 +610,7 @@ int vfs_fill_sparse(files_struct *fsp, SMB_OFF_T len)
        ssize_t pwrite_ret;
 
        release_level_2_oplocks_on_change(fsp);
-       ret = SMB_VFS_FSTAT(fsp,fsp->fh->fd,&st);
+       ret = SMB_VFS_FSTAT(fsp, &st);
        if (ret == -1) {
                return ret;
        }
@@ -629,7 +639,7 @@ int vfs_fill_sparse(files_struct *fsp, SMB_OFF_T len)
        while (total < num_to_write) {
                size_t curr_write_size = MIN(SPARSE_BUF_WRITE_SIZE, (num_to_write - total));
 
-               pwrite_ret = SMB_VFS_PWRITE(fsp, fsp->fh->fd, sparse_buf, curr_write_size, offset + total);
+               pwrite_ret = SMB_VFS_PWRITE(fsp, sparse_buf, curr_write_size, offset + total);
                if (pwrite_ret == -1) {
                        DEBUG(10,("vfs_fill_sparse: SMB_VFS_PWRITE for file %s failed with error %s\n",
                                fsp->fsp_name, strerror(errno) ));
@@ -650,25 +660,24 @@ int vfs_fill_sparse(files_struct *fsp, SMB_OFF_T len)
  Transfer some data (n bytes) between two file_struct's.
 ****************************************************************************/
 
-static files_struct *in_fsp;
-static files_struct *out_fsp;
-
-static ssize_t read_fn(int fd, void *buf, size_t len)
+static ssize_t vfs_read_fn(void *file, void *buf, size_t len)
 {
-       return SMB_VFS_READ(in_fsp, fd, buf, len);
+       struct files_struct *fsp = (struct files_struct *)file;
+
+       return SMB_VFS_READ(fsp, buf, len);
 }
 
-static ssize_t write_fn(int fd, const void *buf, size_t len)
+static ssize_t vfs_write_fn(void *file, const void *buf, size_t len)
 {
-       return SMB_VFS_WRITE(out_fsp, fd, buf, len);
+       struct files_struct *fsp = (struct files_struct *)file;
+
+       return SMB_VFS_WRITE(fsp, buf, len);
 }
 
 SMB_OFF_T vfs_transfer_file(files_struct *in, files_struct *out, SMB_OFF_T n)
 {
-       in_fsp = in;
-       out_fsp = out;
-
-       return transfer_file_internal(in_fsp->fh->fd, out_fsp->fh->fd, n, read_fn, write_fn);
+       return transfer_file_internal((void *)in, (void *)out, n,
+                                     vfs_read_fn, vfs_write_fn);
 }
 
 /*******************************************************************
@@ -731,152 +740,98 @@ int vfs_ChDir(connection_struct *conn, const char *path)
        return(res);
 }
 
-/* number of list structures for a caching GetWd function. */
-#define MAX_GETWDCACHE (50)
-
-static struct {
-       SMB_DEV_T dev; /* These *must* be compatible with the types returned in a stat() call. */
-       SMB_INO_T inode; /* These *must* be compatible with the types returned in a stat() call. */
-       char *path; /* The pathname. */
-       bool valid;
-} ino_list[MAX_GETWDCACHE];
-
-extern bool use_getwd_cache;
-
-/****************************************************************************
- Prompte a ptr (to make it recently used)
-****************************************************************************/
-
-static void array_promote(char *array,int elsize,int element)
-{
-       char *p;
-       if (element == 0)
-               return;
-
-       p = (char *)SMB_MALLOC(elsize);
-
-       if (!p) {
-               DEBUG(5,("array_promote: malloc fail\n"));
-               return;
-       }
-
-       memcpy(p,array + element * elsize, elsize);
-       memmove(array + elsize,array,elsize*element);
-       memcpy(array,p,elsize);
-       SAFE_FREE(p);
-}
-
 /*******************************************************************
  Return the absolute current directory path - given a UNIX pathname.
  Note that this path is returned in DOS format, not UNIX
  format. Note this can be called with conn == NULL.
 ********************************************************************/
 
+struct getwd_cache_key {
+       SMB_DEV_T dev;
+       SMB_INO_T ino;
+};
+
 char *vfs_GetWd(TALLOC_CTX *ctx, connection_struct *conn)
 {
         char s[PATH_MAX+1];
-       static bool getwd_cache_init = False;
        SMB_STRUCT_STAT st, st2;
-       int i;
-       char *ret = NULL;
+       char *result;
+       DATA_BLOB cache_value;
+       struct getwd_cache_key key;
 
        *s = 0;
 
-       if (!use_getwd_cache) {
- nocache:
-               ret = SMB_VFS_GETWD(conn,s);
-               if (!ret) {
-                       DEBUG(0,("vfs_GetWd: SMB_VFS_GETWD call failed, "
-                               "errno %s\n",strerror(errno)));
-                       return NULL;
-               }
-               return talloc_strdup(ctx, ret);
-       }
-
-       /* init the cache */
-       if (!getwd_cache_init) {
-               getwd_cache_init = True;
-               for (i=0;i<MAX_GETWDCACHE;i++) {
-                       string_set(&ino_list[i].path,"");
-                       ino_list[i].valid = False;
-               }
+       if (!lp_getwd_cache()) {
+               goto nocache;
        }
 
-       /*  Get the inode of the current directory, if this doesn't work we're
-               in trouble :-) */
+       SET_STAT_INVALID(st);
 
        if (SMB_VFS_STAT(conn, ".",&st) == -1) {
-               /* Known to fail for root: the directory may be
-                * NFS-mounted and exported with root_squash (so has no root access). */
+               /*
+                * Known to fail for root: the directory may be NFS-mounted
+                * and exported with root_squash (so has no root access).
+                */
                DEBUG(1,("vfs_GetWd: couldn't stat \".\" error %s "
-                       "(NFS problem ?)\n",
-                       strerror(errno) ));
+                        "(NFS problem ?)\n", strerror(errno) ));
                goto nocache;
        }
 
+       ZERO_STRUCT(key); /* unlikely, but possible padding */
+       key.dev = st.st_dev;
+       key.ino = st.st_ino;
 
-       for (i=0; i<MAX_GETWDCACHE; i++) {
-               if (ino_list[i].valid) {
-
-                       /*  If we have found an entry with a matching inode and dev number
-                               then find the inode number for the directory in the cached string.
-                               If this agrees with that returned by the stat for the current
-                               directory then all is o.k. (but make sure it is a directory all
-                               the same...) */
-
-                       if (st.st_ino == ino_list[i].inode && st.st_dev == ino_list[i].dev) {
-                               if (SMB_VFS_STAT(conn,ino_list[i].path,&st2) == 0) {
-                                       if (st.st_ino == st2.st_ino && st.st_dev == st2.st_dev &&
-                                                       (st2.st_mode & S_IFMT) == S_IFDIR) {
+       if (!memcache_lookup(smbd_memcache(), GETWD_CACHE,
+                            data_blob_const(&key, sizeof(key)),
+                            &cache_value)) {
+               goto nocache;
+       }
 
-                                               ret = talloc_strdup(ctx,
-                                                       ino_list[i].path);
+       SMB_ASSERT((cache_value.length > 0)
+                  && (cache_value.data[cache_value.length-1] == '\0'));
 
-                                               /* promote it for future use */
-                                               array_promote((char *)&ino_list[0],sizeof(ino_list[0]),i);
-                                               if (ret == NULL) {
-                                                       errno = ENOMEM;
-                                               }
-                                               return ret;
-                                       } else {
-                                               /*  If the inode is different then something's changed,
-                                                       scrub the entry and start from scratch. */
-                                               ino_list[i].valid = False;
-                                       }
-                               }
-                       }
+       if ((SMB_VFS_STAT(conn, (char *)cache_value.data, &st2) == 0)
+           && (st.st_dev == st2.st_dev) && (st.st_ino == st2.st_ino)
+           && (S_ISDIR(st.st_mode))) {
+               /*
+                * Ok, we're done
+                */
+               result = talloc_strdup(ctx, (char *)cache_value.data);
+               if (result == NULL) {
+                       errno = ENOMEM;
                }
+               return result;
        }
 
-       /*  We don't have the information to hand so rely on traditional
-        *  methods. The very slow getcwd, which spawns a process on some
-        *  systems, or the not quite so bad getwd. */
+ nocache:
+
+       /*
+        * We don't have the information to hand so rely on traditional
+        * methods. The very slow getcwd, which spawns a process on some
+        * systems, or the not quite so bad getwd.
+        */
 
        if (!SMB_VFS_GETWD(conn,s)) {
-               DEBUG(0,("vfs_GetWd: SMB_VFS_GETWD call failed, errno %s\n",
-                               strerror(errno)));
-               return (NULL);
+               DEBUG(0, ("vfs_GetWd: SMB_VFS_GETWD call failed: %s\n",
+                         strerror(errno)));
+               return NULL;
        }
 
-       ret = talloc_strdup(ctx,s);
-
-       DEBUG(5,("vfs_GetWd %s, inode %.0f, dev %.0f\n",
-                               s,(double)st.st_ino,(double)st.st_dev));
+       if (lp_getwd_cache() && VALID_STAT(st)) {
+               ZERO_STRUCT(key); /* unlikely, but possible padding */
+               key.dev = st.st_dev;
+               key.ino = st.st_ino;
 
-       /* add it to the cache */
-       i = MAX_GETWDCACHE - 1;
-       string_set(&ino_list[i].path,s);
-       ino_list[i].dev = st.st_dev;
-       ino_list[i].inode = st.st_ino;
-       ino_list[i].valid = True;
-
-       /* put it at the top of the list */
-       array_promote((char *)&ino_list[0],sizeof(ino_list[0]),i);
+               memcache_add(smbd_memcache(), GETWD_CACHE,
+                            data_blob_const(&key, sizeof(key)),
+                            data_blob_const(s, strlen(s)+1));
+       }
 
-       if (ret == NULL) {
+       result = talloc_strdup(ctx, s);
+       if (result == NULL) {
                errno = ENOMEM;
        }
-       return ret;
+       return result;
 }
 
 /*******************************************************************
@@ -911,14 +866,13 @@ NTSTATUS check_reduced_name(connection_struct *conn, const char *fname)
                                return map_nt_error_from_unix(errno);
                        case ENOENT:
                        {
-                               TALLOC_CTX *tmp_ctx = talloc_stackframe();
+                               TALLOC_CTX *ctx = talloc_tos();
                                char *tmp_fname = NULL;
                                char *last_component = NULL;
                                /* Last component didn't exist. Remove it and try and canonicalise the directory. */
 
-                               tmp_fname = talloc_strdup(tmp_ctx, fname);
+                               tmp_fname = talloc_strdup(ctx, fname);
                                if (!tmp_fname) {
-                                       TALLOC_FREE(tmp_ctx);
                                        return NT_STATUS_NO_MEMORY;
                                }
                                p = strrchr_m(tmp_fname, '/');
@@ -927,10 +881,9 @@ NTSTATUS check_reduced_name(connection_struct *conn, const char *fname)
                                        last_component = p;
                                } else {
                                        last_component = tmp_fname;
-                                       tmp_fname = talloc_strdup(tmp_ctx,
+                                       tmp_fname = talloc_strdup(ctx,
                                                        ".");
                                        if (!tmp_fname) {
-                                               TALLOC_FREE(tmp_ctx);
                                                return NT_STATUS_NO_MEMORY;
                                        }
                                }
@@ -942,15 +895,13 @@ NTSTATUS check_reduced_name(connection_struct *conn, const char *fname)
 #endif
                                if (!resolved_name) {
                                        DEBUG(3,("reduce_name: couldn't get realpath for %s\n", fname));
-                                       TALLOC_FREE(tmp_ctx);
                                        return map_nt_error_from_unix(errno);
                                }
-                               tmp_fname = talloc_asprintf(tmp_ctx,
+                               tmp_fname = talloc_asprintf(ctx,
                                                "%s/%s",
                                                resolved_name,
                                                last_component);
                                if (!tmp_fname) {
-                                       TALLOC_FREE(tmp_ctx);
                                        return NT_STATUS_NO_MEMORY;
                                }
 #ifdef REALPATH_TAKES_NULL
@@ -964,7 +915,6 @@ NTSTATUS check_reduced_name(connection_struct *conn, const char *fname)
                                safe_strcpy(resolved_name_buf, tmp_fname, PATH_MAX);
                                resolved_name = resolved_name_buf;
 #endif
-                               TALLOC_FREE(tmp_ctx);
                                break;
                        }
                        default:
index 02bee835b0872d1c74f201165e788c6478c88da5..82a28bd868ac90781dfc835038e315b269a6baee 100644 (file)
@@ -279,14 +279,27 @@ static NTSTATUS cmd_open(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, c
        }
 
        fsp = SMB_MALLOC_P(struct files_struct);
+       if (fsp == NULL) {
+               return NT_STATUS_NO_MEMORY;
+       }
        fsp->fsp_name = SMB_STRDUP(argv[1]);
+       if (fsp->fsp_name == NULL) {
+               SAFE_FREE(fsp);
+               return NT_STATUS_NO_MEMORY;
+       }
        fsp->fh = SMB_MALLOC_P(struct fd_handle);
+       if (fsp->fh == NULL) {
+               SAFE_FREE(fsp->fsp_name);
+               SAFE_FREE(fsp);
+               return NT_STATUS_NO_MEMORY;
+       }
        fsp->conn = vfs->conn;
 
        fsp->fh->fd = SMB_VFS_OPEN(vfs->conn, argv[1], fsp, flags, mode);
        if (fsp->fh->fd == -1) {
                printf("open: error=%d (%s)\n", errno, strerror(errno));
                SAFE_FREE(fsp->fh);
+               SAFE_FREE(fsp->fsp_name);
                SAFE_FREE(fsp);
                return NT_STATUS_UNSUCCESSFUL;
        }
@@ -376,7 +389,7 @@ static NTSTATUS cmd_read(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, c
        }
        vfs->data_size = size;
        
-       rsize = SMB_VFS_READ(vfs->files[fd], fd, vfs->data, size);
+       rsize = SMB_VFS_READ(vfs->files[fd], vfs->data, size);
        if (rsize == -1) {
                printf("read: error=%d (%s)\n", errno, strerror(errno));
                return NT_STATUS_UNSUCCESSFUL;
@@ -409,7 +422,7 @@ static NTSTATUS cmd_write(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc,
                return NT_STATUS_UNSUCCESSFUL;
        }
 
-       wsize = SMB_VFS_WRITE(vfs->files[fd], fd, vfs->data, size);
+       wsize = SMB_VFS_WRITE(vfs->files[fd], vfs->data, size);
 
        if (wsize == -1) {
                printf("write: error=%d (%s)\n", errno, strerror(errno));
@@ -440,7 +453,7 @@ static NTSTATUS cmd_lseek(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc,
                default:        whence = SEEK_END;
        }
 
-       pos = SMB_VFS_LSEEK(vfs->files[fd], fd, offset, whence);
+       pos = SMB_VFS_LSEEK(vfs->files[fd], offset, whence);
        if (pos == (SMB_OFF_T)-1) {
                printf("lseek: error=%d (%s)\n", errno, strerror(errno));
                return NT_STATUS_UNSUCCESSFUL;
@@ -479,7 +492,7 @@ static NTSTATUS cmd_fsync(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc,
        }
 
        fd = atoi(argv[1]);
-       ret = SMB_VFS_FSYNC(vfs->files[fd], fd);
+       ret = SMB_VFS_FSYNC(vfs->files[fd]);
        if (ret == -1) {
                printf("fsync: error=%d (%s)\n", errno, strerror(errno));
                return NT_STATUS_UNSUCCESSFUL;
@@ -562,7 +575,7 @@ static NTSTATUS cmd_fstat(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc,
        }
 
        fd = atoi(argv[1]);
-       if (fd < 0 || fd > 1024) {
+       if (fd < 0 || fd >= 1024) {
                printf("fstat: error=%d (file descriptor out of range)\n", EBADF);
                return NT_STATUS_OK;
        }
@@ -572,7 +585,7 @@ static NTSTATUS cmd_fstat(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc,
                return NT_STATUS_OK;
        }
 
-       if (SMB_VFS_FSTAT(vfs->files[fd], fd, &st) == -1) {
+       if (SMB_VFS_FSTAT(vfs->files[fd], &st) == -1) {
                printf("fstat: error=%d (%s)\n", errno, strerror(errno));
                return NT_STATUS_UNSUCCESSFUL;
        }
@@ -697,7 +710,7 @@ static NTSTATUS cmd_fchmod(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc,
 
        fd = atoi(argv[1]);
        mode = atoi(argv[2]);
-       if (fd < 0 || fd > 1024) {
+       if (fd < 0 || fd >= 1024) {
                printf("fchmod: error=%d (file descriptor out of range)\n", EBADF);
                return NT_STATUS_OK;
        }
@@ -706,7 +719,7 @@ static NTSTATUS cmd_fchmod(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc,
                return NT_STATUS_OK;
        }
 
-       if (SMB_VFS_FCHMOD(vfs->files[fd], fd, mode) == -1) {
+       if (SMB_VFS_FCHMOD(vfs->files[fd], mode) == -1) {
                printf("fchmod: error=%d (%s)\n", errno, strerror(errno));
                return NT_STATUS_UNSUCCESSFUL;
        }
@@ -750,7 +763,7 @@ static NTSTATUS cmd_fchown(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc,
        uid = atoi(argv[2]);
        gid = atoi(argv[3]);
        fd = atoi(argv[1]);
-       if (fd < 0 || fd > 1024) {
+       if (fd < 0 || fd >= 1024) {
                printf("fchown: faliure=%d (file descriptor out of range)\n", EBADF);
                return NT_STATUS_OK;
        }
@@ -758,7 +771,7 @@ static NTSTATUS cmd_fchown(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc,
                printf("fchown: error=%d (invalid file descriptor)\n", EBADF);
                return NT_STATUS_OK;
        }
-       if (SMB_VFS_FCHOWN(vfs->files[fd], fd, uid, gid) == -1) {
+       if (SMB_VFS_FCHOWN(vfs->files[fd], uid, gid) == -1) {
                printf("fchown error=%d (%s)\n", errno, strerror(errno));
                return NT_STATUS_UNSUCCESSFUL;
        }
@@ -809,7 +822,7 @@ static NTSTATUS cmd_ftruncate(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int ar
 
        fd = atoi(argv[1]);
        off = atoi(argv[2]);
-       if (fd < 0 || fd > 1024) {
+       if (fd < 0 || fd >= 1024) {
                printf("ftruncate: error=%d (file descriptor out of range)\n", EBADF);
                return NT_STATUS_OK;
        }
@@ -818,7 +831,7 @@ static NTSTATUS cmd_ftruncate(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int ar
                return NT_STATUS_OK;
        }
 
-       if (SMB_VFS_FTRUNCATE(vfs->files[fd], fd, off) == -1) {
+       if (SMB_VFS_FTRUNCATE(vfs->files[fd], off) == -1) {
                printf("ftruncate: error=%d (%s)\n", errno, strerror(errno));
                return NT_STATUS_UNSUCCESSFUL;
        }
@@ -901,7 +914,7 @@ static NTSTATUS cmd_lock(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, c
 
        printf("lock: debug lock(fd=%d, op=%d, offset=%ld, count=%ld, type=%d))\n", fd, op, offset, count, type);
 
-       if ((ret = SMB_VFS_LOCK(vfs->files[fd], fd, op, offset, count, type)) == False) {
+       if ((ret = SMB_VFS_LOCK(vfs->files[fd], op, offset, count, type)) == False) {
                printf("lock: error=%d (%s)\n", errno, strerror(errno));
                return NT_STATUS_UNSUCCESSFUL;
        }
index 77666bb664b27e82bb719be1876895d2214be9e7..ab7edde85dc930dbbe08309c587f5fb62918efee 100644 (file)
@@ -364,24 +364,6 @@ int main(int argc, char **argv)
                                        get_friendly_nt_error_msg(rv));
        }
 
-       pdb->setsampwent(pdb, False, 0);
-       while (NT_STATUS_IS_OK(pdb->getsampwent(pdb, out))) {
-               if (pdb_get_username(out) == NULL) {
-                       fprintf(stderr, "Got bad username through getsampwent()\n");
-                       error = True;
-                       break;
-               }
-               if (NT_STATUS_IS_ERR(pdb->getsampwnam(pdb, in, pdb_get_username(out)))) {
-                       fprintf(stderr, "Error getting samu through getsampwnam() of an account we got through getsampwent!\n");
-                       error = True;
-                       continue;
-               }
-               if (!samu_correct(out, in)) {
-                       printf("Record gotten through getsampwnam() differs from same record through getsampwent()\n");
-               }
-       }
-       pdb->endsampwent(pdb);
-       
        TALLOC_FREE(ctx);
 
        if (error) {
diff --git a/source/torture/test_ntlm_auth.py b/source/torture/test_ntlm_auth.py
new file mode 100755 (executable)
index 0000000..12a4dae
--- /dev/null
@@ -0,0 +1,218 @@
+#!/usr/bin/env python
+
+# Unix SMB/CIFS implementation.
+# A test for the ntlm_auth tool
+# Copyright (C) Kai Blin <kai@samba.org> 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/>.
+#
+"""Test ntlm_auth
+This test program will start ntlm_auth with the given command line switches and
+see if it will get the expected results.
+"""
+
+import os
+import sys
+from optparse import OptionParser
+
+class ReadChildError(Exception):
+       pass
+
+class WriteChildError(Exception):
+       pass
+
+def readLine(pipe):
+       """readLine(pipe) -> str
+       Read a line from the child's pipe, returns the string read.
+       Throws ReadChildError if the read fails.
+       """
+       buf = os.read(pipe, 2047)
+       newline = buf.find('\n')
+       if newline == -1:
+               raise ReadChildError()
+       return buf[:newline]
+
+def writeLine(pipe, buf):
+       """writeLine(pipe, buf) -> nul
+       Write a line to the child's pipe.
+       Raises WriteChildError if the write fails.
+       """
+       written = os.write(pipe, buf)
+       if written != len(buf):
+               raise WriteChildError()
+       os.write(pipe, "\n")
+
+def parseCommandLine():
+       """parseCommandLine() -> (opts, ntlm_auth_path)
+       Parse the command line.
+       Return a tuple consisting of the options and the path to ntlm_auth.
+       """
+       usage = "usage: %prog [options] path/to/ntlm_auth"
+       parser = OptionParser(usage)
+
+       parser.set_defaults(client_username="foo")
+       parser.set_defaults(client_password="secret")
+       parser.set_defaults(client_domain="FOO")
+       parser.set_defaults(client_helper="ntlmssp-client-1")
+
+       parser.set_defaults(server_username="foo")
+       parser.set_defaults(server_password="secret")
+       parser.set_defaults(server_domain="FOO")
+       parser.set_defaults(server_helper="squid-2.5-ntlmssp")
+       parser.set_defaults(config_file="/etc/samba/smb.conf")
+
+       parser.add_option("--client-username", dest="client_username",\
+                               help="User name for the client. [default: foo]")
+       parser.add_option("--client-password", dest="client_password",\
+                               help="Password the client will send. [default: secret]")
+       parser.add_option("--client-domain", dest="client_domain",\
+                               help="Domain the client authenticates for. [default: FOO]")
+       parser.add_option("--client-helper", dest="client_helper",\
+                               help="Helper mode for the ntlm_auth client. [default: ntlmssp-client-1]")
+
+       parser.add_option("--server-username", dest="server_username",\
+                               help="User name server uses for local auth. [default: foo]")
+       parser.add_option("--server-password", dest="server_password",\
+                               help="Password server uses for local auth. [default: secret]")
+       parser.add_option("--server-domain", dest="server_domain",\
+                               help="Domain server uses for local auth. [default: FOO]")
+       parser.add_option("--server-helper", dest="server_helper",\
+                               help="Helper mode for the ntlm_auth server. [default: squid-2.5-server]")
+
+       parser.add_option("-s", "--configfile", dest="config_file",\
+                               help="Path to smb.conf file. [default:/etc/samba/smb.conf")
+
+       (opts, args) = parser.parse_args()
+       if len(args) != 1:
+               parser.error("Invalid number of arguments.")
+
+       if not os.access(args[0], os.X_OK):
+               parser.error("%s is not executable." % args[0])
+
+       return (opts, args[0])
+
+
+def main():
+       """main() -> int
+       Run the test.
+       Returns 0 if test succeeded, <>0 otherwise.
+       """
+       (opts, ntlm_auth_path) = parseCommandLine()
+
+       (client_in_r,  client_in_w)  = os.pipe()
+       (client_out_r, client_out_w) = os.pipe()
+
+       client_pid = os.fork()
+
+       if not client_pid:
+               # We're in the client child
+               os.close(0)
+               os.close(1)
+
+               os.dup2(client_out_r, 0)
+               os.close(client_out_r)
+               os.close(client_out_w)
+
+               os.dup2(client_in_w, 1)
+               os.close(client_in_r)
+               os.close(client_in_w)
+
+               client_args = []
+               client_args.append("--helper-protocol=%s" % opts.client_helper)
+               client_args.append("--username=%s" % opts.client_username)
+               client_args.append("--password=%s" % opts.client_password)
+               client_args.append("--domain=%s" % opts.client_domain)
+               client_args.append("--configfile=%s" % opts.config_file)
+
+               os.execv(ntlm_auth_path, client_args)
+
+       client_in = client_in_r
+       os.close(client_in_w)
+
+       client_out = client_out_w
+       os.close(client_out_r)
+
+       (server_in_r,  server_in_w)  = os.pipe()
+       (server_out_r, server_out_w) = os.pipe()
+
+       server_pid = os.fork()
+
+       if not server_pid:
+               # We're in the server child
+               os.close(0)
+               os.close(1)
+
+               os.dup2(server_out_r, 0)
+               os.close(server_out_r)
+               os.close(server_out_w)
+
+               os.dup2(server_in_w, 1)
+               os.close(server_in_r)
+               os.close(server_in_w)
+
+               server_args = []
+               server_args.append("--helper-protocol=%s" % opts.server_helper)
+               server_args.append("--username=%s" % opts.server_username)
+               server_args.append("--password=%s" % opts.server_password)
+               server_args.append("--domain=%s" % opts.server_domain)
+               server_args.append("--configfile=%s" % opts.config_file)
+
+               os.execv(ntlm_auth_path, server_args)
+
+       server_in = server_in_r
+       os.close(server_in_w)
+
+       server_out = server_out_w
+       os.close(server_out_r)
+
+       # We're in the parent
+       writeLine(client_out, "YR")
+       buf = readLine(client_in)
+
+       if buf.count("YR ", 0, 3) != 1:
+               sys.exit(1)
+
+       writeLine(server_out, buf)
+       buf = readLine(server_in)
+
+       if buf.count("TT ", 0, 3) != 1:
+               sys.exit(2)
+
+       writeLine(client_out, buf)
+       buf = readLine(client_in)
+
+       if buf.count("AF ", 0, 3) != 1:
+               sys.exit(3)
+
+       # Client sends 'AF <base64 blob>' but server expects 'KK <abse64 blob>'
+       buf = buf.replace("AF", "KK", 1)
+
+       writeLine(server_out, buf)
+       buf = readLine(server_in)
+
+       if buf.count("AF ", 0, 3) != 1:
+               sys.exit(4)
+
+       os.close(server_in)
+       os.close(server_out)
+       os.close(client_in)
+       os.close(client_out)
+       os.waitpid(server_pid, 0)
+       os.waitpid(client_pid, 0)
+       sys.exit(0)
+
+if __name__ == "__main__":
+       main()
+
+
index ad57470c61001cdea818aa602bdf6d1ffb53e1e1..8d67e512fe66bb2c30adf72b45ac52253a287a61 100644 (file)
@@ -37,6 +37,7 @@ static const char *client_txt = "client_oplocks.txt";
 static bool use_kerberos;
 static fstring multishare_conn_fname;
 static bool use_multishare_conn = False;
+static bool do_encrypt;
 
 bool torture_showall = False;
 
@@ -95,6 +96,57 @@ void *shm_setup(int size)
        return ret;
 }
 
+/********************************************************************
+ Ensure a connection is encrypted.
+********************************************************************/
+
+static bool force_cli_encryption(struct cli_state *c,
+                       const char *sharename)
+{
+       uint16 major, minor;
+       uint32 caplow, caphigh;
+       NTSTATUS status;
+
+       if (!SERVER_HAS_UNIX_CIFS(c)) {
+               d_printf("Encryption required and "
+                       "server that doesn't support "
+                       "UNIX extensions - failing connect\n");
+                       return false;
+       }
+
+       if (!cli_unix_extensions_version(c, &major, &minor, &caplow, &caphigh)) {
+               d_printf("Encryption required and "
+                       "can't get UNIX CIFS extensions "
+                       "version from server.\n");
+               return false;
+       }
+
+       if (!(caplow & CIFS_UNIX_TRANSPORT_ENCRYPTION_CAP)) {
+               d_printf("Encryption required and "
+                       "share %s doesn't support "
+                       "encryption.\n", sharename);
+               return false;
+       }
+
+       if (c->use_kerberos) {
+               status = cli_gss_smb_encryption_start(c);
+       } else {
+               status = cli_raw_ntlm_smb_encryption_start(c,
+                                               username,
+                                               password,
+                                               workgroup);
+       }
+
+       if (!NT_STATUS_IS_OK(status)) {
+               d_printf("Encryption required and "
+                       "setup failed with error %s.\n",
+                       nt_errstr(status));
+               return false;
+       }
+
+       return true;
+}
+
 
 static struct cli_state *open_nbt_connection(void)
 {
@@ -235,6 +287,10 @@ static bool torture_open_connection_share(struct cli_state **c,
        if (use_level_II_oplocks) (*c)->use_level_II_oplocks = True;
        (*c)->timeout = 120000; /* set a really long timeout (2 minutes) */
 
+       if (do_encrypt) {
+               return force_cli_encryption(*c,
+                                       sharename);
+       }
        return True;
 }
 
@@ -834,6 +890,7 @@ static bool run_netbench(int client)
        }
 
        while (fgets(line, sizeof(line)-1, f)) {
+               char *saveptr;
                line_count++;
 
                line[strlen(line)-1] = 0;
@@ -843,9 +900,9 @@ static bool run_netbench(int client)
                all_string_sub(line,"client1", cname, sizeof(line));
 
                /* parse the command parameters */
-               params[0] = strtok(line," ");
+               params[0] = strtok_r(line, " ", &saveptr);
                i = 0;
-               while (params[i]) params[++i] = strtok(NULL," ");
+               while (params[i]) params[++i] = strtok_r(NULL, " ", &saveptr);
 
                params[i] = "";
 
@@ -5042,6 +5099,149 @@ static bool run_local_rbtree(int dummy)
        return ret;
 }
 
+static bool test_stream_name(const char *fname, const char *expected_base,
+                            const char *expected_stream,
+                            NTSTATUS expected_status)
+{
+       NTSTATUS status;
+       char *base = NULL;
+       char *stream = NULL;
+
+       status = split_ntfs_stream_name(talloc_tos(), fname, &base, &stream);
+       if (!NT_STATUS_EQUAL(status, expected_status)) {
+               goto error;
+       }
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return true;
+       }
+
+       if (base == NULL) goto error;
+
+       if (strcmp(expected_base, base) != 0) goto error;
+
+       if ((expected_stream != NULL) && (stream == NULL)) goto error;
+       if ((expected_stream == NULL) && (stream != NULL)) goto error;
+
+       if ((stream != NULL) && (strcmp(expected_stream, stream) != 0))
+               goto error;
+
+       TALLOC_FREE(base);
+       TALLOC_FREE(stream);
+       return true;
+
+ error:
+       d_fprintf(stderr, "test_stream(%s, %s, %s, %s)\n",
+                 fname, expected_base ? expected_base : "<NULL>",
+                 expected_stream ? expected_stream : "<NULL>",
+                 nt_errstr(expected_status));
+       d_fprintf(stderr, "-> base=%s, stream=%s, status=%s\n",
+                 base ? base : "<NULL>", stream ? stream : "<NULL>",
+                 nt_errstr(status));
+       TALLOC_FREE(base);
+       TALLOC_FREE(stream);
+       return false;
+}
+
+static bool run_local_stream_name(int dummy)
+{
+       bool ret = true;
+
+       ret &= test_stream_name(
+               "bla", "bla", NULL, NT_STATUS_OK);
+       ret &= test_stream_name(
+               "bla::$DATA", "bla", NULL, NT_STATUS_OK);
+       ret &= test_stream_name(
+               "bla:blub:", "bla", NULL, NT_STATUS_OBJECT_NAME_INVALID);
+       ret &= test_stream_name(
+               "bla::", NULL, NULL, NT_STATUS_OBJECT_NAME_INVALID);
+       ret &= test_stream_name(
+               "bla::123", "bla", NULL, NT_STATUS_OBJECT_NAME_INVALID);
+       ret &= test_stream_name(
+               "bla:$DATA", "bla", "$DATA:$DATA", NT_STATUS_OK);
+       ret &= test_stream_name(
+               "bla:x:$DATA", "bla", "x:$DATA", NT_STATUS_OK);
+       ret &= test_stream_name(
+               "bla:x", "bla", "x:$DATA", NT_STATUS_OK);
+
+       return ret;
+}
+
+static bool data_blob_equal(DATA_BLOB a, DATA_BLOB b)
+{
+       if (a.length != b.length) {
+               printf("a.length=%d != b.length=%d\n",
+                      (int)a.length, (int)b.length);
+               return false;
+       }
+       if (memcmp(a.data, b.data, a.length) != 0) {
+               printf("a.data and b.data differ\n");
+               return false;
+       }
+       return true;
+}
+
+static bool run_local_memcache(int dummy)
+{
+       struct memcache *cache;
+       DATA_BLOB k1, k2;
+       DATA_BLOB d1, d2, d3;
+       DATA_BLOB v1, v2, v3;
+
+       cache = memcache_init(NULL, 100);
+
+       if (cache == NULL) {
+               printf("memcache_init failed\n");
+               return false;
+       }
+
+       d1 = data_blob_const("d1", 2);
+       d2 = data_blob_const("d2", 2);
+       d3 = data_blob_const("d3", 2);
+
+       k1 = data_blob_const("d1", 2);
+       k2 = data_blob_const("d2", 2);
+
+       memcache_add(cache, STAT_CACHE, k1, d1);
+       memcache_add(cache, GETWD_CACHE, k2, d2);
+
+       if (!memcache_lookup(cache, STAT_CACHE, k1, &v1)) {
+               printf("could not find k1\n");
+               return false;
+       }
+       if (!data_blob_equal(d1, v1)) {
+               return false;
+       }
+
+       if (!memcache_lookup(cache, GETWD_CACHE, k2, &v2)) {
+               printf("could not find k2\n");
+               return false;
+       }
+       if (!data_blob_equal(d2, v2)) {
+               return false;
+       }
+
+       memcache_add(cache, STAT_CACHE, k1, d3);
+
+       if (!memcache_lookup(cache, STAT_CACHE, k1, &v3)) {
+               printf("could not find replaced k1\n");
+               return false;
+       }
+       if (!data_blob_equal(d3, v3)) {
+               return false;
+       }
+
+       memcache_add(cache, GETWD_CACHE, k1, d1);
+
+       if (memcache_lookup(cache, GETWD_CACHE, k2, &v2)) {
+               printf("Did find k2, should have been purged\n");
+               return false;
+       }
+
+       TALLOC_FREE(cache);
+       return true;
+}
+
 static double create_procs(bool (*fn)(int), bool *result)
 {
        int i, status;
@@ -5196,6 +5396,8 @@ static struct {
        { "LOCAL-SUBSTITUTE", run_local_substitute, 0},
        { "LOCAL-GENCACHE", run_local_gencache, 0},
        { "LOCAL-RBTREE", run_local_rbtree, 0},
+       { "LOCAL-MEMCACHE", run_local_memcache, 0},
+       { "LOCAL-STREAM-NAME", run_local_stream_name, 0},
        {NULL, NULL, 0}};
 
 
@@ -5349,7 +5551,7 @@ static void usage(void)
 
        fstrcpy(workgroup, lp_workgroup());
 
-       while ((opt = getopt(argc, argv, "p:hW:U:n:N:O:o:m:Ld:Ac:ks:b:")) != EOF) {
+       while ((opt = getopt(argc, argv, "p:hW:U:n:N:O:o:m:Ld:Aec:ks:b:")) != EOF) {
                switch (opt) {
                case 'p':
                        port_to_use = atoi(optarg);
@@ -5387,6 +5589,9 @@ static void usage(void)
                case 'c':
                        client_txt = optarg;
                        break;
+               case 'e':
+                       do_encrypt = true;
+                       break;
                case 'k':
 #ifdef HAVE_KRB5
                        use_kerberos = True;
index 1436ecc022f258270dba9104881f826a75dbffd0..7e4ee624a120526779e53234bf954568725893e6 100644 (file)
@@ -495,6 +495,19 @@ struct messaging_context *smbd_messaging_context(void)
        return ctx;
 }
 
+struct memcache *smbd_memcache(void)
+{
+       static struct memcache *cache;
+
+       if (!cache
+           && !(cache = memcache_init(NULL,
+                                      lp_max_stat_cache_size()*1024))) {
+
+               smb_panic("Could not init smbd memcache");
+       }
+       return cache;
+}
+
 /* Main function */
 
 int main(int argc, char *argv[])
index bf70d08d8b42aa567c468089688547bb00b657b1..586ea2fdb6673220ae9091b5f43f1fa93727faf3 100644 (file)
@@ -88,6 +88,7 @@ int opt_testmode = False;
 
 int opt_have_ip = False;
 struct sockaddr_storage opt_dest_ip;
+bool smb_encrypt;
 
 extern bool AllowDebugChange;
 
@@ -178,9 +179,7 @@ NTSTATUS connect_to_service(struct cli_state **c,
                                        service_name, service_type,
                                        opt_user_name, opt_workgroup,
                                        opt_password, 0, Undefined, NULL);
-       if (NT_STATUS_IS_OK(nt_status)) {
-               return nt_status;
-       } else {
+       if (!NT_STATUS_IS_OK(nt_status)) {
                d_fprintf(stderr, "Could not connect to server %s\n", server_name);
 
                /* Display a nicer message depending on the result */
@@ -196,9 +195,40 @@ NTSTATUS connect_to_service(struct cli_state **c,
                if (NT_STATUS_V(nt_status) ==
                    NT_STATUS_V(NT_STATUS_ACCOUNT_DISABLED))
                        d_fprintf(stderr, "The account was disabled.\n");
-
                return nt_status;
        }
+
+       if (smb_encrypt) {
+               nt_status = cli_force_encryption(*c,
+                                       opt_user_name,
+                                       opt_password,
+                                       opt_workgroup);
+
+               if (NT_STATUS_EQUAL(nt_status,NT_STATUS_NOT_SUPPORTED)) {
+                       d_printf("Encryption required and "
+                               "server that doesn't support "
+                               "UNIX extensions - failing connect\n");
+               } else if (NT_STATUS_EQUAL(nt_status,NT_STATUS_UNKNOWN_REVISION)) {
+                       d_printf("Encryption required and "
+                               "can't get UNIX CIFS extensions "
+                               "version from server.\n");
+               } else if (NT_STATUS_EQUAL(nt_status,NT_STATUS_UNSUPPORTED_COMPRESSION)) {
+                       d_printf("Encryption required and "
+                               "share %s doesn't support "
+                               "encryption.\n", service_name);
+               } else if (!NT_STATUS_IS_OK(nt_status)) {
+                       d_printf("Encryption required and "
+                               "setup failed with error %s.\n",
+                               nt_errstr(nt_status));
+               }
+
+               if (!NT_STATUS_IS_OK(nt_status)) {
+                       cli_shutdown(*c);
+                       *c = NULL;
+               }
+       }
+
+       return nt_status;
 }
 
 /****************************************************************************
@@ -287,12 +317,24 @@ NTSTATUS connect_to_ipc_krb5(struct cli_state **c,
 
        SAFE_FREE(user_and_realm);
 
-       if (NT_STATUS_IS_OK(nt_status)) {
-               return nt_status;
-       } else {
+       if (!NT_STATUS_IS_OK(nt_status)) {
                DEBUG(1,("Cannot connect to server using kerberos.  Error was %s\n", nt_errstr(nt_status)));
                return nt_status;
        }
+
+        if (smb_encrypt) {
+               nt_status = cli_cm_force_encryption(*c,
+                                       user_and_realm,
+                                       opt_password,
+                                       opt_workgroup,
+                                        "IPC$");
+               if (!NT_STATUS_IS_OK(nt_status)) {
+                       cli_shutdown(*c);
+                       *c = NULL;
+               }
+       }
+
+       return nt_status;
 }
 
 /**
@@ -988,6 +1030,7 @@ static struct functable net_func[] = {
                {"port",        'p', POPT_ARG_INT,    &opt_port},
                {"myname",      'n', POPT_ARG_STRING, &opt_requester_name},
                {"server",      'S', POPT_ARG_STRING, &opt_host},
+               {"encrypt",     'e', POPT_ARG_NONE,   NULL, 'e', "Encrypt SMB transport (UNIX extended servers only)" },
                {"container",   'c', POPT_ARG_STRING, &opt_container},
                {"comment",     'C', POPT_ARG_STRING, &opt_comment},
                {"maxusers",    'M', POPT_ARG_INT,    &opt_maxusers},
@@ -1010,7 +1053,7 @@ static struct functable net_func[] = {
                {"acls",        0, POPT_ARG_NONE,     &opt_acls},
                {"attrs",       0, POPT_ARG_NONE,     &opt_attrs},
                {"timestamps",  0, POPT_ARG_NONE,     &opt_timestamps},
-               {"exclude",     'e', POPT_ARG_STRING, &opt_exclude},
+               {"exclude",     'X', POPT_ARG_STRING, &opt_exclude},
                {"destination", 0, POPT_ARG_STRING,   &opt_destination},
                {"tallocreport", 0, POPT_ARG_NONE, &do_talloc_report},
 
@@ -1037,6 +1080,9 @@ static struct functable net_func[] = {
                        net_help(argc, argv);
                        exit(0);
                        break;
+               case 'e':
+                       smb_encrypt=true;
+                       break;
                case 'I':
                        if (!interpret_string_addr(&opt_dest_ip,
                                                poptGetOptArg(pc), 0)) {
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 141031dacb29c19b732e5ca6dfe56b4a8e89a3d5..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)
 {
@@ -1255,7 +1256,6 @@ static bool net_derive_salting_principal( TALLOC_CTX *ctx, ADS_STRUCT *ads )
        ADS_STATUS status;
        fstring salt;
        char *std_salt;
-       LDAPMessage *res = NULL;
        const char *machine_name = global_myname();
 
        status = ads_domain_func_level( ads, &domain_func );
@@ -1278,24 +1278,11 @@ static bool net_derive_salting_principal( TALLOC_CTX *ctx, ADS_STRUCT *ads )
 
        if ( domain_func == DS_DOMAIN_FUNCTION_2000 ) {
                char *upn;
-               int count;
-
-               status = ads_find_machine_acct(ads, &res, machine_name);
-               if (!ADS_ERR_OK(status)) {
-                       return False;
-               }
-
-               if ( (count = ads_count_replies(ads, res)) != 1 ) {
-                       DEBUG(1,("net_set_machine_spn: %d entries returned!\n", count));
-                       return False;
-               }
 
-               upn = ads_pull_string(ads, ctx, res, "userPrincipalName");
+               upn = ads_get_upn(ads, ctx, machine_name);
                if ( upn ) {
                        fstrcpy( salt, upn );
                }
-
-               ads_msgfree(ads, res);
        }
 
        return kerberos_secrets_store_des_salt( salt );
@@ -1308,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;
@@ -1404,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;
 
@@ -1460,8 +1446,7 @@ int net_ads_join(int argc, const char **argv)
        ADS_STRUCT *ads = NULL;
        ADS_STATUS status;
        NTSTATUS nt_status;
-       char *machine_account = NULL;
-       char *short_domain_name = NULL;
+       const char *short_domain_name = NULL;
        char *tmp_password, *password;
        TALLOC_CTX *ctx = NULL;
        DOM_SID *domain_sid = NULL;
@@ -1698,7 +1683,6 @@ int net_ads_join(int argc, const char **argv)
 
        d_printf("Joined '%s' to realm '%s'\n", global_myname(), ads->server.realm);
 
-       SAFE_FREE(machine_account);
        TALLOC_FREE( ctx );
        ads_destroy(&ads);
 
@@ -1708,7 +1692,6 @@ fail:
        /* issue an overall failure message at the end. */
        d_printf("Failed to join domain: %s\n", get_friendly_nt_error_msg(nt_status));
 
-       SAFE_FREE(machine_account);
        TALLOC_FREE( ctx );
         ads_destroy(&ads);
 
index 16b372ca721bd64dcf18250b02081f2bbb456590..26ed41b2a057756f4b8196ce1e944928125ad56b 100644 (file)
@@ -2,7 +2,7 @@
  *  Samba Unix/Linux SMB client library
  *  Distributed SMB/CIFS Server Management Utility
  *  Local configuration interface
- *  Copyright (C) Michael Adam 2007
+ *  Copyright (C) Michael Adam 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
  */
 
 /*
- * This is an interface to the configuration stored inside the
- * samba registry. In the future there might be support for other
- * configuration backends as well.
+ * This is an interface to Samba's configuration as made available
+ * by the libnet_conf interface (source/libnet/libnet_conf.c).
+ *
+ * This currently supports local interaction with the configuration
+ * stored in the registry. But other backends and remote access via
+ * rpc might get implemented in the future.
  */
 
 #include "includes.h"
 #include "utils/net.h"
+#include "libnet/libnet.h"
 
-/*
+/**********************************************************************
+ *
  * usage functions
- */
+ *
+ **********************************************************************/
 
 static int net_conf_list_usage(int argc, const char **argv)
 {
@@ -42,9 +48,9 @@ static int net_conf_import_usage(int argc, const char**argv)
        d_printf("USAGE: net conf import [--test|-T] <filename> "
                 "[<servicename>]\n"
                 "\t[--test|-T]    testmode - do not act, just print "
-                                  "what would be done\n"
+                       "what would be done\n"
                 "\t<servicename>  only import service <servicename>, "
-                                  "ignore the rest\n");
+                       "ignore the rest\n");
        return -1;
 }
 
@@ -105,356 +111,16 @@ static int net_conf_delparm_usage(int argc, const char **argv)
 }
 
 
-/*
+/**********************************************************************
+ *
  * Helper functions
- */
-
-static char *format_value(TALLOC_CTX *mem_ctx, struct registry_value *value)
-{
-       char *result = NULL;
-
-       /* what if mem_ctx = NULL? */
-
-       switch (value->type) {
-       case REG_DWORD:
-               result = talloc_asprintf(mem_ctx, "%d", value->v.dword);
-               break;
-       case REG_SZ:
-       case REG_EXPAND_SZ:
-               result = talloc_asprintf(mem_ctx, "%s", value->v.sz.str);
-               break;
-       case REG_MULTI_SZ: {
-                uint32 j;
-                for (j = 0; j < value->v.multi_sz.num_strings; j++) {
-                        result = talloc_asprintf(mem_ctx, "\"%s\" ",
-                                                value->v.multi_sz.strings[j]);
-                }
-                break;
-        }
-       case REG_BINARY:
-                result = talloc_asprintf(mem_ctx, "binary (%d bytes)",
-                                        (int)value->v.binary.length);
-                break;
-        default:
-                result = talloc_asprintf(mem_ctx, "<unprintable>");
-                break;
-        }
-       return result;
-}
-
-/*
- * add a value to a key.
- */
-static WERROR reg_setvalue_internal(struct registry_key *key,
-                                   const char *valname,
-                                   const char *valstr)
-{
-       struct registry_value val;
-       WERROR werr = WERR_OK;
-       char *subkeyname;
-       const char *canon_valname;
-       const char *canon_valstr;
-
-       if (!lp_canonicalize_parameter_with_value(valname, valstr,
-                                                 &canon_valname,
-                                                 &canon_valstr))
-       {
-               if (canon_valname == NULL) {
-                       d_fprintf(stderr, "invalid parameter '%s' given\n",
-                                 valname);
-               } else {
-                       d_fprintf(stderr, "invalid value '%s' given for "
-                                 "parameter '%s'\n", valstr, valname);
-               }
-               werr = WERR_INVALID_PARAM;
-               goto done;
-       }
-
-       ZERO_STRUCT(val);
-
-       val.type = REG_SZ;
-       val.v.sz.str = CONST_DISCARD(char *, canon_valstr);
-       val.v.sz.len = strlen(canon_valstr) + 1;
-
-       if (registry_smbconf_valname_forbidden(canon_valname)) {
-               d_fprintf(stderr, "Parameter '%s' not allowed in registry.\n",
-                         canon_valname);
-               werr = WERR_INVALID_PARAM;
-               goto done;
-       }
-
-       subkeyname = strrchr_m(key->key->name, '\\');
-       if ((subkeyname == NULL) || (*(subkeyname +1) == '\0')) {
-               d_fprintf(stderr, "Invalid registry key '%s' given as "
-                         "smbconf section.\n", key->key->name);
-               werr = WERR_INVALID_PARAM;
-               goto done;
-       }
-       subkeyname++;
-       if (!strequal(subkeyname, GLOBAL_NAME) &&
-           lp_parameter_is_global(valname))
-       {
-               d_fprintf(stderr, "Global paramter '%s' not allowed in "
-                         "service definition ('%s').\n", canon_valname,
-                         subkeyname);
-               werr = WERR_INVALID_PARAM;
-               goto done;
-       }
-
-       werr = reg_setvalue(key, canon_valname, &val);
-       if (!W_ERROR_IS_OK(werr)) {
-               d_fprintf(stderr,
-                         "Error adding value '%s' to "
-                         "key '%s': %s\n",
-                         canon_valname, key->key->name, dos_errstr(werr));
-       }
-
-done:
-       return werr;
-}
-
-/*
- * Open a subkey of KEY_SMBCONF (i.e a service)
- * - variant without error output (q = quiet)-
- */
-static WERROR smbconf_open_path_q(TALLOC_CTX *ctx, const char *subkeyname,
-                                 uint32 desired_access,
-                                 struct registry_key **key)
-{
-       WERROR werr = WERR_OK;
-       char *path = NULL;
-       NT_USER_TOKEN *token;
-
-       if (!(token = registry_create_admin_token(ctx))) {
-               DEBUG(1, ("Error creating admin token\n"));
-               goto done;
-       }
-
-       if (subkeyname == NULL) {
-               path = talloc_strdup(ctx, KEY_SMBCONF);
-       } else {
-               path = talloc_asprintf(ctx, "%s\\%s", KEY_SMBCONF, subkeyname);
-       }
-
-       werr = reg_open_path(ctx, path, desired_access,
-                            token, key);
-
-done:
-       TALLOC_FREE(path);
-       return werr;
-}
-
-/*
- * Open a subkey of KEY_SMBCONF (i.e a service)
- * - variant with error output -
- */
-static WERROR smbconf_open_path(TALLOC_CTX *ctx, const char *subkeyname,
-                               uint32 desired_access,
-                               struct registry_key **key)
-{
-       WERROR werr = WERR_OK;
-
-       werr = smbconf_open_path_q(ctx, subkeyname, desired_access, key);
-       if (!W_ERROR_IS_OK(werr)) {
-               d_fprintf(stderr, "Error opening registry path '%s\\%s': %s\n",
-                         KEY_SMBCONF,
-                         (subkeyname == NULL) ? "" : subkeyname,
-                         dos_errstr(werr));
-       }
-
-       return werr;
-}
-
-/*
- * open the base key KEY_SMBCONF
- */
-static WERROR smbconf_open_basepath(TALLOC_CTX *ctx, uint32 desired_access,
-                                   struct registry_key **key)
-{
-       return smbconf_open_path(ctx, NULL, desired_access, key);
-}
-
-/*
- * delete a subkey of KEY_SMBCONF
- */
-static WERROR reg_delkey_internal(TALLOC_CTX *ctx, const char *keyname)
-{
-       WERROR werr = WERR_OK;
-       struct registry_key *key = NULL;
-
-       werr = smbconf_open_basepath(ctx, REG_KEY_WRITE, &key);
-       if (!W_ERROR_IS_OK(werr)) {
-               goto done;
-       }
-
-       werr = reg_deletekey_recursive(key, key, keyname);
-       if (!W_ERROR_IS_OK(werr)) {
-               d_fprintf(stderr, "Error deleting registry key %s\\%s: %s\n",
-                         KEY_SMBCONF, keyname, dos_errstr(werr));
-       }
-
-done:
-       TALLOC_FREE(key);
-       return werr;
-}
-
-/*
- * create a subkey of KEY_SMBCONF
- */
-static WERROR reg_createkey_internal(TALLOC_CTX *ctx,
-                                    const char * subkeyname,
-                                    struct registry_key **newkey)
-{
-       WERROR werr = WERR_OK;
-       struct registry_key *create_parent = NULL;
-       TALLOC_CTX *create_ctx;
-       enum winreg_CreateAction action = REG_ACTION_NONE;
-
-       /* create a new talloc ctx for creation. it will hold
-        * the intermediate parent key (SMBCONF) for creation
-        * and will be destroyed when leaving this function... */
-       if (!(create_ctx = talloc_new(ctx))) {
-               werr = WERR_NOMEM;
-               goto done;
-       }
-
-       werr = smbconf_open_basepath(create_ctx, REG_KEY_WRITE, &create_parent);
-       if (!W_ERROR_IS_OK(werr)) {
-               goto done;
-       }
-
-       werr = reg_createkey(ctx, create_parent, subkeyname,
-                            REG_KEY_WRITE, newkey, &action);
-       if (W_ERROR_IS_OK(werr) && (action != REG_CREATED_NEW_KEY)) {
-               d_fprintf(stderr, "Key '%s' already exists.\n", subkeyname);
-               werr = WERR_ALREADY_EXISTS;
-       }
-       if (!W_ERROR_IS_OK(werr)) {
-               d_fprintf(stderr, "Error creating key %s: %s\n",
-                        subkeyname, dos_errstr(werr));
-       }
-
-done:
-       TALLOC_FREE(create_ctx);
-       return werr;
-}
+ *
+ **********************************************************************/
 
-/*
- * check if a subkey of KEY_SMBCONF of a given name exists
+/**
+ * This formats an in-memory smbconf parameter to a string.
+ * The result string is allocated with talloc.
  */
-static bool smbconf_key_exists(TALLOC_CTX *ctx, const char *subkeyname)
-{
-       bool ret = False;
-       WERROR werr = WERR_OK;
-       TALLOC_CTX *mem_ctx;
-       struct registry_key *key;
-
-       if (!(mem_ctx = talloc_new(ctx))) {
-               d_fprintf(stderr, "ERROR: Out of memory...!\n");
-               goto done;
-       }
-
-       werr = smbconf_open_path_q(mem_ctx, subkeyname, REG_KEY_READ, &key);
-       if (W_ERROR_IS_OK(werr)) {
-               ret = True;
-       }
-
-done:
-       TALLOC_FREE(mem_ctx);
-       return ret;
-}
-
-static bool smbconf_value_exists(TALLOC_CTX *ctx, struct registry_key *key,
-                                const char *param)
-{
-       bool ret = False;
-       WERROR werr = WERR_OK;
-       struct registry_value *value = NULL;
-
-       werr = reg_queryvalue(ctx, key, param, &value);
-       if (W_ERROR_IS_OK(werr)) {
-               ret = True;
-       }
-
-       TALLOC_FREE(value);
-       return ret;
-}
-
-static WERROR list_values(TALLOC_CTX *ctx, struct registry_key *key)
-{
-       WERROR werr = WERR_OK;
-       uint32 idx = 0;
-       struct registry_value *valvalue = NULL;
-       char *valname = NULL;
-
-       for (idx = 0;
-            W_ERROR_IS_OK(werr = reg_enumvalue(ctx, key, idx, &valname,
-                                               &valvalue));
-            idx++)
-       {
-               d_printf("\t%s = %s\n", valname, format_value(ctx, valvalue));
-       }
-       if (!W_ERROR_EQUAL(WERR_NO_MORE_ITEMS, werr)) {
-                d_fprintf(stderr, "Error enumerating values: %s\n",
-                          dos_errstr(werr));
-               goto done;
-        }
-       werr = WERR_OK;
-
-done:
-       return werr;
-}
-
-static WERROR drop_smbconf_internal(TALLOC_CTX *ctx)
-{
-       char *path, *p;
-       WERROR werr = WERR_OK;
-       NT_USER_TOKEN *token;
-       struct registry_key *parent_key = NULL;
-       struct registry_key *new_key = NULL;
-       TALLOC_CTX* tmp_ctx = NULL;
-       enum winreg_CreateAction action;
-
-       tmp_ctx = talloc_new(ctx);
-       if (tmp_ctx == NULL) {
-               werr = WERR_NOMEM;
-               goto done;
-       }
-
-       if (!(token = registry_create_admin_token(tmp_ctx))) {
-               /* what is the appropriate error code here? */
-               werr = WERR_CAN_NOT_COMPLETE;
-               goto done;
-       }
-
-       path = talloc_strdup(tmp_ctx, KEY_SMBCONF);
-       if (path == NULL) {
-               d_fprintf(stderr, "ERROR: out of memory!\n");
-               werr = WERR_NOMEM;
-               goto done;
-       }
-       p = strrchr(path, '\\');
-       *p = '\0';
-       werr = reg_open_path(tmp_ctx, path, REG_KEY_WRITE, token, &parent_key);
-
-       if (!W_ERROR_IS_OK(werr)) {
-               goto done;
-       }
-
-       werr = reg_deletekey_recursive(tmp_ctx, parent_key, p+1);
-
-       if (!W_ERROR_IS_OK(werr)) {
-               goto done;
-       }
-
-       werr = reg_createkey(tmp_ctx, parent_key, p+1, REG_KEY_WRITE,
-                            &new_key, &action);
-
-done:
-       TALLOC_FREE(tmp_ctx);
-       return werr;
-}
-
 static char *parm_valstr(TALLOC_CTX *ctx, struct parm_struct *parm,
                         struct share_params *share)
 {
@@ -481,14 +147,14 @@ static char *parm_valstr(TALLOC_CTX *ctx, struct parm_struct *parm,
                valstr = talloc_asprintf(ctx, "%s", BOOLSTR(!*(bool *)ptr));
                break;
        case P_ENUM:
-               for (i = 0; parm->enum_list[i].name; i++) {
-                       if (*(int *)ptr == parm->enum_list[i].value)
+               for (i = 0; parm->enum_list[i].name; i++) {
+                       if (*(int *)ptr == parm->enum_list[i].value)
                        {
                                valstr = talloc_asprintf(ctx, "%s",
-                                        parm->enum_list[i].name);
-                               break;
-                       }
-               }
+                                       parm->enum_list[i].name);
+                               break;
+                       }
+               }
                break;
        case P_OCTAL: {
                char *o = octal_string(*(int *)ptr);
@@ -529,14 +195,18 @@ static char *parm_valstr(TALLOC_CTX *ctx, struct parm_struct *parm,
        return valstr;
 }
 
+/**
+ * This functions imports a configuration that has previously
+ * been loaded with lp_load() to registry.
+ */
 static int import_process_service(TALLOC_CTX *ctx,
+                                 struct libnet_conf_ctx *conf_ctx,
                                  struct share_params *share)
 {
        int ret = -1;
        struct parm_struct *parm;
        int pnum = 0;
        const char *servicename;
-       struct registry_key *key;
        WERROR werr;
        char *valstr = NULL;
        TALLOC_CTX *tmp_ctx = NULL;
@@ -553,13 +223,13 @@ static int import_process_service(TALLOC_CTX *ctx,
        if (opt_testmode) {
                d_printf("[%s]\n", servicename);
        } else {
-               if (smbconf_key_exists(tmp_ctx, servicename)) {
-                       werr = reg_delkey_internal(tmp_ctx, servicename);
+               if (libnet_conf_share_exists(conf_ctx, servicename)) {
+                       werr = libnet_conf_delete_share(conf_ctx, servicename);
                        if (!W_ERROR_IS_OK(werr)) {
                                goto done;
                        }
                }
-               werr = reg_createkey_internal(tmp_ctx, servicename, &key);
+               werr = libnet_conf_create_share(conf_ctx, servicename);
                if (!W_ERROR_IS_OK(werr)) {
                        goto done;
                }
@@ -567,9 +237,11 @@ static int import_process_service(TALLOC_CTX *ctx,
 
        while ((parm = lp_next_parameter(share->service, &pnum, 0)))
        {
-               if ((share->service < 0 && parm->p_class == P_LOCAL)
+               if ((share->service < 0) && (parm->p_class == P_LOCAL)
                    && !(parm->flags & FLAG_GLOBAL))
+               {
                        continue;
+               }
 
                valstr = parm_valstr(tmp_ctx, parm, share);
 
@@ -577,9 +249,15 @@ static int import_process_service(TALLOC_CTX *ctx,
                        if (opt_testmode) {
                                d_printf("\t%s = %s\n", parm->label, valstr);
                        } else {
-                               werr = reg_setvalue_internal(key, parm->label,
-                                                            valstr);
+                               werr = libnet_conf_set_parameter(conf_ctx,
+                                                                servicename,
+                                                                parm->label,
+                                                                valstr);
                                if (!W_ERROR_IS_OK(werr)) {
+                                       d_fprintf(stderr,
+                                                 "Error setting parameter '%s'"
+                                                 ": %s\n", parm->label,
+                                                  dos_errstr(werr));
                                        goto done;
                                }
                        }
@@ -597,7 +275,10 @@ done:
        return ret;
 }
 
-/* return True iff there are nondefault globals */
+/**
+ * Return true iff there are nondefault globals in the
+ * currently loaded configuration.
+ */
 static bool globals_exist(void)
 {
        int i = 0;
@@ -605,25 +286,31 @@ static bool globals_exist(void)
 
        while ((parm = lp_next_parameter(GLOBAL_SECTION_SNUM, &i, 0)) != NULL) {
                if (parm->type != P_SEP) {
-                       return True;
+                       return true;
                }
        }
-       return False;
+       return false;
 }
 
-/*
- * the conf functions
- */
 
-int net_conf_list(int argc, const char **argv)
+/**********************************************************************
+ *
+ * the main conf functions
+ *
+ **********************************************************************/
+
+static int net_conf_list(struct libnet_conf_ctx *conf_ctx,
+                        int argc, const char **argv)
 {
        WERROR werr = WERR_OK;
        int ret = -1;
        TALLOC_CTX *ctx;
-       struct registry_key *base_key = NULL;
-       struct registry_key *sub_key = NULL;
-       uint32 idx_key = 0;
-       char *subkey_name = NULL;
+       uint32_t num_shares;
+       char **share_names;
+       uint32_t *num_params;
+       char ***param_names;
+       char ***param_values;
+       uint32_t share_count, param_count;
 
        ctx = talloc_init("list");
 
@@ -632,54 +319,25 @@ int net_conf_list(int argc, const char **argv)
                goto done;
        }
 
-       werr = smbconf_open_basepath(ctx, REG_KEY_READ, &base_key);
+       werr = libnet_conf_get_config(ctx, conf_ctx, &num_shares, &share_names,
+                                     &num_params, &param_names, &param_values);
        if (!W_ERROR_IS_OK(werr)) {
+               d_fprintf(stderr, "Error getting config: %s\n",
+                         dos_errstr(werr));
                goto done;
        }
 
-       if (smbconf_key_exists(ctx, GLOBAL_NAME))  {
-               werr = reg_openkey(ctx, base_key, GLOBAL_NAME,
-                                  REG_KEY_READ, &sub_key);
-               if (!W_ERROR_IS_OK(werr)) {
-                       d_fprintf(stderr, "Error opening subkey '%s' : %s\n",
-                                 subkey_name, dos_errstr(werr));
-                       goto done;
-               }
-               d_printf("[%s]\n", GLOBAL_NAME);
-               if (!W_ERROR_IS_OK(list_values(ctx, sub_key))) {
-                       goto done;
-               }
-               d_printf("\n");
-       }
-
-       for (idx_key = 0;
-            W_ERROR_IS_OK(werr = reg_enumkey(ctx, base_key, idx_key,
-                                             &subkey_name, NULL));
-            idx_key++)
-       {
-               if (strequal(subkey_name, GLOBAL_NAME)) {
-                       continue;
-               }
-               d_printf("[%s]\n", subkey_name);
-
-               werr = reg_openkey(ctx, base_key, subkey_name,
-                                  REG_KEY_READ, &sub_key);
-               if (!W_ERROR_IS_OK(werr)) {
-                       d_fprintf(stderr,
-                                 "Error opening subkey '%s': %s\n",
-                                 subkey_name, dos_errstr(werr));
-                       goto done;
-               }
-               if (!W_ERROR_IS_OK(list_values(ctx, sub_key))) {
-                       goto done;
+       for (share_count = 0; share_count < num_shares; share_count++) {
+               d_printf("[%s]\n", share_names[share_count]);
+               for (param_count = 0; param_count < num_params[share_count];
+                    param_count++)
+               {
+                       d_printf("\t%s = %s\n",
+                                param_names[share_count][param_count],
+                                param_values[share_count][param_count]);
                }
                d_printf("\n");
        }
-       if (!W_ERROR_EQUAL(WERR_NO_MORE_ITEMS, werr)) {
-               d_fprintf(stderr, "Error enumerating subkeys: %s\n",
-                         dos_errstr(werr));
-               goto done;
-       }
 
        ret = 0;
 
@@ -688,12 +346,13 @@ done:
        return ret;
 }
 
-int net_conf_import(int argc, const char **argv)
+static int net_conf_import(struct libnet_conf_ctx *conf_ctx,
+                          int argc, const char **argv)
 {
        int ret = -1;
        const char *filename = NULL;
        const char *servicename = NULL;
-       bool service_found = False;
+       bool service_found = false;
        TALLOC_CTX *ctx;
        struct share_iterator *shares;
        struct share_params *share;
@@ -717,10 +376,10 @@ int net_conf_import(int argc, const char **argv)
                filename));
 
        if (!lp_load(filename,
-                    False,     /* global_only */
-                    True,      /* save_defaults */
-                    False,     /* add_ipc */
-                    True))     /* initialize_globals */
+                    false,     /* global_only */
+                    true,      /* save_defaults */
+                    false,     /* add_ipc */
+                    true))     /* initialize_globals */
        {
                d_fprintf(stderr, "Error parsing configuration file.\n");
                goto done;
@@ -734,8 +393,8 @@ int net_conf_import(int argc, const char **argv)
        if (((servicename == NULL) && globals_exist()) ||
            strequal(servicename, GLOBAL_NAME))
        {
-               service_found = True;
-               if (import_process_service(ctx, &global_share) != 0) {
+               service_found = true;
+               if (import_process_service(ctx, conf_ctx, &global_share) != 0) {
                        goto done;
                }
        }
@@ -753,8 +412,8 @@ int net_conf_import(int argc, const char **argv)
                if ((servicename == NULL)
                    || strequal(servicename, lp_servicename(share->service)))
                {
-                       service_found = True;
-                       if (import_process_service(ctx, share)!= 0) {
+                       service_found = true;
+                       if (import_process_service(ctx, conf_ctx, share)!= 0) {
                                goto done;
                        }
                }
@@ -774,13 +433,13 @@ done:
        return ret;
 }
 
-int net_conf_listshares(int argc, const char **argv)
+static int net_conf_listshares(struct libnet_conf_ctx *conf_ctx,
+                              int argc, const char **argv)
 {
        WERROR werr = WERR_OK;
        int ret = -1;
-       struct registry_key *key;
-       uint32 idx = 0;
-       char *subkey_name = NULL;
+       uint32_t count, num_shares = 0;
+       char **share_names = NULL;
        TALLOC_CTX *ctx;
 
        ctx = talloc_init("listshares");
@@ -790,22 +449,15 @@ int net_conf_listshares(int argc, const char **argv)
                goto done;
        }
 
-       werr = smbconf_open_basepath(ctx, SEC_RIGHTS_ENUM_SUBKEYS, &key);
+       werr = libnet_conf_get_share_names(ctx, conf_ctx, &num_shares,
+                                          &share_names);
        if (!W_ERROR_IS_OK(werr)) {
                goto done;
        }
 
-       for (idx = 0;
-            W_ERROR_IS_OK(werr = reg_enumkey(ctx, key, idx,
-                                             &subkey_name, NULL));
-            idx++)
+       for (count = 0; count < num_shares; count++)
        {
-               d_printf("%s\n", subkey_name);
-       }
-       if (! W_ERROR_EQUAL(WERR_NO_MORE_ITEMS, werr)) {
-               d_fprintf(stderr, "Error enumerating subkeys: %s\n",
-                         dos_errstr(werr));
-               goto done;
+               d_printf("%s\n", share_names[count]);
        }
 
        ret = 0;
@@ -815,7 +467,8 @@ done:
        return ret;
 }
 
-int net_conf_drop(int argc, const char **argv)
+static int net_conf_drop(struct libnet_conf_ctx *conf_ctx,
+                        int argc, const char **argv)
 {
        int ret = -1;
        WERROR werr;
@@ -825,7 +478,7 @@ int net_conf_drop(int argc, const char **argv)
                goto done;
        }
 
-       werr = drop_smbconf_internal(NULL);
+       werr = libnet_conf_drop(conf_ctx);
        if (!W_ERROR_IS_OK(werr)) {
                d_fprintf(stderr, "Error deleting configuration: %s\n",
                          dos_errstr(werr));
@@ -838,12 +491,17 @@ done:
        return ret;
 }
 
-int net_conf_showshare(int argc, const char **argv)
+static int net_conf_showshare(struct libnet_conf_ctx *conf_ctx,
+                             int argc, const char **argv)
 {
        int ret = -1;
        WERROR werr = WERR_OK;
-       struct registry_key *key = NULL;
+       const char *sharename = NULL;
        TALLOC_CTX *ctx;
+       uint32_t num_params;
+       uint32_t count;
+       char **param_names;
+       char **param_values;
 
        ctx = talloc_init("showshare");
 
@@ -852,15 +510,21 @@ int net_conf_showshare(int argc, const char **argv)
                goto done;
        }
 
-       werr = smbconf_open_path(ctx, argv[0], REG_KEY_READ, &key);
+       sharename = argv[0];
+
+       werr = libnet_conf_get_share(ctx, conf_ctx, sharename, &num_params,
+                                    &param_names, &param_values);
        if (!W_ERROR_IS_OK(werr)) {
+               d_printf("error getting share parameters: %s\n",
+                        dos_errstr(werr));
                goto done;
        }
 
-       d_printf("[%s]\n", argv[0]);
+       d_printf("[%s]\n", sharename);
 
-       if (!W_ERROR_IS_OK(list_values(ctx, key))) {
-               goto done;
+       for (count = 0; count < num_params; count++) {
+               d_printf("\t%s = %s\n", param_names[count],
+                        param_values[count]);
        }
 
        ret = 0;
@@ -870,11 +534,17 @@ done:
        return ret;
 }
 
-int net_conf_addshare(int argc, const char **argv)
+/**
+ * Add a share, with a couple of standard parameters, partly optional.
+ *
+ * This is a high level utility function of the net conf utility,
+ * not a direct frontend to the libnet_conf API.
+ */
+static int net_conf_addshare(struct libnet_conf_ctx *conf_ctx,
+                            int argc, const char **argv)
 {
        int ret = -1;
        WERROR werr = WERR_OK;
-       struct registry_key *newkey = NULL;
        char *sharename = NULL;
        const char *path = NULL;
        const char *comment = NULL;
@@ -926,7 +596,6 @@ int net_conf_addshare(int argc, const char **argv)
                                        net_conf_addshare_usage(argc, argv);
                                        goto done;
                        }
-
                case 2:
                        path = argv[1];
                        sharename = strdup_lower(argv[0]);
@@ -960,6 +629,12 @@ int net_conf_addshare(int argc, const char **argv)
                goto done;
        }
 
+       if (libnet_conf_share_exists(conf_ctx, sharename)) {
+               d_fprintf(stderr, "ERROR: share %s already exists.\n",
+                         sharename);
+               goto done;
+       }
+
        /* validate path */
 
        if (path[0] != '/') {
@@ -989,43 +664,63 @@ int net_conf_addshare(int argc, const char **argv)
         * create the share
         */
 
-       werr = reg_createkey_internal(NULL, argv[0], &newkey);
+       werr = libnet_conf_create_share(conf_ctx, sharename);
        if (!W_ERROR_IS_OK(werr)) {
+               d_fprintf(stderr, "Error creating share %s: %s\n",
+                         sharename, dos_errstr(werr));
                goto done;
        }
 
-       /* add config params as values */
+       /*
+        * fill the share with parameters
+        */
 
-       werr = reg_setvalue_internal(newkey, "path", path);
-       if (!W_ERROR_IS_OK(werr))
+       werr = libnet_conf_set_parameter(conf_ctx, sharename, "path", path);
+       if (!W_ERROR_IS_OK(werr)) {
+               d_fprintf(stderr, "Error setting parameter %s: %s\n",
+                         "path", dos_errstr(werr));
                goto done;
+       }
 
        if (comment != NULL) {
-               werr = reg_setvalue_internal(newkey, "comment", comment);
-               if (!W_ERROR_IS_OK(werr))
+               werr = libnet_conf_set_parameter(conf_ctx, sharename, "comment",
+                                                comment);
+               if (!W_ERROR_IS_OK(werr)) {
+                       d_fprintf(stderr, "Error setting parameter %s: %s\n",
+                                 "comment", dos_errstr(werr));
                        goto done;
+               }
        }
 
-       werr = reg_setvalue_internal(newkey, "guest ok", guest_ok);
-       if (!W_ERROR_IS_OK(werr))
+       werr = libnet_conf_set_parameter(conf_ctx, sharename, "guest ok",
+                                        guest_ok);
+       if (!W_ERROR_IS_OK(werr)) {
+               d_fprintf(stderr, "Error setting parameter %s: %s\n",
+                         "'guest ok'", dos_errstr(werr));
                goto done;
+       }
 
-       werr = reg_setvalue_internal(newkey, "writeable", writeable);
-       if (!W_ERROR_IS_OK(werr))
+       werr = libnet_conf_set_parameter(conf_ctx, sharename, "writeable",
+                                        writeable);
+       if (!W_ERROR_IS_OK(werr)) {
+               d_fprintf(stderr, "Error setting parameter %s: %s\n",
+                         "writeable", dos_errstr(werr));
                goto done;
+       }
 
        ret = 0;
 
 done:
-       TALLOC_FREE(newkey);
        SAFE_FREE(sharename);
        return ret;
 }
 
-int net_conf_delshare(int argc, const char **argv)
+static int net_conf_delshare(struct libnet_conf_ctx *conf_ctx,
+                            int argc, const char **argv)
 {
        int ret = -1;
        const char *sharename = NULL;
+       WERROR werr = WERR_OK;
 
        if (argc != 1) {
                net_conf_delshare_usage(argc, argv);
@@ -1033,24 +728,26 @@ int net_conf_delshare(int argc, const char **argv)
        }
        sharename = argv[0];
 
-       if (W_ERROR_IS_OK(reg_delkey_internal(NULL, sharename))) {
-               ret = 0;
+       werr = libnet_conf_delete_share(conf_ctx, sharename);
+       if (!W_ERROR_IS_OK(werr)) {
+               d_fprintf(stderr, "Error deleting share %s: %s\n",
+                         sharename, dos_errstr(werr));
+               goto done;
        }
+
+       ret = 0;
 done:
        return ret;
 }
 
-static int net_conf_setparm(int argc, const char **argv)
+static int net_conf_setparm(struct libnet_conf_ctx *conf_ctx,
+                           int argc, const char **argv)
 {
        int ret = -1;
        WERROR werr = WERR_OK;
-       struct registry_key *key = NULL;
        char *service = NULL;
        char *param = NULL;
        const char *value_str = NULL;
-       TALLOC_CTX *ctx;
-
-       ctx = talloc_init("setparm");
 
        if (argc != 3) {
                net_conf_setparm_usage(argc, argv);
@@ -1060,39 +757,39 @@ static int net_conf_setparm(int argc, const char **argv)
        param = strdup_lower(argv[1]);
        value_str = argv[2];
 
-       if (!smbconf_key_exists(ctx, service)) {
-               werr = reg_createkey_internal(ctx, service, &key);
-       } else {
-               werr = smbconf_open_path(ctx, service, REG_KEY_READ, &key);
-       }
-       if (!W_ERROR_IS_OK(werr)) {
-               goto done;
+       if (!libnet_conf_share_exists(conf_ctx, service)) {
+               werr = libnet_conf_create_share(conf_ctx, service);
+               if (!W_ERROR_IS_OK(werr)) {
+                       d_fprintf(stderr, "Error creating share '%s': %s\n",
+                                 service, dos_errstr(werr));
+                       goto done;
+               }
        }
 
-       werr = reg_setvalue_internal(key, param, value_str);
+       werr = libnet_conf_set_parameter(conf_ctx, service, param, value_str);
+
        if (!W_ERROR_IS_OK(werr)) {
                d_fprintf(stderr, "Error setting value '%s': %s\n",
                          param, dos_errstr(werr));
                goto done;
        }
 
-
        ret = 0;
 
 done:
        SAFE_FREE(service);
-       TALLOC_FREE(ctx);
+       SAFE_FREE(param);
        return ret;
 }
 
-static int net_conf_getparm(int argc, const char **argv)
+static int net_conf_getparm(struct libnet_conf_ctx *conf_ctx,
+                           int argc, const char **argv)
 {
        int ret = -1;
        WERROR werr = WERR_OK;
-       struct registry_key *key = NULL;
        char *service = NULL;
        char *param = NULL;
-       struct registry_value *value = NULL;
+       char *valstr = NULL;
        TALLOC_CTX *ctx;
 
        ctx = talloc_init("getparm");
@@ -1104,26 +801,25 @@ static int net_conf_getparm(int argc, const char **argv)
        service = strdup_lower(argv[0]);
        param = strdup_lower(argv[1]);
 
-       if (!smbconf_key_exists(ctx, service)) {
+       werr = libnet_conf_get_parameter(ctx, conf_ctx, service, param, &valstr);
+
+       if (W_ERROR_EQUAL(werr, WERR_NO_SUCH_SERVICE)) {
                d_fprintf(stderr,
-                         "ERROR: given service '%s' does not exist.\n",
+                         "Error: given service '%s' does not exist.\n",
                          service);
                goto done;
-       }
-
-       werr = smbconf_open_path(ctx, service, REG_KEY_READ, &key);
-       if (!W_ERROR_IS_OK(werr)) {
+       } else if (W_ERROR_EQUAL(werr, WERR_INVALID_PARAM)) {
+               d_fprintf(stderr,
+                         "Error: given parameter '%s' is not set.\n",
+                         param);
                goto done;
-       }
-
-       werr = reg_queryvalue(ctx, key, param, &value);
-       if (!W_ERROR_IS_OK(werr)) {
-               d_fprintf(stderr, "Error querying value '%s': %s.\n",
+       } else if (!W_ERROR_IS_OK(werr)) {
+               d_fprintf(stderr, "Error getting value '%s': %s.\n",
                          param, dos_errstr(werr));
                goto done;
        }
 
-       d_printf("%s\n", format_value(ctx, value));
+       d_printf("%s\n", valstr);
 
        ret = 0;
 done:
@@ -1133,16 +829,13 @@ done:
        return ret;
 }
 
-static int net_conf_delparm(int argc, const char **argv)
+static int net_conf_delparm(struct libnet_conf_ctx *conf_ctx,
+                           int argc, const char **argv)
 {
        int ret = -1;
        WERROR werr = WERR_OK;
-       struct registry_key *key = NULL;
        char *service = NULL;
        char *param = NULL;
-       TALLOC_CTX *ctx;
-
-       ctx = talloc_init("delparm");
 
        if (argc != 2) {
                net_conf_delparm_usage(argc, argv);
@@ -1151,26 +844,19 @@ static int net_conf_delparm(int argc, const char **argv)
        service = strdup_lower(argv[0]);
        param = strdup_lower(argv[1]);
 
-       if (!smbconf_key_exists(ctx, service)) {
+       werr = libnet_conf_delete_parameter(conf_ctx, service, param);
+
+       if (W_ERROR_EQUAL(werr, WERR_NO_SUCH_SERVICE)) {
                d_fprintf(stderr,
                          "Error: given service '%s' does not exist.\n",
                          service);
                goto done;
-       }
-
-       werr = smbconf_open_path(ctx, service, REG_KEY_READ, &key);
-       if (!W_ERROR_IS_OK(werr)) {
-               goto done;
-       }
-
-       if (!smbconf_value_exists(ctx, key, param)) {
+       } else if (W_ERROR_EQUAL(werr, WERR_INVALID_PARAM)) {
                d_fprintf(stderr,
                          "Error: given parameter '%s' is not set.\n",
                          param);
                goto done;
-       }
-       werr = reg_deletevalue(key, param);
-       if (!W_ERROR_IS_OK(werr)) {
+       } else if (!W_ERROR_IS_OK(werr)) {
                d_fprintf(stderr, "Error deleting value '%s': %s.\n",
                          param, dos_errstr(werr));
                goto done;
@@ -1179,9 +865,83 @@ static int net_conf_delparm(int argc, const char **argv)
        ret = 0;
 
 done:
+       SAFE_FREE(service);
+       SAFE_FREE(param);
+       return ret;
+}
+
+
+/**********************************************************************
+ *
+ * Wrapper and net_conf_run_function mechanism.
+ *
+ **********************************************************************/
+
+/**
+ * Wrapper function to call the main conf functions.
+ * The wrapper calls handles opening and closing of the
+ * configuration.
+ */
+static int net_conf_wrap_function(int (*fn)(struct libnet_conf_ctx *,
+                                           int, const char **),
+                                 int argc, const char **argv)
+{
+       WERROR werr;
+       TALLOC_CTX *mem_ctx = talloc_stackframe();
+       struct libnet_conf_ctx *conf_ctx;
+       int ret = -1;
+
+       werr = libnet_conf_open(mem_ctx, &conf_ctx);
+
+       if (!W_ERROR_IS_OK(werr)) {
+               return -1;
+       }
+
+       ret = fn(conf_ctx, argc, argv);
+
+       libnet_conf_close(conf_ctx);
+
        return ret;
 }
 
+/*
+ * We need a functable struct of our own, because the
+ * functions are called through a wrapper that handles
+ * the opening and closing of the configuration, and so on.
+ */
+struct conf_functable {
+       const char *funcname;
+       int (*fn)(struct libnet_conf_ctx *ctx, int argc, const char **argv);
+       const char *helptext;
+};
+
+/**
+ * This imitates net_run_function2 but calls the main functions
+ * through the wrapper net_conf_wrap_function().
+ */
+static int net_conf_run_function(int argc, const char **argv,
+                                const char *whoami,
+                                struct conf_functable *table)
+{
+       int i;
+
+       if (argc != 0) {
+               for (i=0; table[i].funcname; i++) {
+                       if (StrCaseCmp(argv[0], table[i].funcname) == 0)
+                               return net_conf_wrap_function(table[i].fn,
+                                                             argc-1,
+                                                             argv+1);
+               }
+       }
+
+       for (i=0; table[i].funcname; i++) {
+               d_printf("%s %-15s %s\n", whoami, table[i].funcname,
+                        table[i].helptext);
+       }
+
+       return -1;
+}
+
 /*
  * Entry-point for all the CONF functions.
  */
@@ -1189,21 +949,21 @@ done:
 int net_conf(int argc, const char **argv)
 {
        int ret = -1;
-       struct functable2 func[] = {
+       struct conf_functable func_table[] = {
                {"list", net_conf_list,
                 "Dump the complete configuration in smb.conf like format."},
                {"import", net_conf_import,
                 "Import configuration from file in smb.conf format."},
                {"listshares", net_conf_listshares,
-                "List the registry shares."},
+                "List the share names."},
                {"drop", net_conf_drop,
-                "Delete the complete configuration from registry."},
+                "Delete the complete configuration."},
                {"showshare", net_conf_showshare,
-                "Show the definition of a registry share."},
+                "Show the definition of a share."},
                {"addshare", net_conf_addshare,
-                "Create a new registry share."},
+                "Create a new share."},
                {"delshare", net_conf_delshare,
-                "Delete a registry share."},
+                "Delete a share."},
                {"setparm", net_conf_setparm,
                 "Store a parameter."},
                {"getparm", net_conf_getparm,
@@ -1213,16 +973,8 @@ int net_conf(int argc, const char **argv)
                {NULL, NULL, NULL}
        };
 
-       if (!registry_init_regdb()) {
-               d_fprintf(stderr, "Error initializing the registry!\n");
-               goto done;
-       }
-
-       ret = net_run_function2(argc, argv, "net conf", func);
+       ret = net_conf_run_function(argc, argv, "net conf", func_table);
 
-       regdb_close();
-
-done:
        return ret;
 }
 
index 8b82a96892d12cb3776ec3e10dc6e14c714d592e..fb6644d6b24cd5f9f8171603f9606f0b7e5eb191 100644 (file)
 
 DNS_ERROR DoDNSUpdate(char *pszServerName,
                      const char *pszDomainName, const char *pszHostName,
-                     const struct in_addr *iplist, size_t num_addrs );
+                     const struct sockaddr_storage *sslist,
+                     size_t num_addrs );
 
 /*********************************************************************
 *********************************************************************/
 
 DNS_ERROR DoDNSUpdate(char *pszServerName,
                      const char *pszDomainName, const char *pszHostName,
-                     const struct in_addr *iplist, size_t num_addrs )
+                     const struct sockaddr_storage *sslist, size_t num_addrs )
 {
        DNS_ERROR err;
        struct dns_connection *conn;
@@ -47,7 +48,7 @@ DNS_ERROR DoDNSUpdate(char *pszServerName,
        OM_uint32 minor;
        struct dns_update_request *req, *resp;
 
-       if ( (num_addrs <= 0) || !iplist ) {
+       if ( (num_addrs <= 0) || !sslist ) {
                return ERROR_DNS_INVALID_PARAMETER;
        }
 
@@ -65,7 +66,7 @@ DNS_ERROR DoDNSUpdate(char *pszServerName,
         */
 
        err = dns_create_probe(mem_ctx, pszDomainName, pszHostName,
-                              num_addrs, iplist, &req);
+                              num_addrs, sslist, &req);
        if (!ERR_DNS_IS_OK(err)) goto error;
 
        err = dns_update_transaction(mem_ctx, conn, req, &resp);
@@ -81,7 +82,7 @@ DNS_ERROR DoDNSUpdate(char *pszServerName,
         */
 
        err = dns_create_update_request(mem_ctx, pszDomainName, pszHostName,
-                                       iplist, num_addrs, &req);
+                                       sslist, num_addrs, &req);
        if (!ERR_DNS_IS_OK(err)) goto error;
 
        err = dns_update_transaction(mem_ctx, conn, req, &resp);
@@ -141,33 +142,42 @@ error:
 /*********************************************************************
 *********************************************************************/
 
-int get_my_ip_address( struct in_addr **ips )
+int get_my_ip_address( struct sockaddr_storage **pp_ss )
+
 {
        struct iface_struct nics[MAX_INTERFACES];
        int i, n;
-       struct in_addr *list;
+       struct sockaddr_storage *list = NULL;
        int count = 0;
 
        /* find the first non-loopback address from our list of interfaces */
 
        n = get_interfaces(nics, MAX_INTERFACES);
-       
-       if ( (list = SMB_MALLOC_ARRAY( struct in_addr, n )) == NULL ) {
+
+       if (n <= 0) {
+               return -1;
+       }
+
+       if ( (list = SMB_MALLOC_ARRAY( struct sockaddr_storage, n )) == NULL ) {
                return -1;
        }
 
        for ( i=0; i<n; i++ ) {
+               if (is_loopback_addr(&nics[i].ip)) {
+                       continue;
+               }
+#if defined(HAVE_IPV6)
                if ((nics[i].ip.ss_family == AF_INET)) {
-                       struct in_addr ifip;
-
-                       ifip = ((const struct sockaddr_in *)&nics[i].ip)->sin_addr;
-
-                       if (!is_loopback_ip_v4(ifip)) {
-                               memcpy(&list[count++], &ifip, sizeof(struct in_addr));
-                       }
+                       memcpy(&list[count++], &nics[i].ip,
+                              sizeof(struct sockaddr_storage));
+               } else
+#endif
+               if (nics[i].ip.ss_family == AF_INET) {
+                       memcpy(&list[count++], &nics[i].ip,
+                              sizeof(struct sockaddr_storage));
                }
        }
-       *ips = list;
+       *pp_ss = list;
 
        return count;
 }
index fd386c95a8e5653ca3af676aab1a92e6b7b0b258..30993ae2fa7742df290b762633c9cd129d702c1b 100644 (file)
@@ -19,7 +19,7 @@
 
 #include "includes.h"
 #include "utils/net.h"
-#include "lib/netapi/joindomain.h"
+#include "lib/netapi/netapi.h"
 
 static int net_dom_usage(int argc, const char **argv)
 {
@@ -43,6 +43,7 @@ int net_help_dom(int argc, const char **argv)
 
 static int net_dom_unjoin(int argc, const char **argv)
 {
+       struct libnetapi_ctx *ctx = NULL;
        const char *server_name = NULL;
        const char *account = NULL;
        const char *password = NULL;
@@ -50,8 +51,8 @@ static int net_dom_unjoin(int argc, const char **argv)
                                WKSSVC_JOIN_FLAGS_JOIN_TYPE;
        struct cli_state *cli = NULL;
        bool reboot = false;
-       NTSTATUS status;
-       WERROR werr;
+       NTSTATUS ntstatus;
+       NET_API_STATUS status;
        int ret = -1;
        int i;
 
@@ -82,17 +83,25 @@ static int net_dom_unjoin(int argc, const char **argv)
        }
 
        if (reboot) {
-               status = net_make_ipc_connection_ex(opt_workgroup, server_name,
-                                                   NULL, 0, &cli);
-               if (!NT_STATUS_IS_OK(status)) {
+               ntstatus = net_make_ipc_connection_ex(opt_workgroup, server_name,
+                                                     NULL, 0, &cli);
+               if (!NT_STATUS_IS_OK(ntstatus)) {
                        return -1;
                }
        }
 
-       werr = NetUnjoinDomain(server_name, account, password, unjoin_flags);
-       if (!W_ERROR_IS_OK(werr)) {
+       status = libnetapi_init(&ctx);
+       if (status != 0) {
+               return -1;
+       }
+
+       libnetapi_set_username(ctx, opt_user_name);
+       libnetapi_set_password(ctx, opt_password);
+
+       status = NetUnjoinDomain(server_name, account, password, unjoin_flags);
+       if (status != 0) {
                printf("Failed to unjoin domain: %s\n",
-                       get_friendly_nt_error_msg(werror_to_ntstatus(werr)));
+                       libnetapi_errstr(status));
                goto done;
        }
 
@@ -121,11 +130,13 @@ static int net_dom_unjoin(int argc, const char **argv)
                cli_shutdown(cli);
        }
 
+       /* libnetapi_free(ctx); */
        return ret;
 }
 
 static int net_dom_join(int argc, const char **argv)
 {
+       struct libnetapi_ctx *ctx = NULL;
        const char *server_name = NULL;
        const char *domain_name = NULL;
        const char *account_ou = NULL;
@@ -135,8 +146,8 @@ static int net_dom_join(int argc, const char **argv)
                              WKSSVC_JOIN_FLAGS_JOIN_TYPE;
        struct cli_state *cli = NULL;
        bool reboot = false;
-       NTSTATUS status;
-       WERROR werr;
+       NTSTATUS ntstatus;
+       NET_API_STATUS status;
        int ret = -1;
        int i;
 
@@ -183,21 +194,28 @@ static int net_dom_join(int argc, const char **argv)
        }
 
        if (reboot) {
-               status = net_make_ipc_connection_ex(opt_workgroup, server_name,
-                                                   NULL, 0, &cli);
-               if (!NT_STATUS_IS_OK(status)) {
+               ntstatus = net_make_ipc_connection_ex(opt_workgroup, server_name,
+                                                     NULL, 0, &cli);
+               if (!NT_STATUS_IS_OK(ntstatus)) {
                        return -1;
                }
        }
 
        /* check if domain is a domain or a workgroup */
 
-       werr = NetJoinDomain(server_name, domain_name, account_ou,
-                            Account, password, join_flags);
-       if (!W_ERROR_IS_OK(werr)) {
-               printf("Failed to join domain: %s (WERROR: %s)\n",
-                       get_friendly_nt_error_msg(werror_to_ntstatus(werr)),
-                       dos_errstr(werr));
+       status = libnetapi_init(&ctx);
+       if (status != 0) {
+               return -1;
+       }
+
+       libnetapi_set_username(ctx, opt_user_name);
+       libnetapi_set_password(ctx, opt_password);
+
+       status = NetJoinDomain(server_name, domain_name, account_ou,
+                              Account, password, join_flags);
+       if (status != 0) {
+               printf("Failed to join domain: %s\n",
+                       libnetapi_errstr(status));
                goto done;
        }
 
@@ -226,6 +244,7 @@ static int net_dom_join(int argc, const char **argv)
                cli_shutdown(cli);
        }
 
+       /* libnetapi_free(ctx); */
        return ret;
 }
 
index 3f1908e242d7d5531f80465ee1142d2e443cc0d3..74b35d0d66829ebd8dbd10194f7e3d1cb4b539a4 100644 (file)
                 goto done; \
         }
 
+static void init_lsa_String(struct lsa_String *name, const char *s)
+{
+       name->string = s;
+}
+
 /*******************************************************************
  Leave an AD domain.  Windows XP disables the machine account.
  We'll try the same.  The old code would do an LDAP delete.
@@ -71,9 +76,12 @@ NTSTATUS netdom_leave_domain( TALLOC_CTX *mem_ctx, struct cli_state *cli,
        if ( !NT_STATUS_IS_OK(status) )
                return status;
 
-       
-       status = rpccli_samr_open_domain(pipe_hnd, mem_ctx, &sam_pol,
-                       SEC_RIGHTS_MAXIMUM_ALLOWED, dom_sid, &domain_pol);
+
+       status = rpccli_samr_OpenDomain(pipe_hnd, mem_ctx,
+                                       &sam_pol,
+                                       SEC_RIGHTS_MAXIMUM_ALLOWED,
+                                       dom_sid,
+                                       &domain_pol);
        if ( !NT_STATUS_IS_OK(status) )
                return status;
 
@@ -98,8 +106,11 @@ NTSTATUS netdom_leave_domain( TALLOC_CTX *mem_ctx, struct cli_state *cli,
                
        /* Open handle on user */
 
-       status = rpccli_samr_open_user(pipe_hnd, mem_ctx, &domain_pol,
-                       SEC_RIGHTS_MAXIMUM_ALLOWED, user_rid, &user_pol);
+       status = rpccli_samr_OpenUser(pipe_hnd, mem_ctx,
+                                     &domain_pol,
+                                     SEC_RIGHTS_MAXIMUM_ALLOWED,
+                                     user_rid,
+                                     &user_pol);
        if ( !NT_STATUS_IS_OK(status) ) {
                goto done;
        }
@@ -108,7 +119,7 @@ NTSTATUS netdom_leave_domain( TALLOC_CTX *mem_ctx, struct cli_state *cli,
 
        status = rpccli_samr_query_userinfo(pipe_hnd, mem_ctx, &user_pol, 16, &qctr);
        if ( !NT_STATUS_IS_OK(status) ) {
-               rpccli_samr_close(pipe_hnd, mem_ctx, &user_pol);
+               rpccli_samr_Close(pipe_hnd, mem_ctx, &user_pol);
                goto done;
        }
 
@@ -123,11 +134,11 @@ NTSTATUS netdom_leave_domain( TALLOC_CTX *mem_ctx, struct cli_state *cli,
        status = rpccli_samr_set_userinfo2(pipe_hnd, mem_ctx, &user_pol, 16, 
                                        &cli->user_session_key, &ctr);
 
-       rpccli_samr_close(pipe_hnd, mem_ctx, &user_pol);
+       rpccli_samr_Close(pipe_hnd, mem_ctx, &user_pol);
 
 done:
-       rpccli_samr_close(pipe_hnd, mem_ctx, &domain_pol);
-       rpccli_samr_close(pipe_hnd, mem_ctx, &sam_pol);
+       rpccli_samr_Close(pipe_hnd, mem_ctx, &domain_pol);
+       rpccli_samr_Close(pipe_hnd, mem_ctx, &sam_pol);
        
        cli_rpc_pipe_close(pipe_hnd); /* Done with this pipe */
        
@@ -157,7 +168,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;
@@ -204,10 +215,12 @@ NTSTATUS netdom_join_domain( TALLOC_CTX *mem_ctx, struct cli_state *cli,
        NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
        char *acct_name;
        const char *const_acct_name;
+       struct lsa_String lsa_acct_name;
        uint32 user_rid;
        uint32 num_rids, *name_types, *user_rids;
        uint32 flags = 0x3e8;
        uint32 acb_info = ACB_WSTRUST;
+       uint32 acct_flags;
        uint32 fields_present;
        uchar pwbuf[532];
        SAM_USERINFO_CTR ctr;
@@ -217,6 +230,7 @@ NTSTATUS netdom_join_domain( TALLOC_CTX *mem_ctx, struct cli_state *cli,
        uchar md5buffer[16];
        DATA_BLOB digested_session_key;
        uchar md4_trust_password[16];
+       uint32_t access_granted = 0;
 
        /* Open the domain */
        
@@ -231,9 +245,12 @@ NTSTATUS netdom_join_domain( TALLOC_CTX *mem_ctx, struct cli_state *cli,
        if ( !NT_STATUS_IS_OK(status) )
                return status;
 
-       
-       status = rpccli_samr_open_domain(pipe_hnd, mem_ctx, &sam_pol,
-                       SEC_RIGHTS_MAXIMUM_ALLOWED, dom_sid, &domain_pol);
+
+       status = rpccli_samr_OpenDomain(pipe_hnd, mem_ctx,
+                                       &sam_pol,
+                                       SEC_RIGHTS_MAXIMUM_ALLOWED,
+                                       dom_sid,
+                                       &domain_pol);
        if ( !NT_STATUS_IS_OK(status) )
                return status;
 
@@ -243,10 +260,25 @@ NTSTATUS netdom_join_domain( TALLOC_CTX *mem_ctx, struct cli_state *cli,
        strlower_m(acct_name);
        const_acct_name = acct_name;
 
-       /* Don't try to set any acb_info flags other than ACB_WSTRUST */
+       init_lsa_String(&lsa_acct_name, acct_name);
 
-       status = rpccli_samr_create_dom_user(pipe_hnd, mem_ctx, &domain_pol,
-                       acct_name, acb_info, 0xe005000b, &user_pol, &user_rid);
+       /* Don't try to set any acb_info flags other than ACB_WSTRUST */
+       acct_flags = SEC_GENERIC_READ | SEC_GENERIC_WRITE | SEC_GENERIC_EXECUTE |
+                    SEC_STD_WRITE_DAC | SEC_STD_DELETE |
+                    SAMR_USER_ACCESS_SET_PASSWORD |
+                    SAMR_USER_ACCESS_GET_ATTRIBUTES |
+                    SAMR_USER_ACCESS_SET_ATTRIBUTES;
+
+       DEBUG(10, ("Creating account with flags: %d\n",acct_flags));
+
+       status = rpccli_samr_CreateUser2(pipe_hnd, mem_ctx,
+                                        &domain_pol,
+                                        &lsa_acct_name,
+                                        acb_info,
+                                        acct_flags,
+                                        &user_pol,
+                                        &access_granted,
+                                        &user_rid);
 
        if ( !NT_STATUS_IS_OK(status) 
                && !NT_STATUS_EQUAL(status, NT_STATUS_USER_EXISTS)) 
@@ -266,7 +298,7 @@ NTSTATUS netdom_join_domain( TALLOC_CTX *mem_ctx, struct cli_state *cli,
        /* We *must* do this.... don't ask... */
 
        if (NT_STATUS_IS_OK(status)) {
-               rpccli_samr_close(pipe_hnd, mem_ctx, &user_pol);
+               rpccli_samr_Close(pipe_hnd, mem_ctx, &user_pol);
        }
 
        status = rpccli_samr_lookup_names(pipe_hnd, mem_ctx,
@@ -284,8 +316,11 @@ NTSTATUS netdom_join_domain( TALLOC_CTX *mem_ctx, struct cli_state *cli,
                
        /* Open handle on user */
 
-       status = rpccli_samr_open_user(pipe_hnd, mem_ctx, &domain_pol,
-                       SEC_RIGHTS_MAXIMUM_ALLOWED, user_rid, &user_pol);
+       status = rpccli_samr_OpenUser(pipe_hnd, mem_ctx,
+                                     &domain_pol,
+                                     SEC_RIGHTS_MAXIMUM_ALLOWED,
+                                     user_rid,
+                                     &user_pol);
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
@@ -336,7 +371,7 @@ NTSTATUS netdom_join_domain( TALLOC_CTX *mem_ctx, struct cli_state *cli,
                return status;
        }
 
-       rpccli_samr_close(pipe_hnd, mem_ctx, &user_pol);
+       rpccli_samr_Close(pipe_hnd, mem_ctx, &user_pol);
        cli_rpc_pipe_close(pipe_hnd); /* Done with this pipe */
        
        return status;
index 2cb601f9172cc00fceeb06603e24a8a9f7ad7519..908be0512a1f2687359140d572a45b173f8c5b1a 100644 (file)
@@ -48,6 +48,7 @@ int net_common_flags_usage(int argc, const char **argv)
        d_printf("\t-l or --long\t\t\tDisplay full information\n");
        d_printf("\t-V or --version\t\t\tPrint samba version information\n");
        d_printf("\t-P or --machine-pass\t\tAuthenticate as machine account\n");
+       d_printf("\t-e or --encrypt\t\tEncrypt SMB transport (UNIX extended servers only)\n");
        return -1;
 }
 
index 20298faa299520b36268960f26a114628690ebb8..8c01b5b4ba92796141f9ca6a7ebd7a9f00b6349e 100644 (file)
@@ -401,7 +401,7 @@ static int net_lookup_dsgetdcname(int argc, const char **argv)
                site_name = sitename_fetch(domain_name);
        }
 
-       status = DsGetDcName(mem_ctx, NULL, domain_name, NULL, site_name,
+       status = dsgetdcname(mem_ctx, domain_name, NULL, site_name,
                             flags, &info);
        if (!NT_STATUS_IS_OK(status)) {
                d_printf("failed with: %s\n", nt_errstr(status));
index ab0cc73e4980ba2de45e5204f93eb0ee7d2f46fe..7091063817acad395d86eb1923c91f8816b77880 100644 (file)
 #include "includes.h"
 #include "utils/net.h"
 
+static void init_lsa_String(struct lsa_String *name, const char *s)
+{
+       name->string = s;
+}
+
 static int net_mode_share;
 static bool sync_files(struct copy_clistate *cp_clistate, const char *mask);
 
@@ -51,7 +56,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 +118,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) {
@@ -451,11 +457,13 @@ NTSTATUS rpc_info_internals(const DOM_SID *domain_sid,
                d_fprintf(stderr, "Could not connect to SAM: %s\n", nt_errstr(result));
                goto done;
        }
-       
+
        /* Get domain policy handle */
-       result = rpccli_samr_open_domain(pipe_hnd, mem_ctx, &connect_pol,
-                                     MAXIMUM_ALLOWED_ACCESS,
-                                     domain_sid, &domain_pol);
+       result = rpccli_samr_OpenDomain(pipe_hnd, mem_ctx,
+                                       &connect_pol,
+                                       MAXIMUM_ALLOWED_ACCESS,
+                                       CONST_DISCARD(struct dom_sid2 *, domain_sid),
+                                       &domain_pol);
        if (!NT_STATUS_IS_OK(result)) {
                d_fprintf(stderr, "Could not open domain: %s\n", nt_errstr(result));
                goto done;
@@ -586,8 +594,10 @@ static NTSTATUS rpc_user_add_internals(const DOM_SID *domain_sid,
        POLICY_HND connect_pol, domain_pol, user_pol;
        NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
        const char *acct_name;
+       struct lsa_String lsa_acct_name;
        uint32 acb_info;
-       uint32 access_mask, user_rid;
+       uint32 acct_flags, user_rid;
+       uint32_t access_granted = 0;
 
        if (argc < 1) {
                d_printf("User must be specified\n");
@@ -596,6 +606,7 @@ static NTSTATUS rpc_user_add_internals(const DOM_SID *domain_sid,
        }
 
        acct_name = argv[0];
+       init_lsa_String(&lsa_acct_name, acct_name);
 
        /* Get sam policy handle */
        
@@ -606,10 +617,12 @@ static NTSTATUS rpc_user_add_internals(const DOM_SID *domain_sid,
        }
        
        /* Get domain policy handle */
-       
-       result = rpccli_samr_open_domain(pipe_hnd, mem_ctx, &connect_pol,
-                                     MAXIMUM_ALLOWED_ACCESS,
-                                     domain_sid, &domain_pol);
+
+       result = rpccli_samr_OpenDomain(pipe_hnd, mem_ctx,
+                                       &connect_pol,
+                                       MAXIMUM_ALLOWED_ACCESS,
+                                       CONST_DISCARD(struct dom_sid2 *, domain_sid),
+                                       &domain_pol);
        if (!NT_STATUS_IS_OK(result)) {
                goto done;
        }
@@ -617,11 +630,21 @@ static NTSTATUS rpc_user_add_internals(const DOM_SID *domain_sid,
        /* Create domain user */
 
        acb_info = ACB_NORMAL;
-       access_mask = 0xe005000b;
+       acct_flags = SEC_GENERIC_READ | SEC_GENERIC_WRITE | SEC_GENERIC_EXECUTE |
+                    SEC_STD_WRITE_DAC | SEC_STD_DELETE |
+                    SAMR_USER_ACCESS_SET_PASSWORD |
+                    SAMR_USER_ACCESS_GET_ATTRIBUTES |
+                    SAMR_USER_ACCESS_SET_ATTRIBUTES;
+
+       result = rpccli_samr_CreateUser2(pipe_hnd, mem_ctx,
+                                        &domain_pol,
+                                        &lsa_acct_name,
+                                        acb_info,
+                                        acct_flags,
+                                        &user_pol,
+                                        &access_granted,
+                                        &user_rid);
 
-       result = rpccli_samr_create_dom_user(pipe_hnd, mem_ctx, &domain_pol,
-                                         acct_name, acb_info, access_mask,
-                                         &user_pol, &user_rid);
        if (!NT_STATUS_IS_OK(result)) {
                goto done;
        }
@@ -643,9 +666,11 @@ static NTSTATUS rpc_user_add_internals(const DOM_SID *domain_sid,
                        goto done;
                }
 
-               result = rpccli_samr_open_user(pipe_hnd, mem_ctx, &domain_pol,
-                                              MAXIMUM_ALLOWED_ACCESS,
-                                              user_rids[0], &user_pol);
+               result = rpccli_samr_OpenUser(pipe_hnd, mem_ctx,
+                                             &domain_pol,
+                                             MAXIMUM_ALLOWED_ACCESS,
+                                             user_rids[0],
+                                             &user_pol);
 
                if (!NT_STATUS_IS_OK(result)) {
                        goto done;
@@ -670,7 +695,8 @@ static NTSTATUS rpc_user_add_internals(const DOM_SID *domain_sid,
                        d_fprintf(stderr, "Failed to set password for user %s - %s\n", 
                                 acct_name, nt_errstr(result));
 
-                       result = rpccli_samr_delete_dom_user(pipe_hnd, mem_ctx, &user_pol);
+                       result = rpccli_samr_DeleteUser(pipe_hnd, mem_ctx,
+                                                       &user_pol);
 
                        if (!NT_STATUS_IS_OK(result)) {
                                d_fprintf(stderr, "Failed to delete user %s - %s\n", 
@@ -682,10 +708,10 @@ static NTSTATUS rpc_user_add_internals(const DOM_SID *domain_sid,
        }
  done:
        if (!NT_STATUS_IS_OK(result)) {
-               d_fprintf(stderr, "Failed to add user %s - %s\n", acct_name, 
-                        nt_errstr(result));
+               d_fprintf(stderr, "Failed to add user '%s' with %s.\n",
+                         acct_name, nt_errstr(result));
        } else {
-               d_printf("Added user %s\n", acct_name);
+               d_printf("Added user '%s'.\n", acct_name);
        }
        return result;
 }
@@ -732,12 +758,16 @@ static NTSTATUS rpc_user_del_internals(const DOM_SID *domain_sid,
 {
        NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
        POLICY_HND connect_pol, domain_pol, user_pol;
+       const char *acct_name;
 
        if (argc < 1) {
                d_printf("User must be specified\n");
                rpc_user_usage(argc, argv);
                return NT_STATUS_OK;
        }
+
+       acct_name = argv[0];
+
        /* Get sam policy and domain handles */
 
        result = rpccli_samr_connect(pipe_hnd, mem_ctx, MAXIMUM_ALLOWED_ACCESS, 
@@ -747,9 +777,11 @@ static NTSTATUS rpc_user_del_internals(const DOM_SID *domain_sid,
                goto done;
        }
 
-       result = rpccli_samr_open_domain(pipe_hnd, mem_ctx, &connect_pol,
-                                     MAXIMUM_ALLOWED_ACCESS,
-                                     domain_sid, &domain_pol);
+       result = rpccli_samr_OpenDomain(pipe_hnd, mem_ctx,
+                                       &connect_pol,
+                                       MAXIMUM_ALLOWED_ACCESS,
+                                       CONST_DISCARD(struct dom_sid2 *, domain_sid),
+                                       &domain_pol);
 
        if (!NT_STATUS_IS_OK(result)) {
                goto done;
@@ -762,7 +794,7 @@ static NTSTATUS rpc_user_del_internals(const DOM_SID *domain_sid,
                uint32 flags = 0x000003e8; /* Unknown */
 
                result = rpccli_samr_lookup_names(pipe_hnd, mem_ctx, &domain_pol,
-                                              flags, 1, &argv[0],
+                                              flags, 1, &acct_name,
                                               &num_rids, &user_rids,
                                               &name_types);
 
@@ -770,9 +802,11 @@ static NTSTATUS rpc_user_del_internals(const DOM_SID *domain_sid,
                        goto done;
                }
 
-               result = rpccli_samr_open_user(pipe_hnd, mem_ctx, &domain_pol,
-                                           MAXIMUM_ALLOWED_ACCESS,
-                                           user_rids[0], &user_pol);
+               result = rpccli_samr_OpenUser(pipe_hnd, mem_ctx,
+                                             &domain_pol,
+                                             MAXIMUM_ALLOWED_ACCESS,
+                                             user_rids[0],
+                                             &user_pol);
 
                if (!NT_STATUS_IS_OK(result)) {
                        goto done;
@@ -781,20 +815,21 @@ static NTSTATUS rpc_user_del_internals(const DOM_SID *domain_sid,
 
        /* Delete user */
 
-       result = rpccli_samr_delete_dom_user(pipe_hnd, mem_ctx, &user_pol);
+       result = rpccli_samr_DeleteUser(pipe_hnd, mem_ctx,
+                                       &user_pol);
 
        if (!NT_STATUS_IS_OK(result)) {
                goto done;
        }
 
-       /* Display results */
+ done:
        if (!NT_STATUS_IS_OK(result)) {
-               d_fprintf(stderr, "Failed to delete user account - %s\n", nt_errstr(result));
-       } else {
-               d_printf("Deleted user account\n");
-       }
+                d_fprintf(stderr, "Failed to delete user '%s' with %s.\n",
+                         acct_name, nt_errstr(result));
+        } else {
+                d_printf("Deleted user '%s'.\n", acct_name);
+        }
 
- done:
        return result;
 }
 
@@ -856,10 +891,12 @@ static NTSTATUS rpc_user_rename_internals(const DOM_SID *domain_sid,
        }
        
        /* Get domain policy handle */
-       
-       result = rpccli_samr_open_domain(pipe_hnd, mem_ctx, &connect_pol,
-                                     MAXIMUM_ALLOWED_ACCESS,
-                                     domain_sid, &domain_pol);
+
+       result = rpccli_samr_OpenDomain(pipe_hnd, mem_ctx,
+                                       &connect_pol,
+                                       MAXIMUM_ALLOWED_ACCESS,
+                                       CONST_DISCARD(struct dom_sid2 *, domain_sid),
+                                       &domain_pol);
        if (!NT_STATUS_IS_OK(result)) {
                goto done;
        }
@@ -877,8 +914,11 @@ static NTSTATUS rpc_user_rename_internals(const DOM_SID *domain_sid,
        }
 
        /* Open domain user */
-       result = rpccli_samr_open_user(pipe_hnd, mem_ctx, &domain_pol,
-                                   MAXIMUM_ALLOWED_ACCESS, user_rid[0], &user_pol);
+       result = rpccli_samr_OpenUser(pipe_hnd, mem_ctx,
+                                     &domain_pol,
+                                     MAXIMUM_ALLOWED_ACCESS,
+                                     user_rid[0],
+                                     &user_pol);
 
        if (!NT_STATUS_IS_OK(result)) {
                goto done;
@@ -1005,9 +1045,11 @@ static NTSTATUS rpc_user_password_internals(const DOM_SID *domain_sid,
                goto done;
        }
 
-       result = rpccli_samr_open_domain(pipe_hnd, mem_ctx, &connect_pol,
-                                     MAXIMUM_ALLOWED_ACCESS,
-                                     domain_sid, &domain_pol);
+       result = rpccli_samr_OpenDomain(pipe_hnd, mem_ctx,
+                                       &connect_pol,
+                                       MAXIMUM_ALLOWED_ACCESS,
+                                       CONST_DISCARD(struct dom_sid2 *, domain_sid),
+                                       &domain_pol);
 
        if (!NT_STATUS_IS_OK(result)) {
                goto done;
@@ -1028,9 +1070,11 @@ static NTSTATUS rpc_user_password_internals(const DOM_SID *domain_sid,
                        goto done;
                }
 
-               result = rpccli_samr_open_user(pipe_hnd, mem_ctx, &domain_pol,
-                                           MAXIMUM_ALLOWED_ACCESS,
-                                           user_rids[0], &user_pol);
+               result = rpccli_samr_OpenUser(pipe_hnd, mem_ctx,
+                                             &domain_pol,
+                                             MAXIMUM_ALLOWED_ACCESS,
+                                             user_rids[0],
+                                             &user_pol);
 
                if (!NT_STATUS_IS_OK(result)) {
                        goto done;
@@ -1123,10 +1167,12 @@ static NTSTATUS rpc_user_info_internals(const DOM_SID *domain_sid,
        if (!NT_STATUS_IS_OK(result)) goto done;
        
        /* Get domain policy handle */
-       
-       result = rpccli_samr_open_domain(pipe_hnd, mem_ctx, &connect_pol,
-                                     MAXIMUM_ALLOWED_ACCESS,
-                                     domain_sid, &domain_pol);
+
+       result = rpccli_samr_OpenDomain(pipe_hnd, mem_ctx,
+                                       &connect_pol,
+                                       MAXIMUM_ALLOWED_ACCESS,
+                                       CONST_DISCARD(struct dom_sid2 *, domain_sid),
+                                       &domain_pol);
        if (!NT_STATUS_IS_OK(result)) goto done;
 
        /* Get handle on user */
@@ -1137,9 +1183,11 @@ static NTSTATUS rpc_user_info_internals(const DOM_SID *domain_sid,
 
        if (!NT_STATUS_IS_OK(result)) goto done;
 
-       result = rpccli_samr_open_user(pipe_hnd, mem_ctx, &domain_pol,
-                                   MAXIMUM_ALLOWED_ACCESS,
-                                   rids[0], &user_pol);
+       result = rpccli_samr_OpenUser(pipe_hnd, mem_ctx,
+                                     &domain_pol,
+                                     MAXIMUM_ALLOWED_ACCESS,
+                                     rids[0],
+                                     &user_pol);
        if (!NT_STATUS_IS_OK(result)) goto done;
 
        result = rpccli_samr_query_usergroups(pipe_hnd, mem_ctx, &user_pol,
@@ -1230,10 +1278,12 @@ static NTSTATUS rpc_user_list_internals(const DOM_SID *domain_sid,
        }
        
        /* Get domain policy handle */
-       
-       result = rpccli_samr_open_domain(pipe_hnd, mem_ctx, &connect_pol,
-                                     MAXIMUM_ALLOWED_ACCESS,
-                                     domain_sid, &domain_pol);
+
+       result = rpccli_samr_OpenDomain(pipe_hnd, mem_ctx,
+                                       &connect_pol,
+                                       MAXIMUM_ALLOWED_ACCESS,
+                                       CONST_DISCARD(struct dom_sid2 *, domain_sid),
+                                       &domain_pol);
        if (!NT_STATUS_IS_OK(result)) {
                goto done;
        }
@@ -1374,16 +1424,20 @@ static NTSTATUS rpc_sh_handle_user(TALLOC_CTX *mem_ctx,
                goto done;
        }
 
-       result = rpccli_samr_open_domain(pipe_hnd, mem_ctx, &connect_pol,
-                                        MAXIMUM_ALLOWED_ACCESS,
-                                        ctx->domain_sid, &domain_pol);
+       result = rpccli_samr_OpenDomain(pipe_hnd, mem_ctx,
+                                       &connect_pol,
+                                       MAXIMUM_ALLOWED_ACCESS,
+                                       ctx->domain_sid,
+                                       &domain_pol);
        if (!NT_STATUS_IS_OK(result)) {
                goto done;
        }
 
-       result = rpccli_samr_open_user(pipe_hnd, mem_ctx, &domain_pol,
-                                      MAXIMUM_ALLOWED_ACCESS,
-                                      rid, &user_pol);
+       result = rpccli_samr_OpenUser(pipe_hnd, mem_ctx,
+                                     &domain_pol,
+                                     MAXIMUM_ALLOWED_ACCESS,
+                                     rid,
+                                     &user_pol);
        if (!NT_STATUS_IS_OK(result)) {
                goto done;
        }
@@ -1392,13 +1446,13 @@ static NTSTATUS rpc_sh_handle_user(TALLOC_CTX *mem_ctx,
 
  done:
        if (is_valid_policy_hnd(&user_pol)) {
-               rpccli_samr_close(pipe_hnd, mem_ctx, &user_pol);
+               rpccli_samr_Close(pipe_hnd, mem_ctx, &user_pol);
        }
        if (is_valid_policy_hnd(&domain_pol)) {
-               rpccli_samr_close(pipe_hnd, mem_ctx, &domain_pol);
+               rpccli_samr_Close(pipe_hnd, mem_ctx, &domain_pol);
        }
        if (is_valid_policy_hnd(&connect_pol)) {
-               rpccli_samr_close(pipe_hnd, mem_ctx, &connect_pol);
+               rpccli_samr_Close(pipe_hnd, mem_ctx, &connect_pol);
        }
        return result;
 }
@@ -1738,11 +1792,13 @@ static NTSTATUS rpc_group_delete_internals(const DOM_SID *domain_sid,
                d_fprintf(stderr, "Request samr_connect failed\n");
                goto done;
         }
-        
-        result = rpccli_samr_open_domain(pipe_hnd, mem_ctx, &connect_pol,
-                                      MAXIMUM_ALLOWED_ACCESS,
-                                      domain_sid, &domain_pol);
-        
+
+        result = rpccli_samr_OpenDomain(pipe_hnd, mem_ctx,
+                                       &connect_pol,
+                                       MAXIMUM_ALLOWED_ACCESS,
+                                       CONST_DISCARD(struct dom_sid2 *, domain_sid),
+                                       &domain_pol);
+
         if (!NT_STATUS_IS_OK(result)) {
                d_fprintf(stderr, "Request open_domain failed\n");
                goto done;
@@ -1761,9 +1817,11 @@ static NTSTATUS rpc_group_delete_internals(const DOM_SID *domain_sid,
        switch (name_types[0])
        {
        case SID_NAME_DOM_GRP:
-               result = rpccli_samr_open_group(pipe_hnd, mem_ctx, &domain_pol,
-                                            MAXIMUM_ALLOWED_ACCESS,
-                                            group_rids[0], &group_pol);
+               result = rpccli_samr_OpenGroup(pipe_hnd, mem_ctx,
+                                              &domain_pol,
+                                              MAXIMUM_ALLOWED_ACCESS,
+                                              group_rids[0],
+                                              &group_pol);
                if (!NT_STATUS_IS_OK(result)) {
                        d_fprintf(stderr, "Request open_group failed");
                        goto done;
@@ -1788,9 +1846,11 @@ static NTSTATUS rpc_group_delete_internals(const DOM_SID *domain_sid,
                /* Check if group is anyone's primary group */
                 for (i = 0; i < num_members; i++)
                {
-                       result = rpccli_samr_open_user(pipe_hnd, mem_ctx, &domain_pol,
-                                                   MAXIMUM_ALLOWED_ACCESS,
-                                                   group_rids[i], &user_pol);
+                       result = rpccli_samr_OpenUser(pipe_hnd, mem_ctx,
+                                                     &domain_pol,
+                                                     MAXIMUM_ALLOWED_ACCESS,
+                                                     group_rids[i],
+                                                     &user_pol);
        
                        if (!NT_STATUS_IS_OK(result)) {
                                d_fprintf(stderr, "Unable to open group member %d\n",group_rids[i]);
@@ -1815,7 +1875,7 @@ static NTSTATUS rpc_group_delete_internals(const DOM_SID *domain_sid,
                                group_is_primary = True;
                         }
 
-                       rpccli_samr_close(pipe_hnd, mem_ctx, &user_pol);
+                       rpccli_samr_Close(pipe_hnd, mem_ctx, &user_pol);
                }
                 
                if (group_is_primary) {
@@ -1842,21 +1902,25 @@ static NTSTATUS rpc_group_delete_internals(const DOM_SID *domain_sid,
                        }       
                }
 
-               result = rpccli_samr_delete_dom_group(pipe_hnd, mem_ctx, &group_pol);
+               result = rpccli_samr_DeleteDomainGroup(pipe_hnd, mem_ctx,
+                                                      &group_pol);
 
                break;
        /* removing a local group is easier... */
        case SID_NAME_ALIAS:
-               result = rpccli_samr_open_alias(pipe_hnd, mem_ctx, &domain_pol,
-                                            MAXIMUM_ALLOWED_ACCESS,
-                                            group_rids[0], &group_pol);
+               result = rpccli_samr_OpenAlias(pipe_hnd, mem_ctx,
+                                              &domain_pol,
+                                              MAXIMUM_ALLOWED_ACCESS,
+                                              group_rids[0],
+                                              &group_pol);
 
                if (!NT_STATUS_IS_OK(result)) {
                        d_fprintf(stderr, "Request open_alias failed\n");
                        goto done;
                }
-               
-               result = rpccli_samr_delete_dom_alias(pipe_hnd, mem_ctx, &group_pol);
+
+               result = rpccli_samr_DeleteDomAlias(pipe_hnd, mem_ctx,
+                                                   &group_pol);
                break;
        default:
                d_fprintf(stderr, "%s is of type %s. This command is only for deleting local or global groups\n",
@@ -1896,6 +1960,8 @@ static NTSTATUS rpc_group_add_internals(const DOM_SID *domain_sid,
        POLICY_HND connect_pol, domain_pol, group_pol;
        NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
        GROUP_INFO_CTR group_info;
+       struct lsa_String grp_name;
+       uint32_t rid = 0;
 
        if (argc != 1) {
                d_printf("Group name must be specified\n");
@@ -1903,6 +1969,8 @@ static NTSTATUS rpc_group_add_internals(const DOM_SID *domain_sid,
                return NT_STATUS_OK;
        }
 
+       init_lsa_String(&grp_name, argv[0]);
+
        /* Get sam policy handle */
        
        result = rpccli_samr_connect(pipe_hnd, mem_ctx, MAXIMUM_ALLOWED_ACCESS, 
@@ -1910,17 +1978,22 @@ static NTSTATUS rpc_group_add_internals(const DOM_SID *domain_sid,
        if (!NT_STATUS_IS_OK(result)) goto done;
        
        /* Get domain policy handle */
-       
-       result = rpccli_samr_open_domain(pipe_hnd, mem_ctx, &connect_pol,
-                                     MAXIMUM_ALLOWED_ACCESS,
-                                     domain_sid, &domain_pol);
+
+       result = rpccli_samr_OpenDomain(pipe_hnd, mem_ctx,
+                                       &connect_pol,
+                                       MAXIMUM_ALLOWED_ACCESS,
+                                       CONST_DISCARD(struct dom_sid2 *, domain_sid),
+                                       &domain_pol);
        if (!NT_STATUS_IS_OK(result)) goto done;
 
        /* Create the group */
 
-       result = rpccli_samr_create_dom_group(pipe_hnd, mem_ctx, &domain_pol,
-                                          argv[0], MAXIMUM_ALLOWED_ACCESS,
-                                          &group_pol);
+       result = rpccli_samr_CreateDomainGroup(pipe_hnd, mem_ctx,
+                                              &domain_pol,
+                                              &grp_name,
+                                              MAXIMUM_ALLOWED_ACCESS,
+                                              &group_pol,
+                                              &rid);
        if (!NT_STATUS_IS_OK(result)) goto done;
 
        if (strlen(opt_comment) == 0) goto done;
@@ -1953,6 +2026,8 @@ static NTSTATUS rpc_alias_add_internals(const DOM_SID *domain_sid,
        POLICY_HND connect_pol, domain_pol, alias_pol;
        NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
        ALIAS_INFO_CTR alias_info;
+       struct lsa_String alias_name;
+       uint32_t rid = 0;
 
        if (argc != 1) {
                d_printf("Alias name must be specified\n");
@@ -1960,6 +2035,8 @@ static NTSTATUS rpc_alias_add_internals(const DOM_SID *domain_sid,
                return NT_STATUS_OK;
        }
 
+       init_lsa_String(&alias_name, argv[0]);
+
        /* Get sam policy handle */
        
        result = rpccli_samr_connect(pipe_hnd, mem_ctx, MAXIMUM_ALLOWED_ACCESS, 
@@ -1967,16 +2044,22 @@ static NTSTATUS rpc_alias_add_internals(const DOM_SID *domain_sid,
        if (!NT_STATUS_IS_OK(result)) goto done;
        
        /* Get domain policy handle */
-       
-       result = rpccli_samr_open_domain(pipe_hnd, mem_ctx, &connect_pol,
-                                     MAXIMUM_ALLOWED_ACCESS,
-                                     domain_sid, &domain_pol);
+
+       result = rpccli_samr_OpenDomain(pipe_hnd, mem_ctx,
+                                       &connect_pol,
+                                       MAXIMUM_ALLOWED_ACCESS,
+                                       CONST_DISCARD(struct dom_sid2 *, domain_sid),
+                                       &domain_pol);
        if (!NT_STATUS_IS_OK(result)) goto done;
 
        /* Create the group */
 
-       result = rpccli_samr_create_dom_alias(pipe_hnd, mem_ctx, &domain_pol,
-                                          argv[0], &alias_pol);
+       result = rpccli_samr_CreateDomAlias(pipe_hnd, mem_ctx,
+                                           &domain_pol,
+                                           &alias_name,
+                                           MAXIMUM_ALLOWED_ACCESS,
+                                           &alias_pol,
+                                           &rid);
        if (!NT_STATUS_IS_OK(result)) goto done;
 
        if (strlen(opt_comment) == 0) goto done;
@@ -2093,11 +2176,13 @@ static NTSTATUS rpc_add_groupmem(struct rpc_pipe_client *pipe_hnd,
        if (!NT_STATUS_IS_OK(result)) {
                return result;
        }
-       
+
        /* Get domain policy handle */
-       result = rpccli_samr_open_domain(pipe_hnd, mem_ctx, &connect_pol,
-                                     MAXIMUM_ALLOWED_ACCESS,
-                                     &sid, &domain_pol);
+       result = rpccli_samr_OpenDomain(pipe_hnd, mem_ctx,
+                                       &connect_pol,
+                                       MAXIMUM_ALLOWED_ACCESS,
+                                       &sid,
+                                       &domain_pol);
        if (!NT_STATUS_IS_OK(result)) {
                return result;
        }
@@ -2111,9 +2196,11 @@ static NTSTATUS rpc_add_groupmem(struct rpc_pipe_client *pipe_hnd,
                goto done;
        }
 
-       result = rpccli_samr_open_group(pipe_hnd, mem_ctx, &domain_pol,
-                                    MAXIMUM_ALLOWED_ACCESS,
-                                    group_rid, &group_pol);
+       result = rpccli_samr_OpenGroup(pipe_hnd, mem_ctx,
+                                      &domain_pol,
+                                      MAXIMUM_ALLOWED_ACCESS,
+                                      group_rid,
+                                      &group_pol);
 
        if (!NT_STATUS_IS_OK(result)) {
                goto done;
@@ -2122,7 +2209,7 @@ static NTSTATUS rpc_add_groupmem(struct rpc_pipe_client *pipe_hnd,
        result = rpccli_samr_add_groupmem(pipe_hnd, mem_ctx, &group_pol, rids[0]);
 
  done:
-       rpccli_samr_close(pipe_hnd, mem_ctx, &connect_pol);
+       rpccli_samr_Close(pipe_hnd, mem_ctx, &connect_pol);
        return result;
 }
 
@@ -2161,18 +2248,22 @@ static NTSTATUS rpc_add_aliasmem(struct rpc_pipe_client *pipe_hnd,
        if (!NT_STATUS_IS_OK(result)) {
                goto done;
        }
-       
+
        /* Get domain policy handle */
-       result = rpccli_samr_open_domain(pipe_hnd, mem_ctx, &connect_pol,
-                                     MAXIMUM_ALLOWED_ACCESS,
-                                     &sid, &domain_pol);
+       result = rpccli_samr_OpenDomain(pipe_hnd, mem_ctx,
+                                       &connect_pol,
+                                       MAXIMUM_ALLOWED_ACCESS,
+                                       &sid,
+                                       &domain_pol);
        if (!NT_STATUS_IS_OK(result)) {
                goto done;
        }
 
-       result = rpccli_samr_open_alias(pipe_hnd, mem_ctx, &domain_pol,
-                                    MAXIMUM_ALLOWED_ACCESS,
-                                    alias_rid, &alias_pol);
+       result = rpccli_samr_OpenAlias(pipe_hnd, mem_ctx,
+                                      &domain_pol,
+                                      MAXIMUM_ALLOWED_ACCESS,
+                                      alias_rid,
+                                      &alias_pol);
 
        if (!NT_STATUS_IS_OK(result)) {
                return result;
@@ -2185,7 +2276,7 @@ static NTSTATUS rpc_add_aliasmem(struct rpc_pipe_client *pipe_hnd,
        }
 
  done:
-       rpccli_samr_close(pipe_hnd, mem_ctx, &connect_pol);
+       rpccli_samr_Close(pipe_hnd, mem_ctx, &connect_pol);
        return result;
 }
 
@@ -2272,11 +2363,13 @@ static NTSTATUS rpc_del_groupmem(struct rpc_pipe_client *pipe_hnd,
                                  &connect_pol);
        if (!NT_STATUS_IS_OK(result))
                return result;
-       
+
        /* Get domain policy handle */
-       result = rpccli_samr_open_domain(pipe_hnd, mem_ctx, &connect_pol,
-                                     MAXIMUM_ALLOWED_ACCESS,
-                                     &sid, &domain_pol);
+       result = rpccli_samr_OpenDomain(pipe_hnd, mem_ctx,
+                                       &connect_pol,
+                                       MAXIMUM_ALLOWED_ACCESS,
+                                       &sid,
+                                       &domain_pol);
        if (!NT_STATUS_IS_OK(result))
                return result;
 
@@ -2289,9 +2382,11 @@ static NTSTATUS rpc_del_groupmem(struct rpc_pipe_client *pipe_hnd,
                goto done;
        }
 
-       result = rpccli_samr_open_group(pipe_hnd, mem_ctx, &domain_pol,
-                                    MAXIMUM_ALLOWED_ACCESS,
-                                    group_rid, &group_pol);
+       result = rpccli_samr_OpenGroup(pipe_hnd, mem_ctx,
+                                      &domain_pol,
+                                      MAXIMUM_ALLOWED_ACCESS,
+                                      group_rid,
+                                      &group_pol);
 
        if (!NT_STATUS_IS_OK(result))
                goto done;
@@ -2299,7 +2394,7 @@ static NTSTATUS rpc_del_groupmem(struct rpc_pipe_client *pipe_hnd,
        result = rpccli_samr_del_groupmem(pipe_hnd, mem_ctx, &group_pol, rids[0]);
 
  done:
-       rpccli_samr_close(pipe_hnd, mem_ctx, &connect_pol);
+       rpccli_samr_Close(pipe_hnd, mem_ctx, &connect_pol);
        return result;
 }
 
@@ -2337,18 +2432,22 @@ static NTSTATUS rpc_del_aliasmem(struct rpc_pipe_client *pipe_hnd,
        if (!NT_STATUS_IS_OK(result)) {
                goto done;
        }
-       
+
        /* Get domain policy handle */
-       result = rpccli_samr_open_domain(pipe_hnd, mem_ctx, &connect_pol,
-                                     MAXIMUM_ALLOWED_ACCESS,
-                                     &sid, &domain_pol);
+       result = rpccli_samr_OpenDomain(pipe_hnd, mem_ctx,
+                                       &connect_pol,
+                                       MAXIMUM_ALLOWED_ACCESS,
+                                       &sid,
+                                       &domain_pol);
        if (!NT_STATUS_IS_OK(result)) {
                goto done;
        }
 
-       result = rpccli_samr_open_alias(pipe_hnd, mem_ctx, &domain_pol,
-                                    MAXIMUM_ALLOWED_ACCESS,
-                                    alias_rid, &alias_pol);
+       result = rpccli_samr_OpenAlias(pipe_hnd, mem_ctx,
+                                      &domain_pol,
+                                      MAXIMUM_ALLOWED_ACCESS,
+                                      alias_rid,
+                                      &alias_pol);
 
        if (!NT_STATUS_IS_OK(result))
                return result;
@@ -2359,7 +2458,7 @@ static NTSTATUS rpc_del_aliasmem(struct rpc_pipe_client *pipe_hnd,
                return result;
 
  done:
-       rpccli_samr_close(pipe_hnd, mem_ctx, &connect_pol);
+       rpccli_samr_Close(pipe_hnd, mem_ctx, &connect_pol);
        return result;
 }
 
@@ -2478,10 +2577,12 @@ static NTSTATUS rpc_group_list_internals(const DOM_SID *domain_sid,
        }
        
        /* Get domain policy handle */
-       
-       result = rpccli_samr_open_domain(pipe_hnd, mem_ctx, &connect_pol,
-                                     MAXIMUM_ALLOWED_ACCESS,
-                                     domain_sid, &domain_pol);
+
+       result = rpccli_samr_OpenDomain(pipe_hnd, mem_ctx,
+                                       &connect_pol,
+                                       MAXIMUM_ALLOWED_ACCESS,
+                                       CONST_DISCARD(struct dom_sid2 *, domain_sid),
+                                       &domain_pol);
        if (!NT_STATUS_IS_OK(result)) {
                goto done;
        }
@@ -2554,15 +2655,15 @@ static NTSTATUS rpc_group_list_internals(const DOM_SID *domain_sid,
                                POLICY_HND alias_pol;
                                ALIAS_INFO_CTR ctr;
 
-                               if ((NT_STATUS_IS_OK(rpccli_samr_open_alias(pipe_hnd, mem_ctx,
-                                                                        &domain_pol,
-                                                                        0x8,
-                                                                        groups[i].rid,
-                                                                        &alias_pol))) &&
+                               if ((NT_STATUS_IS_OK(rpccli_samr_OpenAlias(pipe_hnd, mem_ctx,
+                                                                          &domain_pol,
+                                                                          0x8,
+                                                                          groups[i].rid,
+                                                                          &alias_pol))) &&
                                    (NT_STATUS_IS_OK(rpccli_samr_query_alias_info(pipe_hnd, mem_ctx,
                                                                               &alias_pol, 3,
                                                                               &ctr))) &&
-                                   (NT_STATUS_IS_OK(rpccli_samr_close(pipe_hnd, mem_ctx,
+                                   (NT_STATUS_IS_OK(rpccli_samr_Close(pipe_hnd, mem_ctx,
                                                                    &alias_pol)))) {
                                        description = unistr2_to_ascii_talloc(mem_ctx,
                                                                   ctr.alias.info3.description.string);
@@ -2578,12 +2679,14 @@ static NTSTATUS rpc_group_list_internals(const DOM_SID *domain_sid,
                        }
                }
        } while (NT_STATUS_EQUAL(result, STATUS_MORE_ENTRIES));
-       rpccli_samr_close(pipe_hnd, mem_ctx, &domain_pol);
+       rpccli_samr_Close(pipe_hnd, mem_ctx, &domain_pol);
        /* Get builtin policy handle */
-       
-       result = rpccli_samr_open_domain(pipe_hnd, mem_ctx, &connect_pol,
-                                     MAXIMUM_ALLOWED_ACCESS,
-                                     &global_sid_Builtin, &domain_pol);
+
+       result = rpccli_samr_OpenDomain(pipe_hnd, mem_ctx,
+                                       &connect_pol,
+                                       MAXIMUM_ALLOWED_ACCESS,
+                                       CONST_DISCARD(struct dom_sid2 *, &global_sid_Builtin),
+                                       &domain_pol);
        if (!NT_STATUS_IS_OK(result)) {
                goto done;
        }
@@ -2609,15 +2712,15 @@ static NTSTATUS rpc_group_list_internals(const DOM_SID *domain_sid,
                                POLICY_HND alias_pol;
                                ALIAS_INFO_CTR ctr;
 
-                               if ((NT_STATUS_IS_OK(rpccli_samr_open_alias(pipe_hnd, mem_ctx,
-                                                                        &domain_pol,
-                                                                        0x8,
-                                                                        groups[i].rid,
-                                                                        &alias_pol))) &&
+                               if ((NT_STATUS_IS_OK(rpccli_samr_OpenAlias(pipe_hnd, mem_ctx,
+                                                                          &domain_pol,
+                                                                          0x8,
+                                                                          groups[i].rid,
+                                                                          &alias_pol))) &&
                                    (NT_STATUS_IS_OK(rpccli_samr_query_alias_info(pipe_hnd, mem_ctx,
                                                                               &alias_pol, 3,
                                                                               &ctr))) &&
-                                   (NT_STATUS_IS_OK(rpccli_samr_close(pipe_hnd, mem_ctx,
+                                   (NT_STATUS_IS_OK(rpccli_samr_Close(pipe_hnd, mem_ctx,
                                                                    &alias_pol)))) {
                                        description = unistr2_to_ascii_talloc(mem_ctx,
                                                                   ctr.alias.info3.description.string);
@@ -2663,9 +2766,11 @@ static NTSTATUS rpc_list_group_members(struct rpc_pipe_client *pipe_hnd,
        fstring sid_str;
        sid_to_fstring(sid_str, domain_sid);
 
-       result = rpccli_samr_open_group(pipe_hnd, mem_ctx, domain_pol,
-                                    MAXIMUM_ALLOWED_ACCESS,
-                                    rid, &group_pol);
+       result = rpccli_samr_OpenGroup(pipe_hnd, mem_ctx,
+                                      domain_pol,
+                                      MAXIMUM_ALLOWED_ACCESS,
+                                      rid,
+                                      &group_pol);
 
        if (!NT_STATUS_IS_OK(result))
                return result;
@@ -2726,8 +2831,11 @@ static NTSTATUS rpc_list_alias_members(struct rpc_pipe_client *pipe_hnd,
        enum lsa_SidType *types;
        int i;
 
-       result = rpccli_samr_open_alias(pipe_hnd, mem_ctx, domain_pol,
-                                    MAXIMUM_ALLOWED_ACCESS, rid, &alias_pol);
+       result = rpccli_samr_OpenAlias(pipe_hnd, mem_ctx,
+                                      domain_pol,
+                                      MAXIMUM_ALLOWED_ACCESS,
+                                      rid,
+                                      &alias_pol);
 
        if (!NT_STATUS_IS_OK(result))
                return result;
@@ -2812,10 +2920,12 @@ static NTSTATUS rpc_group_members_internals(const DOM_SID *domain_sid,
                return result;
        
        /* Get domain policy handle */
-       
-       result = rpccli_samr_open_domain(pipe_hnd, mem_ctx, &connect_pol,
-                                     MAXIMUM_ALLOWED_ACCESS,
-                                     domain_sid, &domain_pol);
+
+       result = rpccli_samr_OpenDomain(pipe_hnd, mem_ctx,
+                                       &connect_pol,
+                                       MAXIMUM_ALLOWED_ACCESS,
+                                       CONST_DISCARD(struct dom_sid2 *, domain_sid),
+                                       &domain_pol);
 
        if (!NT_STATUS_IS_OK(result))
                return result;
@@ -2829,13 +2939,15 @@ static NTSTATUS rpc_group_members_internals(const DOM_SID *domain_sid,
 
                DOM_SID sid_Builtin;
 
-               rpccli_samr_close(pipe_hnd, mem_ctx, &domain_pol);
+               rpccli_samr_Close(pipe_hnd, mem_ctx, &domain_pol);
 
                string_to_sid(&sid_Builtin, "S-1-5-32");                
 
-               result = rpccli_samr_open_domain(pipe_hnd, mem_ctx, &connect_pol,
-                                             MAXIMUM_ALLOWED_ACCESS,
-                                             &sid_Builtin, &domain_pol);
+               result = rpccli_samr_OpenDomain(pipe_hnd, mem_ctx,
+                                               &connect_pol,
+                                               MAXIMUM_ALLOWED_ACCESS,
+                                               &sid_Builtin,
+                                               &domain_pol);
 
                if (!NT_STATUS_IS_OK(result)) {
                        d_fprintf(stderr, "Couldn't find group %s\n", argv[0]);
@@ -2909,10 +3021,12 @@ static NTSTATUS rpc_group_rename_internals(const DOM_SID *domain_sid,
                return result;
        
        /* Get domain policy handle */
-       
-       result = rpccli_samr_open_domain(pipe_hnd, mem_ctx, &connect_pol,
-                                     MAXIMUM_ALLOWED_ACCESS,
-                                     domain_sid, &domain_pol);
+
+       result = rpccli_samr_OpenDomain(pipe_hnd, mem_ctx,
+                                       &connect_pol,
+                                       MAXIMUM_ALLOWED_ACCESS,
+                                       CONST_DISCARD(struct dom_sid2 *, domain_sid),
+                                       &domain_pol);
 
        if (!NT_STATUS_IS_OK(result))
                return result;
@@ -2930,9 +3044,11 @@ static NTSTATUS rpc_group_rename_internals(const DOM_SID *domain_sid,
                return NT_STATUS_UNSUCCESSFUL;
        }
 
-       result = rpccli_samr_open_group(pipe_hnd, mem_ctx, &domain_pol,
-                                    MAXIMUM_ALLOWED_ACCESS,
-                                    rids[0], &group_pol);
+       result = rpccli_samr_OpenGroup(pipe_hnd, mem_ctx,
+                                      &domain_pol,
+                                      MAXIMUM_ALLOWED_ACCESS,
+                                      rids[0],
+                                      &group_pol);
 
        if (!NT_STATUS_IS_OK(result))
                return result;
@@ -4000,10 +4116,12 @@ static NTSTATUS rpc_fetch_domain_aliases(struct rpc_pipe_client *pipe_hnd,
        POLICY_HND domain_pol;
 
        /* Get domain policy handle */
-       
-       result = rpccli_samr_open_domain(pipe_hnd, mem_ctx, connect_pol,
-                                     MAXIMUM_ALLOWED_ACCESS,
-                                     domain_sid, &domain_pol);
+
+       result = rpccli_samr_OpenDomain(pipe_hnd, mem_ctx,
+                                       connect_pol,
+                                       MAXIMUM_ALLOWED_ACCESS,
+                                       CONST_DISCARD(struct dom_sid2 *, domain_sid),
+                                       &domain_pol);
        if (!NT_STATUS_IS_OK(result))
                return result;
 
@@ -4022,10 +4140,11 @@ static NTSTATUS rpc_fetch_domain_aliases(struct rpc_pipe_client *pipe_hnd,
                        DOM_SID *members;
                        int j;
 
-                       result = rpccli_samr_open_alias(pipe_hnd, mem_ctx, &domain_pol,
-                                                    MAXIMUM_ALLOWED_ACCESS,
-                                                    groups[i].rid,
-                                                    &alias_pol);
+                       result = rpccli_samr_OpenAlias(pipe_hnd, mem_ctx,
+                                                      &domain_pol,
+                                                      MAXIMUM_ALLOWED_ACCESS,
+                                                      groups[i].rid,
+                                                      &alias_pol);
                        if (!NT_STATUS_IS_OK(result))
                                goto done;
 
@@ -4036,7 +4155,7 @@ static NTSTATUS rpc_fetch_domain_aliases(struct rpc_pipe_client *pipe_hnd,
                        if (!NT_STATUS_IS_OK(result))
                                goto done;
 
-                       result = rpccli_samr_close(pipe_hnd, mem_ctx, &alias_pol);
+                       result = rpccli_samr_Close(pipe_hnd, mem_ctx, &alias_pol);
                        if (!NT_STATUS_IS_OK(result))
                                goto done;
 
@@ -4060,7 +4179,7 @@ static NTSTATUS rpc_fetch_domain_aliases(struct rpc_pipe_client *pipe_hnd,
        result = NT_STATUS_OK;
 
  done:
-       rpccli_samr_close(pipe_hnd, mem_ctx, &domain_pol);
+       rpccli_samr_Close(pipe_hnd, mem_ctx, &domain_pol);
 
        return result;
 }
@@ -4160,7 +4279,7 @@ static NTSTATUS rpc_aliaslist_internals(const DOM_SID *domain_sid,
        result = rpc_fetch_domain_aliases(pipe_hnd, mem_ctx, &connect_pol,
                                          domain_sid);
 
-       rpccli_samr_close(pipe_hnd, mem_ctx, &connect_pol);
+       rpccli_samr_Close(pipe_hnd, mem_ctx, &connect_pol);
  done:
        return result;
 }
@@ -5335,8 +5454,11 @@ static NTSTATUS rpc_trustdom_add_internals(const DOM_SID *domain_sid,
        POLICY_HND connect_pol, domain_pol, user_pol;
        NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
        char *acct_name;
+       struct lsa_String lsa_acct_name;
        uint32 acb_info;
-       uint32 unknown, user_rid;
+       uint32 acct_flags=0;
+       uint32 user_rid;
+       uint32_t access_granted = 0;
 
        if (argc != 2) {
                d_printf("Usage: net rpc trustdom add <domain_name> <pw>\n");
@@ -5346,36 +5468,48 @@ static NTSTATUS rpc_trustdom_add_internals(const DOM_SID *domain_sid,
        /* 
         * Make valid trusting domain account (ie. uppercased and with '$' appended)
         */
-        
+
        if (asprintf(&acct_name, "%s$", argv[0]) < 0) {
                return NT_STATUS_NO_MEMORY;
        }
 
        strupper_m(acct_name);
 
+       init_lsa_String(&lsa_acct_name, acct_name);
+
        /* Get samr policy handle */
        result = rpccli_samr_connect(pipe_hnd, mem_ctx, MAXIMUM_ALLOWED_ACCESS,
                                  &connect_pol);
        if (!NT_STATUS_IS_OK(result)) {
                goto done;
        }
-       
+
        /* Get domain policy handle */
-       result = rpccli_samr_open_domain(pipe_hnd, mem_ctx, &connect_pol,
-                                     MAXIMUM_ALLOWED_ACCESS,
-                                     domain_sid, &domain_pol);
+       result = rpccli_samr_OpenDomain(pipe_hnd, mem_ctx,
+                                       &connect_pol,
+                                       MAXIMUM_ALLOWED_ACCESS,
+                                       CONST_DISCARD(struct dom_sid2 *, domain_sid),
+                                       &domain_pol);
        if (!NT_STATUS_IS_OK(result)) {
                goto done;
        }
 
        /* Create trusting domain's account */
-       acb_info = ACB_NORMAL; 
-       unknown = 0xe00500b0; /* No idea what this is - a permission mask?
-                                mimir: yes, most probably it is */
-
-       result = rpccli_samr_create_dom_user(pipe_hnd, mem_ctx, &domain_pol,
-                                         acct_name, acb_info, unknown,
-                                         &user_pol, &user_rid);
+       acb_info = ACB_NORMAL;
+       acct_flags = SEC_GENERIC_READ | SEC_GENERIC_WRITE | SEC_GENERIC_EXECUTE |
+                    SEC_STD_WRITE_DAC | SEC_STD_DELETE |
+                    SAMR_USER_ACCESS_SET_PASSWORD |
+                    SAMR_USER_ACCESS_GET_ATTRIBUTES |
+                    SAMR_USER_ACCESS_SET_ATTRIBUTES;
+
+       result = rpccli_samr_CreateUser2(pipe_hnd, mem_ctx,
+                                        &domain_pol,
+                                        &lsa_acct_name,
+                                        acb_info,
+                                        acct_flags,
+                                        &user_pol,
+                                        &access_granted,
+                                        &user_rid);
        if (!NT_STATUS_IS_OK(result)) {
                goto done;
        }
@@ -5503,11 +5637,13 @@ static NTSTATUS rpc_trustdom_del_internals(const DOM_SID *domain_sid,
        if (!NT_STATUS_IS_OK(result)) {
                goto done;
        }
-       
+
        /* Get domain policy handle */
-       result = rpccli_samr_open_domain(pipe_hnd, mem_ctx, &connect_pol,
-                                     MAXIMUM_ALLOWED_ACCESS,
-                                     domain_sid, &domain_pol);
+       result = rpccli_samr_OpenDomain(pipe_hnd, mem_ctx,
+                                       &connect_pol,
+                                       MAXIMUM_ALLOWED_ACCESS,
+                                       CONST_DISCARD(struct dom_sid2 *, domain_sid),
+                                       &domain_pol);
        if (!NT_STATUS_IS_OK(result)) {
                goto done;
        }
@@ -5520,9 +5656,11 @@ static NTSTATUS rpc_trustdom_del_internals(const DOM_SID *domain_sid,
                goto done;
        }
 
-       result = rpccli_samr_open_user(pipe_hnd, mem_ctx, &domain_pol,
-                                   MAXIMUM_ALLOWED_ACCESS,
-                                   user_rids[0], &user_pol);
+       result = rpccli_samr_OpenUser(pipe_hnd, mem_ctx,
+                                     &domain_pol,
+                                     MAXIMUM_ALLOWED_ACCESS,
+                                     user_rids[0],
+                                     &user_pol);
 
        if (!NT_STATUS_IS_OK(result)) {
                goto done;
@@ -5545,7 +5683,8 @@ static NTSTATUS rpc_trustdom_del_internals(const DOM_SID *domain_sid,
 
        /* Delete user */
 
-       result = rpccli_samr_delete_dom_user(pipe_hnd, mem_ctx, &user_pol);
+       result = rpccli_samr_DeleteUser(pipe_hnd, mem_ctx,
+                                       &user_pol);
 
        if (!NT_STATUS_IS_OK(result)) {
                goto done;
@@ -5603,7 +5742,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;
@@ -5846,24 +5985,30 @@ static NTSTATUS vampire_trusted_domain(struct rpc_pipe_client *pipe_hnd,
                                      const char *trusted_dom_name)
 {
        NTSTATUS nt_status;
-       LSA_TRUSTED_DOMAIN_INFO *info;
+       union lsa_TrustedDomainInfo info;
        char *cleartextpwd = NULL;
        DATA_BLOB data;
 
-       nt_status = rpccli_lsa_query_trusted_domain_info_by_sid(pipe_hnd, mem_ctx, pol, 4, &dom_sid, &info);
-       
+       nt_status = rpccli_lsa_QueryTrustedDomainInfoBySid(pipe_hnd, mem_ctx,
+                                                          pol,
+                                                          &dom_sid,
+                                                          LSA_TRUSTED_DOMAIN_INFO_PASSWORD,
+                                                          &info);
        if (NT_STATUS_IS_ERR(nt_status)) {
                DEBUG(0,("Could not query trusted domain info. Error was %s\n",
                nt_errstr(nt_status)));
                goto done;
        }
 
-       data = data_blob(NULL, info->password.password.length);
+       data = data_blob(NULL, info.password.password->length);
 
-       memcpy(data.data, info->password.password.data, info->password.password.length);
-       data.length     = info->password.password.length;
-                               
-       cleartextpwd = decrypt_trustdom_secret(pipe_hnd->cli->pwd.password, &data);
+       memcpy(data.data,
+              info.password.password->data,
+              info.password.password->length);
+       data.length = info.password.password->length;
+
+       cleartextpwd = decrypt_trustdom_secret(pipe_hnd->cli->pwd.password,
+                                              &data);
 
        if (cleartextpwd == NULL) {
                DEBUG(0,("retrieved NULL password\n"));
@@ -5907,7 +6052,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)
@@ -6047,7 +6192,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;
@@ -6186,12 +6331,14 @@ static int rpc_trustdom_list(int argc, const char **argv)
                talloc_destroy(mem_ctx);
                return -1;
        };
-       
+
        /* SamrOpenDomain - we have to open domain policy handle in order to be
           able to enumerate accounts*/
-       nt_status = rpccli_samr_open_domain(pipe_hnd, mem_ctx, &connect_hnd,
-                                        SA_RIGHT_DOMAIN_ENUM_ACCOUNTS,
-                                        queried_dom_sid, &domain_hnd);                                                                  
+       nt_status = rpccli_samr_OpenDomain(pipe_hnd, mem_ctx,
+                                          &connect_hnd,
+                                          SA_RIGHT_DOMAIN_ENUM_ACCOUNTS,
+                                          queried_dom_sid,
+                                          &domain_hnd);
        if (!NT_STATUS_IS_OK(nt_status)) {
                DEBUG(0, ("Couldn't open domain object. Error was %s\n",
                        nt_errstr(nt_status)));
@@ -6267,12 +6414,12 @@ static int rpc_trustdom_list(int argc, const char **argv)
        } while (NT_STATUS_EQUAL(nt_status, STATUS_MORE_ENTRIES));
 
        /* close opened samr and domain policy handles */
-       nt_status = rpccli_samr_close(pipe_hnd, mem_ctx, &domain_hnd);
+       nt_status = rpccli_samr_Close(pipe_hnd, mem_ctx, &domain_hnd);
        if (!NT_STATUS_IS_OK(nt_status)) {
                DEBUG(0, ("Couldn't properly close domain policy handle for domain %s\n", domain_name));
        };
        
-       nt_status = rpccli_samr_close(pipe_hnd, mem_ctx, &connect_hnd);
+       nt_status = rpccli_samr_Close(pipe_hnd, mem_ctx, &connect_hnd);
        if (!NT_STATUS_IS_OK(nt_status)) {
                DEBUG(0, ("Couldn't properly close samr policy handle for domain %s\n", domain_name));
        };
index b7fda2b8e379b3f5d1c19f6c82a2eb575f5c56f9..50bd555f16ee1d4134d11536f7bc5624bdafb8cb 100644 (file)
@@ -1,21 +1,21 @@
-/* 
-   Samba Unix/Linux SMB client library 
-   Distributed SMB/CIFS Server Management Utility 
+/*
+   Samba Unix/Linux SMB client library
+   Distributed SMB/CIFS Server Management Utility
    Copyright (C) 2006 Guenther Deschner
 
    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 "utils/net.h"
 
@@ -54,29 +54,26 @@ static void print_auditing_category(const char *policy, const char *value)
        pad_len = col_len - strlen(policy);
        padding[pad_len] = 0;
        do padding[--pad_len] = ' '; while (pad_len > 0);
-                       
+
        d_printf("\t%s%s%s\n", policy, padding, value);
 }
 
-
 /********************************************************************
 ********************************************************************/
 
 static NTSTATUS rpc_audit_get_internal(const DOM_SID *domain_sid,
-                                      const char *domain_name, 
+                                      const char *domain_name,
                                       struct cli_state *cli,
                                       struct rpc_pipe_client *pipe_hnd,
-                                      TALLOC_CTX *mem_ctx, 
+                                      TALLOC_CTX *mem_ctx,
                                       int argc,
                                       const char **argv)
 {
        POLICY_HND pol;
        NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
-       LSA_INFO_CTR dom; 
+       union lsa_PolicyInformation info;
        int i;
-
-       uint32 info_class = 2;
-       uint32 audit_category;
+       uint32_t audit_category;
 
        if (argc < 1 || argc > 2) {
                d_printf("insufficient arguments\n");
@@ -89,7 +86,7 @@ static NTSTATUS rpc_audit_get_internal(const DOM_SID *domain_sid,
                return NT_STATUS_INVALID_PARAMETER;
        }
 
-       result = rpccli_lsa_open_policy(pipe_hnd, mem_ctx, True, 
+       result = rpccli_lsa_open_policy(pipe_hnd, mem_ctx, true,
                                        SEC_RIGHTS_MAXIMUM_ALLOWED,
                                        &pol);
 
@@ -97,15 +94,16 @@ static NTSTATUS rpc_audit_get_internal(const DOM_SID *domain_sid,
                goto done;
        }
 
-       result = rpccli_lsa_query_info_policy_new(pipe_hnd, mem_ctx, &pol, 
-                                                 info_class,
-                                                 &dom);
+       result = rpccli_lsa_QueryInfoPolicy(pipe_hnd, mem_ctx,
+                                           &pol,
+                                           LSA_POLICY_INFO_AUDIT_EVENTS,
+                                           &info);
 
        if (!NT_STATUS_IS_OK(result)) {
                goto done;
        }
 
-       for (i=0; i < dom.info.id2.count1; i++) {
+       for (i=0; i < info.audit_events.count; i++) {
 
                const char *val = NULL, *policy = NULL;
 
@@ -113,14 +111,15 @@ static NTSTATUS rpc_audit_get_internal(const DOM_SID *domain_sid,
                        continue;
                }
 
-               val = audit_policy_str(mem_ctx, dom.info.id2.auditsettings[i]);
+               val = audit_policy_str(mem_ctx, info.audit_events.settings[i]);
                policy = audit_description_str(i);
                print_auditing_category(policy, val);
        }
 
  done:
        if (!NT_STATUS_IS_OK(result)) {
-               d_printf("failed to get auditing policy: %s\n", nt_errstr(result));
+               d_printf("failed to get auditing policy: %s\n",
+                       nt_errstr(result));
        }
 
        return result;
@@ -130,19 +129,17 @@ static NTSTATUS rpc_audit_get_internal(const DOM_SID *domain_sid,
 ********************************************************************/
 
 static NTSTATUS rpc_audit_set_internal(const DOM_SID *domain_sid,
-                                      const char *domain_name, 
+                                      const char *domain_name,
                                       struct cli_state *cli,
                                       struct rpc_pipe_client *pipe_hnd,
-                                      TALLOC_CTX *mem_ctx, 
+                                      TALLOC_CTX *mem_ctx,
                                       int argc,
                                       const char **argv)
 {
        POLICY_HND pol;
        NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
-       LSA_INFO_CTR dom; 
-
-       uint32 info_class = 2;
-       uint32 audit_policy, audit_category;
+       union lsa_PolicyInformation info;
+       uint32_t audit_policy, audit_category;
 
        if (argc < 2 || argc > 3) {
                d_printf("insufficient arguments\n");
@@ -170,7 +167,7 @@ static NTSTATUS rpc_audit_set_internal(const DOM_SID *domain_sid,
                return NT_STATUS_INVALID_PARAMETER;
        }
 
-       result = rpccli_lsa_open_policy(pipe_hnd, mem_ctx, True, 
+       result = rpccli_lsa_open_policy(pipe_hnd, mem_ctx, true,
                                        SEC_RIGHTS_MAXIMUM_ALLOWED,
                                        &pol);
 
@@ -178,29 +175,32 @@ static NTSTATUS rpc_audit_set_internal(const DOM_SID *domain_sid,
                goto done;
        }
 
-       result = rpccli_lsa_query_info_policy_new(pipe_hnd, mem_ctx, &pol, 
-                                                 info_class,
-                                                 &dom);
+       result = rpccli_lsa_QueryInfoPolicy(pipe_hnd, mem_ctx,
+                                           &pol,
+                                           LSA_POLICY_INFO_AUDIT_EVENTS,
+                                           &info);
 
        if (!NT_STATUS_IS_OK(result)) {
                goto done;
        }
 
-       dom.info.id2.auditsettings[audit_category] = audit_policy;
+       info.audit_events.settings[audit_category] = audit_policy;
+
+       result = rpccli_lsa_SetInfoPolicy(pipe_hnd, mem_ctx,
+                                         &pol,
+                                         LSA_POLICY_INFO_AUDIT_EVENTS,
+                                         &info);
 
-       result = rpccli_lsa_set_info_policy(pipe_hnd, mem_ctx, &pol, 
-                                           info_class,
-                                           dom);
        if (!NT_STATUS_IS_OK(result)) {
                goto done;
        }
 
-       result = rpccli_lsa_query_info_policy_new(pipe_hnd, mem_ctx, &pol, 
-                                                 info_class,
-                                                 &dom);
-
+       result = rpccli_lsa_QueryInfoPolicy(pipe_hnd, mem_ctx,
+                                           &pol,
+                                           LSA_POLICY_INFO_AUDIT_EVENTS,
+                                           &info);
        {
-               const char *val = audit_policy_str(mem_ctx, dom.info.id2.auditsettings[audit_category]);
+               const char *val = audit_policy_str(mem_ctx, info.audit_events.settings[audit_category]);
                const char *policy = audit_description_str(audit_category);
                print_auditing_category(policy, val);
        }
@@ -209,11 +209,14 @@ static NTSTATUS rpc_audit_set_internal(const DOM_SID *domain_sid,
        if (!NT_STATUS_IS_OK(result)) {
                d_printf("failed to set audit policy: %s\n", nt_errstr(result));
        }
+
        return result;
 }
 
-static NTSTATUS rpc_audit_enable_internal_ext(struct rpc_pipe_client *pipe_hnd, 
+/********************************************************************
+********************************************************************/
+
+static NTSTATUS rpc_audit_enable_internal_ext(struct rpc_pipe_client *pipe_hnd,
                                              TALLOC_CTX *mem_ctx,
                                              int argc,
                                              const char **argv,
@@ -221,11 +224,9 @@ static NTSTATUS rpc_audit_enable_internal_ext(struct rpc_pipe_client *pipe_hnd,
 {
        POLICY_HND pol;
        NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
-       LSA_INFO_CTR dom;
-
-       uint32 info_class = 2;
+       union lsa_PolicyInformation info;
 
-       result = rpccli_lsa_open_policy(pipe_hnd, mem_ctx, True, 
+       result = rpccli_lsa_open_policy(pipe_hnd, mem_ctx, true,
                                        SEC_RIGHTS_MAXIMUM_ALLOWED,
                                        &pol);
 
@@ -233,19 +234,20 @@ static NTSTATUS rpc_audit_enable_internal_ext(struct rpc_pipe_client *pipe_hnd,
                goto done;
        }
 
-       result = rpccli_lsa_query_info_policy_new(pipe_hnd, mem_ctx, &pol, 
-                                                 info_class,
-                                                 &dom);
-
+       result = rpccli_lsa_QueryInfoPolicy(pipe_hnd, mem_ctx,
+                                           &pol,
+                                           LSA_POLICY_INFO_AUDIT_EVENTS,
+                                           &info);
        if (!NT_STATUS_IS_OK(result)) {
                goto done;
        }
 
-       dom.info.id2.auditing_enabled = enable;
+       info.audit_events.auditing_mode = enable;
 
-       result = rpccli_lsa_set_info_policy(pipe_hnd, mem_ctx, &pol, 
-                                           info_class,
-                                           dom);
+       result = rpccli_lsa_SetInfoPolicy(pipe_hnd, mem_ctx,
+                                         &pol,
+                                         LSA_POLICY_INFO_AUDIT_EVENTS,
+                                         &info);
 
        if (!NT_STATUS_IS_OK(result)) {
                goto done;
@@ -253,59 +255,60 @@ static NTSTATUS rpc_audit_enable_internal_ext(struct rpc_pipe_client *pipe_hnd,
 
  done:
        if (!NT_STATUS_IS_OK(result)) {
-               d_printf("failed to %s audit policy: %s\n", enable ? "enable":"disable", 
-                       nt_errstr(result));
+               d_printf("failed to %s audit policy: %s\n",
+                       enable ? "enable":"disable", nt_errstr(result));
        }
 
        return result;
 }
+
 /********************************************************************
 ********************************************************************/
 
 static NTSTATUS rpc_audit_disable_internal(const DOM_SID *domain_sid,
-                                          const char *domain_name, 
+                                          const char *domain_name,
                                           struct cli_state *cli,
                                           struct rpc_pipe_client *pipe_hnd,
-                                          TALLOC_CTX *mem_ctx, 
+                                          TALLOC_CTX *mem_ctx,
                                           int argc,
                                           const char **argv)
 {
-       return rpc_audit_enable_internal_ext(pipe_hnd, mem_ctx, argc, argv, False);
+       return rpc_audit_enable_internal_ext(pipe_hnd, mem_ctx, argc, argv,
+                                            false);
 }
 
 /********************************************************************
 ********************************************************************/
 
 static NTSTATUS rpc_audit_enable_internal(const DOM_SID *domain_sid,
-                                         const char *domain_name, 
+                                         const char *domain_name,
                                          struct cli_state *cli,
                                          struct rpc_pipe_client *pipe_hnd,
-                                         TALLOC_CTX *mem_ctx, 
+                                         TALLOC_CTX *mem_ctx,
                                          int argc,
                                          const char **argv)
 {
-       return rpc_audit_enable_internal_ext(pipe_hnd, mem_ctx, argc, argv, True);
+       return rpc_audit_enable_internal_ext(pipe_hnd, mem_ctx, argc, argv,
+                                            true);
 }
 
 /********************************************************************
 ********************************************************************/
 
 static NTSTATUS rpc_audit_list_internal(const DOM_SID *domain_sid,
-                                       const char *domain_name, 
+                                       const char *domain_name,
                                        struct cli_state *cli,
                                        struct rpc_pipe_client *pipe_hnd,
-                                       TALLOC_CTX *mem_ctx, 
+                                       TALLOC_CTX *mem_ctx,
                                        int argc,
                                        const char **argv)
 {
        POLICY_HND pol;
        NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
-       LSA_INFO_CTR dom;
+       union lsa_PolicyInformation info;
        int i;
 
-       uint32 info_class = 2;
-
-       result = rpccli_lsa_open_policy(pipe_hnd, mem_ctx, True, 
+       result = rpccli_lsa_open_policy(pipe_hnd, mem_ctx, true,
                                        SEC_RIGHTS_MAXIMUM_ALLOWED,
                                        &pol);
 
@@ -313,53 +316,52 @@ static NTSTATUS rpc_audit_list_internal(const DOM_SID *domain_sid,
                goto done;
        }
 
-       result = rpccli_lsa_query_info_policy_new(pipe_hnd, mem_ctx, &pol, 
-                                                 info_class,
-                                                 &dom);
-
+       result = rpccli_lsa_QueryInfoPolicy(pipe_hnd, mem_ctx,
+                                           &pol,
+                                           LSA_POLICY_INFO_AUDIT_EVENTS,
+                                           &info);
        if (!NT_STATUS_IS_OK(result)) {
                goto done;
        }
 
        printf("Auditing:\t\t");
-       switch (dom.info.id2.auditing_enabled) {
-               case True:
+       switch (info.audit_events.auditing_mode) {
+               case true:
                        printf("Enabled");
                        break;
-               case False:
+               case false:
                        printf("Disabled");
                        break;
                default:
-                       printf("unknown (%d)", dom.info.id2.auditing_enabled);
+                       printf("unknown (%d)", info.audit_events.auditing_mode);
                        break;
        }
        printf("\n");
 
-       printf("Auditing categories:\t%d\n", dom.info.id2.count1);
+       printf("Auditing categories:\t%d\n", info.audit_events.count);
        printf("Auditing settings:\n");
 
-       for (i=0; i < dom.info.id2.count1; i++) {
-               const char *val = audit_policy_str(mem_ctx, dom.info.id2.auditsettings[i]);
+       for (i=0; i < info.audit_events.count; i++) {
+               const char *val = audit_policy_str(mem_ctx, info.audit_events.settings[i]);
                const char *policy = audit_description_str(i);
                print_auditing_category(policy, val);
        }
 
  done:
        if (!NT_STATUS_IS_OK(result)) {
-               d_printf("failed to list auditing policies: %s\n", nt_errstr(result));
+               d_printf("failed to list auditing policies: %s\n",
+                       nt_errstr(result));
        }
 
        return result;
 }
 
-
-
 /********************************************************************
 ********************************************************************/
 
 static int rpc_audit_get(int argc, const char **argv)
 {
-       return run_rpc_command(NULL, PI_LSARPC, 0, 
+       return run_rpc_command(NULL, PI_LSARPC, 0,
                rpc_audit_get_internal, argc, argv);
 }
 
@@ -368,7 +370,7 @@ static int rpc_audit_get(int argc, const char **argv)
 
 static int rpc_audit_set(int argc, const char **argv)
 {
-       return run_rpc_command(NULL, PI_LSARPC, 0, 
+       return run_rpc_command(NULL, PI_LSARPC, 0,
                rpc_audit_set_internal, argc, argv);
 }
 
@@ -377,7 +379,7 @@ static int rpc_audit_set(int argc, const char **argv)
 
 static int rpc_audit_enable(int argc, const char **argv)
 {
-       return run_rpc_command(NULL, PI_LSARPC, 0, 
+       return run_rpc_command(NULL, PI_LSARPC, 0,
                rpc_audit_enable_internal, argc, argv);
 }
 
@@ -386,7 +388,7 @@ static int rpc_audit_enable(int argc, const char **argv)
 
 static int rpc_audit_disable(int argc, const char **argv)
 {
-       return run_rpc_command(NULL, PI_LSARPC, 0, 
+       return run_rpc_command(NULL, PI_LSARPC, 0,
                rpc_audit_disable_internal, argc, argv);
 }
 
@@ -395,14 +397,14 @@ static int rpc_audit_disable(int argc, const char **argv)
 
 static int rpc_audit_list(int argc, const char **argv)
 {
-       return run_rpc_command(NULL, PI_LSARPC, 0, 
+       return run_rpc_command(NULL, PI_LSARPC, 0,
                rpc_audit_list_internal, argc, argv);
 }
 
 /********************************************************************
 ********************************************************************/
 
-int net_rpc_audit(int argc, const char **argv) 
+int net_rpc_audit(int argc, const char **argv)
 {
        struct functable func[] = {
                {"get", rpc_audit_get},
@@ -412,9 +414,9 @@ int net_rpc_audit(int argc, const char **argv)
                {"list", rpc_audit_list},
                {NULL, NULL}
        };
-       
+
        if (argc)
                return net_run_function(argc, argv, func, net_help_audit);
-               
+
        return net_help_audit(argc, argv);
 }
index 0c25a5336528229bee7798d49b393d7d0561d37f..27819bb6ab865ffde82a20fc2360f5bd6d0fdb04 100644 (file)
                 goto done; \
         }
 
+static void init_lsa_String(struct lsa_String *name, const char *s)
+{
+       name->string = s;
+}
+
+
 /**
  * confirm that a domain join is still valid
  *
@@ -45,7 +51,7 @@ NTSTATUS net_rpc_join_ok(const char *domain, const char *server,
 {
        enum security_types sec;
        unsigned int conn_flags = NET_FLAGS_PDC;
-       uint32 neg_flags = NETLOGON_NEG_AUTH2_FLAGS|NETLOGON_NEG_SCHANNEL;
+       uint32 neg_flags = NETLOGON_NEG_SELECT_AUTH2_FLAGS|NETLOGON_NEG_SCHANNEL;
        struct cli_state *cli = NULL;
        struct rpc_pipe_client *pipe_hnd = NULL;
        struct rpc_pipe_client *netlogon_pipe = NULL;
@@ -132,7 +138,7 @@ int net_rpc_join_newstyle(int argc, const char **argv)
        struct cli_state *cli;
        TALLOC_CTX *mem_ctx;
         uint32 acb_info = ACB_WSTRUST;
-       uint32 neg_flags = NETLOGON_NEG_AUTH2_FLAGS|(lp_client_schannel() ? NETLOGON_NEG_SCHANNEL : 0);
+       uint32 neg_flags = NETLOGON_NEG_SELECT_AUTH2_FLAGS|(lp_client_schannel() ? NETLOGON_NEG_SCHANNEL : 0);
        uint32 sec_channel_type;
        struct rpc_pipe_client *pipe_hnd = NULL;
 
@@ -155,11 +161,14 @@ 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;
        const char *const_acct_name;
+       struct lsa_String lsa_acct_name;
+       uint32 acct_flags=0;
+       uint32_t access_granted = 0;
 
        /* check what type of join */
        if (argc >= 0) {
@@ -235,10 +244,12 @@ int net_rpc_join_newstyle(int argc, const char **argv)
                                       &sam_pol),
                      "could not connect to SAM database");
 
-       
-       CHECK_RPC_ERR(rpccli_samr_open_domain(pipe_hnd, mem_ctx, &sam_pol,
-                                          SEC_RIGHTS_MAXIMUM_ALLOWED,
-                                          domain_sid, &domain_pol),
+
+       CHECK_RPC_ERR(rpccli_samr_OpenDomain(pipe_hnd, mem_ctx,
+                                            &sam_pol,
+                                            SEC_RIGHTS_MAXIMUM_ALLOWED,
+                                            domain_sid,
+                                            &domain_pol),
                      "could not open domain");
 
        /* Create domain user */
@@ -249,10 +260,24 @@ int net_rpc_join_newstyle(int argc, const char **argv)
        strlower_m(acct_name);
        const_acct_name = acct_name;
 
-       result = rpccli_samr_create_dom_user(pipe_hnd, mem_ctx, &domain_pol,
-                                         acct_name, acb_info,
-                                         0xe005000b, &user_pol, 
-                                         &user_rid);
+       init_lsa_String(&lsa_acct_name, acct_name);
+
+       acct_flags = SEC_GENERIC_READ | SEC_GENERIC_WRITE | SEC_GENERIC_EXECUTE |
+                    SEC_STD_WRITE_DAC | SEC_STD_DELETE |
+                    SAMR_USER_ACCESS_SET_PASSWORD |
+                    SAMR_USER_ACCESS_GET_ATTRIBUTES |
+                    SAMR_USER_ACCESS_SET_ATTRIBUTES;
+
+       DEBUG(10, ("Creating account with flags: %d\n",acct_flags));
+
+       result = rpccli_samr_CreateUser2(pipe_hnd, mem_ctx,
+                                        &domain_pol,
+                                        &lsa_acct_name,
+                                        acb_info,
+                                        acct_flags,
+                                        &user_pol,
+                                        &access_granted,
+                                        &user_rid);
 
        if (!NT_STATUS_IS_OK(result) && 
            !NT_STATUS_EQUAL(result, NT_STATUS_USER_EXISTS)) {
@@ -271,7 +296,7 @@ int net_rpc_join_newstyle(int argc, const char **argv)
        /* We *must* do this.... don't ask... */
 
        if (NT_STATUS_IS_OK(result)) {
-               rpccli_samr_close(pipe_hnd, mem_ctx, &user_pol);
+               rpccli_samr_Close(pipe_hnd, mem_ctx, &user_pol);
        }
 
        CHECK_RPC_ERR_DEBUG(rpccli_samr_lookup_names(pipe_hnd, mem_ctx,
@@ -292,9 +317,11 @@ int net_rpc_join_newstyle(int argc, const char **argv)
        /* Open handle on user */
 
        CHECK_RPC_ERR_DEBUG(
-               rpccli_samr_open_user(pipe_hnd, mem_ctx, &domain_pol,
-                                  SEC_RIGHTS_MAXIMUM_ALLOWED,
-                                  user_rid, &user_pol),
+               rpccli_samr_OpenUser(pipe_hnd, mem_ctx,
+                                    &domain_pol,
+                                    SEC_RIGHTS_MAXIMUM_ALLOWED,
+                                    user_rid,
+                                    &user_pol),
                ("could not re-open existing user %s: %s\n",
                 acct_name, nt_errstr(result)));
        
@@ -344,7 +371,7 @@ int net_rpc_join_newstyle(int argc, const char **argv)
        result = rpccli_samr_set_userinfo2(pipe_hnd, mem_ctx, &user_pol, 16, 
                                        &cli->user_session_key, &ctr);
 
-       rpccli_samr_close(pipe_hnd, mem_ctx, &user_pol);
+       rpccli_samr_Close(pipe_hnd, mem_ctx, &user_pol);
        cli_rpc_pipe_close(pipe_hnd); /* Done with this pipe */
 
        /* Now check the whole process from top-to-bottom */
@@ -413,7 +440,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 23be8859e031052b5c3b5baf6e5ceefb9084ff32..5f222b8c7e946ca905f8d459ab0cc5f3a1250103 100644 (file)
@@ -28,9 +28,9 @@ static NTSTATUS sid_to_name(struct rpc_pipe_client *pipe_hnd,
                                fstring name)
 {
        POLICY_HND pol;
-       enum lsa_SidType *sid_types;
+       enum lsa_SidType *sid_types = NULL;
        NTSTATUS result;
-       char **domains, **names;
+       char **domains = NULL, **names = NULL;
 
        result = rpccli_lsa_open_policy(pipe_hnd, mem_ctx, True, 
                SEC_RIGHTS_MAXIMUM_ALLOWED, &pol);
@@ -202,7 +202,7 @@ static NTSTATUS enum_accounts_for_privilege(struct rpc_pipe_client *pipe_hnd,
        NTSTATUS result;
        uint32 enum_context=0;
        uint32 pref_max_length=0x1000;
-       DOM_SID *sids;
+       DOM_SID *sids = NULL;
        uint32 count=0;
        int i;
        fstring name;
index ca3279ee3acc6274aea2976fbb69f980baf23714..e1f0cd3751218226751011cdc1575e0ce6679461 100644 (file)
@@ -237,7 +237,7 @@ NTSTATUS rpc_samdump_internals(const DOM_SID *domain_sid,
 
        NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
        uchar trust_password[16];
-       uint32 neg_flags = NETLOGON_NEG_AUTH2_FLAGS;
+       uint32 neg_flags = NETLOGON_NEG_SELECT_AUTH2_FLAGS;
        uint32 sec_channel_type = 0;
 
        if (!secrets_fetch_trust_account_password(domain_name,
@@ -365,7 +365,8 @@ static NTSTATUS sam_account_from_delta(struct samu *account, SAM_ACCOUNT_INFO *d
                old_string = pdb_get_munged_dial(account);
                mung.length = delta->hdr_parameters.uni_str_len;
                mung.data = (uint8 *) delta->uni_parameters.buffer;
-               newstr = (mung.length == 0) ? NULL : base64_encode_data_blob(mung);
+               newstr = (mung.length == 0) ? NULL :
+                       base64_encode_data_blob(talloc_tos(), mung);
 
                if (STRING_CHANGED_NC(old_string, newstr))
                        pdb_set_munged_dial(account, newstr, PDB_CHANGED);
@@ -486,7 +487,7 @@ static NTSTATUS fetch_account_info(uint32 rid, SAM_ACCOUNT_INFO *delta)
                return NT_STATUS_NO_MEMORY;
        }
 
-       if (!(passwd = Get_Pwnam(account))) {
+       if (!(passwd = Get_Pwnam_alloc(sam_account, account))) {
                /* Create appropriate user */
                if (delta->acb_info & ACB_NORMAL) {
                        add_script = talloc_strdup(sam_account,
@@ -525,7 +526,7 @@ static NTSTATUS fetch_account_info(uint32 rid, SAM_ACCOUNT_INFO *delta)
                }
 
                /* try and find the possible unix account again */
-               if ( !(passwd = Get_Pwnam(account)) ) {
+               if ( !(passwd = Get_Pwnam_alloc(sam_account, account)) ) {
                        d_fprintf(stderr, "Could not create posix account info for '%s'\n", account);
                        nt_ret = NT_STATUS_NO_SUCH_USER;
                        goto done;
@@ -1422,12 +1423,11 @@ static int fprintf_attr(FILE *add_fd, const char *attr_name,
        base64_blob.data = (unsigned char *)value;
        base64_blob.length = strlen(value);
 
-       base64 = base64_encode_data_blob(base64_blob);
+       base64 = base64_encode_data_blob(value, base64_blob);
        SMB_ASSERT(base64 != NULL);
 
        res = fprintf(add_fd, "%s:: %s\n", attr_name, base64);
        TALLOC_FREE(value);
-       TALLOC_FREE(base64);
        return res;
 }
 
index ac0ffca1f3f9543a886a162626450fb418b4a8b6..12da031d4b36d5113204a696f84a1ba2355cb59e 100644 (file)
@@ -54,10 +54,12 @@ static NTSTATUS rpc_sh_acct_do(TALLOC_CTX *mem_ctx,
        }
        
        /* Get domain policy handle */
-       
-       result = rpccli_samr_open_domain(pipe_hnd, mem_ctx, &connect_pol,
-                                        MAXIMUM_ALLOWED_ACCESS,
-                                        ctx->domain_sid, &domain_pol);
+
+       result = rpccli_samr_OpenDomain(pipe_hnd, mem_ctx,
+                                       &connect_pol,
+                                       MAXIMUM_ALLOWED_ACCESS,
+                                       ctx->domain_sid,
+                                       &domain_pol);
        if (!NT_STATUS_IS_OK(result)) {
                goto done;
        }
@@ -118,10 +120,10 @@ static NTSTATUS rpc_sh_acct_do(TALLOC_CTX *mem_ctx,
 
  done:
        if (is_valid_policy_hnd(&domain_pol)) {
-               rpccli_samr_close(pipe_hnd, mem_ctx, &domain_pol);
+               rpccli_samr_Close(pipe_hnd, mem_ctx, &domain_pol);
        }
        if (is_valid_policy_hnd(&connect_pol)) {
-               rpccli_samr_close(pipe_hnd, mem_ctx, &connect_pol);
+               rpccli_samr_Close(pipe_hnd, mem_ctx, &connect_pol);
        }
 
        return result;
index bd1f6cd6861deb0c629410db25e286be6f10d9a0..52f8f911e103140f6ea7e8a9642cf1e3214a6b35 100644 (file)
@@ -1135,7 +1135,7 @@ static int net_sam_do_list(int argc, const char **argv,
                }
        }
 
-       search->search_end(search);
+       pdb_search_destroy(search);
        return 0;
 }
 
index 7e2771c9003e61baecdc4927668904dd1fa5b3fb..a3a403d7bdf4e64bb330378fb24502fd9516c80e 100644 (file)
@@ -1,23 +1,24 @@
-/* 
+/*
    Unix SMB/CIFS implementation.
 
    Winbind status program.
 
    Copyright (C) Tim Potter      2000-2003
    Copyright (C) Andrew Bartlett <abartlet@samba.org> 2003-2004
-   Copyright (C) Francesco Chemolli <kinkie@kame.usr.dsi.unimi.it> 2000 
+   Copyright (C) Francesco Chemolli <kinkie@kame.usr.dsi.unimi.it> 2000
    Copyright (C) Robert O'Callahan 2006 (added cached credential code).
+   Copyright (C) Kai Blin <kai@samba.org> 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/>.
 */
@@ -28,7 +29,8 @@
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_WINBIND
 
-#define SQUID_BUFFER_SIZE 2010
+#define INITIAL_BUFFER_SIZE 300
+#define MAX_BUFFER_SIZE 630000
 
 enum stdio_helper_mode {
        SQUID_2_4_BASIC,
@@ -42,28 +44,56 @@ enum stdio_helper_mode {
        NUM_HELPER_MODES
 };
 
-typedef void (*stdio_helper_function)(enum stdio_helper_mode stdio_helper_mode, 
-                                    char *buf, int length);
+enum ntlm_auth_cli_state {
+       CLIENT_INITIAL = 0,
+       CLIENT_RESPONSE,
+       CLIENT_FINISHED,
+       CLIENT_ERROR
+};
+
+enum ntlm_auth_svr_state {
+       SERVER_INITIAL = 0,
+       SERVER_CHALLENGE,
+       SERVER_FINISHED,
+       SERVER_ERROR
+};
+
+struct ntlm_auth_state {
+       TALLOC_CTX *mem_ctx;
+       enum stdio_helper_mode helper_mode;
+       enum ntlm_auth_cli_state cli_state;
+       enum ntlm_auth_svr_state svr_state;
+       struct ntlmssp_state *ntlmssp_state;
+       uint32_t neg_flags;
+       char *want_feature_list;
+       bool have_session_key;
+       DATA_BLOB session_key;
+       DATA_BLOB initial_message;
+};
+
+typedef void (*stdio_helper_function)(struct ntlm_auth_state *state, char *buf,
+                                       int length);
 
-static void manage_squid_basic_request (enum stdio_helper_mode stdio_helper_mode, 
+static void manage_squid_basic_request (struct ntlm_auth_state *state,
                                        char *buf, int length);
 
-static void manage_squid_ntlmssp_request (enum stdio_helper_mode stdio_helper_mode, 
-                                         char *buf, int length);
+static void manage_squid_ntlmssp_request (struct ntlm_auth_state *state,
+                                       char *buf, int length);
 
-static void manage_client_ntlmssp_request (enum stdio_helper_mode stdio_helper_mode, 
-                                          char *buf, int length);
+static void manage_client_ntlmssp_request (struct ntlm_auth_state *state,
+                                       char *buf, int length);
 
-static void manage_gss_spnego_request (enum stdio_helper_mode stdio_helper_mode, 
-                                      char *buf, int length);
+static void manage_gss_spnego_request (struct ntlm_auth_state *state,
+                                       char *buf, int length);
 
-static void manage_gss_spnego_client_request (enum stdio_helper_mode stdio_helper_mode, 
-                                             char *buf, int length);
+static void manage_gss_spnego_client_request (struct ntlm_auth_state *state,
+                                       char *buf, int length);
 
-static void manage_ntlm_server_1_request (enum stdio_helper_mode stdio_helper_mode, 
-                                         char *buf, int length);
+static void manage_ntlm_server_1_request (struct ntlm_auth_state *state,
+                                       char *buf, int length);
 
-static void manage_ntlm_change_password_1_request(enum stdio_helper_mode helper_mode, char *buf, int length);
+static void manage_ntlm_change_password_1_request(struct ntlm_auth_state *state,
+                                       char *buf, int length);
 
 static const struct {
        enum stdio_helper_mode mode;
@@ -123,7 +153,7 @@ static char winbind_separator(void)
                d_printf("winbind separator was NULL!\n");
                return *lp_winbind_separator();
        }
-       
+
        return sep;
 }
 
@@ -679,14 +709,9 @@ static NTSTATUS do_ccache_ntlm_auth(DATA_BLOB initial_msg, DATA_BLOB challenge_m
        return NT_STATUS_MORE_PROCESSING_REQUIRED;
 }
 
-static void manage_squid_ntlmssp_request(enum stdio_helper_mode stdio_helper_mode, 
-                                        char *buf, int length) 
+static void manage_squid_ntlmssp_request(struct ntlm_auth_state *state,
+                                               char *buf, int length)
 {
-       static NTLMSSP_STATE *ntlmssp_state = NULL;
-       static char* want_feature_list = NULL;
-       static uint32 neg_flags = 0;
-       static bool have_session_key = False;
-       static DATA_BLOB session_key;
        DATA_BLOB request, reply;
        NTSTATUS nt_status;
 
@@ -699,8 +724,9 @@ static void manage_squid_ntlmssp_request(enum stdio_helper_mode stdio_helper_mod
        if (strlen(buf) > 3) {
                if(strncmp(buf, "SF ", 3) == 0){
                        DEBUG(10, ("Setting flags to negotioate\n"));
-                       SAFE_FREE(want_feature_list);
-                       want_feature_list = SMB_STRNDUP(buf+3, strlen(buf)-3);
+                       TALLOC_FREE(state->want_feature_list);
+                       state->want_feature_list = talloc_strdup(state->mem_ctx,
+                                       buf+3);
                        x_fprintf(x_stdout, "OK\n");
                        return;
                }
@@ -710,9 +736,11 @@ static void manage_squid_ntlmssp_request(enum stdio_helper_mode stdio_helper_mod
        }
 
        if ((strncmp(buf, "PW ", 3) == 0)) {
-               /* The calling application wants us to use a local password (rather than winbindd) */
+               /* The calling application wants us to use a local password
+                * (rather than winbindd) */
 
-               opt_password = SMB_STRNDUP((const char *)request.data, request.length);
+               opt_password = SMB_STRNDUP((const char *)request.data,
+                               request.length);
 
                if (opt_password == NULL) {
                        DEBUG(1, ("Out of memory\n"));
@@ -727,25 +755,33 @@ static void manage_squid_ntlmssp_request(enum stdio_helper_mode stdio_helper_mod
        }
 
        if (strncmp(buf, "YR", 2) == 0) {
-               if (ntlmssp_state)
-                       ntlmssp_end(&ntlmssp_state);
+               if (state->ntlmssp_state)
+                       ntlmssp_end(&state->ntlmssp_state);
+               state->svr_state = SERVER_INITIAL;
        } else if (strncmp(buf, "KK", 2) == 0) {
-               
+               /* No special preprocessing required */
        } else if (strncmp(buf, "GF", 2) == 0) {
                DEBUG(10, ("Requested negotiated NTLMSSP flags\n"));
-               x_fprintf(x_stdout, "GF 0x%08lx\n", have_session_key?neg_flags:0l);
+
+               if (state->svr_state == SERVER_FINISHED) {
+                       x_fprintf(x_stdout, "GF 0x%08x\n", state->neg_flags);
+               }
+               else {
+                       x_fprintf(x_stdout, "BH\n");
+               }
                data_blob_free(&request);
                return;
        } else if (strncmp(buf, "GK", 2) == 0) {
                DEBUG(10, ("Requested NTLMSSP session key\n"));
-               if(have_session_key) {
-                       char *key64 = base64_encode_data_blob(session_key);
+               if(state->have_session_key) {
+                       char *key64 = base64_encode_data_blob(state->mem_ctx,
+                                       state->session_key);
                        x_fprintf(x_stdout, "GK %s\n", key64?key64:"<NULL>");
                        TALLOC_FREE(key64);
                } else {
                        x_fprintf(x_stdout, "BH\n");
                }
-                       
+
                data_blob_free(&request);
                return;
        } else {
@@ -754,65 +790,62 @@ static void manage_squid_ntlmssp_request(enum stdio_helper_mode stdio_helper_mod
                return;
        }
 
-       if (!ntlmssp_state) {
-               if (!NT_STATUS_IS_OK(nt_status = ntlm_auth_start_ntlmssp_server(&ntlmssp_state))) {
+       if (!state->ntlmssp_state) {
+               nt_status = ntlm_auth_start_ntlmssp_server(
+                               &state->ntlmssp_state);
+               if (!NT_STATUS_IS_OK(nt_status)) {
                        x_fprintf(x_stdout, "BH %s\n", nt_errstr(nt_status));
                        return;
                }
-               ntlmssp_want_feature_list(ntlmssp_state, want_feature_list);
+               ntlmssp_want_feature_list(state->ntlmssp_state,
+                               state->want_feature_list);
        }
 
        DEBUG(10, ("got NTLMSSP packet:\n"));
        dump_data(10, request.data, request.length);
 
-       nt_status = ntlmssp_update(ntlmssp_state, request, &reply);
-       
+       nt_status = ntlmssp_update(state->ntlmssp_state, request, &reply);
+
        if (NT_STATUS_EQUAL(nt_status, NT_STATUS_MORE_PROCESSING_REQUIRED)) {
-               char *reply_base64 = base64_encode_data_blob(reply);
+               char *reply_base64 = base64_encode_data_blob(state->mem_ctx,
+                               reply);
                x_fprintf(x_stdout, "TT %s\n", reply_base64);
                TALLOC_FREE(reply_base64);
                data_blob_free(&reply);
+               state->svr_state = SERVER_CHALLENGE;
                DEBUG(10, ("NTLMSSP challenge\n"));
        } else if (NT_STATUS_EQUAL(nt_status, NT_STATUS_ACCESS_DENIED)) {
                x_fprintf(x_stdout, "BH %s\n", nt_errstr(nt_status));
                DEBUG(0, ("NTLMSSP BH: %s\n", nt_errstr(nt_status)));
 
-               ntlmssp_end(&ntlmssp_state);
+               ntlmssp_end(&state->ntlmssp_state);
        } else if (!NT_STATUS_IS_OK(nt_status)) {
                x_fprintf(x_stdout, "NA %s\n", nt_errstr(nt_status));
                DEBUG(10, ("NTLMSSP %s\n", nt_errstr(nt_status)));
        } else {
-               x_fprintf(x_stdout, "AF %s\n", (char *)ntlmssp_state->auth_context);
+               x_fprintf(x_stdout, "AF %s\n",
+                               (char *)state->ntlmssp_state->auth_context);
                DEBUG(10, ("NTLMSSP OK!\n"));
-               
-               if(have_session_key)
-                       data_blob_free(&session_key);
-               session_key = data_blob(ntlmssp_state->session_key.data, 
-                               ntlmssp_state->session_key.length);
-               neg_flags = ntlmssp_state->neg_flags;
-               have_session_key = True;
+
+               if(state->have_session_key)
+                       data_blob_free(&state->session_key);
+               state->session_key = data_blob(
+                               state->ntlmssp_state->session_key.data,
+                               state->ntlmssp_state->session_key.length);
+               state->neg_flags = state->ntlmssp_state->neg_flags;
+               state->have_session_key = true;
+               state->svr_state = SERVER_FINISHED;
        }
 
        data_blob_free(&request);
 }
 
-static void manage_client_ntlmssp_request(enum stdio_helper_mode stdio_helper_mode, 
-                                        char *buf, int length) 
+static void manage_client_ntlmssp_request(struct ntlm_auth_state *state,
+                                               char *buf, int length)
 {
-       /* The statics here are *HORRIBLE* and this entire concept
-          needs to be rewritten. Essentially it's using these statics
-          as the state in a state machine. BLEEEGH ! JRA. */
-
-       static NTLMSSP_STATE *ntlmssp_state = NULL;
-       static DATA_BLOB initial_message;
-       static char* want_feature_list = NULL;
-       static uint32 neg_flags = 0;
-       static bool have_session_key = False;
-       static DATA_BLOB session_key;
        DATA_BLOB request, reply;
        NTSTATUS nt_status;
-       bool first = False;
-       
+
        if (!opt_username || !*opt_username) {
                x_fprintf(x_stderr, "username must be specified!\n\n");
                exit(1);
@@ -827,8 +860,9 @@ static void manage_client_ntlmssp_request(enum stdio_helper_mode stdio_helper_mo
        if (strlen(buf) > 3) {
                if(strncmp(buf, "SF ", 3) == 0) {
                        DEBUG(10, ("Looking for flags to negotiate\n"));
-                       SAFE_FREE(want_feature_list);
-                       want_feature_list = SMB_STRNDUP(buf+3, strlen(buf)-3);
+                       talloc_free(state->want_feature_list);
+                       state->want_feature_list = talloc_strdup(state->mem_ctx,
+                                       buf+3);
                        x_fprintf(x_stdout, "OK\n");
                        return;
                }
@@ -840,7 +874,8 @@ static void manage_client_ntlmssp_request(enum stdio_helper_mode stdio_helper_mo
        if (strncmp(buf, "PW ", 3) == 0) {
                /* We asked for a password and obviously got it :-) */
 
-               opt_password = SMB_STRNDUP((const char *)request.data, request.length);
+               opt_password = SMB_STRNDUP((const char *)request.data,
+                               request.length);
 
                if (opt_password == NULL) {
                        DEBUG(1, ("Out of memory\n"));
@@ -854,8 +889,8 @@ static void manage_client_ntlmssp_request(enum stdio_helper_mode stdio_helper_mo
                return;
        }
 
-       if (!ntlmssp_state && use_cached_creds) {
-               /* check whether credentials are usable. */
+       if (!state->ntlmssp_state && use_cached_creds) {
+               /* check whether cached credentials are usable. */
                DATA_BLOB empty_blob = data_blob_null;
 
                nt_status = do_ccache_ntlm_auth(empty_blob, empty_blob, NULL);
@@ -866,30 +901,39 @@ static void manage_client_ntlmssp_request(enum stdio_helper_mode stdio_helper_mo
        }
 
        if (opt_password == NULL && !use_cached_creds) {
-               
                /* Request a password from the calling process.  After
-                  sending it, the calling process should retry asking for the negotiate. */
-               
+                  sending it, the calling process should retry asking for the
+                  negotiate. */
+
                DEBUG(10, ("Requesting password\n"));
                x_fprintf(x_stdout, "PW\n");
                return;
        }
 
        if (strncmp(buf, "YR", 2) == 0) {
-               if (ntlmssp_state)
-                       ntlmssp_end(&ntlmssp_state);
+               if (state->ntlmssp_state)
+                       ntlmssp_end(&state->ntlmssp_state);
+               state->cli_state = CLIENT_INITIAL;
        } else if (strncmp(buf, "TT", 2) == 0) {
-               
+               /* No special preprocessing required */
        } else if (strncmp(buf, "GF", 2) == 0) {
                DEBUG(10, ("Requested negotiated NTLMSSP flags\n"));
-               x_fprintf(x_stdout, "GF 0x%08lx\n", have_session_key?neg_flags:0l);
+
+               if(state->cli_state == CLIENT_FINISHED) {
+                       x_fprintf(x_stdout, "GF 0x%08x\n", state->neg_flags);
+               }
+               else {
+                       x_fprintf(x_stdout, "BH\n");
+               }
+
                data_blob_free(&request);
                return;
        } else if (strncmp(buf, "GK", 2) == 0 ) {
                DEBUG(10, ("Requested session key\n"));
 
-               if(have_session_key) {
-                       char *key64 = base64_encode_data_blob(session_key);
+               if(state->cli_state == CLIENT_FINISHED) {
+                       char *key64 = base64_encode_data_blob(state->mem_ctx,
+                                       state->session_key);
                        x_fprintf(x_stdout, "GK %s\n", key64?key64:"<NULL>");
                        TALLOC_FREE(key64);
                }
@@ -905,67 +949,75 @@ static void manage_client_ntlmssp_request(enum stdio_helper_mode stdio_helper_mo
                return;
        }
 
-       if (!ntlmssp_state) {
-               if (!NT_STATUS_IS_OK(nt_status = ntlm_auth_start_ntlmssp_client(&ntlmssp_state))) {
+       if (!state->ntlmssp_state) {
+               nt_status = ntlm_auth_start_ntlmssp_client(
+                               &state->ntlmssp_state);
+               if (!NT_STATUS_IS_OK(nt_status)) {
                        x_fprintf(x_stdout, "BH %s\n", nt_errstr(nt_status));
                        return;
                }
-               ntlmssp_want_feature_list(ntlmssp_state, want_feature_list);
-               first = True;
-               initial_message = data_blob_null;
+               ntlmssp_want_feature_list(state->ntlmssp_state,
+                               state->want_feature_list);
+               state->initial_message = data_blob_null;
        }
 
        DEBUG(10, ("got NTLMSSP packet:\n"));
        dump_data(10, request.data, request.length);
 
-       if (use_cached_creds && !opt_password && !first) {
-               nt_status = do_ccache_ntlm_auth(initial_message, request, &reply);
+       if (use_cached_creds && !opt_password &&
+                       (state->cli_state == CLIENT_RESPONSE)) {
+               nt_status = do_ccache_ntlm_auth(state->initial_message, request,
+                               &reply);
        } else {
-               nt_status = ntlmssp_update(ntlmssp_state, request, &reply);
+               nt_status = ntlmssp_update(state->ntlmssp_state, request,
+                               &reply);
        }
-       
+
        if (NT_STATUS_EQUAL(nt_status, NT_STATUS_MORE_PROCESSING_REQUIRED)) {
-               char *reply_base64 = base64_encode_data_blob(reply);
-               if (first) {
+               char *reply_base64 = base64_encode_data_blob(state->mem_ctx,
+                               reply);
+               if (state->cli_state == CLIENT_INITIAL) {
                        x_fprintf(x_stdout, "YR %s\n", reply_base64);
-               } else { 
-                       x_fprintf(x_stdout, "KK %s\n", reply_base64);
-               }
-               TALLOC_FREE(reply_base64);
-               if (first) {
-                       initial_message = reply;
+                       state->initial_message = reply;
+                       state->cli_state = CLIENT_RESPONSE;
                } else {
+                       x_fprintf(x_stdout, "KK %s\n", reply_base64);
                        data_blob_free(&reply);
                }
+               TALLOC_FREE(reply_base64);
                DEBUG(10, ("NTLMSSP challenge\n"));
        } else if (NT_STATUS_IS_OK(nt_status)) {
-               char *reply_base64 = base64_encode_data_blob(reply);
+               char *reply_base64 = base64_encode_data_blob(talloc_tos(),
+                               reply);
                x_fprintf(x_stdout, "AF %s\n", reply_base64);
                TALLOC_FREE(reply_base64);
 
-               if(have_session_key)
-                       data_blob_free(&session_key);
+               if(state->have_session_key)
+                       data_blob_free(&state->session_key);
 
-               session_key = data_blob(ntlmssp_state->session_key.data, 
-                               ntlmssp_state->session_key.length);
-               neg_flags = ntlmssp_state->neg_flags;
-               have_session_key = True;
+               state->session_key = data_blob(
+                               state->ntlmssp_state->session_key.data,
+                               state->ntlmssp_state->session_key.length);
+               state->neg_flags = state->ntlmssp_state->neg_flags;
+               state->have_session_key = true;
 
                DEBUG(10, ("NTLMSSP OK!\n"));
-               if (ntlmssp_state)
-                       ntlmssp_end(&ntlmssp_state);
+               state->cli_state = CLIENT_FINISHED;
+               if (state->ntlmssp_state)
+                       ntlmssp_end(&state->ntlmssp_state);
        } else {
                x_fprintf(x_stdout, "BH %s\n", nt_errstr(nt_status));
                DEBUG(0, ("NTLMSSP BH: %s\n", nt_errstr(nt_status)));
-               if (ntlmssp_state)
-                       ntlmssp_end(&ntlmssp_state);
+               state->cli_state = CLIENT_ERROR;
+               if (state->ntlmssp_state)
+                       ntlmssp_end(&state->ntlmssp_state);
        }
 
        data_blob_free(&request);
 }
 
-static void manage_squid_basic_request(enum stdio_helper_mode stdio_helper_mode, 
-                                      char *buf, int length) 
+static void manage_squid_basic_request(struct ntlm_auth_state *state,
+                                       char *buf, int length)
 {
        char *user, *pass;      
        user=buf;
@@ -979,7 +1031,7 @@ static void manage_squid_basic_request(enum stdio_helper_mode stdio_helper_mode,
        *pass='\0';
        pass++;
        
-       if (stdio_helper_mode == SQUID_2_5_BASIC) {
+       if (state->helper_mode == SQUID_2_5_BASIC) {
                rfc1738_unescape(user);
                rfc1738_unescape(pass);
        }
@@ -1039,7 +1091,7 @@ static void offer_gss_spnego_mechs(void) {
                return;
        }
 
-       reply_base64 = base64_encode_data_blob(token);
+       reply_base64 = base64_encode_data_blob(talloc_tos(), token);
        x_fprintf(x_stdout, "TT %s *\n", reply_base64);
 
        TALLOC_FREE(reply_base64);
@@ -1048,8 +1100,8 @@ static void offer_gss_spnego_mechs(void) {
        return;
 }
 
-static void manage_gss_spnego_request(enum stdio_helper_mode stdio_helper_mode, 
-                                     char *buf, int length) 
+static void manage_gss_spnego_request(struct ntlm_auth_state *state,
+                                       char *buf, int length)
 {
        static NTLMSSP_STATE *ntlmssp_state = NULL;
        SPNEGO_DATA request, response;
@@ -1163,6 +1215,7 @@ static void manage_gss_spnego_request(enum stdio_helper_mode stdio_helper_mode,
                        char *principal;
                        DATA_BLOB ap_rep;
                        DATA_BLOB session_key;
+                       PAC_DATA *pac_data = NULL;
 
                        if ( request.negTokenInit.mechToken.data == NULL ) {
                                DEBUG(1, ("Client did not provide Kerberos data\n"));
@@ -1177,7 +1230,7 @@ static void manage_gss_spnego_request(enum stdio_helper_mode stdio_helper_mode,
 
                        status = ads_verify_ticket(mem_ctx, lp_realm(), 0,
                                                   &request.negTokenInit.mechToken,
-                                                  &principal, NULL, &ap_rep,
+                                                  &principal, &pac_data, &ap_rep,
                                                   &session_key, True);
 
                        talloc_destroy(mem_ctx);
@@ -1275,7 +1328,7 @@ static void manage_gss_spnego_request(enum stdio_helper_mode stdio_helper_mode,
                return;
        }
 
-       reply_base64 = base64_encode_data_blob(token);
+       reply_base64 = base64_encode_data_blob(talloc_tos(), token);
 
        x_fprintf(x_stdout, "%s %s %s\n",
                  reply_code, reply_base64, reply_argument);
@@ -1342,7 +1395,7 @@ static bool manage_client_ntlmssp_init(SPNEGO_DATA spnego)
        write_spnego_data(&to_server, &spnego);
        data_blob_free(&spnego.negTokenInit.mechToken);
 
-       to_server_base64 = base64_encode_data_blob(to_server);
+       to_server_base64 = base64_encode_data_blob(talloc_tos(), to_server);
        data_blob_free(&to_server);
        x_fprintf(x_stdout, "KK %s\n", to_server_base64);
        TALLOC_FREE(to_server_base64);
@@ -1400,7 +1453,7 @@ static void manage_client_ntlmssp_targ(SPNEGO_DATA spnego)
        write_spnego_data(&to_server, &spnego);
        data_blob_free(&request);
 
-       to_server_base64 = base64_encode_data_blob(to_server);
+       to_server_base64 = base64_encode_data_blob(talloc_tos(), to_server);
        data_blob_free(&to_server);
        x_fprintf(x_stdout, "KK %s\n", to_server_base64);
        TALLOC_FREE(to_server_base64);
@@ -1489,7 +1542,7 @@ static bool manage_client_krb5_init(SPNEGO_DATA spnego)
                return False;
        }
 
-       reply_base64 = base64_encode_data_blob(to_server);
+       reply_base64 = base64_encode_data_blob(talloc_tos(), to_server);
        x_fprintf(x_stdout, "KK %s *\n", reply_base64);
 
        TALLOC_FREE(reply_base64);
@@ -1521,8 +1574,8 @@ static void manage_client_krb5_targ(SPNEGO_DATA spnego)
 
 #endif
 
-static void manage_gss_spnego_client_request(enum stdio_helper_mode stdio_helper_mode, 
-                                            char *buf, int length) 
+static void manage_gss_spnego_client_request(struct ntlm_auth_state *state,
+                                               char *buf, int length)
 {
        DATA_BLOB request;
        SPNEGO_DATA spnego;
@@ -1659,8 +1712,8 @@ static void manage_gss_spnego_client_request(enum stdio_helper_mode stdio_helper
        return;
 }
 
-static void manage_ntlm_server_1_request(enum stdio_helper_mode stdio_helper_mode, 
-                                        char *buf, int length) 
+static void manage_ntlm_server_1_request(struct ntlm_auth_state *state,
+                                               char *buf, int length)
 {
        char *request, *parameter;      
        static DATA_BLOB challenge;
@@ -1852,7 +1905,8 @@ static void manage_ntlm_server_1_request(enum stdio_helper_mode stdio_helper_mod
        }
 }
 
-static void manage_ntlm_change_password_1_request(enum stdio_helper_mode helper_mode, char *buf, int length)
+static void manage_ntlm_change_password_1_request(struct ntlm_auth_state *state,
+                                                       char *buf, int length)
 {
        char *request, *parameter;      
        static DATA_BLOB new_nt_pswd;
@@ -2062,57 +2116,93 @@ static void manage_ntlm_change_password_1_request(enum stdio_helper_mode helper_
        }
 }
 
-static void manage_squid_request(enum stdio_helper_mode helper_mode, stdio_helper_function fn) 
+static void manage_squid_request(struct ntlm_auth_state *state,
+               stdio_helper_function fn)
 {
-       char buf[SQUID_BUFFER_SIZE+1];
-       int length;
+       char *buf;
+       char tmp[INITIAL_BUFFER_SIZE+1];
+       int length, buf_size = 0;
        char *c;
-       static bool err;
 
-       /* this is not a typo - x_fgets doesn't work too well under squid */
-       if (fgets(buf, sizeof(buf)-1, stdin) == NULL) {
-               if (ferror(stdin)) {
-                       DEBUG(1, ("fgets() failed! dying..... errno=%d (%s)\n", ferror(stdin),
-                                 strerror(ferror(stdin))));
-                       
-                       exit(1);    /* BIIG buffer */
-               }
-               exit(0);
-       }
-    
-       c=(char *)memchr(buf,'\n',sizeof(buf)-1);
-       if (c) {
-               *c = '\0';
-               length = c-buf;
-       } else {
-               err = 1;
-               return;
-       }
-       if (err) {
-               DEBUG(2, ("Oversized message\n"));
+       buf = talloc_strdup(state->mem_ctx, "");
+       if (!buf) {
+               DEBUG(0, ("Failed to allocate input buffer.\n"));
                x_fprintf(x_stderr, "ERR\n");
-               err = 0;
-               return;
+               exit(1);
        }
 
+       do {
+
+               /* this is not a typo - x_fgets doesn't work too well under
+                * squid */
+               if (fgets(tmp, sizeof(tmp)-1, stdin) == NULL) {
+                       if (ferror(stdin)) {
+                               DEBUG(1, ("fgets() failed! dying..... errno=%d "
+                                         "(%s)\n", ferror(stdin),
+                                         strerror(ferror(stdin))));
+
+                               exit(1);
+                       }
+                       exit(0);
+               }
+
+               buf = talloc_strdup_append_buffer(buf, tmp);
+               buf_size += INITIAL_BUFFER_SIZE;
+
+               if (buf_size > MAX_BUFFER_SIZE) {
+                       DEBUG(2, ("Oversized message\n"));
+                       x_fprintf(x_stderr, "ERR\n");
+                       talloc_free(buf);
+                       return;
+               }
+
+               c = strchr(buf, '\n');
+       } while (c == NULL);
+
+       *c = '\0';
+       length = c-buf;
+
        DEBUG(10, ("Got '%s' from squid (length: %d).\n",buf,length));
 
        if (buf[0] == '\0') {
                DEBUG(2, ("Invalid Request\n"));
                x_fprintf(x_stderr, "ERR\n");
+               talloc_free(buf);
                return;
        }
-       
-       fn(helper_mode, buf, length);
+
+       fn(state, buf, length);
+       talloc_free(buf);
 }
 
 
 static void squid_stream(enum stdio_helper_mode stdio_mode, stdio_helper_function fn) {
+       TALLOC_CTX *mem_ctx;
+       struct ntlm_auth_state *state;
+
        /* initialize FDescs */
        x_setbuf(x_stdout, NULL);
        x_setbuf(x_stderr, NULL);
+
+       mem_ctx = talloc_init("ntlm_auth");
+       if (!mem_ctx) {
+               DEBUG(0, ("squid_stream: Failed to create talloc context\n"));
+               x_fprintf(x_stderr, "ERR\n");
+               exit(1);
+       }
+
+       state = talloc_zero(mem_ctx, struct ntlm_auth_state);
+       if (!state) {
+               DEBUG(0, ("squid_stream: Failed to talloc ntlm_auth_state\n"));
+               x_fprintf(x_stderr, "ERR\n");
+               exit(1);
+       }
+
+       state->mem_ctx = mem_ctx;
+       state->helper_mode = stdio_mode;
+
        while(1) {
-               manage_squid_request(stdio_mode, fn);
+               manage_squid_request(state, fn);
        }
 }
 
@@ -2232,7 +2322,8 @@ enum {
                { "use-cached-creds", 0, POPT_ARG_NONE, &use_cached_creds, OPT_USE_CACHED_CREDS, "Use cached credentials if no password is given"},
                { "diagnostics", 0, POPT_ARG_NONE, &diagnostics, OPT_DIAGNOSTICS, "Perform diagnostics on the authentictaion chain"},
                { "require-membership-of", 0, POPT_ARG_STRING, &require_membership_of, OPT_REQUIRE_MEMBERSHIP, "Require that a user be a member of this group (either name or SID) for authentication to succeed" },
-               POPT_COMMON_SAMBA
+               POPT_COMMON_CONFIGFILE
+               POPT_COMMON_VERSION
                POPT_TABLEEND
        };
 
@@ -2240,14 +2331,6 @@ enum {
        load_case_tables();
 
        dbf = x_stderr;
-       
-       /* Samba client initialisation */
-
-       if (!lp_load(get_dyn_CONFIGFILE(), True, False, False, True)) {
-               d_fprintf(stderr, "ntlm_auth: error opening config file %s. Error was %s\n",
-                       get_dyn_CONFIGFILE(), strerror(errno));
-               exit(1);
-       }
 
        /* Parse options */
 
@@ -2260,6 +2343,18 @@ enum {
                return 1;
        }
 
+       while((opt = poptGetNextOpt(pc)) != -1) {
+               /* Get generic config options like --configfile */
+       }
+
+       poptFreeContext(pc);
+
+       if (!lp_load(get_dyn_CONFIGFILE(), True, False, False, True)) {
+               d_fprintf(stderr, "ntlm_auth: error opening config file %s. Error was %s\n",
+                       get_dyn_CONFIGFILE(), strerror(errno));
+               exit(1);
+       }
+
        pc = poptGetContext(NULL, argc, (const char **)argv, long_options, 
                            POPT_CONTEXT_KEEP_FIRST);
 
index 6884783396f7dd10273610be23795a0d5903956d..e1d6709073aee32bdca32469e8f776ddd0f9166f 100644 (file)
@@ -61,69 +61,85 @@ static int export_database (struct pdb_methods *in,
                             struct pdb_methods *out, 
                             const char *username) 
 {
-       struct samu *user = NULL;
        NTSTATUS status;
+       struct pdb_search *u_search;
+       struct samr_displayentry userentry;
 
        DEBUG(3, ("export_database: username=\"%s\"\n", username ? username : "(NULL)"));
 
-       status = in->setsampwent(in, 0, 0);
-       if ( NT_STATUS_IS_ERR(status) ) {
-               fprintf(stderr, "Unable to set account database iterator for %s!\n", 
-                       in->name);
+       u_search = pdb_search_init(PDB_USER_SEARCH);
+       if (u_search == NULL) {
+               DEBUG(0, ("pdb_search_init failed\n"));
                return 1;
        }
 
-       if ( ( user = samu_new( NULL ) ) == NULL ) {
-               fprintf(stderr, "export_database: Memory allocation failure!\n");
+       if (!in->search_users(in, u_search, 0)) {
+               DEBUG(0, ("Could not start searching users\n"));
+               pdb_search_destroy(u_search);
                return 1;
        }
 
-       while ( NT_STATUS_IS_OK(in->getsampwent(in, user)) ) 
-       {
-               DEBUG(4, ("Processing account %s\n", user->username));
+       while (u_search->next_entry(u_search, &userentry)) {
+               struct samu *user;
+               struct samu *account;
+               DOM_SID user_sid;
 
-               /* If we don't have a specific user or if we do and 
-                  the login name matches */
+               DEBUG(4, ("Processing account %s\n", userentry.account_name));
 
-               if ( !username || (strcmp(username, user->username) == 0)) {
-                       struct samu *account;
+               if ((username != NULL)
+                   && (strcmp(username, userentry.account_name) != 0)) {
+                       /*
+                        * ignore unwanted users
+                        */
+                       continue;
+               }
 
-                       if ( (account = samu_new( NULL )) == NULL ) {
-                               fprintf(stderr, "export_database: Memory allocation failure!\n");
-                               TALLOC_FREE( user );
-                               in->endsampwent( in );
-                               return 1;
-                       }
+               user = samu_new(talloc_tos());
+               if (user == NULL) {
+                       DEBUG(0, ("talloc failed\n"));
+                       break;
+               }
 
-                       printf("Importing account for %s...", user->username);
-                       if ( !NT_STATUS_IS_OK(out->getsampwnam( out, account, user->username )) ) {
-                               status = out->add_sam_account(out, user);
-                       } else {
-                               status = out->update_sam_account( out, user );
-                       }
+               sid_compose(&user_sid, get_global_sam_sid(), userentry.rid);
 
-                       if ( NT_STATUS_IS_OK(status) ) {
-                               printf( "ok\n");
-                       } else {
-                               printf( "failed\n");
-                       }
+               status = in->getsampwsid(in, user, &user_sid);
 
-                       TALLOC_FREE( account );
+               if (!NT_STATUS_IS_OK(status)) {
+                       DEBUG(2, ("getsampwsid failed: %s\n",
+                                 nt_errstr(status)));
+                       TALLOC_FREE(user);
+                       continue;
                }
 
-               /* clean up and get ready for another run */
+               account = samu_new(NULL);
+               if (account == NULL) {
+                       fprintf(stderr, "export_database: Memory allocation "
+                               "failure!\n");
+                       TALLOC_FREE( user );
+                       pdb_search_destroy(u_search);
+                       return 1;
+               }
 
-               TALLOC_FREE( user );
+               printf("Importing account for %s...", user->username);
+               status = out->getsampwnam(out, account, user->username);
 
-               if ( ( user = samu_new( NULL ) ) == NULL ) {
-                       fprintf(stderr, "export_database: Memory allocation failure!\n");
-                       return 1;
+               if (NT_STATUS_IS_OK(status)) {
+                       status = out->update_sam_account( out, user );
+               } else {
+                       status = out->add_sam_account(out, user);
+               }
+
+               if ( NT_STATUS_IS_OK(status) ) {
+                       printf( "ok\n");
+               } else {
+                       printf( "failed\n");
                }
-       }
 
-       TALLOC_FREE( user );
+               TALLOC_FREE( account );
+               TALLOC_FREE( user );
+       }
 
-       in->endsampwent(in);
+       pdb_search_destroy(u_search);
 
        return 0;
 }
@@ -326,33 +342,50 @@ static int print_user_info (struct pdb_methods *in, const char *username, bool v
 **********************************************************/
 static int print_users_list (struct pdb_methods *in, bool verbosity, bool smbpwdstyle)
 {
-       struct samu *sam_pwent=NULL;
-       bool check;
-       
-       check = NT_STATUS_IS_OK(in->setsampwent(in, False, 0));
-       if (!check) {
+       struct pdb_search *u_search;
+       struct samr_displayentry userentry;
+
+       u_search = pdb_search_init(PDB_USER_SEARCH);
+       if (u_search == NULL) {
+               DEBUG(0, ("pdb_search_init failed\n"));
                return 1;
        }
 
-       check = True;
-       if ( (sam_pwent = samu_new( NULL )) == NULL ) {
+       if (!in->search_users(in, u_search, 0)) {
+               DEBUG(0, ("Could not start searching users\n"));
+               pdb_search_destroy(u_search);
                return 1;
        }
 
-       while (check && NT_STATUS_IS_OK(in->getsampwent (in, sam_pwent))) {
+       while (u_search->next_entry(u_search, &userentry)) {
+               struct samu *sam_pwent;
+               DOM_SID user_sid;
+               NTSTATUS status;
+
+               sam_pwent = samu_new(talloc_tos());
+               if (sam_pwent == NULL) {
+                       DEBUG(0, ("talloc failed\n"));
+                       break;
+               }
+
+               sid_compose(&user_sid, get_global_sam_sid(), userentry.rid);
+
+               status = in->getsampwsid(in, sam_pwent, &user_sid);
+
+               if (!NT_STATUS_IS_OK(status)) {
+                       DEBUG(2, ("getsampwsid failed: %s\n",
+                                 nt_errstr(status)));
+                       TALLOC_FREE(sam_pwent);
+                       continue;
+               }
+
                if (verbosity)
                        printf ("---------------\n");
                print_sam_info (sam_pwent, verbosity, smbpwdstyle);
                TALLOC_FREE(sam_pwent);
-               
-               if ( (sam_pwent = samu_new( NULL )) == NULL ) {
-                       check = False;
-               }
        }
-       if (check) 
-               TALLOC_FREE(sam_pwent);
-       
-       in->endsampwent(in);
+       pdb_search_destroy(u_search);
+
        return 0;
 }
 
@@ -361,38 +394,50 @@ static int print_users_list (struct pdb_methods *in, bool verbosity, bool smbpwd
 **********************************************************/
 static int fix_users_list (struct pdb_methods *in)
 {
-       struct samu *sam_pwent=NULL;
-       bool check;
-       
-       check = NT_STATUS_IS_OK(in->setsampwent(in, False, 0));
-       if (!check) {
+       struct pdb_search *u_search;
+       struct samr_displayentry userentry;
+
+       u_search = pdb_search_init(PDB_USER_SEARCH);
+       if (u_search == NULL) {
+               DEBUG(0, ("pdb_search_init failed\n"));
                return 1;
        }
 
-       check = True;
-       if ( (sam_pwent = samu_new( NULL )) == NULL ) {
+       if (!in->search_users(in, u_search, 0)) {
+               DEBUG(0, ("Could not start searching users\n"));
+               pdb_search_destroy(u_search);
                return 1;
        }
 
-       while (check && NT_STATUS_IS_OK(in->getsampwent (in, sam_pwent))) {
-               printf("Updating record for user %s\n", pdb_get_username(sam_pwent));
-       
-               if (!NT_STATUS_IS_OK(pdb_update_sam_account(sam_pwent))) {
-                       printf("Update of user %s failed!\n", pdb_get_username(sam_pwent));
+       while (u_search->next_entry(u_search, &userentry)) {
+               struct samu *sam_pwent;
+               DOM_SID user_sid;
+               NTSTATUS status;
+
+               sam_pwent = samu_new(talloc_tos());
+               if (sam_pwent == NULL) {
+                       DEBUG(0, ("talloc failed\n"));
+                       break;
                }
-               TALLOC_FREE(sam_pwent);
-               if ( (sam_pwent = samu_new( NULL )) == NULL ) {
-                       check = False;
+
+               sid_compose(&user_sid, get_global_sam_sid(), userentry.rid);
+
+               status = in->getsampwsid(in, sam_pwent, &user_sid);
+
+               if (!NT_STATUS_IS_OK(status)) {
+                       DEBUG(2, ("getsampwsid failed: %s\n",
+                                 nt_errstr(status)));
+                       TALLOC_FREE(sam_pwent);
+                       continue;
                }
-               if (!check) {
-                       fprintf(stderr, "Failed to initialise new struct samu structure (out of memory?)\n");
+
+               if (!NT_STATUS_IS_OK(pdb_update_sam_account(sam_pwent))) {
+                       printf("Update of user %s failed!\n",
+                              pdb_get_username(sam_pwent));
                }
-                       
-       }
-       if (check) 
                TALLOC_FREE(sam_pwent);
-       
-       in->endsampwent(in);
+       }
+       pdb_search_destroy(u_search);
        return 0;
 }
 
index 958f8e255eb1801470ce5ddcf8d830ae4e0448a8..134f5617603ffc44f35ac81af6c24ad08e9c69d7 100644 (file)
@@ -822,7 +822,7 @@ static int cacl_set(struct cli_state *cli, char *filename,
 *******************************************************/
 static struct cli_state *connect_one(const char *server, const char *share)
 {
-       struct cli_state *c;
+       struct cli_state *c = NULL;
        struct sockaddr_storage ss;
        NTSTATUS nt_status;
        zero_addr(&ss);
@@ -834,20 +834,33 @@ static struct cli_state *connect_one(const char *server, const char *share)
                }
        }
 
-       if (NT_STATUS_IS_OK(nt_status = cli_full_connection(&c, global_myname(), server, 
-                                                           &ss, 0,
-                                                           share, "?????",
-                                                           get_cmdline_auth_info_username(),
-                                                           lp_workgroup(),
-                                                           get_cmdline_auth_info_password(),
-                                                           0,
-                                                           get_cmdline_auth_info_signing_state(),
-                                                           NULL))) {
-               return c;
-       } else {
+       nt_status = cli_full_connection(&c, global_myname(), server, 
+                               &ss, 0,
+                               share, "?????",
+                               get_cmdline_auth_info_username(),
+                               lp_workgroup(),
+                               get_cmdline_auth_info_password(),
+                               get_cmdline_auth_info_use_kerberos() ? CLI_FULL_CONNECTION_USE_KERBEROS : 0,
+                               get_cmdline_auth_info_signing_state(),
+                               NULL);
+       if (!NT_STATUS_IS_OK(nt_status)) {
                DEBUG(0,("cli_full_connection failed! (%s)\n", nt_errstr(nt_status)));
                return NULL;
        }
+
+       if (get_cmdline_auth_info_smb_encrypt()) {
+               nt_status = cli_cm_force_encryption(c,
+                                       get_cmdline_auth_info_username(),
+                                       get_cmdline_auth_info_password(),
+                                       lp_workgroup(),
+                                       share);
+                if (!NT_STATUS_IS_OK(nt_status)) {
+                       cli_shutdown(c);
+                       c = NULL;
+                }
+       }
+
+       return c;
 }
 
 /****************************************************************************
index fe0c22911ea7486d0f15f6415b9c84cafbbe0718..76036bfdde6c8e5fa88e79f508c9caf7f46236d2 100644 (file)
@@ -1008,6 +1008,62 @@ static bool do_dump_event_list(struct messaging_context *msg_ctx,
        return send_message(msg_ctx, pid, MSG_DUMP_EVENT_LIST, NULL, 0);
 }
 
+static bool do_winbind_dump_domain_list(struct messaging_context *msg_ctx,
+                                       const struct server_id pid,
+                                       const int argc, const char **argv)
+{
+       const char *domain = NULL;
+       int domain_len = 0;
+       struct server_id myid;
+       uint8_t *buf = NULL;
+       int buf_len = 0;
+
+       myid = pid_to_procid(sys_getpid());
+
+       if (argc < 1 || argc > 2) {
+               fprintf(stderr, "Usage: smbcontrol <dest> dump_domain_list "
+                       "<domain>\n");
+               return false;
+       }
+
+       if (argc == 2) {
+               domain = argv[1];
+               domain_len = strlen(argv[1]) + 1;
+       }
+
+       messaging_register(msg_ctx, NULL, MSG_WINBIND_DUMP_DOMAIN_LIST,
+                          print_pid_string_cb);
+
+       buf_len = sizeof(myid)+domain_len;
+       buf = SMB_MALLOC(buf_len);
+       if (!buf) {
+               return false;
+       }
+
+       memcpy(buf, &myid, sizeof(myid));
+       memcpy(&buf[sizeof(myid)], domain, domain_len);
+
+       if (!send_message(msg_ctx, pid, MSG_WINBIND_DUMP_DOMAIN_LIST,
+                         buf, buf_len))
+       {
+               SAFE_FREE(buf);
+               return false;
+       }
+
+       wait_replies(msg_ctx, procid_to_pid(&pid) == 0);
+
+       /* No replies were received within the timeout period */
+
+       SAFE_FREE(buf);
+       if (num_replies == 0) {
+               printf("No replies received\n");
+       }
+
+       messaging_deregister(msg_ctx, MSG_WINBIND_DUMP_DOMAIN_LIST, NULL);
+
+       return num_replies;
+}
+
 static void winbind_validate_cache_cb(struct messaging_context *msg,
                                      void *private_data,
                                      uint32_t msg_type,
@@ -1150,6 +1206,7 @@ static const struct {
        { "dump-event-list", do_dump_event_list, "Dump event list"},
        { "validate-cache" , do_winbind_validate_cache,
          "Validate winbind's credential cache" },
+       { "dump-domain-list", do_winbind_dump_domain_list, "Dump winbind domain list"},
        { "noop", do_noop, "Do nothing" },
        { NULL }
 };
index e6aa5e86cf21d9c3f2a4c7333add4881dfe937d6..508a2dc8ca625dc2d49ed466f786454ff2997890 100644 (file)
@@ -380,20 +380,33 @@ static struct cli_state *connect_one(const char *share)
                }
        }
 
-       if (NT_STATUS_IS_OK(nt_status = cli_full_connection(&c, global_myname(), server, 
-                                                   &ss, 0,
-                                                   share, "?????",
-                                                   get_cmdline_auth_info_username(),
-                                                   lp_workgroup(),
-                                                   get_cmdline_auth_info_password(),
-                                                   0,
-                                                   get_cmdline_auth_info_signing_state(),
-                                                   NULL))) {
-               return c;
-       } else {
+       nt_status = cli_full_connection(&c, global_myname(), server, 
+                                           &ss, 0,
+                                           share, "?????",
+                                           get_cmdline_auth_info_username(),
+                                           lp_workgroup(),
+                                           get_cmdline_auth_info_password(),
+                                           0,
+                                           get_cmdline_auth_info_signing_state(),
+                                           NULL);
+       if (!NT_STATUS_IS_OK(nt_status)) {
                DEBUG(0,("cli_full_connection failed! (%s)\n", nt_errstr(nt_status)));
                return NULL;
        }
+
+       if (get_cmdline_auth_info_smb_encrypt()) {
+               nt_status = cli_cm_force_encryption(c,
+                                       get_cmdline_auth_info_username(),
+                                       get_cmdline_auth_info_password(),
+                                       lp_workgroup(),
+                                       share);
+               if (!NT_STATUS_IS_OK(nt_status)) {
+                       cli_shutdown(c);
+                       return NULL;
+               }
+       }
+
+       return c;
 }
 
 /****************************************************************************
index 912d575c601d7c620ed51f42e40d15768142f9f4..8db969722afd30108258643df70afd2eadfef98a 100644 (file)
@@ -114,6 +114,30 @@ static void filter_request(char *buf)
 
 }
 
+/****************************************************************************
+ Send an smb to a fd.
+****************************************************************************/
+
+static bool send_smb(int fd, char *buffer)
+{
+       size_t len;
+       size_t nwritten=0;
+       ssize_t ret;
+
+        len = smb_len(buffer) + 4;
+
+       while (nwritten < len) {
+               ret = write_data(fd,buffer+nwritten,len - nwritten);
+               if (ret <= 0) {
+                       DEBUG(0,("Error writing %d bytes to client. %d. (%s)\n",
+                               (int)len,(int)ret, strerror(errno) ));
+                       return false;
+               }
+               nwritten += ret;
+       }
+
+       return true;
+}
 
 static void filter_child(int c, struct sockaddr_storage *dest_ss)
 {
@@ -145,7 +169,7 @@ static void filter_child(int c, struct sockaddr_storage *dest_ss)
                if (num <= 0) continue;
                
                if (c != -1 && FD_ISSET(c, &fds)) {
-                       if (!receive_smb(c, packet, 0, NULL)) {
+                       if (!receive_smb_raw(c, packet, 0, 0, NULL)) {
                                d_printf("client closed connection\n");
                                exit(0);
                        }
@@ -156,7 +180,7 @@ static void filter_child(int c, struct sockaddr_storage *dest_ss)
                        }                       
                }
                if (s != -1 && FD_ISSET(s, &fds)) {
-                       if (!receive_smb(s, packet, 0, NULL)) {
+                       if (!receive_smb_raw(s, packet, 0, 0, NULL)) {
                                d_printf("server closed connection\n");
                                exit(0);
                        }
index ac662e6aceea079dafff035fdc81bd499a0d3930..63b7f4862679ff21f64c560042ae06774a882105 100644 (file)
@@ -521,9 +521,11 @@ int main(int argc, const char **argv)
        int c = 0;
        const char *file = NULL;
        char *rcfile = NULL;
+       bool smb_encrypt = false;
        TALLOC_CTX *frame = talloc_stackframe();
        struct poptOption long_options[] = {
                {"guest", 'a', POPT_ARG_NONE, NULL, 'a', "Work as user guest" },        
+               {"encrypt", 'e', POPT_ARG_NONE, NULL, 'e', "Encrypt SMB transport (UNIX extended servers only)" },      
                {"resume", 'r', POPT_ARG_NONE, &_resume, 0, "Automatically resume aborted files" },
                {"recursive", 'R',  POPT_ARG_NONE, &_recursive, 0, "Recursively download files" },
                {"username", 'u', POPT_ARG_STRING, &username, 'u', "Username to use" },
@@ -568,6 +570,9 @@ int main(int argc, const char **argv)
                case 'a':
                        username = ""; password = "";
                        break;
+               case 'e':
+                       smb_encrypt = true;
+                       break;
                }
        }
 
@@ -586,6 +591,13 @@ int main(int argc, const char **argv)
                return 1;
        }
 
+       if (smb_encrypt) {
+               SMBCCTX *smb_ctx = smbc_set_context(NULL);
+               smbc_option_set(smb_ctx,
+                       CONST_DISCARD(char *, "smb_encrypt_level"),
+                       "require");
+       }
+       
        columns = get_num_cols();
 
        total_start_time = time(NULL);
index 07a6fbcf544cc64106eaf2d413946392f04bded9..c6233b0869485c66353335a68c934608759c6100 100644 (file)
@@ -164,7 +164,9 @@ void cgi_load_variables(void)
        open("/dev/null", O_RDWR);
 
        if ((s=query_string) || (s=getenv("QUERY_STRING"))) {
-               for (tok=strtok(s,"&;");tok;tok=strtok(NULL,"&;")) {
+               char *saveptr;
+               for (tok=strtok_r(s, "&;", &saveptr); tok;
+                    tok=strtok_r(NULL, "&;", &saveptr)) {
                        p = strchr_m(tok,'=');
                        if (!p) continue;
                        
index fa9f2c96812c320c35fc8a6734af21050d31ee5c..46c24d7fcb95629436f4976c0d5de617bb95d383 100644 (file)
@@ -145,7 +145,6 @@ static NTSTATUS idmap_nss_sids_to_unixids(struct idmap_domain *dom, struct id_ma
        }
 
        for (i = 0; ids[i]; i++) {
-               struct passwd *pw;
                struct group *gr;
                enum lsa_SidType type;
                const char *dom_name = NULL;
@@ -166,17 +165,20 @@ static NTSTATUS idmap_nss_sids_to_unixids(struct idmap_domain *dom, struct id_ma
                }
 
                switch (type) {
-               case SID_NAME_USER:
+               case SID_NAME_USER: {
+                       struct passwd *pw;
 
                        /* this will find also all lower case name and use username level */
-                       
-                       pw = Get_Pwnam(name);
+
+                       pw = Get_Pwnam_alloc(talloc_tos(), name);
                        if (pw) {
                                ids[i]->xid.id = pw->pw_uid;
                                ids[i]->xid.type = ID_TYPE_UID;
                                ids[i]->status = ID_MAPPED;
                        }
+                       TALLOC_FREE(pw);
                        break;
+               }
 
                case SID_NAME_DOM_GRP:
                case SID_NAME_ALIAS:
diff --git a/source/winbindd/idmap_tdb2.c b/source/winbindd/idmap_tdb2.c
new file mode 100644 (file)
index 0000000..ab89e61
--- /dev/null
@@ -0,0 +1,1017 @@
+/* 
+   Unix SMB/CIFS implementation.
+
+   idmap TDB2 backend, used for clustered Samba setups.
+
+   This uses 2 tdb files. One is permanent, and is in shared storage
+   on the cluster (using "tdb:idmap2.tdb =" in smb.conf). The other is a
+   temporary cache tdb on local storage.
+
+   Copyright (C) Andrew Tridgell 2007
+
+   This is heavily based upon idmap_tdb.c, which is:
+
+   Copyright (C) Tim Potter 2000
+   Copyright (C) Jim McDonough <jmcd@us.ibm.com> 2003
+   Copyright (C) Jeremy Allison 2006
+   Copyright (C) Simo Sorce 2003-2006
+   
+   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 2 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, write to the Free Software
+   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include "includes.h"
+#include "winbindd.h"
+
+#undef DBGC_CLASS
+#define DBGC_CLASS DBGC_IDMAP
+
+/* High water mark keys */
+#define HWM_GROUP  "GROUP HWM"
+#define HWM_USER   "USER HWM"
+
+static struct idmap_tdb2_state {
+       /* User and group id pool */
+       uid_t low_uid, high_uid;               /* Range of uids to allocate */
+       gid_t low_gid, high_gid;               /* Range of gids to allocate */
+       const char *idmap_script;
+} idmap_tdb2_state;
+
+
+
+/* tdb context for the local cache tdb */
+static TDB_CONTEXT *idmap_tdb2_tmp;
+
+/* handle to the permanent tdb */
+static struct db_context *idmap_tdb2_perm;
+
+/*
+  open the cache tdb
+ */
+static NTSTATUS idmap_tdb2_open_cache_db(void)
+{
+       const char *db_path;
+
+       if (idmap_tdb2_tmp) {
+               /* its already open */
+               return NT_STATUS_OK;
+       }
+
+       db_path = lock_path("idmap2_cache.tdb");
+
+       /* Open idmap repository */
+       if (!(idmap_tdb2_tmp = tdb_open_log(db_path, 0, TDB_CLEAR_IF_FIRST, O_RDWR|O_CREAT, 0644))) {
+               DEBUG(0, ("Unable to open cache idmap database '%s'\n", db_path));
+               return NT_STATUS_UNSUCCESSFUL;
+       }
+
+       return NT_STATUS_OK;
+}
+
+
+static NTSTATUS idmap_tdb2_alloc_load(void);
+
+/*
+  open the permanent tdb
+ */
+static NTSTATUS idmap_tdb2_open_perm_db(void)
+{
+       char *db_path;
+       
+       if (idmap_tdb2_perm) {
+               /* its already open */
+               return NT_STATUS_OK;
+       }
+
+       db_path = lp_parm_talloc_string(-1, "tdb", "idmap2.tdb", NULL);
+       if (db_path == NULL) {
+               /* fall back to the private directory, which, despite
+                  its name, is usually on shared storage */
+               db_path = talloc_asprintf(NULL, "%s/idmap2.tdb", lp_private_dir());
+       }
+       NT_STATUS_HAVE_NO_MEMORY(db_path);
+
+       /* Open idmap repository */
+       idmap_tdb2_perm = db_open(NULL, db_path, 0, TDB_DEFAULT,
+                                 O_RDWR|O_CREAT, 0644);
+       TALLOC_FREE(db_path);
+
+       if (idmap_tdb2_perm == NULL) {
+               DEBUG(0, ("Unable to open permanent idmap database '%s'\n",
+                         db_path));
+               return NT_STATUS_UNSUCCESSFUL;
+       }
+
+       /* load the ranges and high/low water marks */
+       return idmap_tdb2_alloc_load();
+}
+
+
+/*
+  load the idmap allocation ranges and high/low water marks
+*/
+static NTSTATUS idmap_tdb2_alloc_load(void)
+{
+       const char *range;
+       uid_t low_uid = 0;
+       uid_t high_uid = 0;
+       gid_t low_gid = 0;
+       gid_t high_gid = 0;
+
+       /* load ranges */
+       idmap_tdb2_state.low_uid = 0;
+       idmap_tdb2_state.high_uid = 0;
+       idmap_tdb2_state.low_gid = 0;
+       idmap_tdb2_state.high_gid = 0;
+
+       /* see if a idmap script is configured */
+       idmap_tdb2_state.idmap_script = lp_parm_const_string(-1, "idmap", "script", NULL);
+
+       if (idmap_tdb2_state.idmap_script) {
+               DEBUG(1, ("using idmap script '%s'\n", idmap_tdb2_state.idmap_script));
+       }
+
+       range = lp_parm_const_string(-1, "idmap alloc config", "range", NULL);
+       if (range && range[0]) {
+               unsigned low_id, high_id;
+               if (sscanf(range, "%u - %u", &low_id, &high_id) == 2) {
+                       if (low_id < high_id) {
+                               idmap_tdb2_state.low_gid = idmap_tdb2_state.low_uid = low_id;
+                               idmap_tdb2_state.high_gid = idmap_tdb2_state.high_uid = high_id;
+                       } else {
+                               DEBUG(1, ("ERROR: invalid idmap alloc range [%s]", range));
+                       }
+               } else {
+                       DEBUG(1, ("ERROR: invalid syntax for idmap alloc config:range [%s]", range));
+               }
+       }
+
+       /* Create high water marks for group and user id */
+       if (lp_idmap_uid(&low_uid, &high_uid)) {
+               idmap_tdb2_state.low_uid = low_uid;
+               idmap_tdb2_state.high_uid = high_uid;
+       }
+
+       if (lp_idmap_gid(&low_gid, &high_gid)) {
+               idmap_tdb2_state.low_gid = low_gid;
+               idmap_tdb2_state.high_gid = high_gid;
+       }
+
+       if (idmap_tdb2_state.high_uid <= idmap_tdb2_state.low_uid) {
+               DEBUG(1, ("idmap uid range missing or invalid\n"));
+               DEBUGADD(1, ("idmap will be unable to map foreign SIDs\n"));
+               return NT_STATUS_UNSUCCESSFUL;
+       } else {
+               uint32 low_id;
+
+               if (((low_id = dbwrap_fetch_int32(idmap_tdb2_perm,
+                                                 HWM_USER)) == -1) ||
+                   (low_id < idmap_tdb2_state.low_uid)) {
+                       if (dbwrap_store_int32(
+                                   idmap_tdb2_perm, HWM_USER,
+                                   idmap_tdb2_state.low_uid) == -1) {
+                               DEBUG(0, ("Unable to initialise user hwm in idmap database\n"));
+                               return NT_STATUS_INTERNAL_DB_ERROR;
+                       }
+               }
+       }
+
+       if (idmap_tdb2_state.high_gid <= idmap_tdb2_state.low_gid) {
+               DEBUG(1, ("idmap gid range missing or invalid\n"));
+               DEBUGADD(1, ("idmap will be unable to map foreign SIDs\n"));
+               return NT_STATUS_UNSUCCESSFUL;
+       } else {
+               uint32 low_id;
+
+               if (((low_id = dbwrap_fetch_int32(idmap_tdb2_perm,
+                                                 HWM_GROUP)) == -1) ||
+                   (low_id < idmap_tdb2_state.low_gid)) {
+                       if (dbwrap_store_int32(
+                                   idmap_tdb2_perm, HWM_GROUP,
+                                   idmap_tdb2_state.low_gid) == -1) {
+                               DEBUG(0, ("Unable to initialise group hwm in idmap database\n"));
+                               return NT_STATUS_INTERNAL_DB_ERROR;
+                       }
+               }
+       }
+
+       return NT_STATUS_OK;
+}
+
+
+/*
+  Initialise idmap alloc database. 
+*/
+static NTSTATUS idmap_tdb2_alloc_init(const char *params)
+{
+       /* nothing to do - we want to avoid opening the permanent
+          database if possible. Instead we load the params when we
+          first need it. */
+       return NT_STATUS_OK;
+}
+
+
+/*
+  Allocate a new id. 
+*/
+static NTSTATUS idmap_tdb2_allocate_id(struct unixid *xid)
+{
+       bool ret;
+       const char *hwmkey;
+       const char *hwmtype;
+       uint32_t high_hwm;
+       uint32_t hwm;
+       NTSTATUS status;
+
+       status = idmap_tdb2_open_perm_db();
+       NT_STATUS_NOT_OK_RETURN(status);
+
+       /* Get current high water mark */
+       switch (xid->type) {
+
+       case ID_TYPE_UID:
+               hwmkey = HWM_USER;
+               hwmtype = "UID";
+               high_hwm = idmap_tdb2_state.high_uid;
+               break;
+
+       case ID_TYPE_GID:
+               hwmkey = HWM_GROUP;
+               hwmtype = "GID";
+               high_hwm = idmap_tdb2_state.high_gid;
+               break;
+
+       default:
+               DEBUG(2, ("Invalid ID type (0x%x)\n", xid->type));
+               return NT_STATUS_INVALID_PARAMETER;
+       }
+
+       if ((hwm = dbwrap_fetch_int32(idmap_tdb2_perm, hwmkey)) == -1) {
+               return NT_STATUS_INTERNAL_DB_ERROR;
+       }
+
+       /* check it is in the range */
+       if (hwm > high_hwm) {
+               DEBUG(1, ("Fatal Error: %s range full!! (max: %lu)\n", 
+                         hwmtype, (unsigned long)high_hwm));
+               return NT_STATUS_UNSUCCESSFUL;
+       }
+
+       /* fetch a new id and increment it */
+       ret = dbwrap_change_uint32_atomic(idmap_tdb2_perm, hwmkey, &hwm, 1);
+       if (ret == -1) {
+               DEBUG(1, ("Fatal error while fetching a new %s value\n!", hwmtype));
+               return NT_STATUS_UNSUCCESSFUL;
+       }
+
+       /* recheck it is in the range */
+       if (hwm > high_hwm) {
+               DEBUG(1, ("Fatal Error: %s range full!! (max: %lu)\n", 
+                         hwmtype, (unsigned long)high_hwm));
+               return NT_STATUS_UNSUCCESSFUL;
+       }
+       
+       xid->id = hwm;
+       DEBUG(10,("New %s = %d\n", hwmtype, hwm));
+
+       return NT_STATUS_OK;
+}
+
+/*
+  Get current highest id. 
+*/
+static NTSTATUS idmap_tdb2_get_hwm(struct unixid *xid)
+{
+       const char *hwmkey;
+       const char *hwmtype;
+       uint32_t hwm;
+       uint32_t high_hwm;
+
+       /* Get current high water mark */
+       switch (xid->type) {
+
+       case ID_TYPE_UID:
+               hwmkey = HWM_USER;
+               hwmtype = "UID";
+               high_hwm = idmap_tdb2_state.high_uid;
+               break;
+
+       case ID_TYPE_GID:
+               hwmkey = HWM_GROUP;
+               hwmtype = "GID";
+               high_hwm = idmap_tdb2_state.high_gid;
+               break;
+
+       default:
+               return NT_STATUS_INVALID_PARAMETER;
+       }
+
+       if ((hwm = dbwrap_fetch_int32(idmap_tdb2_perm, hwmkey)) == -1) {
+               return NT_STATUS_INTERNAL_DB_ERROR;
+       }
+
+       xid->id = hwm;
+
+       /* Warn if it is out of range */
+       if (hwm >= high_hwm) {
+               DEBUG(0, ("Warning: %s range full!! (max: %lu)\n", 
+                         hwmtype, (unsigned long)high_hwm));
+       }
+
+       return NT_STATUS_OK;
+}
+
+/*
+  Set high id. 
+*/
+static NTSTATUS idmap_tdb2_set_hwm(struct unixid *xid)
+{
+       /* not supported, or we would invalidate the cache tdb on
+          other nodes */
+       DEBUG(0,("idmap_tdb2_set_hwm not supported\n"));
+       return NT_STATUS_NOT_SUPPORTED;
+}
+
+/*
+  Close the alloc tdb 
+*/
+static NTSTATUS idmap_tdb2_alloc_close(void)
+{
+       /* don't actually close it */
+       return NT_STATUS_OK;
+}
+
+/*
+  IDMAP MAPPING TDB BACKEND
+*/
+struct idmap_tdb2_context {
+       uint32_t filter_low_id;
+       uint32_t filter_high_id;
+};
+
+/*
+  try fetching from the cache tdb, and if that fails then
+  fetch from the permanent tdb
+ */
+static TDB_DATA tdb2_fetch_bystring(TALLOC_CTX *mem_ctx, const char *keystr)
+{
+       TDB_DATA ret;
+       NTSTATUS status;
+
+       ret = tdb_fetch_bystring(idmap_tdb2_tmp, keystr);
+       if (ret.dptr != NULL) {
+               /* got it from cache */
+               unsigned char *tmp;
+
+               tmp = (unsigned char *)talloc_memdup(mem_ctx, ret.dptr,
+                                                    ret.dsize);
+               SAFE_FREE(ret.dptr);
+               ret.dptr = tmp;
+
+               if (ret.dptr == NULL) {
+                       return make_tdb_data(NULL, 0);
+               }
+               return ret;
+       }
+       
+       status = idmap_tdb2_open_perm_db();
+       if (!NT_STATUS_IS_OK(status)) {
+               return ret;
+       }
+
+       /* fetch from the permanent tdb */
+       return dbwrap_fetch_bystring(idmap_tdb2_perm, mem_ctx, keystr);
+}
+
+/*
+  store into both databases
+ */
+static NTSTATUS tdb2_store_bystring(const char *keystr, TDB_DATA data, int flags)
+{
+       NTSTATUS ret;
+       NTSTATUS status = idmap_tdb2_open_perm_db();
+       if (!NT_STATUS_IS_OK(status)) {
+               return NT_STATUS_UNSUCCESSFUL;
+       }
+       ret = dbwrap_store_bystring(idmap_tdb2_perm, keystr, data, flags);
+       if (!NT_STATUS_IS_OK(ret)) {
+               ret = tdb_store_bystring(idmap_tdb2_tmp, keystr, data, flags) ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL;
+       }
+       return ret;
+}
+
+/*
+  delete from both databases
+ */
+static NTSTATUS tdb2_delete_bystring(const char *keystr)
+{
+       NTSTATUS ret;
+       NTSTATUS status = idmap_tdb2_open_perm_db();
+       if (!NT_STATUS_IS_OK(status)) {
+               return NT_STATUS_UNSUCCESSFUL;
+       }
+       ret = dbwrap_delete_bystring(idmap_tdb2_perm, keystr);
+       if (!NT_STATUS_IS_OK(ret)) {
+               ret = tdb_delete_bystring(idmap_tdb2_tmp, keystr)  ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL;
+       }
+       return ret;
+}
+
+/*
+  Initialise idmap database. 
+*/
+static NTSTATUS idmap_tdb2_db_init(struct idmap_domain *dom)
+{
+       NTSTATUS ret;
+       struct idmap_tdb2_context *ctx;
+       char *config_option = NULL;
+       const char *range;
+       NTSTATUS status;
+
+       status = idmap_tdb2_open_cache_db();
+       NT_STATUS_NOT_OK_RETURN(status);
+
+       ctx = talloc(dom, struct idmap_tdb2_context);
+       if ( ! ctx) {
+               DEBUG(0, ("Out of memory!\n"));
+               return NT_STATUS_NO_MEMORY;
+       }
+
+       config_option = talloc_asprintf(ctx, "idmap config %s", dom->name);
+       if ( ! config_option) {
+               DEBUG(0, ("Out of memory!\n"));
+               ret = NT_STATUS_NO_MEMORY;
+               goto failed;
+       }
+
+       range = lp_parm_const_string(-1, config_option, "range", NULL);
+       if (( ! range) ||
+           (sscanf(range, "%u - %u", &ctx->filter_low_id, &ctx->filter_high_id) != 2) ||
+           (ctx->filter_low_id > ctx->filter_high_id)) {
+               ctx->filter_low_id = 0;
+               ctx->filter_high_id = 0;
+       }
+
+       dom->private_data = ctx;
+       dom->initialized = True;
+
+       talloc_free(config_option);
+       return NT_STATUS_OK;
+
+failed:
+       talloc_free(ctx);
+       return ret;
+}
+
+
+/*
+  run a script to perform a mapping
+
+  The script should the following command lines:
+
+      SIDTOID S-1-xxxx
+      IDTOSID UID xxxx
+      IDTOSID GID xxxx
+
+  and should return one of the following as a single line of text
+     UID:xxxx
+     GID:xxxx
+     SID:xxxx
+     ERR:xxxx
+ */
+static NTSTATUS idmap_tdb2_script(struct idmap_tdb2_context *ctx, struct id_map *map,
+                                 const char *fmt, ...)
+{
+       va_list ap;
+       char *cmd;
+       FILE *p;
+       char line[64];
+       unsigned long v;
+
+       cmd = talloc_asprintf(ctx, "%s ", idmap_tdb2_state.idmap_script);
+       NT_STATUS_HAVE_NO_MEMORY(cmd);  
+
+       va_start(ap, fmt);
+       cmd = talloc_vasprintf_append(cmd, fmt, ap);
+       va_end(ap);
+       NT_STATUS_HAVE_NO_MEMORY(cmd);
+
+       p = popen(cmd, "r");
+       talloc_free(cmd);
+       if (p == NULL) {
+               return NT_STATUS_NONE_MAPPED;
+       }
+
+       if (fgets(line, sizeof(line)-1, p) == NULL) {
+               pclose(p);
+               return NT_STATUS_NONE_MAPPED;
+       }
+       pclose(p);
+
+       DEBUG(10,("idmap script gave: %s\n", line));
+
+       if (sscanf(line, "UID:%lu", &v) == 1) {
+               map->xid.id   = v;
+               map->xid.type = ID_TYPE_UID;
+       } else if (sscanf(line, "GID:%lu", &v) == 1) {
+               map->xid.id   = v;
+               map->xid.type = ID_TYPE_GID;            
+       } else if (strncmp(line, "SID:S-", 6) == 0) {
+               if (!string_to_sid(map->sid, &line[4])) {
+                       DEBUG(0,("Bad SID in '%s' from idmap script %s\n",
+                                line, idmap_tdb2_state.idmap_script));
+                       return NT_STATUS_NONE_MAPPED;                   
+               }
+       } else {
+               DEBUG(0,("Bad reply '%s' from idmap script %s\n",
+                        line, idmap_tdb2_state.idmap_script));
+               return NT_STATUS_NONE_MAPPED;
+       }
+
+       return NT_STATUS_OK;
+}
+
+
+
+/*
+  Single id to sid lookup function. 
+*/
+static NTSTATUS idmap_tdb2_id_to_sid(struct idmap_tdb2_context *ctx, struct id_map *map)
+{
+       NTSTATUS ret;
+       TDB_DATA data;
+       char *keystr;
+
+       if (!ctx || !map) {
+               return NT_STATUS_INVALID_PARAMETER;
+       }
+
+       /* apply filters before checking */
+       if ((ctx->filter_low_id && (map->xid.id < ctx->filter_low_id)) ||
+           (ctx->filter_high_id && (map->xid.id > ctx->filter_high_id))) {
+               DEBUG(5, ("Requested id (%u) out of range (%u - %u). Filtered!\n",
+                               map->xid.id, ctx->filter_low_id, ctx->filter_high_id));
+               return NT_STATUS_NONE_MAPPED;
+       }
+
+       switch (map->xid.type) {
+
+       case ID_TYPE_UID:
+               keystr = talloc_asprintf(ctx, "UID %lu", (unsigned long)map->xid.id);
+               break;
+               
+       case ID_TYPE_GID:
+               keystr = talloc_asprintf(ctx, "GID %lu", (unsigned long)map->xid.id);
+               break;
+
+       default:
+               DEBUG(2, ("INVALID unix ID type: 0x02%x\n", map->xid.type));
+               return NT_STATUS_INVALID_PARAMETER;
+       }
+
+       /* final SAFE_FREE safe */
+       data.dptr = NULL;
+
+       if (keystr == NULL) {
+               DEBUG(0, ("Out of memory!\n"));
+               ret = NT_STATUS_NO_MEMORY;
+               goto done;
+       }
+
+       DEBUG(10,("Fetching record %s\n", keystr));
+
+       /* Check if the mapping exists */
+       data = tdb2_fetch_bystring(keystr, keystr);
+
+       if (!data.dptr) {
+               fstring sidstr;
+
+               DEBUG(10,("Record %s not found\n", keystr));
+               if (idmap_tdb2_state.idmap_script == NULL) {
+                       ret = NT_STATUS_NONE_MAPPED;
+                       goto done;
+               }
+
+               ret = idmap_tdb2_script(ctx, map, "IDTOSID %s", keystr);
+
+               /* store it on shared storage */
+               if (!NT_STATUS_IS_OK(ret)) {
+                       goto done;
+               }
+
+               if (sid_to_fstring(sidstr, map->sid)) {
+                       /* both forward and reverse mappings */
+                       tdb2_store_bystring(keystr,
+                                           string_term_tdb_data(sidstr), 
+                                           TDB_REPLACE);
+                       tdb2_store_bystring(sidstr,
+                                           string_term_tdb_data(keystr), 
+                                           TDB_REPLACE);
+               }
+               goto done;
+       }
+               
+       if (!string_to_sid(map->sid, (const char *)data.dptr)) {
+               DEBUG(10,("INVALID SID (%s) in record %s\n",
+                       (const char *)data.dptr, keystr));
+               ret = NT_STATUS_INTERNAL_DB_ERROR;
+               goto done;
+       }
+
+       DEBUG(10,("Found record %s -> %s\n", keystr, (const char *)data.dptr));
+       ret = NT_STATUS_OK;
+
+done:
+       talloc_free(keystr);
+       return ret;
+}
+
+
+/*
+ Single sid to id lookup function. 
+*/
+static NTSTATUS idmap_tdb2_sid_to_id(struct idmap_tdb2_context *ctx, struct id_map *map)
+{
+       NTSTATUS ret;
+       TDB_DATA data;
+       char *keystr;
+       unsigned long rec_id = 0;
+
+       if ((keystr = sid_string_talloc(ctx, map->sid)) == NULL) {
+               DEBUG(0, ("Out of memory!\n"));
+               ret = NT_STATUS_NO_MEMORY;
+               goto done;
+       }
+
+       DEBUG(10,("Fetching record %s\n", keystr));
+
+       /* Check if sid is present in database */
+       data = tdb2_fetch_bystring(keystr, keystr);
+       if (!data.dptr) {
+               fstring idstr;
+
+               DEBUG(10,(__location__ " Record %s not found\n", keystr));
+
+               if (idmap_tdb2_state.idmap_script == NULL) {
+                       ret = NT_STATUS_NONE_MAPPED;
+                       goto done;
+               }
+                       
+               ret = idmap_tdb2_script(ctx, map, "SIDTOID %s", keystr);
+               /* store it on shared storage */
+               if (!NT_STATUS_IS_OK(ret)) {
+                       goto done;
+               }
+
+               snprintf(idstr, sizeof(idstr), "%cID %lu", 
+                        map->xid.type == ID_TYPE_UID?'U':'G',
+                        (unsigned long)map->xid.id);
+               /* store both forward and reverse mappings */
+               tdb2_store_bystring(keystr, string_term_tdb_data(idstr),
+                                   TDB_REPLACE);
+               tdb2_store_bystring(idstr, string_term_tdb_data(keystr),
+                                   TDB_REPLACE);
+               goto done;
+       }
+
+       /* What type of record is this ? */
+       if (sscanf((const char *)data.dptr, "UID %lu", &rec_id) == 1) { /* Try a UID record. */
+               map->xid.id = rec_id;
+               map->xid.type = ID_TYPE_UID;
+               DEBUG(10,("Found uid record %s -> %s \n", keystr, (const char *)data.dptr ));
+               ret = NT_STATUS_OK;
+
+       } else if (sscanf((const char *)data.dptr, "GID %lu", &rec_id) == 1) { /* Try a GID record. */
+               map->xid.id = rec_id;
+               map->xid.type = ID_TYPE_GID;
+               DEBUG(10,("Found gid record %s -> %s \n", keystr, (const char *)data.dptr ));
+               ret = NT_STATUS_OK;
+
+       } else { /* Unknown record type ! */
+               DEBUG(2, ("Found INVALID record %s -> %s\n", keystr, (const char *)data.dptr));
+               ret = NT_STATUS_INTERNAL_DB_ERROR;
+       }
+       
+       /* apply filters before returning result */
+       if ((ctx->filter_low_id && (map->xid.id < ctx->filter_low_id)) ||
+           (ctx->filter_high_id && (map->xid.id > ctx->filter_high_id))) {
+               DEBUG(5, ("Requested id (%u) out of range (%u - %u). Filtered!\n",
+                               map->xid.id, ctx->filter_low_id, ctx->filter_high_id));
+               ret = NT_STATUS_NONE_MAPPED;
+       }
+
+done:
+       talloc_free(keystr);
+       return ret;
+}
+
+/*
+  lookup a set of unix ids. 
+*/
+static NTSTATUS idmap_tdb2_unixids_to_sids(struct idmap_domain *dom, struct id_map **ids)
+{
+       struct idmap_tdb2_context *ctx;
+       NTSTATUS ret;
+       int i;
+
+       /* make sure we initialized */
+       if ( ! dom->initialized) {
+               ret = idmap_tdb2_db_init(dom);
+               if ( ! NT_STATUS_IS_OK(ret)) {
+                       return ret;
+               }
+       }
+
+       ctx = talloc_get_type(dom->private_data, struct idmap_tdb2_context);
+
+       for (i = 0; ids[i]; i++) {
+               ret = idmap_tdb2_id_to_sid(ctx, ids[i]);
+               if ( ! NT_STATUS_IS_OK(ret)) {
+
+                       /* if it is just a failed mapping continue */
+                       if (NT_STATUS_EQUAL(ret, NT_STATUS_NONE_MAPPED)) {
+
+                               /* make sure it is marked as unmapped */
+                               ids[i]->status = ID_UNMAPPED;
+                               continue;
+                       }
+                       
+                       /* some fatal error occurred, return immediately */
+                       goto done;
+               }
+
+               /* all ok, id is mapped */
+               ids[i]->status = ID_MAPPED;
+       }
+
+       ret = NT_STATUS_OK;
+
+done:
+       return ret;
+}
+
+/*
+  lookup a set of sids. 
+*/
+static NTSTATUS idmap_tdb2_sids_to_unixids(struct idmap_domain *dom, struct id_map **ids)
+{
+       struct idmap_tdb2_context *ctx;
+       NTSTATUS ret;
+       int i;
+
+       /* make sure we initialized */
+       if ( ! dom->initialized) {
+               ret = idmap_tdb2_db_init(dom);
+               if ( ! NT_STATUS_IS_OK(ret)) {
+                       return ret;
+               }
+       }
+
+       ctx = talloc_get_type(dom->private_data, struct idmap_tdb2_context);
+
+       for (i = 0; ids[i]; i++) {
+               ret = idmap_tdb2_sid_to_id(ctx, ids[i]);
+               if ( ! NT_STATUS_IS_OK(ret)) {
+
+                       /* if it is just a failed mapping continue */
+                       if (NT_STATUS_EQUAL(ret, NT_STATUS_NONE_MAPPED)) {
+
+                               /* make sure it is marked as unmapped */
+                               ids[i]->status = ID_UNMAPPED;
+                               continue;
+                       }
+                       
+                       /* some fatal error occurred, return immediately */
+                       goto done;
+               }
+
+               /* all ok, id is mapped */
+               ids[i]->status = ID_MAPPED;
+       }
+
+       ret = NT_STATUS_OK;
+
+done:
+       return ret;
+}
+
+
+/*
+  set a mapping. 
+*/
+static NTSTATUS idmap_tdb2_set_mapping(struct idmap_domain *dom, const struct id_map *map)
+{
+       struct idmap_tdb2_context *ctx;
+       NTSTATUS ret;
+       TDB_DATA data;
+       char *ksidstr, *kidstr;
+       struct db_record *update_lock = NULL;
+       struct db_record *rec = NULL;
+
+       /* make sure we initialized */
+       if ( ! dom->initialized) {
+               ret = idmap_tdb2_db_init(dom);
+               if ( ! NT_STATUS_IS_OK(ret)) {
+                       return ret;
+               }
+       }
+
+       if (!map || !map->sid) {
+               return NT_STATUS_INVALID_PARAMETER;
+       }
+
+       ksidstr = kidstr = NULL;
+       data.dptr = NULL;
+
+       /* TODO: should we filter a set_mapping using low/high filters ? */
+       
+       ctx = talloc_get_type(dom->private_data, struct idmap_tdb2_context);
+
+       switch (map->xid.type) {
+
+       case ID_TYPE_UID:
+               kidstr = talloc_asprintf(ctx, "UID %lu", (unsigned long)map->xid.id);
+               break;
+               
+       case ID_TYPE_GID:
+               kidstr = talloc_asprintf(ctx, "GID %lu", (unsigned long)map->xid.id);
+               break;
+
+       default:
+               DEBUG(2, ("INVALID unix ID type: 0x02%x\n", map->xid.type));
+               return NT_STATUS_INVALID_PARAMETER;
+       }
+
+       if (kidstr == NULL) {
+               DEBUG(0, ("ERROR: Out of memory!\n"));
+               ret = NT_STATUS_NO_MEMORY;
+               goto done;
+       }
+
+       if (!(ksidstr = sid_string_talloc(ctx, map->sid))) {
+               DEBUG(0, ("Out of memory!\n"));
+               ret = NT_STATUS_NO_MEMORY;
+               goto done;
+       }
+
+       DEBUG(10, ("Storing %s <-> %s map\n", ksidstr, kidstr));
+
+       /*
+        * Get us the update lock. This is necessary to get the lock orders
+        * right, we need to deal with two records under a lock.
+        */
+
+       if (!(update_lock = idmap_tdb2_perm->fetch_locked(
+                     idmap_tdb2_perm, ctx,
+                     string_term_tdb_data("UPDATELOCK")))) {
+               DEBUG(10,("Failed to lock record %s\n", ksidstr));
+               ret = NT_STATUS_UNSUCCESSFUL;
+               goto done;
+       }
+
+       /*
+        * *DELETE* previous mappings if any. *
+        */
+
+       /* First delete indexed on SID */
+
+       if (((rec = idmap_tdb2_perm->fetch_locked(
+                    idmap_tdb2_perm, update_lock,
+                    string_term_tdb_data(ksidstr))) != NULL)
+           && (rec->value.dsize != 0)) {
+               struct db_record *rec2;
+
+               if ((rec2 = idmap_tdb2_perm->fetch_locked(
+                            idmap_tdb2_perm, update_lock, rec->value))
+                   != NULL) {
+                       rec2->delete_rec(rec2);
+                       TALLOC_FREE(rec2);
+               }
+
+               rec->delete_rec(rec);
+
+               tdb_delete(idmap_tdb2_tmp, rec->key);
+               tdb_delete(idmap_tdb2_tmp, rec->value);
+       }
+       TALLOC_FREE(rec);
+
+       /* Now delete indexed on unix ID */
+
+       if (((rec = idmap_tdb2_perm->fetch_locked(
+                    idmap_tdb2_perm, update_lock,
+                    string_term_tdb_data(kidstr))) != NULL)
+           && (rec->value.dsize != 0)) {
+               struct db_record *rec2;
+
+               if ((rec2 = idmap_tdb2_perm->fetch_locked(
+                            idmap_tdb2_perm, update_lock, rec->value))
+                   != NULL) {
+                       rec2->delete_rec(rec2);
+                       TALLOC_FREE(rec2);
+               }
+
+               rec->delete_rec(rec);
+
+               tdb_delete(idmap_tdb2_tmp, rec->key);
+               tdb_delete(idmap_tdb2_tmp, rec->value);
+       }
+       TALLOC_FREE(rec);
+
+       if (!NT_STATUS_IS_OK(tdb2_store_bystring(ksidstr, string_term_tdb_data(kidstr),
+                               TDB_INSERT))) {
+               DEBUG(0, ("Error storing SID -> ID\n"));
+               ret = NT_STATUS_UNSUCCESSFUL;
+               goto done;
+       }
+       if (!NT_STATUS_IS_OK(tdb2_store_bystring(kidstr, string_term_tdb_data(ksidstr),
+                               TDB_INSERT))) {
+               DEBUG(0, ("Error storing ID -> SID\n"));
+               /* try to remove the previous stored SID -> ID map */
+               tdb2_delete_bystring(ksidstr);
+               ret = NT_STATUS_UNSUCCESSFUL;
+               goto done;
+       }
+
+       DEBUG(10,("Stored %s <-> %s\n", ksidstr, kidstr));
+       ret = NT_STATUS_OK;
+
+done:
+       talloc_free(ksidstr);
+       talloc_free(kidstr);
+       SAFE_FREE(data.dptr);
+       TALLOC_FREE(update_lock);
+       return ret;
+}
+
+/*
+  remove a mapping. 
+*/
+static NTSTATUS idmap_tdb2_remove_mapping(struct idmap_domain *dom, const struct id_map *map)
+{
+       /* not supported as it would invalidate the cache tdb on other
+          nodes */
+       DEBUG(0,("idmap_tdb2_remove_mapping not supported\n"));
+       return NT_STATUS_NOT_SUPPORTED;
+}
+
+/*
+  Close the idmap tdb instance
+*/
+static NTSTATUS idmap_tdb2_close(struct idmap_domain *dom)
+{
+       /* don't do anything */
+       return NT_STATUS_OK;
+}
+
+
+/*
+  Dump all mappings out
+*/
+static NTSTATUS idmap_tdb2_dump_data(struct idmap_domain *dom, struct id_map **maps, int *num_maps)
+{
+       DEBUG(0,("idmap_tdb2_dump_data not supported\n"));
+       return NT_STATUS_NOT_SUPPORTED;
+}
+
+static struct idmap_methods db_methods = {
+       .init            = idmap_tdb2_db_init,
+       .unixids_to_sids = idmap_tdb2_unixids_to_sids,
+       .sids_to_unixids = idmap_tdb2_sids_to_unixids,
+       .set_mapping     = idmap_tdb2_set_mapping,
+       .remove_mapping  = idmap_tdb2_remove_mapping,
+       .dump_data       = idmap_tdb2_dump_data,
+       .close_fn        = idmap_tdb2_close
+};
+
+static struct idmap_alloc_methods db_alloc_methods = {
+       .init        = idmap_tdb2_alloc_init,
+       .allocate_id = idmap_tdb2_allocate_id,
+       .get_id_hwm  = idmap_tdb2_get_hwm,
+       .set_id_hwm  = idmap_tdb2_set_hwm,
+       .close_fn    = idmap_tdb2_alloc_close
+};
+
+NTSTATUS idmap_tdb2_init(void)
+{
+       NTSTATUS ret;
+
+       /* register both backends */
+       ret = smb_register_idmap_alloc(SMB_IDMAP_INTERFACE_VERSION, "tdb2", &db_alloc_methods);
+       if (! NT_STATUS_IS_OK(ret)) {
+               DEBUG(0, ("Unable to register idmap alloc tdb2 module: %s\n", get_friendly_nt_error_msg(ret)));
+               return ret;
+       }
+
+       return smb_register_idmap(SMB_IDMAP_INTERFACE_VERSION, "tdb2", &db_methods);
+}
index 07cf22618e4a37b678876857363e176c103a4cb3..615f4a918e6c06bbafbc132b39cf0beb4bd9728c 100644 (file)
@@ -121,7 +121,24 @@ static void flush_caches(void)
            otherwise cached access denied errors due to restrict anonymous
            hang around until the sequence number changes. */
 
-       wcache_invalidate_cache();
+       if (!wcache_invalidate_cache()) {
+               DEBUG(0, ("invalidating the cache failed; revalidate the cache\n"));
+               /* Close the cache to be able to valdite the cache */
+               close_winbindd_cache();
+               /*
+                * Ensure all cache and idmap caches are consistent
+                * before we initialize the cache again.
+                */
+               if (winbindd_validate_cache() < 0) {
+                       DEBUG(0, ("winbindd cache tdb corrupt and no backup "
+                                 "could be restore.\n"));
+               }
+
+               /* Initialize cache again. */
+               if (!initialize_winbindd_cache()) {
+                       exit(1);
+               }
+       }
 }
 
 /* Handle the signal by unlinking socket and exiting */
@@ -1210,6 +1227,10 @@ int main(int argc, char **argv, char **envp)
                           MSG_WINBIND_VALIDATE_CACHE,
                           winbind_msg_validate_cache);
 
+       messaging_register(winbind_messaging_context(), NULL,
+                          MSG_WINBIND_DUMP_DOMAIN_LIST,
+                          winbind_msg_dump_domain_list);
+
        netsamlogon_cache_init(); /* Non-critical */
        
        /* clear the cached list of trusted domains */
index 6bf6e6c68f91213425d1953e8d6997710e1233fb..c4c1278d739868899b457189e44e2e6ada4ec558 100644 (file)
@@ -164,9 +164,9 @@ struct winbindd_domain {
        fstring alt_name;                      /* alt Domain name, if any (FQDN for ADS) */
        fstring forest_name;                   /* Name of the AD forest we're in */
        DOM_SID sid;                           /* SID for this domain */
-       uint32 domain_flags;                   /* Domain flags from rpc_ds.h */
-       uint32 domain_type;                    /* Domain type from rpc_ds.h */
-       uint32 domain_trust_attribs;           /* Trust attribs from rpc_ds.h */
+       uint32 domain_flags;                   /* Domain flags from netlogon.h */
+       uint32 domain_type;                    /* Domain type from netlogon.h */
+       uint32 domain_trust_attribs;           /* Trust attribs from netlogon.h */
        bool initialized;                      /* Did we already ask for the domain mode? */
        bool native_mode;                      /* is this a win2k domain in native mode ? */
        bool active_directory;                 /* is this a win2k active directory ? */
index c9b2a52388a3937ac03d84a96afd8375356d34b3..db7ceca04de661aef3c7f5a728c9f74aa7b84013 100644 (file)
@@ -596,8 +596,9 @@ static NTSTATUS lookup_usergroups_member(struct winbindd_domain *domain,
        num_groups = 0;
 
        /* always add the primary group to the sid array */
-       if (!add_sid_to_array(mem_ctx, primary_group, user_sids, &num_groups)) {
-               status = NT_STATUS_NO_MEMORY;
+       status = add_sid_to_array(mem_ctx, primary_group, user_sids,
+                                 &num_groups);
+       if (!NT_STATUS_IS_OK(status)) {
                goto done;
        }
 
@@ -615,10 +616,10 @@ static NTSTATUS lookup_usergroups_member(struct winbindd_domain *domain,
                        if (sid_check_is_in_builtin(&group_sid)) {
                                continue;
                        }
-                              
-                       if (!add_sid_to_array(mem_ctx, &group_sid, user_sids,
-                                        &num_groups)) {
-                               status = NT_STATUS_NO_MEMORY;
+
+                       status = add_sid_to_array(mem_ctx, &group_sid,
+                                                 user_sids, &num_groups);
+                       if (!NT_STATUS_IS_OK(status)) {
                                goto done;
                        }
                }
@@ -684,8 +685,9 @@ static NTSTATUS lookup_usergroups_memberof(struct winbindd_domain *domain,
        num_groups = 0;
 
        /* always add the primary group to the sid array */
-       if (!add_sid_to_array(mem_ctx, primary_group, user_sids, &num_groups)) {
-               status = NT_STATUS_NO_MEMORY;
+       status = add_sid_to_array(mem_ctx, primary_group, user_sids,
+                                 &num_groups);
+       if (!NT_STATUS_IS_OK(status)) {
                goto done;
        }
 
@@ -720,10 +722,10 @@ static NTSTATUS lookup_usergroups_memberof(struct winbindd_domain *domain,
                if (sid_check_is_in_builtin(&group_sids[i])) {
                        continue;
                }
-                      
-               if (!add_sid_to_array(mem_ctx, &group_sids[i], user_sids,
-                                &num_groups)) {
-                       status = NT_STATUS_NO_MEMORY;
+
+               status = add_sid_to_array(mem_ctx, &group_sids[i], user_sids,
+                                         &num_groups);
+               if (!NT_STATUS_IS_OK(status)) {
                        goto done;
                }
        
@@ -861,8 +863,9 @@ static NTSTATUS lookup_usergroups(struct winbindd_domain *domain,
        *user_sids = NULL;
        num_groups = 0;
 
-       if (!add_sid_to_array(mem_ctx, &primary_group, user_sids, &num_groups)) {
-               status = NT_STATUS_NO_MEMORY;
+       status = add_sid_to_array(mem_ctx, &primary_group, user_sids,
+                                 &num_groups);
+       if (!NT_STATUS_IS_OK(status)) {
                goto done;
        }
        
@@ -872,10 +875,10 @@ static NTSTATUS lookup_usergroups(struct winbindd_domain *domain,
                if (sid_check_is_in_builtin(&sids[i])) {
                        continue;
                }
-                              
-               if (!add_sid_to_array_unique(mem_ctx, &sids[i],
-                                       user_sids, &num_groups)) {
-                       status = NT_STATUS_NO_MEMORY;
+
+               status = add_sid_to_array_unique(mem_ctx, &sids[i],
+                                                user_sids, &num_groups);
+               if (!NT_STATUS_IS_OK(status)) {
                        goto done;
                }
        }
@@ -1154,12 +1157,11 @@ static NTSTATUS trusted_domains(struct winbindd_domain *domain,
                                DOM_SID **dom_sids)
 {
        NTSTATUS                result = NT_STATUS_UNSUCCESSFUL;
-       struct ds_domain_trust  *domains = NULL;
-       int                     count = 0;
+       struct netr_DomainTrustList trusts;
        int                     i;
        uint32                  flags;  
        struct rpc_pipe_client *cli;
-       uint32                 fr_flags = (DS_DOMAIN_IN_FOREST | DS_DOMAIN_TREE_ROOT);  
+       uint32                 fr_flags = (NETR_TRUST_FLAG_IN_FOREST | NETR_TRUST_FLAG_TREEROOT);
        int ret_count;
        
        DEBUG(3,("ads: trusted_domains\n"));
@@ -1176,11 +1178,11 @@ static NTSTATUS trusted_domains(struct winbindd_domain *domain,
        if ( domain->primary ||
                ((domain->domain_flags&fr_flags) == fr_flags) ) 
        {
-               flags = DS_DOMAIN_DIRECT_OUTBOUND | 
-                       DS_DOMAIN_DIRECT_INBOUND | 
-                       DS_DOMAIN_IN_FOREST;
+               flags = NETR_TRUST_FLAG_OUTBOUND |
+                       NETR_TRUST_FLAG_INBOUND |
+                       NETR_TRUST_FLAG_IN_FOREST;
        } else {
-               flags = DS_DOMAIN_IN_FOREST;
+               flags = NETR_TRUST_FLAG_IN_FOREST;
        }       
 
        result = cm_connect_netlogon(domain, &cli);
@@ -1191,29 +1193,27 @@ static NTSTATUS trusted_domains(struct winbindd_domain *domain,
                          domain->name, nt_errstr(result)));
                return NT_STATUS_UNSUCCESSFUL;
        }
-       
-       if ( NT_STATUS_IS_OK(result) ) {
-               result = rpccli_ds_enum_domain_trusts(cli, mem_ctx,
-                                                     cli->cli->desthost, 
-                                                     flags, &domains,
-                                                     (unsigned int *)&count);
-       }
-       
-       if ( NT_STATUS_IS_OK(result) && count) {
+
+       result = rpccli_netr_DsrEnumerateDomainTrusts(cli, mem_ctx,
+                                                     cli->cli->desthost,
+                                                     flags,
+                                                     &trusts,
+                                                     NULL);
+       if ( NT_STATUS_IS_OK(result) && trusts.count) {
 
                /* Allocate memory for trusted domain names and sids */
 
-               if ( !(*names = TALLOC_ARRAY(mem_ctx, char *, count)) ) {
+               if ( !(*names = TALLOC_ARRAY(mem_ctx, char *, trusts.count)) ) {
                        DEBUG(0, ("trusted_domains: out of memory\n"));
                        return NT_STATUS_NO_MEMORY;
                }
 
-               if ( !(*alt_names = TALLOC_ARRAY(mem_ctx, char *, count)) ) {
+               if ( !(*alt_names = TALLOC_ARRAY(mem_ctx, char *, trusts.count)) ) {
                        DEBUG(0, ("trusted_domains: out of memory\n"));
                        return NT_STATUS_NO_MEMORY;
                }
 
-               if ( !(*dom_sids = TALLOC_ARRAY(mem_ctx, DOM_SID, count)) ) {
+               if ( !(*dom_sids = TALLOC_ARRAY(mem_ctx, DOM_SID, trusts.count)) ) {
                        DEBUG(0, ("trusted_domains: out of memory\n"));
                        return NT_STATUS_NO_MEMORY;
                }
@@ -1222,7 +1222,7 @@ static NTSTATUS trusted_domains(struct winbindd_domain *domain,
 
 
                ret_count = 0;          
-               for (i = 0; i < count; i++) {
+               for (i = 0; i < trusts.count; i++) {
                        struct winbindd_domain d;
                        
                        /* drop external trusts if this is not our primary 
@@ -1230,24 +1230,24 @@ static NTSTATUS trusted_domains(struct winbindd_domain *domain,
                           domains may be less that the ones actually trusted
                           by the DC. */
 
-                       if ( (domains[i].trust_attributes == DS_DOMAIN_TRUST_ATTRIB_QUARANTINED_DOMAIN) && 
+                       if ( (trusts.array[i].trust_attributes == NETR_TRUST_ATTRIBUTE_QUARANTINED_DOMAIN) &&
                             !domain->primary ) 
                        {
                                DEBUG(10,("trusted_domains: Skipping external trusted domain "
                                          "%s because it is outside of our primary domain\n",
-                                         domains[i].netbios_domain));                          
+                                         trusts.array[i].netbios_name));
                                continue;                               
                        }
                        
-                       (*names)[ret_count] = domains[i].netbios_domain;
-                       (*alt_names)[ret_count] = domains[i].dns_domain;
-                       sid_copy(&(*dom_sids)[ret_count], &domains[i].sid);
+                       (*names)[ret_count] = CONST_DISCARD(char *, trusts.array[i].netbios_name);
+                       (*alt_names)[ret_count] = CONST_DISCARD(char *, trusts.array[i].dns_name);
+                       sid_copy(&(*dom_sids)[ret_count], trusts.array[i].sid);
 
                        /* add to the trusted domain cache */
 
-                       fstrcpy( d.name,  domains[i].netbios_domain );
-                       fstrcpy( d.alt_name, domains[i].dns_domain );                   
-                       sid_copy( &d.sid, &domains[i].sid );
+                       fstrcpy( d.name,  trusts.array[i].netbios_name);
+                       fstrcpy( d.alt_name, trusts.array[i].dns_name);
+                       sid_copy( &d.sid, trusts.array[i].sid);
 
                        /* This gets a little tricky.  If we are
                           following a transitive forest trust, then
@@ -1266,16 +1266,28 @@ static NTSTATUS trusted_domains(struct winbindd_domain *domain,
                                   we have the current trust flags and
                                   attributes */
 
-                               d.domain_flags = domains[i].flags;
-                               d.domain_type = domains[i].trust_type;
-                               d.domain_trust_attribs = domains[i].trust_attributes;
+                               d.domain_flags = trusts.array[i].trust_flags;
+                               d.domain_type = trusts.array[i].trust_type;
+                               d.domain_trust_attribs = trusts.array[i].trust_attributes;
                        } else {
+                               /* Look up the record in the cache */
+                               struct winbindd_tdc_domain *parent;
+
                                DEBUG(10,("trusted_domains(ads):  Inheriting trust "
                                          "flags for domain %s\n", d.alt_name));                                
+
+                               parent = wcache_tdc_fetch_domain(NULL, domain->name);
+                               if (parent) {
+                                       d.domain_flags = parent->trust_flags;
+                                       d.domain_type  = parent->trust_type;
+                                       d.domain_trust_attribs = parent->trust_attribs;
+                               } else {
                                d.domain_flags = domain->domain_flags;                          
                                d.domain_type  = domain->domain_type;
                                d.domain_trust_attribs = domain->domain_trust_attribs;
                        }
+                               TALLOC_FREE(parent);
+                       }
 
                        wcache_tdc_add_domain( &d );
 
index 76724582a1817a97e7662919ba3803d02c750d84..ab32ee0c761d59bdbed61fdff201d847fb564c82 100644 (file)
@@ -492,7 +492,9 @@ static bool parse_sidlist(TALLOC_CTX *mem_ctx, char *sidstr,
                        DEBUG(0, ("Could not parse sid %s\n", p));
                        return False;
                }
-               if (!add_sid_to_array(mem_ctx, &sid, sids, num_sids)) {
+               if (!NT_STATUS_IS_OK(add_sid_to_array(mem_ctx, &sid, sids,
+                                                     num_sids)))
+               {
                        return False;
                }
                p = q;
@@ -714,7 +716,9 @@ enum winbindd_result winbindd_dual_getsidaliases(struct winbindd_domain *domain,
                DEBUGADD(10, (" rid %d\n", alias_rids[i]));
                sid_copy(&sid, &domain->sid);
                sid_append_rid(&sid, alias_rids[i]);
-               if (!add_sid_to_array(state->mem_ctx, &sid, &sids, &num_sids)) {
+               result = add_sid_to_array(state->mem_ctx, &sid, &sids,
+                                         &num_sids);
+               if (!NT_STATUS_IS_OK(result)) {
                        return WINBINDD_ERROR;
                }
        }
@@ -832,8 +836,9 @@ static void gettoken_recvdomgroups(TALLOC_CTX *mem_ctx, bool success,
        state->sids = NULL;
        state->num_sids = 0;
 
-       if (!add_sid_to_array(mem_ctx, &state->user_sid, &state->sids,
-                        &state->num_sids)) {
+       if (!NT_STATUS_IS_OK(add_sid_to_array(mem_ctx, &state->user_sid,
+                                             &state->sids, &state->num_sids)))
+       {
                DEBUG(0, ("Out of memory\n"));
                state->cont(state->private_data, False, NULL, 0);
                return;
@@ -874,8 +879,11 @@ static void gettoken_recvaliases(void *private_data, bool success,
        }
 
        for (i=0; i<num_aliases; i++) {
-               if (!add_sid_to_array(state->mem_ctx, &aliases[i],
-                                &state->sids, &state->num_sids)) {
+               if (!NT_STATUS_IS_OK(add_sid_to_array(state->mem_ctx,
+                                                     &aliases[i],
+                                                     &state->sids,
+                                                     &state->num_sids)))
+               {
                        DEBUG(0, ("Out of memory\n"));
                        state->cont(state->private_data, False, NULL, 0);
                        return;
index f63c7a5b2f7185b9384fa9e3b9bcbdf81fd572a5..c2938614922e72f6bde3e0d75022db1022390bd5 100644 (file)
@@ -62,7 +62,7 @@ static bool is_non_centry_key(TDB_DATA kbuf)
        int i;
 
        if (kbuf.dptr == NULL || kbuf.dsize == 0) {
-               return False;
+               return false;
        }
        for (i = 0; non_centry_keys[i] != NULL; i++) {
                size_t namelen = strlen(non_centry_keys[i]);
@@ -70,10 +70,10 @@ static bool is_non_centry_key(TDB_DATA kbuf)
                        continue;
                }
                if (strncmp(non_centry_keys[i], (const char *)kbuf.dptr, namelen) == 0) {
-                       return True;
+                       return true;
                }
        }
-       return False;
+       return false;
 }
 
 /* Global online/offline state - False when online. winbindd starts up online
@@ -210,9 +210,9 @@ static bool centry_check_bytes(struct cache_entry *centry, size_t nbytes)
                DEBUG(0,("centry corruption? needed %u bytes, have %d\n", 
                         (unsigned int)nbytes,
                         centry->len - centry->ofs));
-               return False;
+               return false;
        }
-       return True;
+       return true;
 }
 
 /*
@@ -348,9 +348,9 @@ static bool centry_sid(struct cache_entry *centry, TALLOC_CTX *mem_ctx, DOM_SID
        char *sid_string;
        sid_string = centry_string(centry, mem_ctx);
        if ((sid_string == NULL) || (!string_to_sid(sid, sid_string))) {
-               return False;
+               return false;
        }
-       return True;
+       return true;
 }
 
 
@@ -372,7 +372,7 @@ static bool wcache_server_down(struct winbindd_domain *domain)
        bool ret;
 
        if (!wcache->tdb)
-               return False;
+               return false;
 
        ret = (domain->sequence_number == DOM_SEQUENCE_NONE);
 
@@ -454,7 +454,7 @@ static NTSTATUS store_cache_seqnum( struct winbindd_domain *domain )
 }
 
 /*
-  refresh the domain sequence number. If force is True
+  refresh the domain sequence number. If force is true
   then always refresh it, no matter how recently we fetched it
 */
 
@@ -538,7 +538,7 @@ static bool centry_expired(struct winbindd_domain *domain, const char *keystr, s
        if (lp_winbind_offline_logon() && global_winbindd_offline_state) {
                DEBUG(10,("centry_expired: Key %s for domain %s valid as winbindd is globally offline.\n",
                        keystr, domain->name ));
-               return False;
+               return false;
        }
 
        /* when the domain is offline return the cached entry.
@@ -547,7 +547,7 @@ static bool centry_expired(struct winbindd_domain *domain, const char *keystr, s
        if (!domain->online) {
                DEBUG(10,("centry_expired: Key %s for domain %s valid as domain is offline.\n",
                        keystr, domain->name ));
-               return False;
+               return false;
        }
 
        /* if the server is OK and our cache entry came from when it was down then
@@ -556,7 +556,7 @@ static bool centry_expired(struct winbindd_domain *domain, const char *keystr, s
            (centry->sequence_number == DOM_SEQUENCE_NONE)) {
                DEBUG(10,("centry_expired: Key %s for domain %s invalid sequence.\n",
                        keystr, domain->name ));
-               return True;
+               return true;
        }
 
        /* if the server is down or the cache entry is not older than the
@@ -565,14 +565,14 @@ static bool centry_expired(struct winbindd_domain *domain, const char *keystr, s
            centry->sequence_number == domain->sequence_number) {
                DEBUG(10,("centry_expired: Key %s for domain %s is good.\n",
                        keystr, domain->name ));
-               return False;
+               return false;
        }
 
        DEBUG(10,("centry_expired: Key %s for domain %s expired\n",
                keystr, domain->name ));
 
        /* it's expired */
-       return True;
+       return true;
 }
 
 static struct cache_entry *wcache_fetch_raw(char *kstr)
@@ -625,7 +625,7 @@ static struct cache_entry *wcache_fetch(struct winbind_cache *cache,
                return NULL;
        }
 
-       refresh_sequence_number(domain, False);
+       refresh_sequence_number(domain, false);
 
        va_start(ap, format);
        smb_xvasprintf(&kstr, format, ap);
@@ -1189,7 +1189,7 @@ do_query:
                 (retry++ < 5));
 
        /* and save it */
-       refresh_sequence_number(domain, False);
+       refresh_sequence_number(domain, false);
        centry = centry_start(domain, status);
        if (!centry)
                goto skip_save;
@@ -1280,7 +1280,7 @@ do_query:
        status = domain->backend->enum_dom_groups(domain, mem_ctx, num_entries, info);
 
        /* and save it */
-       refresh_sequence_number(domain, False);
+       refresh_sequence_number(domain, false);
        centry = centry_start(domain, status);
        if (!centry)
                goto skip_save;
@@ -1364,7 +1364,7 @@ do_query:
        status = domain->backend->enum_local_groups(domain, mem_ctx, num_entries, info);
 
        /* and save it */
-       refresh_sequence_number(domain, False);
+       refresh_sequence_number(domain, false);
        centry = centry_start(domain, status);
        if (!centry)
                goto skip_save;
@@ -1437,7 +1437,7 @@ do_query:
                                              domain_name, name, sid, type);
 
        /* and save it */
-       refresh_sequence_number(domain, False);
+       refresh_sequence_number(domain, false);
 
        if (domain->online &&
            (NT_STATUS_IS_OK(status) || NT_STATUS_EQUAL(status, NT_STATUS_NONE_MAPPED))) {
@@ -1510,7 +1510,7 @@ do_query:
        status = domain->backend->sid_to_name(domain, mem_ctx, sid, domain_name, name, type);
 
        /* and save it */
-       refresh_sequence_number(domain, False);
+       refresh_sequence_number(domain, false);
        wcache_save_sid_to_name(domain, status, sid, *domain_name, *name, *type);
 
        /* We can't save the name to sid mapping here, as with sid history a
@@ -1554,7 +1554,7 @@ static NTSTATUS rids_to_names(struct winbindd_domain *domain,
                goto error;
        }
 
-       have_mapped = have_unmapped = False;
+       have_mapped = have_unmapped = false;
 
        for (i=0; i<num_rids; i++) {
                DOM_SID sid;
@@ -1577,7 +1577,7 @@ static NTSTATUS rids_to_names(struct winbindd_domain *domain,
 
                if (NT_STATUS_IS_OK(centry->status)) {
                        char *dom;
-                       have_mapped = True;
+                       have_mapped = true;
                        (*types)[i] = (enum lsa_SidType)centry_uint32(centry);
 
                        dom = centry_string(centry, mem_ctx);
@@ -1590,7 +1590,7 @@ static NTSTATUS rids_to_names(struct winbindd_domain *domain,
                        (*names)[i] = centry_string(centry, *names);
 
                } else if (NT_STATUS_EQUAL(centry->status, NT_STATUS_NONE_MAPPED)) {
-                       have_unmapped = True;
+                       have_unmapped = true;
 
                } else {
                        /* something's definitely wrong */
@@ -1647,7 +1647,7 @@ static NTSTATUS rids_to_names(struct winbindd_domain *domain,
                return result;
        }
 
-       refresh_sequence_number(domain, False);
+       refresh_sequence_number(domain, false);
 
        for (i=0; i<num_rids; i++) {
                DOM_SID sid;
@@ -1739,7 +1739,7 @@ do_query:
        status = domain->backend->query_user(domain, mem_ctx, user_sid, info);
 
        /* and save it */
-       refresh_sequence_number(domain, False);
+       refresh_sequence_number(domain, false);
        wcache_save_user(domain, status, info);
 
        return status;
@@ -1819,7 +1819,7 @@ do_query:
                goto skip_save;
        
        /* and save it */
-       refresh_sequence_number(domain, False);
+       refresh_sequence_number(domain, false);
        centry = centry_start(domain, status);
        if (!centry)
                goto skip_save;
@@ -1912,7 +1912,7 @@ static NTSTATUS lookup_useraliases(struct winbindd_domain *domain,
                                                     num_aliases, alias_rids);
 
        /* and save it */
-       refresh_sequence_number(domain, False);
+       refresh_sequence_number(domain, false);
        centry = centry_start(domain, status);
        if (!centry)
                goto skip_save;
@@ -1993,7 +1993,7 @@ do_query:
                                                  sid_mem, names, name_types);
 
        /* and save it */
-       refresh_sequence_number(domain, False);
+       refresh_sequence_number(domain, false);
        centry = centry_start(domain, status);
        if (!centry)
                goto skip_save;
@@ -2013,7 +2013,7 @@ skip_save:
 /* find the sequence number for a domain */
 static NTSTATUS sequence_number(struct winbindd_domain *domain, uint32 *seq)
 {
-       refresh_sequence_number(domain, False);
+       refresh_sequence_number(domain, false);
 
        *seq = domain->sequence_number;
 
@@ -2104,7 +2104,7 @@ do_query:
            the main parent and always to make the query.  --jerry */
 
        /* and save it */
-       refresh_sequence_number(domain, False);
+       refresh_sequence_number(domain, false);
  
        centry = centry_start(domain, status);
        if (!centry)
@@ -2170,7 +2170,7 @@ do_query:
        status = domain->backend->lockout_policy(domain, mem_ctx, policy); 
  
        /* and save it */
-       refresh_sequence_number(domain, False);
+       refresh_sequence_number(domain, false);
        wcache_save_lockout_policy(domain, status, policy);
  
        return status;
@@ -2221,7 +2221,7 @@ do_query:
        status = domain->backend->password_policy(domain, mem_ctx, policy); 
 
        /* and save it */
-       refresh_sequence_number(domain, False);
+       refresh_sequence_number(domain, false);
        wcache_save_password_policy(domain, status, policy);
 
        return status;
@@ -2261,7 +2261,7 @@ void wcache_invalidate_samlogon(struct winbindd_domain *domain,
        netsamlogon_clear_cached_user(cache->tdb, info3);
 }
 
-void wcache_invalidate_cache(void)
+bool wcache_invalidate_cache(void)
 {
        struct winbindd_domain *domain;
 
@@ -2270,9 +2270,15 @@ void wcache_invalidate_cache(void)
 
                DEBUG(10, ("wcache_invalidate_cache: invalidating cache "
                           "entries for %s\n", domain->name));
-               if (cache)
-                       tdb_traverse(cache->tdb, traverse_fn, NULL);
+               if (cache) {
+                       if (cache->tdb) {
+                               tdb_traverse(cache->tdb, traverse_fn, NULL);
+                       } else {
+                               return false;
+                       }
+               }
        }
+       return true;
 }
 
 bool init_wcache(void)
@@ -2283,7 +2289,7 @@ bool init_wcache(void)
        }
 
        if (wcache->tdb != NULL)
-               return True;
+               return true;
 
        /* when working offline we must not clear the cache on restart */
        wcache->tdb = tdb_open_log(lock_path("winbindd_cache.tdb"),
@@ -2293,10 +2299,10 @@ bool init_wcache(void)
 
        if (wcache->tdb == NULL) {
                DEBUG(0,("Failed to open winbindd_cache.tdb!\n"));
-               return False;
+               return false;
        }
 
-       return True;
+       return true;
 }
 
 /************************************************************************
@@ -2307,18 +2313,18 @@ bool init_wcache(void)
 
 bool initialize_winbindd_cache(void)
 {
-       bool cache_bad = True;
+       bool cache_bad = true;
        uint32 vers;
 
        if (!init_wcache()) {
                DEBUG(0,("initialize_winbindd_cache: init_wcache failed.\n"));
-               return False;
+               return false;
        }
 
        /* Check version number. */
        if (tdb_fetch_uint32(wcache->tdb, WINBINDD_CACHE_VERSION_KEYSTR, &vers) &&
                        vers == WINBINDD_CACHE_VERSION) {
-               cache_bad = False;
+               cache_bad = false;
        }
 
        if (cache_bad) {
@@ -2333,25 +2339,36 @@ bool initialize_winbindd_cache(void)
                        DEBUG(0,("initialize_winbindd_cache: unlink %s failed %s ",
                                lock_path("winbindd_cache.tdb"),
                                strerror(errno) ));
-                       return False;
+                       return false;
                }
                if (!init_wcache()) {
                        DEBUG(0,("initialize_winbindd_cache: re-initialization "
                                        "init_wcache failed.\n"));
-                       return False;
+                       return false;
                }
 
                /* Write the version. */
                if (!tdb_store_uint32(wcache->tdb, WINBINDD_CACHE_VERSION_KEYSTR, WINBINDD_CACHE_VERSION)) {
                        DEBUG(0,("initialize_winbindd_cache: version number store failed %s\n",
                                tdb_errorstr(wcache->tdb) ));
-                       return False;
+                       return false;
                }
        }
 
        tdb_close(wcache->tdb);
        wcache->tdb = NULL;
-       return True;
+       return true;
+}
+
+void close_winbindd_cache(void)
+{
+       if (!wcache) {
+               return;
+       }
+       if (wcache->tdb) {
+               tdb_close(wcache->tdb);
+               wcache->tdb = NULL;
+       }
 }
 
 void cache_store_response(pid_t pid, struct winbindd_response *response)
@@ -2400,7 +2417,7 @@ bool cache_retrieve_response(pid_t pid, struct winbindd_response * response)
        fstring key_str;
 
        if (!init_wcache())
-               return False;
+               return false;
 
        DEBUG(10, ("Retrieving response for pid %d\n", pid));
 
@@ -2408,17 +2425,17 @@ bool cache_retrieve_response(pid_t pid, struct winbindd_response * response)
        data = tdb_fetch(wcache->tdb, string_tdb_data(key_str));
 
        if (data.dptr == NULL)
-               return False;
+               return false;
 
        if (data.dsize != sizeof(*response))
-               return False;
+               return false;
 
        memcpy(response, data.dptr, data.dsize);
        SAFE_FREE(data.dptr);
 
        if (response->length == sizeof(*response)) {
                response->extra_data.data = NULL;
-               return True;
+               return true;
        }
 
        /* There's extra data */
@@ -2431,19 +2448,19 @@ bool cache_retrieve_response(pid_t pid, struct winbindd_response * response)
 
        if (data.dptr == NULL) {
                DEBUG(0, ("Did not find extra data\n"));
-               return False;
+               return false;
        }
 
        if (data.dsize != (response->length - sizeof(*response))) {
                DEBUG(0, ("Invalid extra data length: %d\n", (int)data.dsize));
                SAFE_FREE(data.dptr);
-               return False;
+               return false;
        }
 
        dump_data(11, (uint8 *)data.dptr, data.dsize);
 
        response->extra_data.data = data.dptr;
-       return True;
+       return true;
 }
 
 void cache_cleanup_response(pid_t pid)
@@ -2475,19 +2492,19 @@ bool lookup_cached_sid(TALLOC_CTX *mem_ctx, const DOM_SID *sid,
 
        domain = find_lookup_domain_from_sid(sid);
        if (domain == NULL) {
-               return False;
+               return false;
        }
 
        cache = get_cache(domain);
 
        if (cache->tdb == NULL) {
-               return False;
+               return false;
        }
 
        centry = wcache_fetch(cache, domain, "SN/%s",
                              sid_to_fstring(tmp, sid));
        if (centry == NULL) {
-               return False;
+               return false;
        }
 
        if (NT_STATUS_IS_OK(centry->status)) {
@@ -2516,13 +2533,13 @@ bool lookup_cached_name(TALLOC_CTX *mem_ctx,
 
        domain = find_lookup_domain_from_name(domain_name);
        if (domain == NULL) {
-               return False;
+               return false;
        }
 
        cache = get_cache(domain);
 
        if (cache->tdb == NULL) {
-               return False;
+               return false;
        }
 
        fstrcpy(uname, name);
@@ -2532,12 +2549,12 @@ bool lookup_cached_name(TALLOC_CTX *mem_ctx,
           offline so the cache won't expire the entry */
        
        original_online_state = domain->online;
-       domain->online = False;
+       domain->online = false;
        centry = wcache_fetch(cache, domain, "NS/%s/%s", domain_name, uname);
        domain->online = original_online_state;
        
        if (centry == NULL) {
-               return False;
+               return false;
        }
 
        if (NT_STATUS_IS_OK(centry->status)) {
@@ -2555,7 +2572,7 @@ void cache_name2sid(struct winbindd_domain *domain,
                    const char *domain_name, const char *name,
                    enum lsa_SidType type, const DOM_SID *sid)
 {
-       refresh_sequence_number(domain, False);
+       refresh_sequence_number(domain, false);
        wcache_save_name_to_sid(domain, NT_STATUS_OK, domain_name, name,
                                sid, type);
 }
@@ -2769,17 +2786,17 @@ bool set_global_winbindd_state_offline(void)
 
        if (wcache == NULL || wcache->tdb == NULL) {
                DEBUG(10,("set_global_winbindd_state_offline: wcache not open yet.\n"));
-               return False;
+               return false;
        }
 
        if (!lp_winbind_offline_logon()) {
                DEBUG(10,("set_global_winbindd_state_offline: rejecting.\n"));
-               return False;
+               return false;
        }
 
        if (global_winbindd_offline_state) {
                /* Already offline. */
-               return True;
+               return true;
        }
 
        data = tdb_fetch_bystring( wcache->tdb, "WINBINDD_OFFLINE" );
@@ -2787,12 +2804,12 @@ bool set_global_winbindd_state_offline(void)
        if (!data.dptr || data.dsize != 4) {
                DEBUG(10,("set_global_winbindd_state_offline: offline state not set.\n"));
                SAFE_FREE(data.dptr);
-               return False;
+               return false;
        } else {
                DEBUG(10,("set_global_winbindd_state_offline: offline state set.\n"));
-               global_winbindd_offline_state = True;
+               global_winbindd_offline_state = true;
                SAFE_FREE(data.dptr);
-               return True;
+               return true;
        }
 }
 
@@ -2809,7 +2826,7 @@ void set_global_winbindd_state_online(void)
                /* Already online. */
                return;
        }
-       global_winbindd_offline_state = False;
+       global_winbindd_offline_state = false;
 
        if (!wcache->tdb) {
                return;
@@ -2846,8 +2863,8 @@ static struct cache_entry *create_centry_validate(const char *kstr, TDB_DATA dat
                /* huh? corrupt cache? */
                DEBUG(0,("create_centry_validate: Corrupt cache for key %s (len < 8) ?\n", kstr));
                centry_free(centry);
-               state->bad_entry = True;
-               state->success = False;
+               state->bad_entry = true;
+               state->success = false;
                return NULL;
        }
 
@@ -2862,7 +2879,7 @@ static int validate_seqnum(TALLOC_CTX *mem_ctx, const char *keystr, TDB_DATA dbu
        if (dbuf.dsize != 8) {
                DEBUG(0,("validate_seqnum: Corrupt cache for key %s (len %u != 8) ?\n",
                                keystr, (unsigned int)dbuf.dsize ));
-               state->bad_entry = True;
+               state->bad_entry = true;
                return 1;
        }
        return 0;
@@ -3157,8 +3174,8 @@ static int validate_dr(TALLOC_CTX *mem_ctx, const char *keystr, TDB_DATA dbuf,
        if (dbuf.dsize == 0) {
                DEBUG(0,("validate_dr: Corrupt cache for key %s (len == 0) ?\n",
                                keystr));
-               state->bad_entry = True;
-               state->success = False;
+               state->bad_entry = true;
+               state->success = false;
                return 1;
        }
 
@@ -3173,8 +3190,8 @@ static int validate_de(TALLOC_CTX *mem_ctx, const char *keystr, TDB_DATA dbuf,
        if (dbuf.dsize == 0) {
                DEBUG(0,("validate_de: Corrupt cache for key %s (len == 0) ?\n",
                                keystr));
-               state->bad_entry = True;
-               state->success = False;
+               state->bad_entry = true;
+               state->success = false;
                return 1;
        }
 
@@ -3217,8 +3234,8 @@ static int validate_trustdomcache(TALLOC_CTX *mem_ctx, const char *keystr,
        if (dbuf.dsize == 0) {
                DEBUG(0, ("validate_trustdomcache: Corrupt cache for "
                          "key %s (len ==0) ?\n", keystr));
-               state->bad_entry = True;
-               state->success = False;
+               state->bad_entry = true;
+               state->success = false;
                return 1;
        }
 
@@ -3233,8 +3250,8 @@ static int validate_offline(TALLOC_CTX *mem_ctx, const char *keystr, TDB_DATA db
        if (dbuf.dsize != 4) {
                DEBUG(0,("validate_offline: Corrupt cache for key %s (len %u != 4) ?\n",
                                keystr, (unsigned int)dbuf.dsize ));
-               state->bad_entry = True;
-               state->success = False;
+               state->bad_entry = true;
+               state->success = false;
                return 1;
        }
        DEBUG(10,("validate_offline: %s ok\n", keystr));
@@ -3248,8 +3265,8 @@ static int validate_cache_version(TALLOC_CTX *mem_ctx, const char *keystr, TDB_D
                DEBUG(0, ("validate_cache_version: Corrupt cache for "
                          "key %s (len %u != 4) ?\n", 
                          keystr, (unsigned int)dbuf.dsize));
-               state->bad_entry = True;
-               state->success = False;
+               state->bad_entry = true;
+               state->success = false;
                return 1;
        }
 
@@ -3338,8 +3355,8 @@ static int cache_traverse_validate_fn(TDB_CONTEXT *the_tdb, TDB_DATA kbuf, TDB_D
        dump_data(0, (uint8 *)kbuf.dptr, kbuf.dsize);
        DEBUG(0,("data :\n"));
        dump_data(0, (uint8 *)dbuf.dptr, dbuf.dsize);
-       v_state->unknown_key = True;
-       v_state->success = False;
+       v_state->unknown_key = true;
+       v_state->success = false;
        return 1; /* terminate. */
 }
 
@@ -3433,7 +3450,7 @@ static bool add_wbdomain_to_tdc_array( struct winbindd_domain *new_dom,
        struct winbindd_tdc_domain *list = NULL;
        size_t idx;
        int i;
-       bool set_only = False;  
+       bool set_only = false;
        
        /* don't allow duplicates */
 
@@ -3445,7 +3462,7 @@ static bool add_wbdomain_to_tdc_array( struct winbindd_domain *new_dom,
                        DEBUG(10,("add_wbdomain_to_tdc_array: Found existing record for %s\n",
                                  new_dom->name));
                        idx = i;
-                       set_only = True;
+                       set_only = true;
                        
                        break;
                }
@@ -3466,7 +3483,7 @@ static bool add_wbdomain_to_tdc_array( struct winbindd_domain *new_dom,
        }
 
        if ( !list )
-               return False;
+               return false;
 
        list[idx].domain_name = talloc_strdup( list, new_dom->name );
        list[idx].dns_name = talloc_strdup( list, new_dom->alt_name );
@@ -3488,7 +3505,7 @@ static bool add_wbdomain_to_tdc_array( struct winbindd_domain *new_dom,
                *num_domains = idx + 1; 
        }
 
-       return True;    
+       return true;
 }
 
 /*********************************************************************
@@ -3644,7 +3661,7 @@ static bool wcache_tdc_store_list( struct winbindd_tdc_domain *domains, size_t n
        int ret;
        
        if ( !key.dptr )
-               return False;
+               return false;
        
        /* See if we were asked to delete the cache entry */
 
@@ -3681,23 +3698,23 @@ bool wcache_tdc_fetch_list( struct winbindd_tdc_domain **domains, size_t *num_do
        *num_domains = 0;       
 
        if ( !key.dptr )
-               return False;
+               return false;
        
        data = tdb_fetch( wcache->tdb, key );
 
        SAFE_FREE( key.dptr );
        
        if ( !data.dptr ) 
-               return False;
+               return false;
        
        *num_domains = unpack_tdc_domains( data.dptr, data.dsize, domains );
 
        SAFE_FREE( data.dptr );
        
        if ( !*domains )
-               return False;
+               return false;
 
-       return True;    
+       return true;
 }
 
 /*********************************************************************
@@ -3707,7 +3724,7 @@ bool wcache_tdc_add_domain( struct winbindd_domain *domain )
 {
        struct winbindd_tdc_domain *dom_list = NULL;
        size_t num_domains = 0;
-       bool ret = False;       
+       bool ret = false;
 
        DEBUG(10,("wcache_tdc_add_domain: Adding domain %s (%s), SID %s, "
                  "flags = 0x%x, attributes = 0x%x, type = 0x%x\n",
@@ -3718,7 +3735,7 @@ bool wcache_tdc_add_domain( struct winbindd_domain *domain )
                  domain->domain_type));        
        
        if ( !init_wcache() ) {
-               return False;
+               return false;
        }
        
        /* fetch the list */
@@ -3739,7 +3756,7 @@ bool wcache_tdc_add_domain( struct winbindd_domain *domain )
        
        /* Success */
 
-       ret = True;     
+       ret = true;
  done:
        TALLOC_FREE( dom_list );
        
@@ -3759,7 +3776,7 @@ struct winbindd_tdc_domain * wcache_tdc_fetch_domain( TALLOC_CTX *ctx, const cha
        DEBUG(10,("wcache_tdc_fetch_domain: Searching for domain %s\n", name));
 
        if ( !init_wcache() ) {
-               return False;
+               return false;
        }
        
        /* fetch the list */
@@ -3892,7 +3909,7 @@ do_query:
 
 /* the cache backend methods are exposed via this structure */
 struct winbindd_methods cache_methods = {
-       True,
+       true,
        query_user_list,
        enum_dom_groups,
        enum_local_groups,
index cb366a293c07160f3d758b7797f9e40a7743cf37..d2a76630024dcca051a147275e81508f17af2c79 100644 (file)
@@ -74,7 +74,7 @@ extern bool override_logfile;
 
 static NTSTATUS init_dc_connection_network(struct winbindd_domain *domain);
 static void set_dc_type_and_flags( struct winbindd_domain *domain );
-static bool get_dcs(TALLOC_CTX *mem_ctx, const struct winbindd_domain *domain,
+static bool get_dcs(TALLOC_CTX *mem_ctx, struct winbindd_domain *domain,
                    struct dc_name_ip **dcs, int *num_dcs);
 
 /****************************************************************
@@ -560,7 +560,7 @@ static void cm_get_ipc_userpass(char **username, char **domain, char **password)
        }
 }
 
-static bool get_dc_name_via_netlogon(const struct winbindd_domain *domain,
+static bool get_dc_name_via_netlogon(struct winbindd_domain *domain,
                                     fstring dcname,
                                     struct sockaddr_storage *dc_ss)
 {
@@ -570,7 +570,7 @@ static bool get_dc_name_via_netlogon(const struct winbindd_domain *domain,
        WERROR werr;
        TALLOC_CTX *mem_ctx;
        unsigned int orig_timeout;
-       fstring tmp;
+       char *tmp = NULL;
        char *p;
 
        /* Hmmmm. We can only open one connection to the NETLOGON pipe at the
@@ -600,18 +600,51 @@ static bool get_dc_name_via_netlogon(const struct winbindd_domain *domain,
           35 seconds should do it. */
 
        orig_timeout = cli_set_timeout(netlogon_pipe->cli, 35000);
-       
-       werr = rpccli_netlogon_getanydcname(netlogon_pipe, mem_ctx, our_domain->dcname,
-                                           domain->name, tmp);
+
+       if (our_domain->active_directory) {
+               struct DS_DOMAIN_CONTROLLER_INFO *domain_info = NULL;
+
+               werr = rpccli_netlogon_dsr_getdcname(netlogon_pipe,
+                                                    mem_ctx,
+                                                    our_domain->dcname,
+                                                    domain->name,
+                                                    NULL,
+                                                    NULL,
+                                                    DS_RETURN_DNS_NAME,
+                                                    &domain_info);
+               if (W_ERROR_IS_OK(werr)) {
+                       tmp = talloc_strdup(
+                               mem_ctx, domain_info->domain_controller_name);
+                       if (tmp == NULL) {
+                               DEBUG(0, ("talloc_strdup failed\n"));
+                               talloc_destroy(mem_ctx);
+                               return false;
+                       }
+                       if (strlen(domain->alt_name) == 0) {
+                               fstrcpy(domain->alt_name,
+                                       domain_info->domain_name);
+                       }
+                       if (strlen(domain->forest_name) == 0) {
+                               fstrcpy(domain->forest_name,
+                                       domain_info->dns_forest_name);
+                       }
+               }
+       } else {
+
+               werr = rpccli_netlogon_getanydcname(netlogon_pipe,
+                                                   mem_ctx,
+                                                   our_domain->dcname,
+                                                   domain->name,
+                                                   &tmp);
+       }
 
        /* And restore our original timeout. */
        cli_set_timeout(netlogon_pipe->cli, orig_timeout);
 
-       talloc_destroy(mem_ctx);
-
        if (!W_ERROR_IS_OK(werr)) {
                DEBUG(10, ("rpccli_netlogon_getanydcname failed: %s\n",
                           dos_errstr(werr)));
+               talloc_destroy(mem_ctx);
                return False;
        }
 
@@ -626,6 +659,8 @@ static bool get_dc_name_via_netlogon(const struct winbindd_domain *domain,
 
        fstrcpy(dcname, p);
 
+       talloc_destroy(mem_ctx);
+
        DEBUG(10, ("rpccli_netlogon_getanydcname returned %s\n", dcname));
 
        if (!resolve_name(dcname, dc_ss, 0x20)) {
@@ -644,8 +679,22 @@ static NTSTATUS get_trust_creds(const struct winbindd_domain *domain,
                                char **machine_krb5_principal)
 {
        const char *account_name;
+       const char *name = NULL;
+       
+       /* If we are a DC and this is not our own domain */
 
-       if (!get_trust_pw_clear(domain->name, machine_password,
+       if (IS_DC) {
+               name = domain->name;
+       } else {
+               struct winbindd_domain *our_domain = find_our_domain();
+
+               if (!our_domain)
+                       return NT_STATUS_INVALID_SERVER_STATE;          
+               
+               name = our_domain->name;                
+       }       
+       
+       if (!get_trust_pw_clear(name, machine_password,
                                &account_name, NULL))
        {
                return NT_STATUS_CANT_ACCESS_DOMAIN_INFO;
@@ -659,11 +708,15 @@ static NTSTATUS get_trust_creds(const struct winbindd_domain *domain,
 
        /* this is at least correct when domain is our domain,
         * which is the only case, when this is currently used: */
-       if ((machine_krb5_principal != NULL) &&
-           (asprintf(machine_krb5_principal, "%s$@%s", account_name,
-                     domain->alt_name) == -1))
+       if (machine_krb5_principal != NULL)
        {
-               return NT_STATUS_NO_MEMORY;
+               if (asprintf(machine_krb5_principal, "%s$@%s",
+                            account_name, domain->alt_name) == -1)
+               {
+                       return NT_STATUS_NO_MEMORY;
+               }
+
+               strupper_m(*machine_krb5_principal);
        }
 
        return NT_STATUS_OK;
@@ -978,6 +1031,7 @@ static bool send_getdc_request(struct sockaddr_storage *dc_ss,
        char *p;
        fstring my_acct_name;
        fstring my_mailslot;
+       size_t sid_size;
 
        if (dc_ss->ss_family != AF_INET) {
                return false;
@@ -1019,7 +1073,9 @@ static bool send_getdc_request(struct sockaddr_storage *dc_ss,
        SIVAL(p, 0, 0x80);
        p+=4;
 
-       SIVAL(p, 0, sid_size(sid));
+       sid_size = ndr_size_dom_sid(sid, 0);
+
+       SIVAL(p, 0, sid_size);
        p+=4;
 
        p = ALIGN4(p, outbuf);
@@ -1027,12 +1083,12 @@ static bool send_getdc_request(struct sockaddr_storage *dc_ss,
                return false;
        }
 
-       sid_linearize(p, sid_size(sid), sid);
-       if (sid_size(sid) + 8 > sizeof(outbuf) - PTR_DIFF(p, outbuf)) {
+       if (sid_size + 8 > sizeof(outbuf) - PTR_DIFF(p, outbuf)) {
                return false;
        }
+       sid_linearize(p, sizeof(outbuf) - PTR_DIFF(p, outbuf), sid);
 
-       p += sid_size(sid);
+       p += sid_size;
 
        SIVAL(p, 0, 1);
        SSVAL(p, 4, 0xffff);
@@ -1216,7 +1272,7 @@ static bool dcip_to_name(const struct winbindd_domain *domain,
  the dcs[]  with results.
 *******************************************************************/
 
-static bool get_dcs(TALLOC_CTX *mem_ctx, const struct winbindd_domain *domain,
+static bool get_dcs(TALLOC_CTX *mem_ctx, struct winbindd_domain *domain,
                    struct dc_name_ip **dcs, int *num_dcs)
 {
        fstring dcname;
@@ -1319,7 +1375,7 @@ static bool get_dcs(TALLOC_CTX *mem_ctx, const struct winbindd_domain *domain,
 }
 
 static bool find_new_dc(TALLOC_CTX *mem_ctx,
-                       const struct winbindd_domain *domain,
+                       struct winbindd_domain *domain,
                        fstring dcname, struct sockaddr_storage *pss, int *fd)
 {
        struct dc_name_ip *dcs = NULL;
@@ -1660,12 +1716,11 @@ static bool set_dc_type_and_flags_trustinfo( struct winbindd_domain *domain )
 {
        struct winbindd_domain *our_domain;
        NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
-       struct ds_domain_trust *domains = NULL;
-       int count = 0;
+       struct netr_DomainTrustList trusts;
        int i;
-       uint32 flags = (DS_DOMAIN_IN_FOREST | 
-                       DS_DOMAIN_DIRECT_OUTBOUND | 
-                       DS_DOMAIN_DIRECT_INBOUND);
+       uint32 flags = (NETR_TRUST_FLAG_IN_FOREST |
+                       NETR_TRUST_FLAG_OUTBOUND |
+                       NETR_TRUST_FLAG_INBOUND);
        struct rpc_pipe_client *cli;
        TALLOC_CTX *mem_ctx = NULL;
 
@@ -1707,27 +1762,35 @@ static bool set_dc_type_and_flags_trustinfo( struct winbindd_domain *domain )
                return False;
        }       
 
-       result = rpccli_ds_enum_domain_trusts(cli, mem_ctx,
-                                             cli->cli->desthost, 
-                                             flags, &domains,
-                                             (unsigned int *)&count);
+       result = rpccli_netr_DsrEnumerateDomainTrusts(cli, mem_ctx,
+                                                     cli->cli->desthost,
+                                                     flags,
+                                                     &trusts,
+                                                     NULL);
+       if (!NT_STATUS_IS_OK(result)) {
+               DEBUG(0,("set_dc_type_and_flags_trustinfo: "
+                       "failed to query trusted domain list: %s\n",
+                       nt_errstr(result)));
+               talloc_destroy(mem_ctx);
+               return false;
+       }
 
        /* Now find the domain name and get the flags */
 
-       for ( i=0; i<count; i++ ) {
-               if ( strequal( domain->name, domains[i].netbios_domain ) ) {                    
-                       domain->domain_flags          = domains[i].flags;
-                       domain->domain_type           = domains[i].trust_type;
-                       domain->domain_trust_attribs  = domains[i].trust_attributes;
-                                               
-                       if ( domain->domain_type == DS_DOMAIN_TRUST_TYPE_UPLEVEL )
+       for ( i=0; i<trusts.count; i++ ) {
+               if ( strequal( domain->name, trusts.array[i].netbios_name) ) {
+                       domain->domain_flags          = trusts.array[i].trust_flags;
+                       domain->domain_type           = trusts.array[i].trust_type;
+                       domain->domain_trust_attribs  = trusts.array[i].trust_attributes;
+
+                       if ( domain->domain_type == NETR_TRUST_TYPE_UPLEVEL )
                                domain->active_directory = True;
 
                        /* This flag is only set if the domain is *our* 
                           primary domain and the primary domain is in
                           native mode */
 
-                       domain->native_mode = (domain->domain_flags & DS_DOMAIN_NATIVE_MODE);
+                       domain->native_mode = (domain->domain_flags & NETR_TRUST_FLAG_NATIVE);
 
                        DEBUG(5, ("set_dc_type_and_flags_trustinfo: domain %s is %sin "
                                  "native mode.\n", domain->name, 
@@ -1763,17 +1826,17 @@ static bool set_dc_type_and_flags_trustinfo( struct winbindd_domain *domain )
 static void set_dc_type_and_flags_connect( struct winbindd_domain *domain )
 {
        NTSTATUS                result;
-       DS_DOMINFO_CTR          ctr;
+       WERROR werr;
        TALLOC_CTX              *mem_ctx = NULL;
        struct rpc_pipe_client  *cli;
        POLICY_HND pol;
+       union dssetup_DsRoleInfo info;
 
-       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 );
        
        if (!connection_ok(domain)) {
                return;
@@ -1788,24 +1851,25 @@ static void set_dc_type_and_flags_connect( struct winbindd_domain *domain )
 
        DEBUG(5, ("set_dc_type_and_flags_connect: domain %s\n", domain->name ));
 
-       cli = cli_rpc_pipe_open_noauth(domain->conn.cli, PI_LSARPC_DS,
+       cli = cli_rpc_pipe_open_noauth(domain->conn.cli, PI_DSSETUP,
                                       &result);
 
        if (cli == NULL) {
                DEBUG(5, ("set_dc_type_and_flags_connect: Could not bind to "
-                         "PI_LSARPC_DS on domain %s: (%s)\n",
+                         "PI_DSSETUP on domain %s: (%s)\n",
                          domain->name, nt_errstr(result)));
 
                /* if this is just a non-AD domain we need to continue
                 * identifying so that we can in the end return with
                 * domain->initialized = True - gd */
 
-               goto no_lsarpc_ds;
+               goto no_dssetup;
        }
 
-       result = rpccli_ds_getprimarydominfo(cli, mem_ctx,
-                                            DsRolePrimaryDomainInfoBasic,
-                                            &ctr);
+       result = rpccli_dssetup_DsRoleGetPrimaryDomainInformation(cli, mem_ctx,
+                                                                 DS_ROLE_BASIC_INFORMATION,
+                                                                 &info,
+                                                                 &werr);
        cli_rpc_pipe_close(cli);
 
        if (!NT_STATUS_IS_OK(result)) {
@@ -1814,26 +1878,26 @@ static void set_dc_type_and_flags_connect( struct winbindd_domain *domain )
                          domain->name, nt_errstr(result)));
 
                /* older samba3 DCs will return DCERPC_FAULT_OP_RNG_ERROR for
-                * every opcode on the LSARPC_DS pipe, continue with
-                * no_lsarpc_ds mode here as well to get domain->initialized
+                * every opcode on the DSSETUP pipe, continue with
+                * no_dssetup mode here as well to get domain->initialized
                 * set - gd */
 
                if (NT_STATUS_V(result) == DCERPC_FAULT_OP_RNG_ERROR) {
-                       goto no_lsarpc_ds;
+                       goto no_dssetup;
                }
 
                TALLOC_FREE(mem_ctx);
                return;
        }
-       
-       if ((ctr.basic->flags & DSROLE_PRIMARY_DS_RUNNING) &&
-           !(ctr.basic->flags & DSROLE_PRIMARY_DS_MIXED_MODE)) {
+
+       if ((info.basic.flags & DS_ROLE_PRIMARY_DS_RUNNING) &&
+           !(info.basic.flags & DS_ROLE_PRIMARY_DS_MIXED_MODE)) {
                domain->native_mode = True;
        } else {
                domain->native_mode = False;
        }
 
-no_lsarpc_ds:
+no_dssetup:
        cli = cli_rpc_pipe_open_noauth(domain->conn.cli, PI_LSARPC, &result);
 
        if (cli == NULL) {
@@ -1866,9 +1930,17 @@ no_lsarpc_ds:
                if (dns_name)
                        fstrcpy(domain->alt_name, dns_name);
 
-               if ( forest_name )
+               /* See if we can set some domain trust flags about
+                  ourself */
+
+               if ( forest_name ) {
                        fstrcpy(domain->forest_name, forest_name);              
 
+                       if (strequal(domain->forest_name, domain->alt_name)) {
+                               domain->domain_flags = NETR_TRUST_FLAG_TREEROOT;
+                       }
+               }
+
                if (dom_sid) 
                        sid_copy(&domain->sid, dom_sid);
        } else {
@@ -2003,13 +2075,16 @@ NTSTATUS cm_connect_sam(struct winbindd_domain *domain, TALLOC_CTX *mem_ctx,
                        goto schannel;
                }
                domain_name = domain->name;
-               goto schannel;
        } else {
-               machine_password = conn_pwd;
-               machine_account = conn->cli->user_name;
+               machine_password = SMB_STRDUP(conn_pwd);                
+               machine_account = SMB_STRDUP(conn->cli->user_name);
                domain_name = conn->cli->domain;
        }
 
+       if (!machine_password || !machine_account) {
+               result = NT_STATUS_NO_MEMORY;
+               goto done;
+       }
 
        /* We have an authenticated connection. Use a NTLMSSP SPNEGO
           authenticated SAMR pipe with sign & seal. */
@@ -2101,12 +2176,12 @@ NTSTATUS cm_connect_sam(struct winbindd_domain *domain, TALLOC_CTX *mem_ctx,
        }
 
  open_domain:
-       result = rpccli_samr_open_domain(conn->samr_pipe,
-                                        mem_ctx,
-                                        &conn->sam_connect_handle,
-                                        SEC_RIGHTS_MAXIMUM_ALLOWED,
-                                        &domain->sid,
-                                        &conn->sam_domain_handle);
+       result = rpccli_samr_OpenDomain(conn->samr_pipe,
+                                       mem_ctx,
+                                       &conn->sam_connect_handle,
+                                       SEC_RIGHTS_MAXIMUM_ALLOWED,
+                                       &domain->sid,
+                                       &conn->sam_domain_handle);
 
  done:
 
@@ -2249,7 +2324,7 @@ NTSTATUS cm_connect_netlogon(struct winbindd_domain *domain,
        struct winbindd_cm_conn *conn;
        NTSTATUS result;
 
-       uint32 neg_flags = NETLOGON_NEG_AUTH2_FLAGS;
+       uint32 neg_flags = NETLOGON_NEG_SELECT_AUTH2_FLAGS;
        uint8  mach_pwd[16];
        uint32  sec_chan_type;
        const char *account_name;
index 62facb67698838937a1200f2b7e968dd00073039..4dbace5bcc4f8b24422f4971093e255964b43504 100644 (file)
@@ -69,7 +69,7 @@ NTSTATUS winbindd_store_creds(struct winbindd_domain *domain,
                sid_copy(&sid, &(info3->dom_sid.sid));
                sid_append_rid(&sid, info3->user_rid);
                sid_copy(&cred_sid, &sid);
-               info3->user_flgs |= LOGON_CACHED_ACCOUNT;
+               info3->user_flgs |= NETLOGON_CACHED_ACCOUNT;
                
        } else if (user_sid != NULL) {
        
index 2739ab542e2cf988fa2c5d5d4a38bba44dd75fb8..1f2972f9b2be5b3a6c9dd7c47f7e109b98f3ca34 100644 (file)
@@ -481,7 +481,6 @@ void winbind_child_died(pid_t pid)
        child->event.fd = 0;
        child->event.flags = 0;
        child->pid = 0;
-       SAFE_FREE(child->logfilename);
 
        schedule_async_request(child);
 }
@@ -678,6 +677,88 @@ void winbind_msg_dump_event_list(struct messaging_context *msg_ctx,
 
 }
 
+void winbind_msg_dump_domain_list(struct messaging_context *msg_ctx,
+                                 void *private_data,
+                                 uint32_t msg_type,
+                                 struct server_id server_id,
+                                 DATA_BLOB *data)
+{
+       TALLOC_CTX *mem_ctx;
+       const char *message = NULL;
+       struct server_id *sender = NULL;
+       const char *domain = NULL;
+       char *s = NULL;
+       NTSTATUS status;
+       struct winbindd_domain *dom = NULL;
+
+       DEBUG(5,("winbind_msg_dump_domain_list received.\n"));
+
+       if (!data || !data->data) {
+               return;
+       }
+
+       if (data->length < sizeof(struct server_id)) {
+               return;
+       }
+
+       mem_ctx = talloc_init("winbind_msg_dump_domain_list");
+       if (!mem_ctx) {
+               return;
+       }
+
+       sender = (struct server_id *)data->data;
+       if (data->length > sizeof(struct server_id)) {
+               domain = (const char *)data->data+sizeof(struct server_id);
+       }
+
+       if (domain) {
+
+               DEBUG(5,("winbind_msg_dump_domain_list for domain: %s\n",
+                       domain));
+
+               message = NDR_PRINT_STRUCT_STRING(mem_ctx, winbindd_domain,
+                                                 find_domain_from_name_noinit(domain));
+               if (!message) {
+                       talloc_destroy(mem_ctx);
+                       return;
+               }
+
+               messaging_send_buf(msg_ctx, *sender,
+                                  MSG_WINBIND_DUMP_DOMAIN_LIST,
+                                  (uint8_t *)message, strlen(message) + 1);
+
+               talloc_destroy(mem_ctx);
+
+               return;
+       }
+
+       DEBUG(5,("winbind_msg_dump_domain_list all domains\n"));
+
+       for (dom = domain_list(); dom; dom=dom->next) {
+               message = NDR_PRINT_STRUCT_STRING(mem_ctx, winbindd_domain, dom);
+               if (!message) {
+                       talloc_destroy(mem_ctx);
+                       return;
+               }
+
+               s = talloc_asprintf_append(s, "%s\n", message);
+               if (!s) {
+                       talloc_destroy(mem_ctx);
+                       return;
+               }
+       }
+
+       status = messaging_send_buf(msg_ctx, *sender,
+                                   MSG_WINBIND_DUMP_DOMAIN_LIST,
+                                   (uint8_t *)s, strlen(s) + 1);
+       if (!NT_STATUS_IS_OK(status)) {
+               DEBUG(0,("failed to send message: %s\n",
+               nt_errstr(status)));
+       }
+
+       talloc_destroy(mem_ctx);
+}
+
 static void account_lockout_policy_handler(struct event_context *ctx,
                                           struct timed_event *te,
                                           const struct timeval *now,
@@ -879,6 +960,13 @@ static bool fork_domain_child(struct winbindd_child *child)
        struct winbindd_cli_state state;
        struct winbindd_domain *domain;
 
+       if (child->domain) {
+               DEBUG(10, ("fork_domain_child called for domain '%s'\n",
+                          child->domain->name));
+       } else {
+               DEBUG(10, ("fork_domain_child called without domain.\n"));
+       }
+
        if (socketpair(AF_UNIX, SOCK_STREAM, 0, fdpair) != 0) {
                DEBUG(0, ("Could not open child pipe: %s\n",
                          strerror(errno)));
@@ -948,6 +1036,8 @@ static bool fork_domain_child(struct winbindd_child *child)
                             MSG_WINBIND_ONLINESTATUS, NULL);
        messaging_deregister(winbind_messaging_context(),
                             MSG_DUMP_EVENT_LIST, NULL);
+       messaging_deregister(winbind_messaging_context(),
+                            MSG_WINBIND_DUMP_DOMAIN_LIST, NULL);
 
        /* Handle online/offline messages. */
        messaging_register(winbind_messaging_context(), NULL,
index 140943cc2c97b3dbec40c7180bbc1d43f59a445f..6a704cf2902d349a15ad9aa552eecd3cb4bfedba 100644 (file)
@@ -438,18 +438,15 @@ static NTSTATUS expand_groups( TALLOC_CTX *ctx,
                        if ( name_types[j] == SID_NAME_DOM_GRP ||
                             name_types[j] == SID_NAME_ALIAS )
                        {
-                               bool ret;
-                               
-                               ret = add_sid_to_array_unique( ctx, 
-                                                              &sid_mem[j],
-                                                              &new_groups, 
-                                                              &new_groups_size );
-                               if ( !ret ) {
-                                       status = NT_STATUS_NO_MEMORY;
+                               status = add_sid_to_array_unique(ctx,
+                                                                &sid_mem[j],
+                                                                &new_groups,
+                                                                &new_groups_size);
+                               if (NT_STATUS_IS_OK(status)) {
                                        goto out;
                                }
 
-                               continue;                               
+                               continue;
                        }
                }
 
@@ -1045,7 +1042,10 @@ static bool get_sam_group_entries(struct getent_state *ent)
                status = domain->methods->enum_local_groups(domain, mem_ctx, &num_entries, &sam_grp_entries);
                
                if ( !NT_STATUS_IS_OK(status) ) { 
-                       DEBUG(3,("get_sam_group_entries: Failed to enumerate domain local groups!\n"));
+                       DEBUG(3,("get_sam_group_entries: "
+                               "Failed to enumerate "
+                               "domain local groups with error %s!\n",
+                               nt_errstr(status)));
                        num_entries = 0;
                }
                else
@@ -1491,9 +1491,18 @@ void winbindd_getgroups(struct winbindd_cli_state *state)
                s->username = talloc_strdup( state->mem_ctx, state->request.data.username );
        }
        
-       /* Get info for the domain */
+       /* Get info for the domain (either by short domain name or 
+          DNS name in the case of a UPN) */
 
        s->domain = find_domain_from_name_noinit(s->domname);
+       if (!s->domain) {
+               char *p = strchr(s->username, '@');
+               
+               if (p) {
+                       s->domain = find_domain_from_name_noinit(p+1);                  
+               }
+               
+       }
 
        if (s->domain == NULL) {
                DEBUG(7, ("could not find domain entry for domain %s\n", 
index ee497ebf32092e667e75bbe65b2abfebd6138c49..6b1cff99e09fe34b52b8fed62a13bc2dce3c9247 100644 (file)
@@ -48,7 +48,7 @@ void winbindd_dsgetdcname(struct winbindd_cli_state *state)
        state->request.domain_name
                [sizeof(state->request.domain_name)-1] = '\0';
 
-       DEBUG(3, ("[%5lu]: DsGetDcName for %s\n", (unsigned long)state->pid,
+       DEBUG(3, ("[%5lu]: dsgetdcname for %s\n", (unsigned long)state->pid,
                  state->request.domain_name));
 
        sendto_child(state, locator_child());
@@ -64,10 +64,10 @@ static enum winbindd_result dual_dsgetdcname(struct winbindd_domain *domain,
        state->request.domain_name
                [sizeof(state->request.domain_name)-1] = '\0';
 
-       DEBUG(3, ("[%5lu]: DsGetDcName for %s\n", (unsigned long)state->pid,
+       DEBUG(3, ("[%5lu]: dsgetdcname for %s\n", (unsigned long)state->pid,
                  state->request.domain_name));
 
-       result = DsGetDcName(state->mem_ctx, NULL, state->request.domain_name,
+       result = dsgetdcname(state->mem_ctx, state->request.domain_name,
                             NULL, NULL, state->request.flags, &info);
 
        if (!NT_STATUS_IS_OK(result)) {
index 8c3ef5bb6f522ae8230c5b3c491f7632117e5b2e..76f2554122b476482e8c80a4d49af7b9a0db0fbb 100644 (file)
@@ -231,7 +231,7 @@ void winbindd_getdcname(struct winbindd_cli_state *state)
 enum winbindd_result winbindd_dual_getdcname(struct winbindd_domain *domain,
                                             struct winbindd_cli_state *state)
 {
-       fstring dcname_slash;
+       char *dcname_slash = NULL;
        char *p;
        struct rpc_pipe_client *netlogon_pipe;
        NTSTATUS result;
@@ -262,12 +262,12 @@ enum winbindd_result winbindd_dual_getdcname(struct winbindd_domain *domain,
                werr = rpccli_netlogon_getdcname(netlogon_pipe, state->mem_ctx,
                                                 domain->dcname,
                                                 state->request.domain_name,
-                                                dcname_slash);
+                                                &dcname_slash);
        } else {
                werr = rpccli_netlogon_getanydcname(netlogon_pipe, state->mem_ctx,
                                                    domain->dcname,
                                                    state->request.domain_name,
-                                                   dcname_slash);
+                                                   &dcname_slash);
        }
        /* And restore our original timeout. */
        cli_set_timeout(netlogon_pipe->cli, orig_timeout);
diff --git a/source/winbindd/winbindd_ndr.c b/source/winbindd/winbindd_ndr.c
new file mode 100644 (file)
index 0000000..842c915
--- /dev/null
@@ -0,0 +1,153 @@
+/*
+ *  Unix SMB/CIFS implementation.
+ *  winbindd debug helper
+ *  Copyright (C) Guenther Deschner 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/>.
+ */
+
+#include "includes.h"
+#include "winbindd.h"
+
+#undef DBGC_CLASS
+#define DBGC_CLASS DBGC_WINBIND
+
+/****************************************************************
+****************************************************************/
+
+void ndr_print_winbindd_child(struct ndr_print *ndr,
+                             const char *name,
+                             const struct winbindd_child *r)
+{
+       ndr_print_struct(ndr, name, "winbindd_child");
+       ndr->depth++;
+       ndr_print_ptr(ndr, "next", r->next);
+       ndr_print_ptr(ndr, "prev", r->prev);
+       ndr_print_uint32(ndr, "pid", (uint32_t)r->pid);
+#if 0
+       ndr_print_winbindd_domain(ndr, "domain", r->domain);
+#else
+       ndr_print_ptr(ndr, "domain", r->domain);
+#endif
+       ndr_print_string(ndr, "logfilename", r->logfilename);
+       /* struct fd_event event; */
+       ndr_print_ptr(ndr, "lockout_policy_event", r->lockout_policy_event);
+       ndr_print_ptr(ndr, "requests", r->requests);
+       ndr_print_ptr(ndr, "table", r->table);
+       ndr->depth--;
+}
+
+/****************************************************************
+****************************************************************/
+
+void ndr_print_winbindd_cm_conn(struct ndr_print *ndr,
+                               const char *name,
+                               const struct winbindd_cm_conn *r)
+{
+       ndr_print_struct(ndr, name, "winbindd_cm_conn");
+       ndr->depth++;
+       ndr_print_ptr(ndr, "cli", r->cli);
+       ndr_print_ptr(ndr, "samr_pipe", r->samr_pipe);
+       ndr_print_policy_handle(ndr, "sam_connect_handle", &r->sam_connect_handle);
+       ndr_print_policy_handle(ndr, "sam_domain_handle", &r->sam_domain_handle);
+       ndr_print_ptr(ndr, "lsa_pipe", r->lsa_pipe);
+       ndr_print_policy_handle(ndr, "lsa_policy", &r->lsa_policy);
+       ndr_print_ptr(ndr, "netlogon_pipe", r->netlogon_pipe);
+       ndr->depth--;
+}
+
+/****************************************************************
+****************************************************************/
+
+void ndr_print_winbindd_methods(struct ndr_print *ndr,
+                               const char *name,
+                               const struct winbindd_methods *r)
+{
+#ifdef HAVE_ADS
+       extern struct winbindd_methods ads_methods;
+#endif
+       extern struct winbindd_methods msrpc_methods;
+       extern struct winbindd_methods passdb_methods;
+       extern struct winbindd_methods reconnect_methods;
+       extern struct winbindd_methods cache_methods;
+
+       ndr_print_struct(ndr, name, "winbindd_methods");
+       ndr->depth++;
+
+       if (r == NULL) {
+               ndr_print_string(ndr, name, "(NULL)");
+               ndr->depth--;
+               return;
+       }
+
+       if (r == &msrpc_methods) {
+               ndr_print_string(ndr, name, "msrpc_methods");
+#ifdef HAVE_ADS
+       } else if (r == &ads_methods) {
+               ndr_print_string(ndr, name, "ads_methods");
+#endif
+       } else if (r == &passdb_methods) {
+               ndr_print_string(ndr, name, "passdb_methods");
+       } else if (r == &reconnect_methods) {
+               ndr_print_string(ndr, name, "reconnect_methods");
+       } else if (r == &cache_methods) {
+               ndr_print_string(ndr, name, "cache_methods");
+       } else {
+               ndr_print_string(ndr, name, "UNKNOWN");
+       }
+       ndr->depth--;
+}
+
+/****************************************************************
+****************************************************************/
+
+void ndr_print_winbindd_domain(struct ndr_print *ndr,
+                              const char *name,
+                              const struct winbindd_domain *r)
+{
+       if (!r) {
+               return;
+       }
+
+       ndr_print_struct(ndr, name, "winbindd_domain");
+       ndr->depth++;
+       ndr_print_string(ndr, "name", r->name);
+       ndr_print_string(ndr, "alt_name", r->alt_name);
+       ndr_print_string(ndr, "forest_name", r->forest_name);
+       ndr_print_dom_sid(ndr, "sid", &r->sid);
+       ndr_print_netr_TrustFlags(ndr, "domain_flags", r->domain_flags);
+       ndr_print_netr_TrustType(ndr, "domain_type", r->domain_type);
+       ndr_print_netr_TrustAttributes(ndr, "domain_trust_attribs", r->domain_trust_attribs);
+       ndr_print_bool(ndr, "initialized", r->initialized);
+       ndr_print_bool(ndr, "native_mode", r->native_mode);
+       ndr_print_bool(ndr, "active_directory", r->active_directory);
+       ndr_print_bool(ndr, "primary", r->primary);
+       ndr_print_bool(ndr, "internal", r->internal);
+       ndr_print_bool(ndr, "online", r->online);
+       ndr_print_time_t(ndr, "startup_time", r->startup_time);
+       ndr_print_bool(ndr, "startup", r->startup);
+       ndr_print_winbindd_methods(ndr, "methods", r->methods);
+       ndr_print_winbindd_methods(ndr, "backend", r->backend);
+       ndr_print_ptr(ndr, "private_data", r->private_data);
+       ndr_print_string(ndr, "dcname", r->dcname);
+       ndr_print_sockaddr_storage(ndr, "dcaddr", &r->dcaddr);
+       ndr_print_time_t(ndr, "last_seq_check", r->last_seq_check);
+       ndr_print_uint32(ndr, "sequence_number", r->sequence_number);
+       ndr_print_NTSTATUS(ndr, "last_status", r->last_status);
+       ndr_print_winbindd_cm_conn(ndr, "conn", &r->conn);
+       ndr_print_winbindd_child(ndr, "child", &r->child);
+       ndr_print_uint32(ndr, "check_online_timeout", r->check_online_timeout);
+       ndr_print_ptr(ndr, "check_online_event", r->check_online_event);
+       ndr->depth--;
+}
index 51332392587fd82500c16ae4f9d8c5df23c10b43..14b1621fc997f430ccfa73ff43a8c9662a01045d 100644 (file)
@@ -31,8 +31,6 @@ static NTSTATUS append_info3_as_txt(TALLOC_CTX *mem_ctx,
                                    struct winbindd_cli_state *state,
                                    NET_USER_INFO_3 *info3)
 {
-       fstring str_sid;
-
        state->response.data.auth.info3.logon_time =
                nt_time_to_unix(info3->logon_time);
        state->response.data.auth.info3.logoff_time =
@@ -51,8 +49,7 @@ static NTSTATUS append_info3_as_txt(TALLOC_CTX *mem_ctx,
 
        state->response.data.auth.info3.user_rid = info3->user_rid;
        state->response.data.auth.info3.group_rid = info3->group_rid;
-       sid_to_fstring(str_sid, &(info3->dom_sid.sid));
-       fstrcpy(state->response.data.auth.info3.dom_sid, str_sid);
+       sid_to_fstring(state->response.data.auth.info3.dom_sid, &(info3->dom_sid.sid));
 
        state->response.data.auth.info3.num_groups = info3->num_groups;
        state->response.data.auth.info3.user_flgs = info3->user_flgs;
@@ -273,12 +270,13 @@ static NTSTATUS check_info3_in_group(TALLOC_CTX *mem_ctx,
                        return NT_STATUS_INVALID_PARAMETER;
                }
 
-               if (!add_sid_to_array(mem_ctx, &sid,
-                                     &require_membership_of_sid,
-                                     &num_require_membership_of_sid)) {
+               status = add_sid_to_array(mem_ctx, &sid,
+                                         &require_membership_of_sid,
+                                         &num_require_membership_of_sid);
+               if (!NT_STATUS_IS_OK(status)) {
                        DEBUG(0, ("add_sid_to_array failed\n"));
                        TALLOC_FREE(frame);
-                       return NT_STATUS_NO_MEMORY;
+                       return status;
                }
        }
 
@@ -922,7 +920,7 @@ NTSTATUS winbindd_dual_pam_auth_cached(struct winbindd_domain *domain,
                /* User *DOES* know the password, update logon_time and reset
                 * bad_pw_count */
        
-               my_info3->user_flgs |= LOGON_CACHED_ACCOUNT;
+               my_info3->user_flgs |= NETLOGON_CACHED_ACCOUNT;
        
                if (my_info3->acct_flags & ACB_AUTOLOCK) {
                        return NT_STATUS_ACCOUNT_LOCKED_OUT;
@@ -958,7 +956,7 @@ NTSTATUS winbindd_dual_pam_auth_cached(struct winbindd_domain *domain,
                must_change_time = nt_time_to_unix(my_info3->pass_must_change_time);
                if (must_change_time != 0 && must_change_time < time(NULL)) {
                        /* we allow grace logons when the password has expired */
-                       my_info3->user_flgs |= LOGON_GRACE_LOGON;
+                       my_info3->user_flgs |= NETLOGON_GRACE_LOGON;
                        /* return NT_STATUS_PASSWORD_EXPIRED; */
                        goto success;
                }
@@ -966,7 +964,7 @@ NTSTATUS winbindd_dual_pam_auth_cached(struct winbindd_domain *domain,
 #ifdef HAVE_KRB5
                if ((state->request.flags & WBFLAG_PAM_KRB5) &&
                    ((tdc_domain = wcache_tdc_fetch_domain(state->mem_ctx, name_domain)) != NULL) &&
-                   (tdc_domain->trust_type & DS_DOMAIN_TRUST_TYPE_UPLEVEL)) {
+                   (tdc_domain->trust_type & NETR_TRUST_TYPE_UPLEVEL)) {
 
                        uid_t uid = -1;
                        const char *cc = NULL;
@@ -1074,7 +1072,7 @@ NTSTATUS winbindd_dual_pam_auth_cached(struct winbindd_domain *domain,
                }
 
                if ((my_info3->user_rid != DOMAIN_USER_RID_ADMIN) || 
-                   (password_properties & DOMAIN_LOCKOUT_ADMINS)) {
+                   (password_properties & DOMAIN_PASSWORD_LOCKOUT_ADMINS)) {
                        my_info3->acct_flags |= ACB_AUTOLOCK;
                }
        }
@@ -1341,10 +1339,11 @@ NTSTATUS winbindd_dual_pam_auth_samlogon(struct winbindd_domain *domain,
                        goto done;
                }
 
-               status_tmp = rpccli_samr_open_user(samr_pipe, state->mem_ctx, 
-                                                  &samr_domain_handle,
-                                                  MAXIMUM_ALLOWED_ACCESS,
-                                                  my_info3->user_rid, &user_pol);
+               status_tmp = rpccli_samr_OpenUser(samr_pipe, state->mem_ctx,
+                                                 &samr_domain_handle,
+                                                 MAXIMUM_ALLOWED_ACCESS,
+                                                 my_info3->user_rid,
+                                                 &user_pol);
 
                if (!NT_STATUS_IS_OK(status_tmp)) {
                        DEBUG(3, ("could not open user handle on SAMR pipe: %s\n",
@@ -1358,14 +1357,14 @@ NTSTATUS winbindd_dual_pam_auth_samlogon(struct winbindd_domain *domain,
                if (!NT_STATUS_IS_OK(status_tmp)) {
                        DEBUG(3, ("could not query user info on SAMR pipe: %s\n",
                                nt_errstr(status_tmp)));
-                       rpccli_samr_close(samr_pipe, state->mem_ctx, &user_pol);
+                       rpccli_samr_Close(samr_pipe, state->mem_ctx, &user_pol);
                        goto done;
                }
 
                acct_flags = user_ctr->info.id16->acb_info;
 
                if (acct_flags == 0) {
-                       rpccli_samr_close(samr_pipe, state->mem_ctx, &user_pol);
+                       rpccli_samr_Close(samr_pipe, state->mem_ctx, &user_pol);
                        goto done;
                }
 
@@ -1373,7 +1372,7 @@ NTSTATUS winbindd_dual_pam_auth_samlogon(struct winbindd_domain *domain,
 
                DEBUG(10,("successfully retrieved acct_flags 0x%x\n", acct_flags));
 
-               rpccli_samr_close(samr_pipe, state->mem_ctx, &user_pol);
+               rpccli_samr_Close(samr_pipe, state->mem_ctx, &user_pol);
        }
 
        *info3 = my_info3;
@@ -1593,13 +1592,16 @@ process_result:
                        }
                }
 
-               result = fillup_password_policy(domain, state);
 
-               if (!NT_STATUS_IS_OK(result) 
-                   && !NT_STATUS_EQUAL(result, NT_STATUS_NOT_SUPPORTED) ) 
-               {
-                       DEBUG(10,("Failed to get password policies: %s\n", nt_errstr(result)));
-                       goto done;
+               if (state->request.flags & WBFLAG_PAM_GET_PWD_POLICY) {
+                       result = fillup_password_policy(domain, state);
+
+                       if (!NT_STATUS_IS_OK(result) 
+                           && !NT_STATUS_EQUAL(result, NT_STATUS_NOT_SUPPORTED) ) 
+                       {
+                               DEBUG(10,("Failed to get password policies: %s\n", nt_errstr(result)));
+                               goto done;
+                       }
                }
 
                result = NT_STATUS_OK;          
index ffb47692cbd43aed49a369e6fd461fb263c6e0f0..0d937ef30e8612b4ab99f5b1b288fad0b76b92c4 100644 (file)
@@ -308,7 +308,7 @@ NTSTATUS msrpc_sid_to_name(struct winbindd_domain *domain,
 {
        char **domains;
        char **names;
-       enum lsa_SidType *types;
+       enum lsa_SidType *types = NULL;
        NTSTATUS result;
        struct rpc_pipe_client *cli;
        POLICY_HND lsa_policy;
@@ -456,6 +456,12 @@ static NTSTATUS query_user(struct winbindd_domain *domain,
                return NT_STATUS_OK;
        }
        
+       if ( !winbindd_can_contact_domain( domain ) ) {
+               DEBUG(10,("query_user: No incoming trust for domain %s\n",
+                         domain->name));
+               return NT_STATUS_OK;
+       }
+       
        /* no cache; hit the wire */
                
        result = cm_connect_sam(domain, mem_ctx, &cli, &dom_pol);
@@ -463,9 +469,11 @@ static NTSTATUS query_user(struct winbindd_domain *domain,
                return result;
 
        /* Get user handle */
-       result = rpccli_samr_open_user(cli, mem_ctx, &dom_pol,
-                                      SEC_RIGHTS_MAXIMUM_ALLOWED, user_rid,
-                                      &user_pol);
+       result = rpccli_samr_OpenUser(cli, mem_ctx,
+                                     &dom_pol,
+                                     SEC_RIGHTS_MAXIMUM_ALLOWED,
+                                     user_rid,
+                                     &user_pol);
 
        if (!NT_STATUS_IS_OK(result))
                return result;
@@ -474,7 +482,7 @@ static NTSTATUS query_user(struct winbindd_domain *domain,
        result = rpccli_samr_query_userinfo(cli, mem_ctx, &user_pol,
                                            0x15, &ctr);
 
-       rpccli_samr_close(cli, mem_ctx, &user_pol);
+       rpccli_samr_Close(cli, mem_ctx, &user_pol);
 
        if (!NT_STATUS_IS_OK(result))
                return result;
@@ -539,8 +547,11 @@ static NTSTATUS lookup_usergroups(struct winbindd_domain *domain,
                return result;
 
        /* Get user handle */
-       result = rpccli_samr_open_user(cli, mem_ctx, &dom_pol,
-                                       des_access, user_rid, &user_pol);
+       result = rpccli_samr_OpenUser(cli, mem_ctx,
+                                     &dom_pol,
+                                     des_access,
+                                     user_rid,
+                                     &user_pol);
 
        if (!NT_STATUS_IS_OK(result))
                return result;
@@ -549,7 +560,7 @@ static NTSTATUS lookup_usergroups(struct winbindd_domain *domain,
        result = rpccli_samr_query_usergroups(cli, mem_ctx, &user_pol, 
                                           num_groups, &user_groups);
 
-       rpccli_samr_close(cli, mem_ctx, &user_pol);
+       rpccli_samr_Close(cli, mem_ctx, &user_pol);
 
        if (!NT_STATUS_IS_OK(result) || (*num_groups) == 0)
                return result;
@@ -694,8 +705,11 @@ static NTSTATUS lookup_groupmem(struct winbindd_domain *domain,
        if (!NT_STATUS_IS_OK(result))
                return result;
 
-        result = rpccli_samr_open_group(cli, mem_ctx, &dom_pol,
-                                       des_access, group_rid, &group_pol);
+        result = rpccli_samr_OpenGroup(cli, mem_ctx,
+                                      &dom_pol,
+                                      des_access,
+                                      group_rid,
+                                      &group_pol);
 
         if (!NT_STATUS_IS_OK(result))
                return result;
@@ -715,7 +729,7 @@ static NTSTATUS lookup_groupmem(struct winbindd_domain *domain,
        /* And restore our original timeout. */
        cli_set_timeout(cli->cli, orig_timeout);
 
-       rpccli_samr_close(cli, mem_ctx, &group_pol);
+       rpccli_samr_Close(cli, mem_ctx, &group_pol);
 
         if (!NT_STATUS_IS_OK(result))
                return result;
index 795209619ced8ffcb121ecec4e1dd65e9e2b3054..7933ecf63e42391729e6c7176cd5a3b72bc8001f 100644 (file)
@@ -41,7 +41,7 @@ extern struct winbindd_methods passdb_methods;
    individual winbindd_domain structures cannot be made.  Keep a copy of
    the domain name instead. */
 
-static struct winbindd_domain *_domain_list;
+static struct winbindd_domain *_domain_list = NULL;
 
 /**
    When was the last scan of trusted domains done?
@@ -212,7 +212,7 @@ static void add_trusted_domains( struct winbindd_domain *domain )
        TALLOC_CTX *mem_ctx;
        struct winbindd_request *request;
        struct winbindd_response *response;
-       uint32 fr_flags = (DS_DOMAIN_TREE_ROOT|DS_DOMAIN_IN_FOREST);    
+       uint32 fr_flags = (NETR_TRUST_FLAG_TREEROOT|NETR_TRUST_FLAG_IN_FOREST);
 
        struct trustdom_state *state;
 
@@ -385,8 +385,8 @@ static void rescan_forest_root_trusts( void )
                   the domain_list() as our primary domain may not 
                   have been initialized. */
 
-               if ( !(dom_list[i].trust_flags & DS_DOMAIN_TREE_ROOT) ) {
-                       continue;                       
+               if ( !(dom_list[i].trust_flags & NETR_TRUST_FLAG_TREEROOT) ) {
+                       continue;
                }
        
                /* Here's the forest root */
@@ -450,10 +450,10 @@ static void rescan_forest_trusts( void )
 
                if ( d && (d->internal || d->primary ) )
                        continue;               
-               
-               if ( (flags & DS_DOMAIN_DIRECT_INBOUND) &&
-                    (type == DS_DOMAIN_TRUST_TYPE_UPLEVEL) &&
-                    (attribs == DS_DOMAIN_TRUST_ATTRIB_FOREST_TRANSITIVE) )
+
+               if ( (flags & NETR_TRUST_FLAG_INBOUND) &&
+                    (type == NETR_TRUST_TYPE_UPLEVEL) &&
+                    (attribs == NETR_TRUST_ATTRIBUTE_FOREST_TRANSITIVE) )
                {
                        /* add the trusted domain if we don't know
                           about it */
@@ -494,9 +494,13 @@ void rescan_trusted_domains( void )
            ((now-last_trustdom_scan) < WINBINDD_RESCAN_FREQ) )
                return;
                
-       /* clear the TRUSTDOM cache first */
-
-       wcache_tdc_clear();
+       /* I use to clear the cache here and start over but that
+          caused problems in child processes that needed the
+          trust dom list early on.  Removing it means we
+          could have some trusted domains listed that have been
+          removed from our primary domain's DC until a full
+          restart.  This should be ok since I think this is what
+          Windows does as well. */
 
        /* this will only add new domains we didn't already know about
           in the domain_list()*/
@@ -561,7 +565,7 @@ enum winbindd_result init_child_connection(struct winbindd_domain *domain,
                /* The primary domain has to find the DC name itself */
                request->cmd = WINBINDD_INIT_CONNECTION;
                fstrcpy(request->domain_name, domain->name);
-               request->data.init_conn.is_primary = domain->internal ? False : True;
+               request->data.init_conn.is_primary = domain->primary ? true : false;
                fstrcpy(request->data.init_conn.dcname, "");
                async_request(mem_ctx, &domain->child, request, response,
                              init_child_recv, state);
@@ -760,8 +764,8 @@ void check_domain_trusted( const char *name, const DOM_SID *user_sid )
           forest trust */
 
        domain->active_directory = True;
-       domain->domain_flags = DS_DOMAIN_DIRECT_OUTBOUND;
-       domain->domain_type  = DS_DOMAIN_TRUST_TYPE_UPLEVEL;
+       domain->domain_flags = NETR_TRUST_FLAG_OUTBOUND;
+       domain->domain_type  = NETR_TRUST_TYPE_UPLEVEL;
        domain->internal = False;
        domain->online = True;  
 
@@ -1294,19 +1298,22 @@ NTSTATUS lookup_usergroups_cached(struct winbindd_domain *domain,
        /* always add the primary group to the sid array */
        sid_compose(&primary_group, &info3->dom_sid.sid, info3->user_rid);
        
-       if (!add_sid_to_array(mem_ctx, &primary_group, user_sids, &num_groups)) {
+       status = add_sid_to_array(mem_ctx, &primary_group, user_sids,
+                                 &num_groups);
+       if (!NT_STATUS_IS_OK(status)) {
                TALLOC_FREE(info3);
-               return NT_STATUS_NO_MEMORY;
+               return status;
        }
 
        for (i=0; i<info3->num_groups; i++) {
                sid_copy(&group_sid, &info3->dom_sid.sid);
                sid_append_rid(&group_sid, info3->gids[i].g_rid);
 
-               if (!add_sid_to_array(mem_ctx, &group_sid, user_sids,
-                                &num_groups)) {
+               status = add_sid_to_array(mem_ctx, &group_sid, user_sids,
+                                         &num_groups);
+               if (!NT_STATUS_IS_OK(status)) {
                        TALLOC_FREE(info3);
-                       return NT_STATUS_NO_MEMORY;
+                       return status;
                }
        }
 
@@ -1318,11 +1325,11 @@ NTSTATUS lookup_usergroups_cached(struct winbindd_domain *domain,
                if (info3->other_sids_attrib[i] & SE_GROUP_RESOURCE)
                        continue;
 
-               if (!add_sid_to_array(mem_ctx, &info3->other_sids[i].sid,
-                                     user_sids, &num_groups))
-               {
+               status = add_sid_to_array(mem_ctx, &info3->other_sids[i].sid,
+                                         user_sids, &num_groups);
+               if (!NT_STATUS_IS_OK(status)) {
                        TALLOC_FREE(info3);
-                       return NT_STATUS_NO_MEMORY;                     
+                       return status;
                }
        }
        
@@ -1373,31 +1380,56 @@ void ws_name_return( char *name, char replace )
 /*********************************************************************
  ********************************************************************/
 
-bool winbindd_can_contact_domain( struct winbindd_domain *domain )
+bool winbindd_can_contact_domain(struct winbindd_domain *domain)
 {
+       struct winbindd_tdc_domain *tdc = NULL;
+       TALLOC_CTX *frame = talloc_stackframe();
+       bool ret = false;
+
        /* We can contact the domain if it is our primary domain */
 
-       if ( domain->primary )
-               return True;
+       if (domain->primary) {
+               return true;
+       }
 
-       /* Can always contact a domain that is in out forest */
+       /* Trust the TDC cache and not the winbindd_domain flags */
 
-       if ( domain->domain_flags & DS_DOMAIN_IN_FOREST )
-               return True;    
+       if ((tdc = wcache_tdc_fetch_domain(frame, domain->name)) == NULL) {
+               DEBUG(10,("winbindd_can_contact_domain: %s not found in cache\n",
+                         domain->name));
+               return false;
+       }
 
-       /* We cannot contact the domain if it is running AD and
-          we have no inbound trust */
+       /* Can always contact a domain that is in out forest */
 
-       if ( domain->active_directory && 
-            ((domain->domain_flags&DS_DOMAIN_DIRECT_INBOUND) != DS_DOMAIN_DIRECT_INBOUND) ) 
-       {
-               return False;
+       if (tdc->trust_flags & NETR_TRUST_FLAG_IN_FOREST) {
+               ret = true;
+               goto done;
        }
        
+       /*
+        * On a _member_ server, we cannot contact the domain if it
+        * is running AD and we have no inbound trust.
+        */
+
+       if (!IS_DC && 
+            domain->active_directory &&
+           ((tdc->trust_flags & NETR_TRUST_FLAG_INBOUND) != NETR_TRUST_FLAG_INBOUND))
+       {
+               DEBUG(10, ("winbindd_can_contact_domain: %s is an AD domain "
+                          "and we have no inbound trust.\n", domain->name));
+               goto done;
+       }
+
        /* Assume everything else is ok (probably not true but what
           can you do?) */
+
+       ret = true;     
+
+done:  
+       talloc_destroy(frame);
        
-       return True;    
+       return ret;     
 }
 
 /*********************************************************************